Author: dfabulich
Date: Sat Nov 24 23:27:30 2007
New Revision: 597960
URL: http://svn.apache.org/viewvc?rev=597960&view=rev
Log:
[SUREFIRE-183] Accept debug line from plugin configuration, instead of relying
on system property
Modified:
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
Modified:
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=597960&r1=597959&r2=597960&view=diff
==============================================================================
---
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
(original)
+++
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Sat Nov 24 23:27:30 2007
@@ -286,13 +286,23 @@
private String jvm;
/**
- * Arbitrary options to set on the command line.
+ * Arbitrary JVM options to set on the command line.
*
* @parameter expression="${argLine}"
*/
private String argLine;
/**
+ * Attach a debugger to the forked JVM. If set to "true", the process
will suspend and
+ * wait for a debugger to attach on port 5005. If set to some other
string, that
+ * string will be appended to the argLine, allowing you to configure
arbitrary
+ * debuggability options (without overwriting the other options specified
in the argLine).
+ *
+ * @parameter expression="${maven.surefire.debug}"
+ */
+ private String debugForkedProcess;
+
+ /**
* Additional environments to set on the command line.
*
* @parameter
@@ -777,6 +787,13 @@
fork.setUseSystemClassLoader( useSystemClassLoader );
fork.setSystemProperties( systemProperties );
+
+ if ( "true".equals( debugForkedProcess ) )
+ {
+ debugForkedProcess = "-Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005";
+ }
+
+ fork.setDebugLine( debugForkedProcess );
if ( jvm == null || "".equals( jvm ) )
{
Modified:
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java?rev=597960&r1=597959&r2=597960&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
(original)
+++
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
Sat Nov 24 23:27:30 2007
@@ -64,6 +64,8 @@
private File workingDirectory;
private boolean debug;
+
+ private String debugLine;
public void setForkMode( String forkMode )
{
@@ -114,6 +116,11 @@
{
this.argLine = argLine;
}
+
+ public void setDebugLine( String debugLine )
+ {
+ this.debugLine = debugLine;
+ }
public void setEnvironmentVariables( Map environmentVariables )
{
@@ -171,10 +178,9 @@
}
}
- if ( System.getProperty( "maven.surefire.debug" ) != null )
+ if ( debugLine != null && !"".equals( debugLine ) )
{
- cli.createArg().setLine(
- "-Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" );
+ cli.createArg().setLine( debugLine );
}
if ( useJar )