Author: rfscholte Date: Tue Aug 26 10:55:44 2014 New Revision: 1620561 URL: http://svn.apache.org/r1620561 Log: IDE fix, when localRepository is not a System property
Modified: maven/plugins/trunk/maven-compiler-plugin/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java Modified: maven/plugins/trunk/maven-compiler-plugin/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java?rev=1620561&r1=1620560&r2=1620561&view=diff ============================================================================== --- maven/plugins/trunk/maven-compiler-plugin/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java (original) +++ maven/plugins/trunk/maven-compiler-plugin/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java Tue Aug 26 10:55:44 2014 @@ -31,6 +31,7 @@ import org.apache.maven.plugin.testing.s import org.apache.maven.project.MavenProject; import java.io.File; +import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -320,7 +321,20 @@ public class CompilerMojoTestCase setVariableValueToObject( mojo, "outputDirectory", testClassesDir ); List<String> testClasspathList = new ArrayList<String>(); - testClasspathList.add( System.getProperty( "localRepository" ) + "/junit/junit/3.8.1/junit-3.8.1.jar" ); + + String localRepository = System.getProperty( "localRepository" ); + if ( localRepository != null ) + { + testClasspathList.add( localRepository + "/junit/junit/3.8.1/junit-3.8.1.jar" ); + } + else + { + // for IDE + String junitURI = org.junit.Test.class.getResource( "Test.class" ).toURI().toString(); + junitURI = junitURI.substring( "jar:".length(), junitURI.indexOf( '!' ) ); + testClasspathList.add( new File( URI.create( junitURI ) ).getAbsolutePath() ); + } + testClasspathList.add( compilerMojo.getOutputDirectory().getPath() ); setVariableValueToObject( mojo, "classpathElements", testClasspathList );