MaxonT opened a new pull request, #759: URL: https://github.com/apache/maven-checkstyle-plugin/pull/759
This swaps the checkstyle plugin's use of Maven APIs deprecated since Maven 3 for their current replacements; I haven't confirmed the build against older Maven versions, so please say if that matters. ### Description `CheckstyleProjectStub` built an `ArtifactRepository` (a `MavenArtifactRepository` with two `ArtifactRepositoryPolicy` objects and a `DefaultRepositoryLayout`) in `getRemoteArtifactRepositories()` and converted it with `RepositoryUtils.toRepos()` to answer `getRemoteProjectRepositories()`. Nothing under `src/main` or `src/test` calls `getRemoteArtifactRepositories()`; the two report tests mock `getRemoteProjectRepositories()` themselves. This change removes the deprecated override and the five imports it needed, and builds the same `central` repository directly as a Resolver `RemoteRepository` (`https://repo1.maven.org/maven2`, type `default`). To check the result is the same repository, I read the bytecode of `RepositoryUtils.toRepo` in maven-core 3.9.16 (the version this build uses). For this stub it passes the id, the layout id (`default` for `DefaultRepositoryLayout`) and the url, plus both policies, and null authentication, null proxy, no mirrors and not blocked. `new ArtifactRepositoryPolicy()` and the `RemoteRepository.Builder` default policy are both enabled, `daily` and `warn`, so the policies match too. One side effect: without the override, `getRemoteArtifactRepositories()` falls back to the harness default (an empty list, maven-plugin-testing-harness 3.5.1) instead of returning `central`; nothing in the module reads it. Only `src/test` is touched, so no public API, config or output changes. This covers only `CheckstyleProjectStub` from #758. I left the `ArtifactRepository` mocks in `CheckstyleReportTest` and `CheckstyleReportScenarioTest` alone: they feed a mocked local repository into the repository session factory, so they need their own change. ### Validation `mvn -B clean verify` on this head: exit 0, 53 tests run, 0 failures, 0 errors, 1 skipped (in `CheckstyleReportTest`). The same command on the unchanged `master` also exits 0 with the same counts. That run includes `spotless:apply` (it left the diff as it is), the RAT check and the enforcer rules. The existing tests already exercise this stub through the `*MavenProjectStub` subclasses, so I did not add a new one; this is a refactor, not a behaviour fix. I did not run the integration tests (`-Prun-its`). The build ran with JDK 23.0.2 and Maven 3.9.9 on macOS. Part of #758. Part of apache/maven#14157. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
