diff --git a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java index f56504c4a..970ac78d0 100644 --- a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java +++ b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java @@ -47,6 +47,16 @@ import static org.apache.maven.shared.utils.io.FileUtils.deleteDirectory; */ public class ProcessorSuiteRunner extends ParentRunner { + /** + * System property for specifying the location of the toolchains.xml file + */ + public static final String SYS_PROP_TOOLCHAINS_FILE = "processorIntegrationTest.toolchainsFile"; + + /** + * System property to enable remote debugging of the processor execution in the integration test + */ + public static final String SYS_PROP_DEBUG = "processorIntegrationTest.debug"; + public static final class ProcessorTestCase { private final String baseDir; private final ProcessorType processor; @@ -147,7 +157,22 @@ public class ProcessorSuiteRunner extends ParentRunner { File destination = extractTest( child, description ); PrintStream originalOut = System.out; - Verifier verifier = new Verifier( destination.getCanonicalPath() ); + final Verifier verifier; + if ( Boolean.getBoolean( SYS_PROP_DEBUG ) ) { + if ( child.processor.getToolchain() == null ) { + // when not using toolchains for a test, then the compiler is executed within the Maven JVM. So make + // sure we fork a new JVM for that, and let that new JVM use the command 'mvnDebug' instead of 'mvn' + verifier = new Verifier( destination.getCanonicalPath(), null, true, true ); + verifier.setDebugJvm( true ); + } + else { + verifier = new Verifier( destination.getCanonicalPath() ); + verifier.addCliOption( "-Pdebug-forked-javac" ); + } + } + else { + verifier = new Verifier( destination.getCanonicalPath() ); + } List goals = new ArrayList( 3 ); @@ -166,6 +191,11 @@ public class ProcessorSuiteRunner extends ParentRunner { verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct" ); } + if ( Boolean.getBoolean( SYS_PROP_DEBUG ) ) { + originalOut.print( "Processor Integration Test: " ); + originalOut.println( "Listening for transport dt_socket at address: 8000 (in some seconds)" ); + } + goals.add( "test" ); originalOut.println( "executing " + child.processor.name().toLowerCase() ); @@ -222,7 +252,7 @@ public class ProcessorSuiteRunner extends ParentRunner { } private static File getSpecifiedToolchainsFile() { - String specifiedToolchainsFile = System.getProperty( "processorIntegrationTest.toolchainsFile" ); + String specifiedToolchainsFile = System.getProperty( SYS_PROP_TOOLCHAINS_FILE ); if ( null != specifiedToolchainsFile ) { try { File canonical = new File( specifiedToolchainsFile ).getCanonicalFile(); diff --git a/integrationtest/src/test/resources/pom.xml b/integrationtest/src/test/resources/pom.xml index b71f9e86f..e9ce4bdeb 100644 --- a/integrationtest/src/test/resources/pom.xml +++ b/integrationtest/src/test/resources/pom.xml @@ -115,6 +115,34 @@ + + debug-forked-javac + + false + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + + true + + -J-Xdebug + -J-Xnoagent + -J-Djava.compiler=NONE + -J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 + + + + + + + + diff --git a/parent/pom.xml b/parent/pom.xml index b9c400f83..df01390f4 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -43,6 +43,7 @@ UTF-8 1.0.0 1.2 + 2.17 4.0.3.RELEASE 1 @@ -200,11 +201,11 @@ mapstruct-processor ${project.version} - - org.apache.maven.shared - maven-verifier - 1.5 - + + org.apache.maven.shared + maven-verifier + 1.5 + @@ -337,10 +338,17 @@ org.apache.maven.plugins maven-surefire-plugin - 2.17 + ${org.apache.maven.plugins.surefire.version} ${forkCount} + + + org.apache.maven.surefire + surefire-junit47 + ${org.apache.maven.plugins.surefire.version} + + com.mycila.maven-license-plugin @@ -425,16 +433,16 @@ jacoco-maven-plugin 0.7.1.201405082137 - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - 0.9.0 - - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.9.0 + + + org.codehaus.mojo + properties-maven-plugin + 1.0-alpha-2 +