Browse Source

Attempt to simplify build process using maven toolchains (#1952)

* Attempt to simplify build process using maven toolchains

* Introduce property to hold latest jdk version

---------

Co-authored-by: Marvin Froeder <velobr@gmail.com>
pull/1928/head
Marvin Froeder 2 years ago committed by GitHub
parent
commit
83a113eb95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 127
      .circleci/config.yml
  2. 1
      apt-test-generator/pom.xml
  3. 1
      example-github-with-coroutine/pom.xml
  4. 1
      example-github/pom.xml
  5. 1
      example-wikipedia-with-springboot/pom.xml
  6. 1
      example-wikipedia/pom.xml
  7. 1
      jakarta/pom.xml
  8. 73
      jaxb/pom.xml
  9. 120
      pom.xml

127
.circleci/config.yml

@ -12,27 +12,12 @@ @@ -12,27 +12,12 @@
# the License.
#
orbs:
android: circleci/android@1.0.3
# common executors
executors:
java:
parameters:
version:
description: 'jdk version to use'
default: '8.0'
type: string
docker:
- image: cimg/openjdk:<<parameters.version>>
android:
parameters:
version:
description: 'jdk version to use'
default: '8.0'
type: string
docker:
- image: cimg/openjdk:<<parameters.version>>
- image: velo/toolchains-4-ci-builds
# common commands
commands:
resolve-dependencies:
@ -60,16 +45,7 @@ commands: @@ -60,16 +45,7 @@ commands:
name: 'Deploy Core Modules Sonatype'
command: |
./mvnw -ntp -nsu -s .circleci/settings.xml -P release -pl -:feign-benchmark -DskipTests=true deploy
nexus-deploy-jdk11:
steps:
- run:
name: 'Build JDK 11 Release modules locally'
command: |
./mvnw -ntp -B -nsu -s .circleci/settings.xml -P java11 -pl :feign-java11,:feign-jakarta -am -DskipTests=true install
- run:
name: 'Deploy JDK 11 Modules to Sonatype'
command: |
./mvnw -ntp -B -nsu -s .circleci/settings.xml -P release,java11 -pl :feign-java11,:feign-jakarta -DskipTests=true deploy
# our job defaults
defaults: &defaults
working_directory: ~/feign
@ -98,14 +74,8 @@ version: 2.1 @@ -98,14 +74,8 @@ version: 2.1
jobs:
test:
parameters:
jdk:
description: 'jdk version to use'
default: '8.0'
type: string
executor:
name: java
version: <<parameters.jdk>>
<<: *defaults
steps:
- checkout
@ -123,28 +93,10 @@ jobs: @@ -123,28 +93,10 @@ jobs:
command: |
./mvnw -ntp -B test
- verify-formatting
android-test:
# These next lines define the Android machine image executor: https://circleci.com/docs/2.0/executor-types/
executor:
name: android/android-machine
steps:
# Checkout the code as the first step.
- checkout
# The next step will run the unit tests
- android/run-tests:
test-command: ./gradlew lint testDebug --continue
deploy:
parameters:
jdk:
description: 'jdk version to use'
default: '8.0'
type: string
executor:
name: java
version: <<parameters.jdk>>
<<: *defaults
steps:
- checkout
@ -156,82 +108,25 @@ jobs: @@ -156,82 +108,25 @@ jobs:
- configure-gpg
- nexus-deploy
deploy-jdk11:
parameters:
jdk:
description: 'jdk version to use'
default: '11.0'
type: string
executor:
name: java
version: <<parameters.jdk>>
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- feign-dependencies-{{ checksum "pom.xml" }}
- feign-dependencies-
- resolve-dependencies
- configure-gpg
- nexus-deploy-jdk11
workflows:
version: 2
build:
jobs:
- test:
jdk: '8.0'
name: 'jdk 8'
filters:
<<: *all-branches
- test:
jdk: '11.0'
name: 'jdk 11'
filters:
<<: *all-branches
- test:
jdk: '17.0'
name: 'jdk 17'
name: 'pr-build'
filters:
<<: *all-branches
- test:
name: 'android test'
snapshot:
jobs:
- test:
jdk: '8.0'
name: 'jdk 8'
filters:
<<: *master-only
- test:
jdk: '11.0'
name: 'jdk 11'
filters:
<<: *master-only
- test:
jdk: '17.0'
name: 'jdk 17'
name: 'snapshot'
filters:
<<: *master-only
- deploy:
jdk: '8.0'
name: 'deploy snapshot'
requires:
- 'jdk 8'
- 'jdk 11'
- 'jdk 17'
context: Sonatype
filters:
<<: *master-only
- deploy-jdk11:
jdk: '11.0'
name: 'deploy jdk11 snapshot modules'
requires:
- 'jdk 11'
- 'deploy snapshot'
- 'snapshot'
context: Sonatype
filters:
<<: *master-only
@ -239,17 +134,7 @@ workflows: @@ -239,17 +134,7 @@ workflows:
release:
jobs:
- deploy:
jdk: '8.0'
name: 'release to maven central'
context: Sonatype
filters:
<<: *tags-only
- deploy-jdk11:
jdk: '11.0'
name: 'release jdk11 artifacts to maven central'
requires:
- 'release to maven central'
context: Sonatype
filters:
<<: *tags-only

1
apt-test-generator/pom.xml

@ -132,7 +132,6 @@ @@ -132,7 +132,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<goals>

1
example-github-with-coroutine/pom.xml

@ -95,7 +95,6 @@ @@ -95,7 +95,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!--
Travis does not inject GITHUB_TOKEN when building PRs, which will make module fail

1
example-github/pom.xml

@ -91,7 +91,6 @@ @@ -91,7 +91,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<!--
Travis does not inject GITHUB_TOKEN when building PRs, which will make module fail

1
example-wikipedia-with-springboot/pom.xml

@ -103,7 +103,6 @@ @@ -103,7 +103,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<goals>

1
example-wikipedia/pom.xml

@ -92,7 +92,6 @@ @@ -92,7 +92,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<goals>

1
jakarta/pom.xml

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
<description>Feign Jakarta</description>
<properties>
<main.java.version>11</main.java.version>
<main.basedir>${project.basedir}/..</main.basedir>
</properties>

73
jaxb/pom.xml

@ -43,57 +43,28 @@ @@ -43,57 +43,28 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.4.0-b180830.0438</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>java11</id>
<activation>
<jdk>[11,]</jdk>
</activation>
<!--
JAXB was removed from java SDK on JEP 320
http://openjdk.java.net/jeps/320
-->
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.4.0-b180830.0438</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>java17</id>
<activation>
<jdk>[17,]</jdk>
</activation>
<!--
JAXB was removed from java SDK on JEP 320
http://openjdk.java.net/jeps/320
-->
<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

120
pom.xml

@ -37,6 +37,8 @@ @@ -37,6 +37,8 @@
<module>jaxb</module>
<module>jaxrs</module>
<module>jaxrs2</module>
<module>java11</module>
<module>jakarta</module>
<module>json</module>
<module>okhttp</module>
<module>googlehttpclient</module>
@ -50,14 +52,14 @@ @@ -50,14 +52,14 @@
<module>dropwizard-metrics5</module>
<module>kotlin</module>
<module>micrometer</module>
<module>mock</module>
<module>apt-test-generator</module>
<module>annotation-error-decoder</module>
<module>example-github</module>
<module>example-github-with-coroutine</module>
<module>example-wikipedia</module>
<module>example-wikipedia-with-springboot</module>
<module>mock</module>
<module>apt-test-generator</module>
<module>benchmark</module>
<module>annotation-error-decoder</module>
</modules>
<properties>
@ -69,7 +71,7 @@ @@ -69,7 +71,7 @@
<!-- default bytecode version for src/main -->
<main.java.version>1.8</main.java.version>
<main.signature.artifact>java18</main.signature.artifact>
<latest.java.version>17</latest.java.version>
<!-- default bytecode version for src/test -->
<maven.compiler.source>${main.java.version}</maven.compiler.source>
@ -93,7 +95,6 @@ @@ -93,7 +95,6 @@
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>4.11.0</mockito.version>
<animal-sniffer-maven-plugin.version>1.22</animal-sniffer-maven-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-install-plugin.version>3.1.0</maven-install-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
@ -103,7 +104,7 @@ @@ -103,7 +104,7 @@
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-bundle-plugin.version>5.1.8</maven-bundle-plugin.version>
<centralsync-maven-plugin.version>0.1.1</centralsync-maven-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.0.0-M9</maven-surefire-plugin.version>
<bom-generator.version>0.94.0</bom-generator.version>
<bom.template.file.path>file://${project.basedir}/src/config/bom.xml</bom.template.file.path>
<maven-scm-plugin.version>1.13.0</maven-scm-plugin.version>
@ -310,12 +311,6 @@ @@ -310,12 +311,6 @@
<version>${hamcrest.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet</groupId>
<artifactId>animal-sniffer-annotation</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
@ -420,6 +415,7 @@ @@ -420,6 +415,7 @@
</dependencies>
<build>
<defaultGoal>clean install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
@ -445,20 +441,63 @@ @@ -445,20 +441,63 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<argLine>${jvm.options}</argLine>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
<dependencies>
<dependency>
<!-- surefire uses ASM to do some bytecode magic... need to bump version to be java 11 compatible -->
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
<configuration>
<toolchains>
<jdk>
<version>${main.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
<execution>
<id>test</id>
<phase>generate-test-sources</phase>
<goals>
<goal>toolchain</goal>
</goals>
<configuration>
<toolchains>
<jdk>
<version>${latest.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
@ -490,40 +529,13 @@ @@ -490,40 +529,13 @@
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
<source>${main.java.version}</source>
<target>${main.java.version}</target>
<source>${latest.java.version}</source>
<target>${latest.java.version}</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>${animal-sniffer-maven-plugin.version}</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>${main.signature.artifact}</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.4</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
@ -776,16 +788,6 @@ @@ -776,16 +788,6 @@
<bom.template.file.path>file:///${project.basedir}/src/config/bom.xml</bom.template.file.path>
</properties>
</profile>
<profile>
<id>java11</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<modules>
<module>java11</module>
<module>jakarta</module>
</modules>
</profile>
<profile>
<id>validateCodeFormat</id>

Loading…
Cancel
Save