Skip to content
Permalink
Browse files

JENKINS-43446 - java.lang.NoSuchFieldError: DEFAULT_USER_SETTINGS_FILE

  • Loading branch information...
Tomer Cohen
Tomer Cohen committed Apr 11, 2017
1 parent 9807ed5 commit 9addffc853ab178bc280ef5cecb1f4e6a07d0fe9
12 pom.xml
@@ -45,7 +45,7 @@ THE SOFTWARE.
<properties>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<mavenInterceptorsVersion>1.8.1</mavenInterceptorsVersion>
<mavenInterceptorsVersion>1.9-SNAPSHOT</mavenInterceptorsVersion>
<mavenVersion>3.1.0</mavenVersion>
<maven.version>${mavenVersion}</maven.version>
<aetherVersion>1.1.0</aetherVersion>
@@ -164,6 +164,11 @@ THE SOFTWARE.
<artifactId>maven33-agent</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven35-agent</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
@@ -195,6 +200,11 @@ THE SOFTWARE.
<artifactId>maven33-interceptor</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven35-interceptor</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven3-interceptor-commons</artifactId>
@@ -0,0 +1,102 @@
/*
* 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.Channel;
import hudson.tasks.Maven.MavenInstallation;
import jenkins.maven3.agent.Maven35Main;
import jenkins.security.MasterToSlaveCallable;
import org.jvnet.hudson.maven3.launcher.Maven35Interceptor;
import org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult;

import java.io.IOException;
import java.net.URL;

/**
* {@link AbstractMavenProcessFactory} for Maven 3.5.x
*
* @author Olivier Lamy
*/
public class Maven35ProcessFactory extends Maven3ProcessFactory
{

Maven35ProcessFactory(MavenModuleSet mms, AbstractMavenBuild<?, ?> build, Launcher launcher, EnvVars envVars,
String mavenOpts, FilePath workDir ) {
super( mms, build, launcher, envVars, mavenOpts, workDir );
}

@Override
protected String getMainClassName()
{
return Maven35Main.class.getName();
}

@Override
protected String getMavenAgentClassPath(MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException {
String classWorldsJar = getLauncher().getChannel().call(new GetClassWorldsJar(mvn.getHome(),listener));
String path = classPathEntry(slaveRoot, Maven35Main.class, "maven35-agent", listener) +
(getLauncher().isUnix()?":":";")+classWorldsJar;

// TODO this configurable??
path += (getLauncher().isUnix()?":":";")+mvn.getHomeDir().getPath()+"/conf/logging";

return path;
}

@Override
protected void applyPlexusModuleContributor(Channel channel, AbstractMavenBuild<?, ?> context) throws InterruptedException, IOException {
channel.call(new InstallPlexusModulesTask(context));
}

private static final class InstallPlexusModulesTask extends MasterToSlaveCallable<Void,IOException>
{
PlexusModuleContributor c;

public InstallPlexusModulesTask(AbstractMavenBuild<?, ?> context) throws IOException, InterruptedException {
c = PlexusModuleContributorFactory.aggregate(context);
}

public Void call() throws IOException {
Maven35Main.addPlexusComponents( c.getPlexusComponentJars().toArray( new URL[0] ) );
return null;
}

private static final long serialVersionUID = 1L;
}

@Override
protected String getMavenInterceptorClassPath(MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException {
return classPathEntry(slaveRoot, Maven35Interceptor.class, "maven35-interceptor", listener);
}

protected String getMavenInterceptorCommonClassPath(MavenInstallation mvn, FilePath slaveRoot, BuildListener listener) throws IOException, InterruptedException {
return classPathEntry(slaveRoot, HudsonMavenExecutionResult.class, "maven3-interceptor-commons", listener);
}


}
@@ -837,9 +837,13 @@ protected Result doRun(BuildListener listener) throws Exception {
LOGGER.fine( "using maven 3 " + mavenVersion );
factory = new Maven32ProcessFactory( getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null );
break;
default:
case MAVEN_3_3:
LOGGER.fine( "using maven 3 " + mavenVersion );
factory = new Maven33ProcessFactory( getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null );
break;
default:
LOGGER.fine( "using maven 3 " + mavenVersion );
factory = new Maven35ProcessFactory( getParent().getParent(), MavenBuild.this, launcher, envVars, getMavenOpts(listener, envVars), null );

}

@@ -85,6 +85,7 @@

import jenkins.MasterToSlaveFileCallable;
import jenkins.maven3.agent.Maven33Main;
import jenkins.maven3.agent.Maven35Main;
import jenkins.model.Jenkins;
import jenkins.mvn.GlobalSettingsProvider;
import jenkins.mvn.SettingsProvider;
@@ -101,10 +102,7 @@
import jenkins.maven3.agent.Maven32Main;

import org.jvnet.hudson.maven3.agent.Maven3Main;
import org.jvnet.hudson.maven3.launcher.Maven31Launcher;
import org.jvnet.hudson.maven3.launcher.Maven32Launcher;
import org.jvnet.hudson.maven3.launcher.Maven33Launcher;
import org.jvnet.hudson.maven3.launcher.Maven3Launcher;
import org.jvnet.hudson.maven3.launcher.*;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
@@ -787,12 +785,19 @@ protected Result doRun(final BuildListener listener) throws Exception {
maven3MainClass = Maven32Main.class;
maven3LauncherClass = Maven32Launcher.class;
break;
default:
case MAVEN_3_3:
LOGGER.fine( "using maven 3 " + mavenVersion );
factory = new Maven33ProcessFactory( project, MavenModuleSetBuild.this, launcher, envVars, mavenOpts,
pom.getParent() );
pom.getParent() );
maven3MainClass = Maven33Main.class;
maven3LauncherClass = Maven33Launcher.class;
break;
default:
LOGGER.fine( "using maven 3 " + mavenVersion );
factory = new Maven35ProcessFactory( project, MavenModuleSetBuild.this, launcher, envVars, mavenOpts,
pom.getParent() );
maven3MainClass = Maven35Main.class;
maven3LauncherClass = Maven35Launcher.class;
}

process = MavenBuild.mavenProcessCache.get( launcher.getChannel(), slistener, factory);
@@ -309,7 +309,11 @@ public static MavenVersion getMavenVersion(String mavenVersion){
if (mavenCurrent.compareTo( maven3_2_0 ) >= 0 && mavenCurrent.compareTo( maven3_3_1 ) < 0){
return MavenVersion.MAVEN_3_2;
}
return MavenVersion.MAVEN_3_3;
ComparableVersion maven3_5_0 = new ComparableVersion("3.5.0");
if (mavenCurrent.compareTo( maven3_3_1 ) >= 0 && mavenCurrent.compareTo( maven3_5_0 ) < 0){
return MavenVersion.MAVEN_3_3;
}
return MavenVersion.MAVEN_3_5;

}

@@ -328,7 +332,7 @@ public static boolean supportEventSpy(String mavenVersion){
}

public enum MavenVersion {
MAVEN_2,MAVEN_3_0_X,MAVEN_3_1,MAVEN_3_2,MAVEN_3_3;
MAVEN_2,MAVEN_3_0_X,MAVEN_3_1,MAVEN_3_2,MAVEN_3_3, MAVEN_3_5
}


0 comments on commit 9addffc

Please sign in to comment.
You can’t perform that action at this time.