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-54828] - Support building plugins with java.level=11 #133

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
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
58 changes: 49 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<!-- Change this property if you need your tests to be compiled with a different Java level than the plugin. -->
<!-- Use only if strictly necessary. It may cause problems in your IDE. -->
<java.level.test>${java.level}</java.level.test>
<plugin.tests.minimumJavaVersion>1.${java.level.test}</plugin.tests.minimumJavaVersion>
<concurrency>1</concurrency> <!-- DEPRECATED use forkCount -->
<forkCount>${concurrency}</forkCount> <!-- may use e.g. 2C for 2 × (number of cores) -->
<trimStackTrace>false</trimStackTrace> <!-- SUREFIRE-1226 workaround -->
Expand Down Expand Up @@ -92,11 +93,13 @@
<maven-scm.version>1.9.5</maven-scm.version>
<!-- To skip the wizard by default in hpi:run. It should not impact other goals. -->
<hudson.Main.development>true</hudson.Main.development>
<access-modifier.version>1.15</access-modifier.version>
<access-modifier.version>1.16</access-modifier.version>
<!-- May be used to select timestamped snapshots: -->
<access-modifier-annotation.version>${access-modifier.version}</access-modifier-annotation.version>
<access-modifier-checker.version>${access-modifier.version}</access-modifier-checker.version>
<annotation-indexer.version>1.12</annotation-indexer.version>
<animal.sniffer.version>1.17</animal.sniffer.version>
<animal.sniffer.signature.version>java1${java.level}</animal.sniffer.signature.version>
<!-- To opt in to @Restricted(Beta.class) APIs, set to true: -->
<useBeta>false</useBeta>
<incrementals.url>https://repo.jenkins-ci.org/incrementals/</incrementals.url>
Expand Down Expand Up @@ -287,6 +290,12 @@
<version>${access-modifier-annotation.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
<version>${annotation-indexer.version}</version>
<scope>provided</scope>
</dependency>
<dependency> <!-- to avoid https://www.slf4j.org/codes.html#release warning -->
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand All @@ -307,7 +316,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down Expand Up @@ -335,7 +344,7 @@
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version> <!-- TODO 3.0.0 when released -->
<version>3.0.0-M2</version> <!-- TODO 3.0.0 when released -->
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
Expand Down Expand Up @@ -520,7 +529,7 @@
</requirePluginVersions>
-->
<enforceBytecodeVersion>
<maxJdkVersion>1.${java.level}</maxJdkVersion>
<maxJdkVersion>${plugin.minimumJavaVersion}</maxJdkVersion>
<ignoredScopes>
<ignoredScope>test</ignoredScope>
</ignoredScopes>
Expand Down Expand Up @@ -615,10 +624,10 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.${java.level}</source>
<target>1.${java.level}</target>
<testSource>1.${java.level.test}</testSource>
<testTarget>1.${java.level.test}</testTarget>
<source>${plugin.minimumJavaVersion}</source>
<target>${plugin.minimumJavaVersion}</target>
<testSource>${plugin.tests.minimumJavaVersion}</testSource>
<testTarget>${plugin.tests.minimumJavaVersion}</testTarget>
</configuration>
</plugin>
<plugin>
Expand All @@ -635,7 +644,7 @@
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java1${java.level}</artifactId>
<artifactId>${animal.sniffer.signature.version}</artifactId>
</signature>
</configuration>
</plugin>
Expand Down Expand Up @@ -1489,5 +1498,36 @@
</plugins>
</build>
</profile>
<profile>
<!-- oleg_nenashev: Cannot setup activation for multiple Java versions:
https://issues.apache.org/jira/browse/MNG-3328
-->
<id>java-level-11</id>
<activation>
<property>
<name>java.level</name>
Copy link
Member

Choose a reason for hiding this comment

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

you can not activate properties like this. It requires you run maven with mvn -Djava.level=11 as it can only look at system properties - not properties defined in the <properties> section of the XML

Copy link
Member Author

@oleg-nenashev oleg-nenashev Dec 23, 2019

Choose a reason for hiding this comment

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

Not a big concern for me (whatever works if it is theoretically supported)

Copy link
Member

Choose a reason for hiding this comment

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

the problem is it doesn't work if you have a reactor with a mix of things - you need to move everything in one to java11 (the reactor may not be the parent and all the plugins could come from different repositories with different release cycles)

<value>11</value>
</property>
</activation>
<properties>
<plugin.minimumJavaVersion>${java.level}</plugin.minimumJavaVersion>
<!-- TODO(oleg_nenashev): disable it at all? Now we assume that the code is just compatible with Java 8 which is OK for now.
Tracked as https://issues.jenkins-ci.org/browse/JENKINS-54842
-->
<animal.sniffer.signature.version>java18</animal.sniffer.signature.version>
</properties>
</profile>
<profile>
<id>java-test-level-11</id>
<activation>
<property>
<name>java.level.test</name>
<value>11</value>
</property>
</activation>
<properties>
<plugin.tests.minimumJavaVersion>${java.level.test}</plugin.tests.minimumJavaVersion>
</properties>
</profile>
</profiles>
</project>