Skip to content

Commit

Permalink
Upgrade parent to apache:43, require JDK 11 at build time and upgrade…
Browse files Browse the repository at this point in the history
… a few plugins (fixes apache#536)
  • Loading branch information
gnodet committed Jul 25, 2024
1 parent c2d64f4 commit 441bdfe
Show file tree
Hide file tree
Showing 33 changed files with 182 additions and 308 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
java: [ '8' ]
os: [ ubuntu-latest ]
java: [ '11' ]
steps:
- uses: actions/checkout@v4

Expand All @@ -46,8 +46,13 @@ jobs:
restore-keys: |
${{ matrix.os }}-maven-
- name: Set up Maven
run:
mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=3.9.8"

- name: Build with maven
run: mvn -B --errors --activate-profiles ci --no-transfer-progress package -DskipTests
run:
./mvnw -V -B --errors --activate-profiles ci,jdk${{ matrix.java }} --no-transfer-progress help:evaluate -Dexpression=workspace.root.dir package -DskipTests

test:
needs: compile
Expand All @@ -72,9 +77,22 @@ jobs:
restore-keys: |
${{ matrix.os }}-maven-
- name: Set up Maven
run:
mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.2:wrapper "-Dmaven=3.9.8"

- name: Build and test with maven
# Skip all static checks, they were already done in the compile jobs
run:
mvnw.cmd -B --errors --activate-profiles ci,jdk${{ matrix.java }} --no-transfer-progress package
shell: cmd
if: matrix.os == 'windows-latest'

- name: Build and test with maven
# Skip all static checks, they were already done in the compile jobs
run: mvn -B --errors --activate-profiles ci --no-transfer-progress package
run:
./mvnw -B --errors --activate-profiles ci,jdk${{ matrix.java }} --no-transfer-progress package
if: matrix.os != 'windows-latest'

- name: Archive test results and logs
# if: success() || failure() to also get the test results on successful runs.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
java-version: '11'
# Create a ~/.m2/settings.xml referencing these environment variable names
server-id: 'apache.snapshots.https'
server-username: NEXUS_USERNAME
Expand Down
2 changes: 2 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Dworkspace.root.dir=${session.rootDirectory}
-DprojectRoot=${session.rootDirectory}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Sensitive issues such as security vulnerabilities must be reported through [priv

# Core requirements

* Java 8+ (as of version 1.3)
* Java 8+ at runtime (as of version 2.3)
* Java 11+ at build time (as of version 2.14)

* [Slf4j](https://www.slf4j.org/)

Expand Down
233 changes: 42 additions & 191 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>32</version>
<version>33</version>
</parent>

<groupId>org.apache.sshd</groupId>
Expand Down Expand Up @@ -79,18 +79,14 @@
</scm>

<properties>
<projectRoot>${project.basedir}</projectRoot>
<minimalJavaBuildVersion>11</minimalJavaBuildVersion>
<minimalMavenBuildVersion>3.9.8</minimalMavenBuildVersion>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>2024-06-20T20:44:27Z</project.build.outputTimestamp>

<!-- NOTE: actual workspace root dir value updated by gmavenplus-plugin on initialization phase -->
<!-- workspace.root.dir>${project.basedir}</workspace.root.dir -->

<java.major.version>1</java.major.version>
<java.minor.version>8</java.minor.version>
<java.sdk.version>8</java.sdk.version>
<sniffer.signatures.version>1.0</sniffer.signatures.version>
<javac.source>${java.major.version}.${java.minor.version}</javac.source>
<javac.source>${java.sdk.version}</javac.source>
<project.build.java.source>${javac.source}</project.build.java.source>
<maven.compiler.source>${javac.source}</maven.compiler.source>
<ant.version>1.10.12</ant.version>
Expand Down Expand Up @@ -137,10 +133,43 @@

<profiles>
<profile>
<id>release</id>
<id>jdk8</id>
<properties>
<required.java.version>[1.8,1.9)</required.java.version>
<minimalJavaBuildVersion>8</minimalJavaBuildVersion>
</properties>
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<id>format</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<executions>
<execution>
<id>sort-imports</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk11</id>
</profile>
<profile>
<id>jdk17</id>
</profile>
<profile>
<id>jdk21</id>
</profile>

<profile>
Expand Down Expand Up @@ -318,21 +347,6 @@
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>compile</goal>
<goal>execute</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.rat</groupId>
Expand Down Expand Up @@ -752,27 +766,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java${java.major.version}${java.minor.version}</artifactId>
<version>${sniffer.signatures.version}</version>
</signature>
</configuration>
<!-- make sure the signatures artifact is downloaded -->
<dependencies>
<dependency>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java${java.major.version}${java.minor.version}</artifactId>
<version>${sniffer.signatures.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
Expand Down Expand Up @@ -844,56 +837,6 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>3.0.2</version>
<dependencies>
<!-- referenced indirectly by groovy-ant -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>${ant.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>${ant.version}</version>
</dependency>
<dependency> <!-- replace ant-junit artifact -->
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit4</artifactId>
<version>${ant.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-antlr</artifactId>
<version>${ant.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>

<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-ant</artifactId>
<version>${groovy.version}</version>
<exclusions>
<exclusion> <!-- replaced by ant-junit4 -->
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down Expand Up @@ -1062,7 +1005,7 @@
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.16.0</version>
<version>2.23.0</version>
<configuration>
<skipXmlFormatting>true</skipXmlFormatting>
<skipHtmlFormatting>true</skipHtmlFormatting>
Expand All @@ -1074,15 +1017,7 @@
<plugin>
<groupId>net.revelc.code</groupId>
<artifactId>impsort-maven-plugin</artifactId>
<version>1.6.2</version>
<dependencies>
<!-- Must override dependency to build on Maven 3.9.x, even though not declared (see MNG-6965) -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
<version>1.9.0</version>
<configuration>
<lineEnding>LF</lineEnding>
<groups>java.,javax.,org.w3c.,org.xml.,junit.</groups>
Expand All @@ -1091,52 +1026,10 @@
<staticGroups>java.,javax.,org.w3c.,org.xml.,junit.</staticGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<executions>
<!-- Works only for Maven 3.x -->
<execution>
<id>detect-workspace-root-dir</id>
<!-- NOTE: phase must be BEFORE checkstyle plugin one -->
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scripts>
<script>
<![CDATA[
for (java.io.File file = new java.io.File(new java.net.URI('${project.baseUri}')); file != null; file = file.getParentFile()) {
if (!file.isDirectory()) {
continue
}
java.io.File testFile = new java.io.File(file, 'LICENSE.txt')
if (testFile.canRead()) {
project.properties['workspace.root.dir'] = file.getAbsolutePath()
// System.out.println("Workspace root dir: " + project.properties['workspace.root.dir'])
return
}
}
System.err.println("Failed to detect workspace root dir")
]]>
</script>
</scripts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
Expand Down Expand Up @@ -1206,19 +1099,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<executions>
<execution>
<id>check-java-api</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down Expand Up @@ -1430,18 +1310,6 @@
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>${maven.archiver.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>${plexus.archiver.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -1483,23 +1351,6 @@
</dependency>
</dependencies>
</plugin>
<!-- Automatically remove artifacts from local repository on clean -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>remove-previous-artifact</id>
<phase>clean</phase>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>false</removeAll>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit 441bdfe

Please sign in to comment.