Skip to content

Commit

Permalink
Ignore toolchains plugin when running openrewrite
Browse files Browse the repository at this point in the history
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
  • Loading branch information
velo committed Jul 25, 2024
1 parent 037a6db commit 84ada86
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/receive-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Execute recipes
- name: Apply OpenRewrite recipes
run: mvn --activate-profiles openrewrite org.openrewrite.maven:rewrite-maven-plugin:run
run: ./mvnw -Dtoolchain.skip=true -Dlicense.skip=true -DskipTests=true -P openrewrite clean install

# Capture the diff
- name: Create patch
Expand Down
157 changes: 101 additions & 56 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,6 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<argLine>${jvm.options}</argLine>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>

Expand All @@ -492,49 +489,12 @@
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.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>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
Expand Down Expand Up @@ -667,6 +627,9 @@
<exclude>etc/header.txt</exclude>
<exclude>**/.idea/**</exclude>
<exclude>**/target/**</exclude>
<exclude>**/scripts/**</exclude>
<exclude>**/src/config/**</exclude>
<exclude>**/codequality/**</exclude>
<exclude>LICENSE</exclude>
<exclude>NOTICE</exclude>
<exclude>OSSMETADATA</exclude>
Expand Down Expand Up @@ -961,43 +924,125 @@
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.35.0</version>

<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ</recipe>
<recipe>org.openrewrite.java.testing.assertj.JUnitToAssertj</recipe>
<recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>
<recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
</activeRecipes>
<exclusions>
<exclusion>**/src/main/java/**</exclusion>
<exclusion>**/pom.xml</exclusion>
</exclusions>
</configuration>
<version>5.36.0</version>

<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-testing-frameworks</artifactId>
<version>2.13.0</version>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>2.19.0</version>
<version>2.20.0</version>
</dependency>
</dependencies>

<executions>
<execution>
<id>tests</id>
<goals>
<goal>runNoFork</goal>
</goals>
<phase>verify</phase>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ</recipe>
<recipe>org.openrewrite.java.testing.assertj.JUnitToAssertj</recipe>
<recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>
<recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
</activeRecipes>
<exclusions>
<exclusion>**/src/main/java/**</exclusion>
<exclusion>pom.xml</exclusion>
</exclusions>
</configuration>
</execution>
<execution>
<id>sources</id>
<goals>
<goal>runNoFork</goal>
</goals>
<phase>verify</phase>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.Java8toJava11</recipe>
</activeRecipes>
<exclusions>
<exclusion>pom.xml</exclusion>
</exclusions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>toolchain</id>
<activation>
<property>
<name>!toolchain.skip</name>
</property>
</activation>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.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>
<goals>
<goal>toolchain</goal>
</goals>
<phase>generate-test-sources</phase>
<configuration>
<toolchains>
<jdk>
<version>${latest.java.version}</version>
</jdk>
</toolchains>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<jdkToolchain>
<version>${latest.java.version}</version>
</jdkToolchain>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit 84ada86

Please sign in to comment.