I'm upgrading the CheckStyle plugin at runtime, per the documentation.
However, my local and CI/CD builds fail because it appears there is dependency resolution happening in the plugin upgrade that is not respecting the defined repositories in the pom.xml.
The dependency in question holds the company checkstyle files.
Note: I've even tried adding the dependency outside the plugin as shown below. No dice.
Any hints as to how to get this to resolve? Logs follow configuration.
<repositories> <repository> <id>checkstyle-repo</id>
</repository>
<repository>
<id>company-repo</id>
<url>
</url>
</repository>
</repositories>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.41</version>
</dependency>
<dependency>
<groupId>com.company</groupId>
<artifactId>co-checkstyles</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
<configuration>
<configLocation>
company_transitional_checkstyle.xml
</configLocation>
<encoding>UTF-8</encoding>
<failOnViolation>true</failOnViolation>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
...
<dependencies>
...
<dependency>
<groupId>com.company</groupId>
<artifactId>co-checkstyles</artifactId>
<version>1.0.4</version>
</dependency>
...
Error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.985 s
[INFO] Finished at: 2021-03-11T19:14:33-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (validate)
on project tax-service: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check failed:
Plugin org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2 or one of its dependencies could not be resolved:
Failure to find com.company:co-checkstyles:jar:1.0.4 in http://nexus-01.co.lan/content/groups/CompanyRepository/ was cached in the local repository,
resolution will not be reattempted until the update interval of corepository has elapsed or updates are forced -> [Help 1] [ERROR]