Skip to content

Commit

Permalink
chore(pom): support debug when run main
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Dec 19, 2023
1 parent 3f67e7f commit 2eccbf6
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions main-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

<hello.agent.opt>-javaagent:${io.foldright.study:hello-agent:jar}</hello.agent.opt>
<world.agent.opt>-javaagent:${io.foldright.study:world-agent:jar}</world.agent.opt>
<!-- dummy default value, overridden by profile -->
<main.run.debug.java.opt>-ea</main.run.debug.java.opt>
</properties>

<dependencies>
Expand Down Expand Up @@ -45,6 +47,8 @@
<argument>-Duser.language=en</argument>
<argument>-Duser.country=US</argument>

<argument>${main.run.debug.java.opt}</argument>

<argument>-classpath</argument>
<classpath/>

Expand All @@ -56,6 +60,17 @@
</build>

<profiles>
<profile>
<id>java-main-run-enable-debug</id>
<activation>
<property>
<name>env.STUDY_MAIN_RUN_DEBUG</name>
</property>
</activation>
<properties>
<main.run.debug.java.opt>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</main.run.debug.java.opt>
</properties>
</profile>
<!-- agent config mode profiles -->
<profile>
<id>enable-hello-and-world-agents-mode</id>
Expand Down Expand Up @@ -84,9 +99,7 @@
<argument>-Duser.language=en</argument>
<argument>-Duser.country=US</argument>

<!--
<argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argument>
-->
<argument>${main.run.debug.java.opt}</argument>

<argument>${hello.agent.opt}</argument>
<argument>${world.agent.opt}</argument>
Expand Down Expand Up @@ -128,9 +141,7 @@
<argument>-Duser.language=en</argument>
<argument>-Duser.country=US</argument>

<!--
<argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argument>
-->
<argument>${main.run.debug.java.opt}</argument>

<argument>${hello.agent.opt}</argument>

Expand Down Expand Up @@ -171,9 +182,7 @@
<argument>-Duser.language=en</argument>
<argument>-Duser.country=US</argument>

<!--
<argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argument>
-->
<argument>${main.run.debug.java.opt}</argument>

<argument>${hello.agent.opt}</argument>
<argument>${hello.agent.opt}</argument>
Expand Down

0 comments on commit 2eccbf6

Please sign in to comment.