Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-46053, JENKINS-45271, JENKINS-46210, JENKINS-46148] - Update HttpClient libraries and Fix Parent POM #102

Merged
merged 18 commits into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4826ae7
[JENKINS-46053, JENKINS-45271] Update Parent POM.xml, pick dev versio…
oleg-nenashev Aug 11, 2017
a7b4824
[JENKINS-46148] - Avoid using deprecated APIs
oleg-nenashev Aug 11, 2017
a213921
[JENKINS-46210] - Pick the released version of apache-httpcomponents-…
oleg-nenashev Aug 15, 2017
21662c0
Update Maven Interceptors to 1.12-alpha-1
oleg-nenashev Sep 15, 2017
b53baa2
Try updating Wagon to 3.0.0
oleg-nenashev Sep 15, 2017
9ef0dee
Merge commit '21662c03e39b3e673df2f17a9baa323da96a8454' into facelift
oleg-nenashev Sep 15, 2017
c4e3f39
Pick Maven Embedder snapshot release
oleg-nenashev Sep 15, 2017
fdfb11c
Get rid of the obsolete Maven Surefire section
oleg-nenashev Sep 15, 2017
b0b64ad
Rework AbstractMaven3xBuildTest to JUnit4, add tests for Maven 3.3.9 …
oleg-nenashev Sep 15, 2017
8a1790e
Use Parent POM 2.35, block non-operational integration tests
oleg-nenashev Sep 20, 2017
969c5ed
Stop bundling Guava in Maven Plugin
oleg-nenashev Sep 20, 2017
e88d12a
Revert the version of Maven Embedder to 3.1.0
oleg-nenashev Sep 20, 2017
1ad5793
Ignore just another test
oleg-nenashev Sep 20, 2017
3e5566c
Exclude Maven core components from interceptors and agents
oleg-nenashev Sep 21, 2017
940a6bb
Do not bundle org.apache.httpcomponents:httpcore:jar:4.4.6 from wagon…
oleg-nenashev Sep 21, 2017
04c6a6b
Exclude Ant library from Maven Embedder
oleg-nenashev Sep 21, 2017
cf133ea
Now exclude Ant from the proper source
oleg-nenashev Sep 21, 2017
acac87d
Merge Enforcer rules to suppress the build warning
oleg-nenashev Sep 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 61 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.17</version>
<version>2.33</version>
</parent>

<groupId>org.jenkins-ci.main</groupId><!-- for historical reason, this plugin has a different groupId -->
Expand All @@ -44,8 +44,8 @@ THE SOFTWARE.
<properties>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<mavenInterceptorsVersion>1.11</mavenInterceptorsVersion>
<mavenVersion>3.1.0</mavenVersion>
<mavenInterceptorsVersion>1.12-SNAPSHOT</mavenInterceptorsVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a timestamped snapshot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but it depends how many days the PR will leave. SNAPSHOTs are quickly removed and thus it makes the build KO each time a new SNAPSHOT is published ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SNAPSHOTs are quickly removed

Not that quickly.

<mavenVersion>3.5.0</mavenVersion>
<maven.version>${mavenVersion}</maven.version>
<aetherVersion>1.1.0</aetherVersion>
<sisuInjectVersion>0.3.3</sisuInjectVersion>
Expand All @@ -67,26 +67,7 @@ THE SOFTWARE.
</license>
</licenses>

<dependencyManagement>
<dependencies>
<!-- Newer version of plexus-utils is required for artifact deployment to
work using scpexe wagon (see JENKINS-4861). This may be removed when
the effective version of the transitive plexus-utils dependency is 3.0.16+. -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.17</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency> <!-- TODO pending https://github.com/jenkinsci/plugin-pom/pull/17 -->
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>javadoc</artifactId>
Expand Down Expand Up @@ -223,7 +204,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<version>${mavenVersion}</version>
<version>3.3.9</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will quickly have a nightmare to resolve with the 3 versions of aether (Maven 3.5.0 added a new lib) cc @olamy

Copy link
Member Author

@oleg-nenashev oleg-nenashev Aug 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The released version of Maven plugin already depends on Maven Core 3.5.0, but Maven Plugin bundles core 3.1.0. So we are already in the YOLO mode :(

maven-aether-provider 3.5.0 does not exist. If the new library uses different package names, there should be no issue. We could bundle both. What could possibly go wrong? (c)

</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -309,17 +290,20 @@ THE SOFTWARE.
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.3</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>apache-httpcomponents-client-4-api</artifactId>
<version>4.5.3-1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
Expand Down Expand Up @@ -361,7 +345,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.5.1</version>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.lib</groupId>
Expand Down Expand Up @@ -435,7 +419,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.8.5</version>
<version>1.10.19</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -467,11 +451,17 @@ THE SOFTWARE.
<artifactId>mock-javamail</artifactId>
<version>1.9</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.4</version>
<version>1.7.7</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -566,6 +556,43 @@ THE SOFTWARE.
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not get a version for free from plugin-pom?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, at least maven-enforcer-plugin.version should be used


<!-- Consider adding to Jenkins plugin parent POM? -->
<dependencies>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>0.7.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>ban-commons-httpclient-3x</id>
<phase>process-sources</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.RestrictImports">
<basePackage>**</basePackage>
<includeTestCode>true</includeTestCode>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary.

<bannedImports>
<bannedImport>org.apache.commons.httpclient.**</bannedImport>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this better than bannedDependencies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick It is a transient dependency from the Jenkins core, so it will blow up if I just ban it. bannedImports rather says that this lib usage is deprecated across the Maven Plugin. jenkinsci/maven-interceptors#13

</bannedImports>
</restrictImports>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down
32 changes: 29 additions & 3 deletions src/main/java/hudson/maven/MavenBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@

import jenkins.model.ArtifactManager;
import jenkins.mvn.SettingsProvider;
import org.apache.maven.project.DuplicateProjectException;
import org.apache.maven.project.ProjectSorter;
import org.codehaus.plexus.util.dag.CycleDetectedException;

/**
* {@link Run} for {@link MavenModule}.
Expand Down Expand Up @@ -347,18 +350,41 @@ 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.
*/
@Deprecated
@CheckForNull
private static MavenProject getTopLevelProject(ReactorManager rm) throws BuildFailureException {
List<MavenProject> sortedProjects = rm.getSortedProjects();
if (sortedProjects.isEmpty()) {
return null;
}

final ProjectSorter sorter;
try {
sorter = new ProjectSorter(sortedProjects);
} catch(CycleDetectedException ex) {
throw new BuildFailureException("Cannot retrieve the top-level project due to the cycle", ex);
} catch(DuplicateProjectException ex) {
throw new BuildFailureException("Cannot retrieve the duplicate in the project list", ex);
}
return sorter.getTopLevelProject();
}

@Override
void preBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, IOException, InterruptedException {
for (MavenReporter r : reporters.get(moduleName))
r.preBuild(buildProxy,rm.getTopLevelProject(),listener);
r.preBuild(buildProxy,getTopLevelProject(rm),listener);
}

@Override
void postBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, IOException, InterruptedException {
buildProxy.setExecutedMojos(executedMojos);
for (MavenReporter r : reporters.get(moduleName))
r.postBuild(buildProxy,rm.getTopLevelProject(),listener);
r.postBuild(buildProxy,getTopLevelProject(rm),listener);
}

@Override
Expand Down