Skip to content

Commit

Permalink
Update maven-interceptors version. Ensure that maven 3.3 request uses…
Browse files Browse the repository at this point in the history
… correct launcher and the main class (#292)
  • Loading branch information
c00ler committed Oct 13, 2022
1 parent 56e7dda commit f7f8dfa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ THE SOFTWARE.
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}</gitHubRepo>
<jenkins.version>2.332.1</jenkins.version>
<mavenInterceptorsVersion>1.13</mavenInterceptorsVersion>
<mavenInterceptorsVersion>1.14</mavenInterceptorsVersion>
<!--
Minimal supported version of Maven.
It declares version of the core, which should be included into the the server-side.
Expand Down Expand Up @@ -118,7 +118,7 @@ THE SOFTWARE.
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven-agent</artifactId>
Expand All @@ -139,7 +139,7 @@ THE SOFTWARE.
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven-interceptor</artifactId>
Expand All @@ -156,13 +156,13 @@ THE SOFTWARE.
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jvnet.hudson</groupId>
<artifactId>maven2.1-interceptor</artifactId>
<version>1.2</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven3-agent</artifactId>
Expand Down Expand Up @@ -410,7 +410,7 @@ THE SOFTWARE.
<artifactId>org.eclipse.sisu.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
Expand Down Expand Up @@ -477,7 +477,7 @@ THE SOFTWARE.
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-util</artifactId>
<version>${resolverVersion}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-wagon</artifactId>
Expand Down Expand Up @@ -866,7 +866,7 @@ THE SOFTWARE.
</configuration>
</execution>
</executions>

<!-- Consider adding to Jenkins plugin parent POM? -->
<dependencies>
<dependency>
Expand Down
47 changes: 24 additions & 23 deletions src/main/java/hudson/maven/MavenBuild.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* 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
Expand Down Expand Up @@ -107,7 +107,7 @@

/**
* {@link Run} for {@link MavenModule}.
*
*
* @author Kohsuke Kawaguchi
*/
@SuppressWarnings("deprecation") // as we're restricted to Maven 2.x API here, but compile against Maven 3.x we cannot avoid deprecations
Expand All @@ -125,7 +125,7 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
* @since 1.98.
*/
private List<ExecutedMojo> executedMojos;

public MavenBuild(MavenModule job) throws IOException {
super(job);
}
Expand Down Expand Up @@ -274,7 +274,7 @@ public List<ExecutedMojo> getExecutedMojos() {
else
return Collections.unmodifiableList(executedMojos);
}

@Override
public void run() {
execute(new MavenBuildExecution());
Expand Down Expand Up @@ -310,7 +310,7 @@ public static ExecutedMojo.Cache createExecutedMojoCache() {
protected void setWorkspace(FilePath path) {
super.setWorkspace(path);
}

@Override
public MavenModule getParent() {// don't know why, but javac wants this
return super.getParent();
Expand Down Expand Up @@ -355,7 +355,7 @@ public void executeAsync(final BuildCallable<?,?> program) throws IOException {

private static final long serialVersionUID = 1L;
}

/**
* @deprecated Used APIs are deprecated and probably unstable according to
* {@link ProjectSorter#getTopLevelProject()} comments.
Expand All @@ -367,7 +367,7 @@ private static MavenProject getTopLevelProject(ReactorManager rm) throws BuildFa
if (sortedProjects.isEmpty()) {
return null;
}

final ProjectSorter sorter;
try {
sorter = new ProjectSorter(sortedProjects);
Expand All @@ -378,7 +378,7 @@ private static MavenProject getTopLevelProject(ReactorManager rm) throws BuildFa
}
return sorter.getTopLevelProject();
}

@Override
void preBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, IOException, InterruptedException {
for (MavenReporter r : reporters.get(moduleName))
Expand Down Expand Up @@ -441,7 +441,7 @@ void postModule(MavenProject project) throws InterruptedException, IOException,
public boolean hasBuildFailures() {
return hasTestFailures.get();
}

private static final long serialVersionUID = 1L;
}

Expand Down Expand Up @@ -572,11 +572,11 @@ public long getMilliSecsSinceBuildStart() {
public boolean isArchivingDisabled() {
return MavenBuild.this.getParent().getParent().isArchivingDisabled();
}

public boolean isSiteArchivingDisabled() {
return MavenBuild.this.getParent().getParent().isSiteArchivingDisabled();
}

public void registerAsProjectAction(MavenReporter reporter) {
MavenBuild.this.registerAsProjectAction(reporter);
}
Expand Down Expand Up @@ -613,7 +613,7 @@ private static final class CanonicalPath extends MasterToSlaveFileCallable<Strin

public class ProxyImpl2 extends ProxyImpl implements MavenBuildProxy2 {
private static final long serialVersionUID = -3377221864644014218L;

private final SplittableBuildListener listener;
long startTime;
private OutputStream log;
Expand Down Expand Up @@ -731,18 +731,18 @@ public Result run(BuildListener listener) {
}
});
}

rememberModulesToBuildAgainNextTime();
}

private void rememberModulesToBuildAgainNextTime() {
MavenModuleSetBuild moduleSetBuild = getModuleSetBuild();

if (moduleSetBuild == null) {
// ModuleSetBuild is gone, for whatever reason JENKINS-9822
return;
}

if(hasntStartedYet()) {
// record modules which have not been build though they should have - i.e. because they
// have SCM changes.
Expand Down Expand Up @@ -772,10 +772,10 @@ private void rememberModulesToBuildAgainNextTime() {
}
}
}

if (moduleSetBuild.getParent().isIncrementalBuild() &&
(moduleSetBuild.getResult() != Result.SUCCESS)) {

// JENKINS-5121: maybe module needs to be deployed on next build over the deployment threshold
MavenModuleSet mavenModuleSet = moduleSetBuild.getParent();
boolean isDeploying = false;
Expand All @@ -788,7 +788,7 @@ private void rememberModulesToBuildAgainNextTime() {
break;
}
}

if (isDeploying && moduleSetBuild.getResult().isWorseThan(deploymentThreshold)) {
UnbuiltModuleAction action = moduleSetBuild.getAction(UnbuiltModuleAction.class);
if (action == null) {
Expand Down Expand Up @@ -818,8 +818,8 @@ protected void setBlockBuildEvents(boolean blockBuildEvents) {
this.blockBuildEvents = blockBuildEvents;
}
}



private class MavenBuildExecution extends AbstractBuildExecution {
private List<MavenReporter> reporters;
Expand Down Expand Up @@ -1010,6 +1010,7 @@ private Maven3Builder.Maven3BuilderRequest createRequest(ProxyImpl2 buildProxy,
case MAVEN_3_3:
request.maven3MainClass = Maven33Main.class;
request.maven3LauncherClass = Maven33Launcher.class;
break;
default:
request.maven3MainClass = Maven35Main.class;
request.maven3LauncherClass = Maven35Launcher.class;
Expand Down

0 comments on commit f7f8dfa

Please sign in to comment.