I have a Maven project in eclipse, which I run with a Run configuration. That configuration does compile
and exec:exec
with a script (called runner) defined in my pom.xml
dependent on the OS (.bat
in Windows, .sh
in Linux). The runners do OS-dependent stuff and then start Java with my application. Which runner to use is specified with profiles like the following:
<profile>
<id>WINused</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<runnerForLaunch>${basedir}/src/runners/windowsRunner.bat</runnerToUse>
</properties>
</profile>
So, when I want to run it, I use Alt+Shift+X, M
and select the Maven config. Later, I just use Ctrl+F11
.
When I have to debug it, I have to do the following:
- Edit the
pom.xml
to use another runner script that adds-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y
to the Java call. - Launch the run configuration.
- Launch a debug configuration that connects to the debugger.
My question is, can I somehow shorten that process? I regularly forget to undo my changes to pom.xml
and use the runner I currently do not need.
Can't Maven somehow detect if I run it with Run as or Debug as and adjust variables depending on that?