提交 9fd3e798 编写于 作者: O Olivier Lamy

install needed maven installation for testing in ${project.build.directory}

so not delete/unzip anymore for all units but reuse already extracted one.
preserve io stuff :-)
上级 d2e14f55
......@@ -78,7 +78,11 @@ THE SOFTWARE.
<property>
<name>java.io.tmpdir</name>
<value>${project.build.directory}</value>
</property>
</property>
<property>
<name>buildDirectory</name>
<value>${project.build.directory}</value>
</property>
</systemProperties>
</configuration>
</execution>
......
......@@ -406,6 +406,15 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
*/
protected MavenInstallation configureDefaultMaven(String mavenVersion, int mavenReqVersion) throws Exception {
// first if we are running inside Maven, pick that Maven, if it meets the criteria we require..
// does it exists in the buildDirectory see maven-junit-plugin systemProperties
// buildDirectory -> ${project.build.directory} (so no reason to be null ;-) )
String buildDirectory = System.getProperty( "buildDirectory" );
File mavenAlreadyInstalled = new File(buildDirectory, mavenVersion);
if (mavenAlreadyInstalled.exists()) {
MavenInstallation mavenInstallation = new MavenInstallation("default",mavenAlreadyInstalled.getAbsolutePath(), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
String home = System.getProperty("maven.home");
if(home!=null) {
MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES);
......@@ -421,7 +430,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
"To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation.");
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
File mvnHome = createTmpDir();
File mvnHome = new File(buildDirectory);//createTmpDir();
mvn.unzip(new FilePath(mvnHome));
// TODO: switch to tar that preserves file permissions more easily
if(!Functions.isWindows())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册