diff --git a/.gitignore b/.gitignore
index dd64ba3170..74009c2ad5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,4 @@ jenkins_*.changes
*.zip
push-build.sh
war/node_modules/
+.java-version
diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml
index 992eac7082..d4abfa3500 100644
--- a/maven-plugin/pom.xml
+++ b/maven-plugin/pom.xml
@@ -41,11 +41,11 @@ THE SOFTWARE.
http://wiki.jenkins-ci.org/display/JENKINS/Maven+Project+Plugin
- 1.3
- 3.0.5
+ 1.4
+ 3.1.0
${mavenVersion}
- 1.13.1
- 2.3.0
+ 0.9.0.M2
+ 0.0.0.M4
2.4
@@ -112,12 +112,47 @@ THE SOFTWARE.
org.jenkins-ci.main.maven
maven3-agent
${mavenInterceptorsVersion}
-
+
+
+ org.sonatype.sisu
+ sisu-inject-plexus
+
+
+ org.sonatype.sisu
+ sisu-inject-bean
+
+
+
+
+ org.jenkins-ci.main.maven
+ maven31-agent
+ ${mavenInterceptorsVersion}
+
org.jenkins-ci.main.maven
maven3-interceptor
${mavenInterceptorsVersion}
+
+
+ org.sonatype.sisu
+ sisu-inject-plexus
+
+
+ org.sonatype.sisu
+ sisu-inject-bean
+
+
+
+
+ org.jenkins-ci.main.maven
+ maven31-interceptor
+ ${mavenInterceptorsVersion}
+
+
+ org.jenkins-ci.main.maven
+ maven3-interceptor-commons
+ ${mavenInterceptorsVersion}
org.apache.ant
@@ -147,27 +182,27 @@ THE SOFTWARE.
- org.sonatype.aether
+ org.eclipse.aether
aether-api
${aetherVersion}
- org.sonatype.aether
+ org.eclipse.aether
aether-impl
${aetherVersion}
- org.sonatype.aether
+ org.eclipse.aether
aether-spi
${aetherVersion}
- org.sonatype.aether
+ org.eclipse.aether
aether-util
${aetherVersion}
- org.sonatype.aether
+ org.eclipse.aether
aether-connector-wagon
${aetherVersion}
@@ -176,13 +211,26 @@ THE SOFTWARE.
plexus-container-default
-
-
+
+
+
+ org.eclipse.sisu
+ org.eclipse.sisu.plexus
+ ${sisuInjectVersion}
+
+
+
org.sonatype.sisu
@@ -200,19 +248,6 @@ THE SOFTWARE.
-
- org.sonatype.sisu
- sisu-inject-bean
- ${sisuInjectVersion}
-
-
-
- org.sonatype.sisu
- sisu-guice
-
-
-
-
org.apache.maven.wagon
@@ -281,7 +316,7 @@ THE SOFTWARE.
org.jenkins-ci.lib
lib-jenkins-maven-embedder
- 3.9
+ 3.11
jtidy
@@ -420,6 +455,7 @@ THE SOFTWARE.
+ org.apache.maven.plugins
maven-dependency-plugin
diff --git a/maven-plugin/src/main/java/hudson/maven/AbstractMavenProcessFactory.java b/maven-plugin/src/main/java/hudson/maven/AbstractMavenProcessFactory.java
index 70dc320233..dcb69d488b 100644
--- a/maven-plugin/src/main/java/hudson/maven/AbstractMavenProcessFactory.java
+++ b/maven-plugin/src/main/java/hudson/maven/AbstractMavenProcessFactory.java
@@ -374,6 +374,12 @@ public abstract class AbstractMavenProcessFactory
// interceptor.jar
args.add(getMavenInterceptorClassPath(mvn,isMaster,slaveRoot));
+ String mavenInterceptorCommonClasspath = getMavenInterceptorCommonClassPath( mvn, isMaster, slaveRoot );
+
+ if (mavenInterceptorCommonClasspath!=null){
+ args.add( mavenInterceptorCommonClasspath );
+ }
+
// TCP/IP port to establish the remoting infrastructure
args.add(tcpPort);
@@ -394,6 +400,14 @@ public abstract class AbstractMavenProcessFactory
* Returns the classpath string for the maven-interceptor jar
*/
protected abstract String getMavenInterceptorClassPath(MavenInstallation mvn,boolean isMaster,FilePath slaveRoot) throws IOException, InterruptedException;
+
+ /**
+ * Returns the classpath string for the maven-interceptor jar
+ * @since 1.525
+ */
+ protected String getMavenInterceptorCommonClassPath(MavenInstallation mvn,boolean isMaster,FilePath slaveRoot) throws IOException, InterruptedException {
+ return null;
+ }
/**
* For Maven 2.1.x - 2.2.x we need an additional jar which overrides some classes in the other interceptor jar.
diff --git a/maven-plugin/src/main/java/hudson/maven/EmbedderLoggerImpl.java b/maven-plugin/src/main/java/hudson/maven/EmbedderLoggerImpl.java
deleted file mode 100644
index 57f08058a7..0000000000
--- a/maven-plugin/src/main/java/hudson/maven/EmbedderLoggerImpl.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * The MIT License
- *
- * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package hudson.maven;
-
-import hudson.model.TaskListener;
-
-import java.io.PrintStream;
-import java.util.StringTokenizer;
-
-import org.apache.maven.cli.MavenLoggerManager;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-
-/**
- * {@link MavenEmbedderLogger} implementation that
- * sends output to {@link TaskListener}.
- *
- * @author Kohsuke Kawaguchi
- */
-public final class EmbedderLoggerImpl extends MavenLoggerManager {
- private final PrintStream logger;
-
- public EmbedderLoggerImpl(TaskListener listener, int threshold) {
- super(new ConsoleLogger( threshold, "hudson-logger" ));
- logger = listener.getLogger();
- }
-
- private void print(String message, Throwable throwable, int threshold, String prefix) {
- if (getThreshold() <= threshold) {
- StringTokenizer tokens = new StringTokenizer(message,"\n");
- while(tokens.hasMoreTokens()) {
- logger.print(prefix);
- logger.println(tokens.nextToken());
- }
-
- if (throwable!=null)
- throwable.printStackTrace(logger);
- }
- }
-
- public void debug(String message, Throwable throwable) {
- print(message, throwable, Logger.LEVEL_DEBUG, "[DEBUG] ");
- }
-
- public void info(String message, Throwable throwable) {
- print(message, throwable, Logger.LEVEL_INFO, "[INFO ] ");
- }
-
- public void warn(String message, Throwable throwable) {
- print(message, throwable, Logger.LEVEL_WARN, "[WARN ] ");
- }
-
- public void error(String message, Throwable throwable) {
- print(message, throwable, Logger.LEVEL_ERROR, "[ERROR] ");
- }
-
- public void fatalError(String message, Throwable throwable) {
- print(message, throwable, Logger.LEVEL_FATAL, "[FATAL] ");
- }
-}
diff --git a/maven-plugin/src/main/java/hudson/maven/Maven31ProcessFactory.java b/maven-plugin/src/main/java/hudson/maven/Maven31ProcessFactory.java
new file mode 100644
index 0000000000..1ba686d7cd
--- /dev/null
+++ b/maven-plugin/src/main/java/hudson/maven/Maven31ProcessFactory.java
@@ -0,0 +1,108 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Olivier Lamy
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package hudson.maven;
+
+import hudson.EnvVars;
+import hudson.FilePath;
+import hudson.Launcher;
+import hudson.model.BuildListener;
+import hudson.remoting.Callable;
+import hudson.remoting.Channel;
+import hudson.remoting.Which;
+import hudson.tasks.Maven.MavenInstallation;
+import jenkins.maven3.agent.Maven31Main;
+import org.jvnet.hudson.maven3.launcher.Maven31Interceptor;
+import org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult;
+
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * {@link hudson.maven.AbstractMavenProcessFactory} for Maven 3.
+ *
+ * @author Olivier Lamy
+ */
+public class Maven31ProcessFactory extends Maven3ProcessFactory
+{
+
+ Maven31ProcessFactory( MavenModuleSet mms, AbstractMavenBuild, ?> build, Launcher launcher, EnvVars envVars,
+ String mavenOpts, FilePath workDir ) {
+ super( mms, build, launcher, envVars, mavenOpts, workDir );
+ }
+
+ @Override
+ protected String getMainClassName()
+ {
+ return Maven31Main.class.getName();
+ }
+
+ @Override
+ protected String getMavenAgentClassPath(MavenInstallation mvn,boolean isMaster,FilePath slaveRoot,BuildListener listener) throws IOException, InterruptedException {
+ String classWorldsJar = getLauncher().getChannel().call(new Maven3ProcessFactory.GetClassWorldsJar(mvn.getHome(),listener));
+ String path = (isMaster? Which.jarFile(Maven31Main.class).getAbsolutePath():slaveRoot.child("maven31-agent.jar").getRemote())+
+ (getLauncher().isUnix()?":":";")+classWorldsJar;
+
+ return path;
+ }
+
+ @Override
+ protected void applyPlexusModuleContributor(Channel channel, AbstractMavenBuild, ?> context) throws InterruptedException, IOException {
+ channel.call(new InstallPlexusModulesTask(context));
+ }
+
+ private static final class InstallPlexusModulesTask implements Callable
+ {
+ PlexusModuleContributor c;
+
+ public InstallPlexusModulesTask(AbstractMavenBuild, ?> context) throws IOException, InterruptedException {
+ c = PlexusModuleContributorFactory.aggregate(context);
+ }
+
+ public Void call() throws IOException {
+ Maven31Main.addPlexusComponents( c.getPlexusComponentJars().toArray( new URL[0] ) );
+ return null;
+ }
+
+ private static final long serialVersionUID = 1L;
+ }
+
+ @Override
+ protected String getMavenInterceptorClassPath(MavenInstallation mvn,boolean isMaster,FilePath slaveRoot) throws IOException, InterruptedException {
+ String path = isMaster?
+ Which.jarFile(Maven31Interceptor.class).getAbsolutePath():
+ slaveRoot.child("maven31-interceptor.jar").getRemote();
+
+ return path;
+ }
+
+ protected String getMavenInterceptorCommonClassPath(MavenInstallation mvn,boolean isMaster,FilePath slaveRoot) throws IOException, InterruptedException {
+ String path = isMaster?
+ Which.jarFile(HudsonMavenExecutionResult.class).getAbsolutePath():
+ slaveRoot.child("maven3-interceptor-commons.jar").getRemote();
+
+ return path;
+ }
+
+
+}
diff --git a/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java b/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
index d39e3f603b..111bb7c4ea 100644
--- a/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
+++ b/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
@@ -25,29 +25,30 @@ package hudson.maven;
import hudson.maven.MavenBuild.ProxyImpl2;
import hudson.maven.reporters.TestFailureDetector;
-import hudson.maven.util.ExecutionEventLogger;
import hudson.model.BuildListener;
import hudson.model.Result;
import hudson.remoting.Channel;
import hudson.remoting.DelegatingCallable;
import hudson.util.IOException2;
-import org.apache.maven.cli.PrintStreamLogger;
+import org.apache.maven.cli.event.ExecutionEventLogger;
+import org.apache.maven.eventspy.EventSpy;
import org.apache.maven.execution.AbstractExecutionListener;
import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.execution.ExecutionListener;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
-import org.jvnet.hudson.maven3.agent.Maven3Main;
-import org.jvnet.hudson.maven3.launcher.Maven3Launcher;
import org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.text.NumberFormat;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -57,7 +58,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;
-import static hudson.Util.*;
+import static hudson.Util.fixNull;
/**
* @author Olivier Lamy
@@ -71,33 +72,65 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
*/
private final boolean profile = MavenProcessFactory.profile;
- HudsonMavenExecutionResult mavenExecutionResult;
-
- protected Maven3Builder(BuildListener listener,Map proxies, Collection modules, List goals, Map systemProps, MavenBuildInformation mavenBuildInformation) {
- super( listener, modules, goals, systemProps );
- this.sourceProxies.putAll(proxies);
+ HudsonMavenExecutionResult mavenExecutionResult;
+
+ Class> maven3MainClass;
+ Class> maven3LauncherClass;
+ boolean supportEventSpy = false;
+
+ protected Maven3Builder(Maven3BuilderRequest maven3BuilderRequest) {
+ super( maven3BuilderRequest.listener, maven3BuilderRequest.modules, maven3BuilderRequest.goals, maven3BuilderRequest.systemProps );
+ this.sourceProxies.putAll(maven3BuilderRequest.proxies);
this.proxies = new HashMap();
for (Entry e : this.sourceProxies.entrySet()) {
- this.proxies.put(e.getKey(), new FilterImpl(e.getValue(), mavenBuildInformation));
+ this.proxies.put(e.getKey(), new FilterImpl(e.getValue(), maven3BuilderRequest.mavenBuildInformation));
}
- }
+ this.maven3LauncherClass = maven3BuilderRequest.maven3LauncherClass;
+ this.maven3MainClass = maven3BuilderRequest.maven3MainClass;
+ this.supportEventSpy = maven3BuilderRequest.supportEventSpy;
+ }
+
+ protected static class Maven3BuilderRequest {
+ BuildListener listener;
+ Map proxies;
+ Collection modules;
+ List goals;
+ Map systemProps;
+ MavenBuildInformation mavenBuildInformation;
+ Class> maven3MainClass;
+ Class> maven3LauncherClass;
+ boolean supportEventSpy = false;
+ }
public Result call() throws IOException {
try {
initializeAsynchronousExecutions();
-
- MavenExecutionListener mavenExecutionListener = new MavenExecutionListener( this );
- Maven3Launcher.setMavenExecutionListener( mavenExecutionListener );
-
+
+ MavenExecutionListener mavenExecutionListener = supportEventSpy ? new JenkinsEventSpy(this) : new MavenExecutionListener( this );
+ if (supportEventSpy)
+ {
+ Method setEventSpiesMethod = maven3LauncherClass.getMethod( "setEventSpies", List.class );
+ setEventSpiesMethod.invoke( null, Collections.singletonList(mavenExecutionListener) );
+
+ } else {
+ Method setMavenExecutionListenerMethod = maven3LauncherClass.getMethod( "setMavenExecutionListener", ExecutionListener.class );
+
+ setMavenExecutionListenerMethod.invoke( null, mavenExecutionListener );
+ }
markAsSuccess = false;
registerSystemProperties();
listener.getLogger().println(formatArgs(goals));
+ Method launchMethod = maven3MainClass.getMethod( "launch", String[].class );
- int r = Maven3Main.launch( goals.toArray(new String[goals.size()]));
+ Integer res = (Integer) launchMethod.invoke(null, new Object[] {goals.toArray(new String[goals.size()])} );
+
+ //int r = Maven3Main.launch( goals.toArray(new String[goals.size()]));
+
+ int r = res.intValue();
// now check the completion status of async ops
long startTime = System.nanoTime();
@@ -118,7 +151,11 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
logger.println("Resource loading "+format(n,ch.resourceLoadingTime.get())+"ms, "+ch.resourceLoadingCount+" times");
}
- mavenExecutionResult = Maven3Launcher.getMavenExecutionResult();
+ Method mavenExecutionResultGetMethod = maven3LauncherClass.getMethod( "getMavenExecutionResult", null );
+
+ mavenExecutionResult = (HudsonMavenExecutionResult) mavenExecutionResultGetMethod.invoke( null, null );
+
+ //mavenExecutionResult = Maven3Launcher.getMavenExecutionResult();
PrintStream logger = listener.getLogger();
@@ -156,8 +193,8 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
throw new IOException2(e);
} catch (InvocationTargetException e) {
throw new IOException2(e);
- } catch (ClassNotFoundException e) {
- throw new IOException2(e);
+ //} catch (ClassNotFoundException e) {
+ // throw new IOException2(e);
} catch (Exception e) {
throw new IOException2(e);
} finally {
@@ -166,13 +203,104 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
}
}
- private static final class MavenExecutionListener extends AbstractExecutionListener implements Serializable, ExecutionListener {
+ private static final class JenkinsEventSpy extends MavenExecutionListener implements EventSpy,Serializable{
+ private static final long serialVersionUID = 4942789836756366117L;
+
+ public JenkinsEventSpy(AbstractMavenBuilder maven3Builder) {
+ super(maven3Builder);
+ }
+
+ @Override
+ public void init( Context context )
+ throws Exception
+ {
+ //no op
+ }
+
+ @Override
+ public void onEvent( Object event )
+ throws Exception
+ {
+ if (event instanceof ExecutionEvent){
+ ExecutionEvent.Type eventType = ( (ExecutionEvent) event ).getType();
+
+ switch ( eventType )
+ {
+ case ProjectDiscoveryStarted:
+ super.projectDiscoveryStarted( (ExecutionEvent) event );
+ break;
+ case SessionStarted:
+ super.sessionStarted( (ExecutionEvent) event );
+ break;
+ case SessionEnded:
+ super.sessionEnded( (ExecutionEvent) event );
+ break;
+ case ProjectSkipped:
+ super.projectSkipped( (ExecutionEvent) event );
+ break;
+ case ProjectStarted:
+ super.projectStarted( (ExecutionEvent) event );
+ break;
+ case ProjectSucceeded:
+ super.projectSucceeded( (ExecutionEvent) event );
+ break;
+ case ProjectFailed:
+ super.projectFailed( (ExecutionEvent) event );
+ break;
+ case MojoSkipped:
+ super.mojoSkipped( (ExecutionEvent) event );
+ break;
+ case MojoStarted:
+ super.mojoStarted( (ExecutionEvent) event );
+ break;
+ case MojoSucceeded:
+ super.mojoSucceeded( (ExecutionEvent) event );
+ break;
+ case MojoFailed:
+ super.mojoFailed( (ExecutionEvent) event );
+ break;
+ case ForkStarted:
+ super.forkedProjectStarted( (ExecutionEvent) event );
+ break;
+ case ForkSucceeded:
+ super.forkSucceeded( (ExecutionEvent) event );
+ break;
+ case ForkFailed:
+ super.forkFailed( (ExecutionEvent) event );
+ break;
+ case ForkedProjectStarted:
+ super.forkedProjectStarted( (ExecutionEvent) event );
+ break;
+ case ForkedProjectSucceeded:
+ super.forkedProjectSucceeded( (ExecutionEvent) event );
+ break;
+ case ForkedProjectFailed:
+ super.forkFailed( (ExecutionEvent) event );
+ break;
+ default:
+ LOGGER.fine( "event not managed" );
+ }
+
+ }
+ }
+
+ @Override
+ public void close()
+ throws Exception
+ {
+ //no op
+ }
+ }
+
+ private static class MavenExecutionListener extends AbstractExecutionListener implements Serializable, ExecutionListener {
private static final long serialVersionUID = 4942789836756366116L;
private final AbstractMavenBuilder maven3Builder;
private AtomicBoolean hasTestFailures = new AtomicBoolean();
+
+ private org.slf4j.Logger logger = LoggerFactory.getLogger( MavenExecutionListener.class );
/**
* Number of total nanoseconds {@link Maven3Builder} spent.
@@ -198,15 +326,9 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
}
this.reporters = new ConcurrentHashMap>(maven3Builder.reporters);
- // TODO: we should think about reusing the code in org.apache.maven.cli.DefaultMavenExecutionRequestBuilder#logging?
+
// E.g. there's also the option to redirect logging to a file which is handled there, but not here.
- PrintStreamLogger logger = new PrintStreamLogger( maven3Builder.listener.getLogger() );
- if (maven3Builder.isDebug()) {
- logger.setThreshold(PrintStreamLogger.LEVEL_DEBUG);
- } else if (maven3Builder.isQuiet()) {
- logger.setThreshold(PrintStreamLogger.LEVEL_ERROR);
- }
-
+
this.eventLogger = new ExecutionEventLogger( logger );
}
diff --git a/maven-plugin/src/main/java/hudson/maven/Maven3ProcessFactory.java b/maven-plugin/src/main/java/hudson/maven/Maven3ProcessFactory.java
index ecadce647a..8051028d6d 100644
--- a/maven-plugin/src/main/java/hudson/maven/Maven3ProcessFactory.java
+++ b/maven-plugin/src/main/java/hudson/maven/Maven3ProcessFactory.java
@@ -33,19 +33,19 @@ import hudson.remoting.Callable;
import hudson.remoting.Channel;
import hudson.remoting.Which;
import hudson.tasks.Maven.MavenInstallation;
+import org.jvnet.hudson.maven3.agent.Maven3Main;
+import org.jvnet.hudson.maven3.launcher.Maven3Launcher;
+import org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.URL;
-import org.jvnet.hudson.maven3.agent.Maven3Main;
-import org.jvnet.hudson.maven3.launcher.Maven3Launcher;
-
/**
* {@link AbstractMavenProcessFactory} for Maven 3.
*
- * @author Olivier Lam
+ * @author Olivier Lamy
*/
public class Maven3ProcessFactory extends AbstractMavenProcessFactory implements ProcessCache.Factory
{
@@ -74,6 +74,12 @@ public class Maven3ProcessFactory extends AbstractMavenProcessFactory implements
slaveRoot.child("maven3-interceptor.jar").getRemote();
}
+ protected String getMavenInterceptorCommonClassPath(MavenInstallation mvn,boolean isMaster,FilePath slaveRoot) throws IOException, InterruptedException {
+ return isMaster?
+ Which.jarFile(HudsonMavenExecutionResult.class).getAbsolutePath():
+ slaveRoot.child("maven3-interceptor-commons.jar").getRemote();
+ }
+
@Override
protected String getMavenInterceptorOverride(MavenInstallation mvn,
boolean isMaster, FilePath slaveRoot) throws IOException,
@@ -105,12 +111,12 @@ public class Maven3ProcessFactory extends AbstractMavenProcessFactory implements
/**
* Finds classworlds.jar
*/
- private static final class GetClassWorldsJar implements Callable {
+ protected static final class GetClassWorldsJar implements Callable {
private static final long serialVersionUID = -2599434124883557137L;
private final String mvnHome;
private final TaskListener listener;
- private GetClassWorldsJar(String mvnHome, TaskListener listener) {
+ protected GetClassWorldsJar(String mvnHome, TaskListener listener) {
this.mvnHome = mvnHome;
this.listener = listener;
}
diff --git a/maven-plugin/src/main/java/hudson/maven/MavenBuild.java b/maven-plugin/src/main/java/hudson/maven/MavenBuild.java
index 43218130c5..a67fb93da2 100644
--- a/maven-plugin/src/main/java/hudson/maven/MavenBuild.java
+++ b/maven-plugin/src/main/java/hudson/maven/MavenBuild.java
@@ -703,13 +703,26 @@ public class MavenBuild extends AbstractMavenBuild {
LOGGER.fine(getFullDisplayName()+" is building with mavenVersion " + mavenVersion + " from file " + mavenInformation.getVersionResourcePath());
- boolean maven3orLater = MavenUtil.maven3orLater(mavenVersion);
+ MavenUtil.MavenVersion mavenVersionType = MavenUtil.getMavenVersion( mavenVersion );
- ProcessCache.MavenProcess process = MavenBuild.mavenProcessCache.get( launcher.getChannel(), listener, maven3orLater
- ? new Maven3ProcessFactory(
- getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null )
- : new MavenProcessFactory(
- getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null ));
+ final ProcessCache.Factory factory;
+
+ switch ( mavenVersionType ){
+ case MAVEN_2:
+ LOGGER.fine( "using maven 2 " + mavenVersion );
+ factory = new MavenProcessFactory( getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null );
+ break;
+ case MAVEN_3_0_X:
+ LOGGER.fine( "using maven 3 " + mavenVersion );
+ factory = new Maven3ProcessFactory( getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null );
+ break;
+ default:
+ LOGGER.fine( "using maven 3 " + mavenVersion );
+ factory = new Maven31ProcessFactory( getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null );
+
+ }
+
+ ProcessCache.MavenProcess process = MavenBuild.mavenProcessCache.get( launcher.getChannel(), listener, factory);
ArgumentListBuilder margs = new ArgumentListBuilder("-N","-B");
FilePath localRepo = mms.getLocalRepository().locate(MavenBuild.this);
@@ -729,7 +742,7 @@ public class MavenBuild extends AbstractMavenBuild {
// backward compatibility
systemProps.put("hudson.build.number",String.valueOf(getNumber()));
- if (maven3orLater)
+ if (mavenVersionType == MavenUtil.MavenVersion.MAVEN_3_0_X || mavenVersionType == MavenUtil.MavenVersion.MAVEN_3_1)
{
// FIXME here for maven 3 builds
listener.getLogger().println("Building single Maven modules is not implemented for Maven 3, yet!");
diff --git a/maven-plugin/src/main/java/hudson/maven/MavenComputerListener.java b/maven-plugin/src/main/java/hudson/maven/MavenComputerListener.java
index 6e9405fac0..594a0c8728 100644
--- a/maven-plugin/src/main/java/hudson/maven/MavenComputerListener.java
+++ b/maven-plugin/src/main/java/hudson/maven/MavenComputerListener.java
@@ -41,8 +41,11 @@ import java.io.PrintStream;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Zip;
import org.codehaus.plexus.classworlds.ClassWorld;
+import jenkins.maven3.agent.Maven31Agent;
import org.jvnet.hudson.maven3.agent.Maven3Main;
+import org.jvnet.hudson.maven3.launcher.Maven31Interceptor;
import org.jvnet.hudson.maven3.launcher.Maven3Launcher;
+import org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult;
/**
* When a slave is connected, copy maven-agent.jar and maven-intercepter.jar
@@ -56,8 +59,11 @@ public class MavenComputerListener extends ComputerListener {
PrintStream logger = listener.getLogger();
copyJar(logger, root, Main.class, "maven-agent");
copyJar(logger, root, Maven3Main.class, "maven3-agent");
+ copyJar(logger, root, Maven31Agent.class, "maven31-agent");
copyJar(logger, root, Maven3Launcher.class, "maven3-interceptor");
+ copyJar(logger, root, Maven31Interceptor.class, "maven31-interceptor");
copyJar(logger, root, AbortException.class, "maven-interceptor");
+ copyJar(logger, root, HudsonMavenExecutionResult.class, "maven3-interceptor-commons" );
copyJar(logger, root, Maven21Interceptor.class, "maven2.1-interceptor");
copyJar(logger, root, ClassWorld.class, "plexus-classworld");
diff --git a/maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java b/maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java
index 73784b4a3e..b7fecf1c0d 100755
--- a/maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java
+++ b/maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java
@@ -34,8 +34,8 @@ import java.util.Properties;
import org.apache.commons.io.IOUtils;
import org.apache.maven.model.building.ModelBuildingRequest;
-import org.sonatype.aether.repository.WorkspaceReader;
-import org.sonatype.aether.transfer.TransferListener;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.transfer.TransferListener;
/**
* @author Olivier Lamy
diff --git a/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java b/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
index 0b71413876..b763072ce9 100644
--- a/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+++ b/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
@@ -97,12 +97,16 @@ import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingException;
import org.codehaus.plexus.util.PathTool;
+import jenkins.maven3.agent.Maven31Main;
+import org.jvnet.hudson.maven3.agent.Maven3Main;
+import org.jvnet.hudson.maven3.launcher.Maven31Launcher;
+import org.jvnet.hudson.maven3.launcher.Maven3Launcher;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
-import org.sonatype.aether.transfer.TransferCancelledException;
-import org.sonatype.aether.transfer.TransferEvent;
-import org.sonatype.aether.transfer.TransferListener;
+import org.eclipse.aether.transfer.TransferCancelledException;
+import org.eclipse.aether.transfer.TransferEvent;
+import org.eclipse.aether.transfer.TransferListener;
/**
* {@link Build} for {@link MavenModuleSet}.
@@ -679,22 +683,40 @@ public class MavenModuleSetBuild extends AbstractMavenBuild maven3MainClass = null;
+
+ Class> maven3LauncherClass = null;
+
+ switch ( mavenVersionType ){
+ case MAVEN_2:
+ LOGGER.fine( "using maven 2 " + mavenVersion );
+ factory = new MavenProcessFactory( project, MavenModuleSetBuild.this, launcher, envVars,getMavenOpts(listener, envVars),
+ pom.getParent() );
+ break;
+ case MAVEN_3_0_X:
+ LOGGER.fine( "using maven 3 " + mavenVersion );
+ factory = new Maven3ProcessFactory( project, MavenModuleSetBuild.this, launcher, envVars, getMavenOpts(listener, envVars),
+ pom.getParent() );
+ maven3MainClass = Maven3Main.class;
+ maven3LauncherClass = Maven3Launcher.class;
+ break;
+ default:
+ LOGGER.fine( "using maven 3 " + mavenVersion );
+ factory = new Maven31ProcessFactory( project, MavenModuleSetBuild.this, launcher, envVars, getMavenOpts(listener, envVars),
+ pom.getParent() );
+ maven3MainClass = Maven31Main.class;
+ maven3LauncherClass = Maven31Launcher.class;
}
+ process = MavenBuild.mavenProcessCache.get( launcher.getChannel(), slistener, factory);
+
+
ArgumentListBuilder margs = new ArgumentListBuilder().add("-B").add("-f", pom.getRemote());
FilePath localRepo = project.getLocalRepository().locate(MavenModuleSetBuild.this);
if(localRepo!=null)
@@ -756,8 +778,17 @@ public class MavenModuleSetBuild extends AbstractMavenBuild= 0;
+ return new ComparableVersion(mavenVersion).compareTo( new ComparableVersion ("3.0") ) >= 0;
+ }
+
+ public static MavenVersion getMavenVersion(String mavenVersion){
+ // we don't know so return maven 2
+ if(StringUtils.isBlank( mavenVersion )){
+ return MavenVersion.MAVEN_2;
+ }
+
+ ComparableVersion maven3_0 = new ComparableVersion("3.0");
+
+ ComparableVersion maven2_0 = new ComparableVersion("2.0");
+
+ ComparableVersion mavenCurrent = new ComparableVersion( mavenVersion );
+
+ if (mavenCurrent.compareTo( maven2_0 ) >= 0 && mavenCurrent.compareTo( maven3_0 ) < 0){
+ return MavenVersion.MAVEN_2;
+ }
+
+ ComparableVersion maven3_1_0 = new ComparableVersion("3.1.0");
+
+ if (mavenCurrent.compareTo( maven3_0 ) >= 0 && mavenCurrent.compareTo( maven3_1_0 ) < 0){
+ return MavenVersion.MAVEN_3_0_X;
+ }
+
+ return MavenVersion.MAVEN_3_1;
+
+ }
+
+ /**
+ * support of {@link org.apache.maven.eventspy.EventSpy} only since 3.0.2
+ * due to the current implementation will be supported only for maven 3.1.0
+ * @param mavenVersion
+ * @return
+ */
+ public static boolean supportEventSpy(String mavenVersion){
+ // null or empty so false !
+ if (StringUtils.isBlank( mavenVersion )) {
+ return false;
+ }
+ return new ComparableVersion(mavenVersion).compareTo( new ComparableVersion ("3.1.0") ) >= 0;
+ }
+
+ public enum MavenVersion {
+ MAVEN_2,MAVEN_3_0_X,MAVEN_3_1;
}
diff --git a/maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java b/maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
index c9e2597b7c..5d0ef7ffe6 100644
--- a/maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
+++ b/maven-plugin/src/main/java/hudson/maven/RedeployPublisher.java
@@ -64,7 +64,7 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.Authentication;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.cli.BatchModeMavenTransferListener;
+import org.apache.maven.cli.transfer.BatchModeMavenTransferListener;
import org.apache.maven.repository.Proxy;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/maven-plugin/src/main/java/hudson/maven/util/ExecutionEventLogger.java b/maven-plugin/src/main/java/hudson/maven/util/ExecutionEventLogger.java
index d594360220..0054f4fef1 100644
--- a/maven-plugin/src/main/java/hudson/maven/util/ExecutionEventLogger.java
+++ b/maven-plugin/src/main/java/hudson/maven/util/ExecutionEventLogger.java
@@ -40,7 +40,7 @@ import org.codehaus.plexus.logging.Logger;
*
* @author Benjamin Bentmann
*/
-// Note: copied from package org.apache.maven.cli with just one minor adaption for Maven3MojoNote
+// Note: copied from package org.apache.maven.cli with just one minor adaption for Maven3Mojo
public class ExecutionEventLogger
extends AbstractExecutionListener
{
diff --git a/maven-plugin/src/test/java/hudson/maven/MavenUtilTest.java b/maven-plugin/src/test/java/hudson/maven/MavenUtilTest.java
new file mode 100644
index 0000000000..65e7bf0582
--- /dev/null
+++ b/maven-plugin/src/test/java/hudson/maven/MavenUtilTest.java
@@ -0,0 +1,67 @@
+package hudson.maven;
+
+/*
+ * Copyright 2013 Olivier Lamy
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MavenUtilTest
+{
+ @Test
+ public void testMaven2(){
+ Assert.assertEquals( MavenUtil.MavenVersion.MAVEN_2, MavenUtil.getMavenVersion( "2.2.1" ) );
+ }
+
+ @Test
+ public void testMaven301(){
+ Assert.assertEquals( MavenUtil.MavenVersion.MAVEN_3_0_X, MavenUtil.getMavenVersion( "3.0.1" ) );
+ }
+
+ @Test
+ public void testMaven31(){
+ Assert.assertEquals( MavenUtil.MavenVersion.MAVEN_3_1, MavenUtil.getMavenVersion( "3.1.0" ) );
+ }
+
+ @Test
+ public void eventSpy2x(){
+ Assert.assertFalse( MavenUtil.supportEventSpy( "2.2.1" ) );
+ }
+
+ @Test
+ public void eventSpy301(){
+ Assert.assertFalse( MavenUtil.supportEventSpy( "3.0.1" ) );
+ }
+
+ @Test
+ public void eventSpy302(){
+ Assert.assertFalse( MavenUtil.supportEventSpy( "3.0.2" ) );
+ }
+
+ @Test
+ public void eventSpy31x(){
+ Assert.assertTrue( MavenUtil.supportEventSpy( "3.1.0" ) );
+ }
+}
diff --git a/pom.xml b/pom.xml
index 6e9119c126..d80610437e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,16 +95,13 @@ THE SOFTWARE.
https://api.github.com
jenkins-jira
- 1.6.2
+ 1.7.4
none
${skipTests}
1.6
-
-
-
repo.jenkins-ci.org
@@ -312,6 +309,11 @@ THE SOFTWARE.
maven-deploy-plugin
2.7
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 2.8
+
org.apache.maven.plugins
maven-compiler-plugin
@@ -356,11 +358,6 @@ THE SOFTWARE.
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.6
-
org.apache.maven.plugins
maven-assembly-plugin
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000000..e48875bc1d
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1 @@
+!*.zip
diff --git a/test/pom.xml b/test/pom.xml
index 6bdc15d28b..1685472acf 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -178,6 +178,7 @@ THE SOFTWARE.
true
+ org.apache.maven.plugins
maven-surefire-plugin
diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
index db7701ae7d..0abf3bb95d 100644
--- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
+++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
@@ -545,7 +545,15 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
MavenInstallation m3 = new MavenInstallation("apache-maven-3.0.1",mvn.getHome(), NO_PROPERTIES);
jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3);
return m3;
- }
+ }
+
+ protected MavenInstallation configureMaven31() throws Exception {
+ MavenInstallation mvn = configureDefaultMaven("apache-maven-3.1.0", MavenInstallation.MAVEN_30);
+
+ MavenInstallation m3 = new MavenInstallation("apache-maven-3.1.0",mvn.getHome(), NO_PROPERTIES);
+ jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3);
+ return m3;
+ }
/**
* Locates Maven2 and configure that as the only Maven in the system.
diff --git a/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java b/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
index 5335127d58..0ef9ac3ed6 100644
--- a/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
+++ b/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
@@ -720,7 +720,9 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
* @see #configureDefaultMaven()
*/
public MavenModuleSet createMavenProject(String name) throws IOException {
- return jenkins.createProject(MavenModuleSet.class,name);
+ MavenModuleSet mavenModuleSet = jenkins.createProject(MavenModuleSet.class,name);
+ mavenModuleSet.setRunHeadless( true );
+ return mavenModuleSet;
}
/**
diff --git a/test/src/main/resources/apache-maven-3.1.0-bin.zip b/test/src/main/resources/apache-maven-3.1.0-bin.zip
new file mode 100644
index 0000000000..10d8f5c252
Binary files /dev/null and b/test/src/main/resources/apache-maven-3.1.0-bin.zip differ
diff --git a/test/src/test/java/hudson/maven/Maven3BuildTest.java b/test/src/test/java/hudson/maven/AbstractMaven3xBuildTest.java
similarity index 90%
rename from test/src/test/java/hudson/maven/Maven3BuildTest.java
rename to test/src/test/java/hudson/maven/AbstractMaven3xBuildTest.java
index 09adf18b49..b69a03e573 100755
--- a/test/src/test/java/hudson/maven/Maven3BuildTest.java
+++ b/test/src/test/java/hudson/maven/AbstractMaven3xBuildTest.java
@@ -21,13 +21,11 @@ package hudson.maven;
*/
import hudson.Launcher;
-import hudson.model.*;
+import hudson.model.BuildListener;
+import hudson.model.ParametersDefinitionProperty;
+import hudson.model.Result;
+import hudson.model.StringParameterDefinition;
import hudson.tasks.Maven.MavenInstallation;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-
import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.TestResultProjectAction;
import org.apache.commons.io.FileUtils;
@@ -36,15 +34,22 @@ import org.jvnet.hudson.test.Email;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.HudsonTestCase;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+
/**
* @author Olivier Lamy
*/
-public class Maven3BuildTest extends HudsonTestCase {
-
+public abstract class AbstractMaven3xBuildTest
+ extends HudsonTestCase {
+
+ public abstract MavenInstallation configureMaven3x() throws Exception;
+
public void testSimpleMaven3Build() throws Exception {
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
m.setScm(new ExtractResourceSCM(getClass().getResource("maven3-project.zip")));
@@ -56,7 +61,7 @@ public class Maven3BuildTest extends HudsonTestCase {
public void testSimpleMaven3BuildRedeployPublisher() throws Exception {
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
m.setMaven( mavenInstallation.getName() );
File repo = createTmpDir();
FileUtils.cleanDirectory( repo );
@@ -82,7 +87,7 @@ public class Maven3BuildTest extends HudsonTestCase {
public void testSiteBuildWithForkedMojo() throws Exception {
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
m.setScm(new ExtractResourceSCM(getClass().getResource("maven3-project.zip")));
@@ -96,7 +101,7 @@ public class Maven3BuildTest extends HudsonTestCase {
File pom = new File(this.getClass().getResource("test-pom-8395.xml").toURI());
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
m.setRootPOM(pom.getAbsolutePath());
@@ -111,7 +116,7 @@ public class Maven3BuildTest extends HudsonTestCase {
public void testMaven3BuildWrongInheritence() throws Exception {
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
m.setScm(new ExtractResourceSCM(getClass().getResource("incorrect-inheritence-testcase.zip")));
@@ -126,7 +131,7 @@ public class Maven3BuildTest extends HudsonTestCase {
public void testMavenSeveralModulesInDirectory() throws Exception {
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
m.setScm(new ExtractResourceSCM(getClass().getResource("several-modules-in-directory.zip")));
@@ -139,7 +144,7 @@ public class Maven3BuildTest extends HudsonTestCase {
public void testMavenWithDependencyVersionInEnvVar() throws Exception {
MavenModuleSet m = createMavenProject();
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
ParametersDefinitionProperty parametersDefinitionProperty =
new ParametersDefinitionProperty(new StringParameterDefinition( "JUNITVERSION", "3.8.2" ));
@@ -154,7 +159,7 @@ public class Maven3BuildTest extends HudsonTestCase {
@Bug(8484)
public void testMultiModMavenNonRecursive() throws Exception {
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
MavenModuleSet m = createMavenProject();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
@@ -167,7 +172,7 @@ public class Maven3BuildTest extends HudsonTestCase {
@Bug(8573)
public void testBuildTimeStampProperty() throws Exception {
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
MavenModuleSet m = createMavenProject();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
@@ -181,7 +186,7 @@ public class Maven3BuildTest extends HudsonTestCase {
@Bug(1557)
public void testDuplicateTestResults() throws Exception {
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
MavenModuleSet m = createMavenProject();
m.setMaven( mavenInstallation.getName() );
m.getReporters().add(new TestReporter());
@@ -196,7 +201,7 @@ public class Maven3BuildTest extends HudsonTestCase {
@Bug(9326)
public void testTychoTestResults() throws Exception {
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
MavenModuleSet m = createMavenProject();
m.setRootPOM( "org.foobar.build/pom.xml" );
m.setMaven( mavenInstallation.getName() );
@@ -222,7 +227,7 @@ public class Maven3BuildTest extends HudsonTestCase {
@Bug(9326)
public void testTychoEclipseTestResults() throws Exception {
- MavenInstallation mavenInstallation = configureMaven3();
+ MavenInstallation mavenInstallation = configureMaven3x();
MavenModuleSet m = createMavenProject();
m.setRootPOM( "org.foobar.build/pom.xml" );
m.setMaven( mavenInstallation.getName() );
diff --git a/test/src/test/java/hudson/maven/Maven30xBuildTest.java b/test/src/test/java/hudson/maven/Maven30xBuildTest.java
new file mode 100755
index 0000000000..5c236ce046
--- /dev/null
+++ b/test/src/test/java/hudson/maven/Maven30xBuildTest.java
@@ -0,0 +1,55 @@
+package hudson.maven;
+
+/*
+ * Olivier Lamy
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import hudson.Launcher;
+import hudson.model.BuildListener;
+import hudson.model.ParametersDefinitionProperty;
+import hudson.model.Result;
+import hudson.model.StringParameterDefinition;
+import hudson.tasks.Maven;
+import hudson.tasks.Maven.MavenInstallation;
+import hudson.tasks.test.AbstractTestResultAction;
+import hudson.tasks.test.TestResultProjectAction;
+import org.apache.commons.io.FileUtils;
+import org.jvnet.hudson.test.Bug;
+import org.jvnet.hudson.test.Email;
+import org.jvnet.hudson.test.ExtractResourceSCM;
+import org.jvnet.hudson.test.HudsonTestCase;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+
+/**
+ * @author Olivier Lamy
+ */
+public class Maven30xBuildTest
+ extends AbstractMaven3xBuildTest {
+
+ @Override
+ public MavenInstallation configureMaven3x()
+ throws Exception
+ {
+ return configureMaven3();
+ }
+
+}
diff --git a/test/src/test/java/hudson/maven/Maven31xBuildTest.java b/test/src/test/java/hudson/maven/Maven31xBuildTest.java
new file mode 100755
index 0000000000..449d782492
--- /dev/null
+++ b/test/src/test/java/hudson/maven/Maven31xBuildTest.java
@@ -0,0 +1,54 @@
+package hudson.maven;
+
+/*
+ * Olivier Lamy
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import hudson.Launcher;
+import hudson.model.BuildListener;
+import hudson.model.ParametersDefinitionProperty;
+import hudson.model.Result;
+import hudson.model.StringParameterDefinition;
+import hudson.tasks.Maven;
+import hudson.tasks.Maven.MavenInstallation;
+import hudson.tasks.test.AbstractTestResultAction;
+import hudson.tasks.test.TestResultProjectAction;
+import org.apache.commons.io.FileUtils;
+import org.jvnet.hudson.test.Bug;
+import org.jvnet.hudson.test.Email;
+import org.jvnet.hudson.test.ExtractResourceSCM;
+import org.jvnet.hudson.test.HudsonTestCase;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+
+/**
+ * @author Olivier Lamy
+ */
+public class Maven31xBuildTest
+ extends AbstractMaven3xBuildTest {
+
+ @Override
+ public MavenInstallation configureMaven3x()
+ throws Exception
+ {
+ return configureMaven31();
+ }
+}
diff --git a/test/src/test/java/hudson/tasks/MavenTest.java b/test/src/test/java/hudson/tasks/MavenTest.java
index e6758f502c..1e0588d345 100644
--- a/test/src/test/java/hudson/tasks/MavenTest.java
+++ b/test/src/test/java/hudson/tasks/MavenTest.java
@@ -207,7 +207,7 @@ public class MavenTest extends HudsonTestCase {
@SuppressWarnings("deprecation")
String buildLog = build.getLog();
assertNotNull(buildLog);
- System.out.println(buildLog);
+ System.out.println(buildLog);
assertFalse(buildLog.contains("-Dpassword=12345"));
}
diff --git a/test/src/test/resources/hudson/maven/maven3-project.zip b/test/src/test/resources/hudson/maven/maven3-project.zip
index 2701bb5b42..35c1bec72c 100644
Binary files a/test/src/test/resources/hudson/maven/maven3-project.zip and b/test/src/test/resources/hudson/maven/maven3-project.zip differ