-
Notifications
You must be signed in to change notification settings - Fork 89
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-67912] Maven HPI plugin does not compile with Java 11 #310
Conversation
new DefaultProjectBuildingRequest(session.getProjectBuildingRequest()); | ||
buildingRequest.setRemoteRepositories(remoteRepositories); | ||
buildingRequest.setLocalRepository(localRepository); | ||
buildingRequest.setProcessPlugins(false); // improve performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling the processing of plugins has a significant effect on performance. I noticed build times had doubled compared to before this PR. Investigating further, I suspected the the Maven 2 APIs we were using before this PR never processed plugins. When I disabled plugin processing in fc9ae1e, performance went back to its old levels. You can see the difference between build 1 and build 2 of this PR. Build 1 took 29 minutes; build 2 took 12 minutes. Builds of the main branch typically take 15 minutes. So this PR keeps performance at similar levels. I repeated the manual testing I had done in core and plugins, and processing plugins didn't seem to have any noticeable effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay to me as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoot, too late
Problem
See JENKINS-67912. When compiling
maven-hpi-plugin
with Java 11, the build fails:Evaluation
This error seems to be caused by the use of
maven-stapler-plugin
as a direct dependency. The comment states: "for using annotation processor", but this seems to be outdated. The logic dates from commit 334506f from 2007, and the annotation logic was ripped out in commit 334506f in 2012. So this dependency is just no longer needed. Plugins and core consumemaven-stapler-plugin
through their respective parent POMs. This is not needed inmaven-hpi-plugin
.Solution
Remove
maven-stapler-plugin
. This opens a can of worms, as it seems we were unintentionally relying onmaven-stapler-plugin
to pull in:So now we explicitly depend on the latest versions of Ant and Guava (which we consume directly) and rewrite any usages of Maven 2 in terms of the equivalent Maven 3 APIs.
Implementation
The main Maven 2 API we were still consuming was
org.apache.maven.project.MavenProjectBuilder#buildFromRepository
. This PR rewrites our usages in terms of the Maven 3 APIorg.apache.maven.project.ProjectBuilder#build
instead.Testing done
I tested this both from plugins and core. In the case of core I verified that the
generate-taglib-interface
Mojo still produced the same results as before. In the case of plugins I verified that the resulting.hpi
had the same contents as before and thatmvn hpi:run
still worked as before.Fixes #286