Skip to content

Commit

Permalink
Build with Java 11 (#425)
Browse files Browse the repository at this point in the history
Some plugins now require Java 11.
  • Loading branch information
freemanjp authored Mar 6, 2022
1 parent c90e018 commit 39707c2
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

./mvnw install --batch-mode --show-version
./mvnw install --batch-mode --show-version -Denforce.java-version.skip
1 change: 1 addition & 0 deletions .github/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ set +x
-P attach-site-descriptor,sign-artifacts,ossrh-deploy \
-DskipTests \
-Dinvoker.skip=true \
-Denforce.java-version.skip \
--batch-mode \
--show-version
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '1.8'
java-version: '11'
- name: Build with Maven
run: .github/scripts/build.sh

Expand All @@ -37,7 +37,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '1.8'
java-version: '11'
- name: Install GPG key
run: |-
gpg --batch --import-options import-show --import << EOF
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '1.8'
java-version: '11'
- name: Build with Maven
run: .github/scripts/build.sh
1 change: 0 additions & 1 deletion java-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<description>Parent for Java projects</description>

<properties>
<java.require.version>${java.target.version}</java.require.version>
<java.target.version>11</java.target.version>
</properties>

Expand Down
14 changes: 14 additions & 0 deletions java8-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<description>Parent for Java 8 projects</description>

<properties>
<java.require.version>[${java.target.version},9)</java.require.version>
<java.target.version>1.8</java.target.version>
<javac.version>9+181-r4173-1</javac.version>
</properties>

Expand Down Expand Up @@ -50,4 +52,16 @@
</plugins>
</build>

<profiles>
<profile>
<id>post-java-9</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<jdeps.multiRelease>9</jdeps.multiRelease>
<maven.compiler.release>8</maven.compiler.release>
</properties>
</profile>
</profiles>
</project>
1 change: 1 addition & 0 deletions java8-parent/src/it/basic/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals = clean install -Denforce.java-version.skip
2 changes: 2 additions & 0 deletions java8-parent/src/it/basic/src/main/java/example/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/** Example class. */
@Slf4j
@RequiredArgsConstructor
public class Example {
Expand All @@ -13,6 +14,7 @@ public void log() {
log.info("msg");
}

/** Example bean. */
@Data
@Builder
public static class ExampleBean {
Expand Down
5 changes: 5 additions & 0 deletions kotlin-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<name>Kotlin Parent</name>
<description>Parent for Kotlin projects</description>

<properties>
<java.require.version>[${java.target.version},9)</java.require.version>
<java.target.version>1.8</java.target.version>
</properties>

<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
Expand Down
41 changes: 36 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
<guava.version>31.1-jre</guava.version>
<jacoco-maven-plugin.version>0.8.7</jacoco-maven-plugin.version>
<jacoco.file.minimum-coverage-ratio>0.75</jacoco.file.minimum-coverage-ratio>
<java.require.version>[${java.target.version},9)</java.require.version>
<java.target.version>1.8</java.target.version>
<java.target.version>11</java.target.version>
<jdepend-maven-plugin.version>2.0</jdepend-maven-plugin.version>
<jib-maven-plugin.version>3.2.0</jib-maven-plugin.version>
<jsr305.version>3.0.2</jsr305.version>
Expand Down Expand Up @@ -597,9 +596,6 @@
<requireMavenVersion>
<version>[3.5.4,3.7)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>${java.require.version}</version>
</requireJavaVersion>
<!-- When there are multiple versions of a dependency you have to choose which one to use. -->
<dependencyConvergence/>
<requireReleaseDeps>
Expand Down Expand Up @@ -825,6 +821,41 @@
</properties>
</profile>

<profile>
<id>enforce-java-version</id>
<activation>
<property>
<name>!enforce.java-version.skip</name>
</property>
</activation>
<properties>
<java.require.version>${java.target.version}</java.require.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-java-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>${java.require.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>find-sec-bugs</id>
<properties>
Expand Down

0 comments on commit 39707c2

Please sign in to comment.