Skip to content

Commit

Permalink
deps: upgrade enforcer rule to the latest 3.5.0 (#2379)
Browse files Browse the repository at this point in the history
* deps: upgrade enforcer rule to the latest 3.5.0

Credit: this change is based on the proposed changes by Robert Scholte in
#2378 (comment)

* Fixing integration tests to use a better syntax in the new enforcer rule version

* Detailed error message for the new enforcer rule version
  • Loading branch information
suztomo authored Sep 23, 2024
1 parent f50c4db commit 7c7fe4f
Show file tree
Hide file tree
Showing 17 changed files with 234 additions and 200 deletions.
9 changes: 7 additions & 2 deletions enforcer-rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ $ mvn verify
Listening for transport dt_socket at address: 5005
```

When you debug one of the integration tests in the "src/it" directory, use the following
command to specify the test case and to provide the debug parameter to Maven invoker plugin.
When you debug one of the integration tests in the "src/it" directory, check the
`build.log` files in the `enforcer-rules/target/it` directory (run
`find enforcer-rules -name 'build.log'`).
The file is used in verification scripts and usually contains build errors.

If you want to attach a debugger, use the following command to specify the test
case and to provide the debug parameter to Maven invoker plugin.

```
mvn install -Dmaven.test.skip -Dinvoker.test=bom-project-using-spring-repository \
Expand Down
16 changes: 15 additions & 1 deletion enforcer-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</licenses>

<properties>
<enforcer.version>3.0.0-M3</enforcer.version>
<enforcer.version>3.5.0</enforcer.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Expand Down Expand Up @@ -131,6 +131,20 @@

<build>
<plugins>
<plugin>
<!-- generate index of project components, this enables users to
specify the rule as linkageCheckerRule via the Named annotation -->
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.9.0.M1</version>
<executions>
<execution>
<goals>
<goal>main-index</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.2</version>
Expand Down
6 changes: 2 additions & 4 deletions enforcer-rules/src/it/abstract-method-errors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -69,9 +69,7 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
</LinkageCheckerRule>
<linkageCheckerRule/>
</rules>
</configuration>
</execution>
Expand Down
7 changes: 3 additions & 4 deletions enforcer-rules/src/it/bom-project-error/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -71,10 +71,9 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
<linkageCheckerRule>
<dependencySection>DEPENDENCY_MANAGEMENT</dependencySection>
</LinkageCheckerRule>
</linkageCheckerRule>
</rules>
</configuration>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion enforcer-rules/src/it/bom-project-no-error/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand Down
7 changes: 3 additions & 4 deletions enforcer-rules/src/it/bom-project-no-packaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -65,10 +65,9 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
<linkageCheckerRule>
<dependencySection>DEPENDENCY_MANAGEMENT</dependencySection>
</LinkageCheckerRule>
</linkageCheckerRule>
</rules>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -84,10 +84,9 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
<linkageCheckerRule>
<dependencySection>DEPENDENCY_MANAGEMENT</dependencySection>
</LinkageCheckerRule>
</linkageCheckerRule>
</rules>
</configuration>
</execution>
Expand Down
6 changes: 2 additions & 4 deletions enforcer-rules/src/it/fail-build-for-linkage-errors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -67,9 +67,7 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
</LinkageCheckerRule>
<linkageCheckerRule />
</rules>
</configuration>
</execution>
Expand Down
6 changes: 2 additions & 4 deletions enforcer-rules/src/it/inaccessible-class-error/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -69,9 +69,7 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
</LinkageCheckerRule>
<linkageCheckerRule />
</rules>
</configuration>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion enforcer-rules/src/it/missing-filter-file-error/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand Down
7 changes: 3 additions & 4 deletions enforcer-rules/src/it/report-only-reachable-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -76,11 +76,10 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
<linkageCheckerRule>
<dependencySection>DEPENDENCY_MANAGEMENT</dependencySection>
<reportOnlyReachable>true</reportOnlyReachable>
</LinkageCheckerRule>
</linkageCheckerRule>
</rules>
</configuration>
</execution>
Expand Down
7 changes: 3 additions & 4 deletions enforcer-rules/src/it/report-only-reachable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -68,10 +68,9 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
<linkageCheckerRule>
<reportOnlyReachable>true</reportOnlyReachable>
</LinkageCheckerRule>
</linkageCheckerRule>
</rules>
</configuration>
</execution>
Expand Down
6 changes: 2 additions & 4 deletions enforcer-rules/src/it/return-type-mismatch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -64,9 +64,7 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
</LinkageCheckerRule>
<linkageCheckerRule/>
</rules>
</configuration>
</execution>
Expand Down
7 changes: 3 additions & 4 deletions enforcer-rules/src/it/test-scope/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand All @@ -73,10 +73,9 @@
</goals>
<configuration>
<rules>
<LinkageCheckerRule
implementation="com.google.cloud.tools.dependencies.enforcer.LinkageCheckerRule">
<linkageCheckerRule>
<reportOnlyReachable>true</reportOnlyReachable>
</LinkageCheckerRule>
</linkageCheckerRule>
</rules>
</configuration>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion enforcer-rules/src/it/war-project-private-modifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>@enforcer.version@</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
Expand Down
Loading

0 comments on commit 7c7fe4f

Please sign in to comment.