In recent versions of Maven, you can activate the debugger by running mvnDebug rather than mvn , the mvnDebug bat / sh file installs MVN__DEBUG_OPTS and passes them to java.exe. Past values:
set MAVEN_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
If this is not enough, this may work (note that I have not tested this yet, I will update as soon as I have). Maven reads properties with the prefix "env." from the environment you can set environment variables by pre-adding them. i.e:.
<profile> <id>dev</id> <properties> <env.MAVEN_OPTS>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000<env.MAVEN_OPTS> </properties> </profile>
Update: the surefire plugin allows you to specify the system properties that will be used during the test. The configuration is as follows:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.2</version> <configuration> <systemProperties> <property> <name>propertyName</name> <value>propertyValue</value> </property> </systemProperties> </configuration> </plugin>
If none of them works for you, you can write a small plugin configured in your profile that binds to the initialization phase and sets your variables. The plugin would have this configuration:
<plugin> <groupId>name.seller.rich</groupId> <artifactId>maven-environment-plugin</artifactId> <version>0.0.1</version> <executions> <execution> <id>set-properties</id> <phase>initialize</phase> <goals> <goal>set-properties</goal> </goals> </execution> </executions> <configuration> <properties> <env.MAVEN_OPTS>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000<env.MAVEN_OPTS> </properties> </configuration> </plugin>
at run time, the plugin will set each property passed with System.setProperty (). If the first two do not fit or do not work, this should solve your problem.
Rich seller
source share