Skip to content

Remove the Maven and commons-lang dependencies from the compiler TCK - #499

Merged
slachiewicz merged 2 commits into
masterfrom
tck-no-maven
Aug 18, 2026
Merged

slachiewicz merged 2 commits into
masterfrom
tck-no-maven

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

This change follows #498, which replaced maven-core with the Maven resolver. The resolver isn't needed either.

The TCK builds a classpath for the compiler under test from two JAR files: one library for the ExternalDeps.java test input to resolve, and the aspectjrt library for the AspectJ module. Each module that needs one of them declares it as a dependency, so both are on the test JVM classpath before the test runs. Locating them by path inside the local repository duplicates that resolution, and it requires an injected LocalRepositoryProvider object, a DefaultRepositorySystemSession object, and a maven.repo.local system property set by the Maven Surefire plugin. Asking the class loader where a class came from replaces all three.

A comment beside that dependency asks for this: "it would be preferable for the tests to resolve it directly".

After this change, the plexus-compiler-test artifact depends on no part of Maven. Its dependencies are javax.inject, plexus-compiler-api, junit-jupiter-api, plexus-testing, plexus-utils, plexus-xml, and the fixture library.

The second commit changes that fixture library from commons-lang 2.6, whose last release was in 2011, to commons-lang3 3.20.0. The StringUtils.upperCase method is the only method that the ExternalDeps.java file calls, and both libraries provide it. The plexus-compilers/pom.xml file declares the same library a second time, for a reason its own comment gives: "is required in the local repository". The first commit makes that untrue.

Together with #498, this leaves one Dependabot alert on the repository, for the Jenkins remoting library in an integration-test reproducer POM that the reactor doesn't build.

API change: both overloads of getLocalArtifactPath are replaced by the getJarPath method, which takes a class name rather than artifact coordinates. Both are protected methods on a base class in a published artifact, so a TCK subclass outside this repository needs a one-line change. That's the same consideration as #498, and an argument for releasing this in 2.17.0 rather than in a patch version.

Verified: dependency:tree across the reactor reports no Maven artifact and no commons-lang. The AspectJCompilerTest class compiles the ExternalDeps.java file and asserts ExternalDeps.class among its outputs, so both classpath entries are in use.

This change was created with AI assistance.

The TCK builds a classpath for the compiler under test out of exactly two
jars: commons-lang for every module, plus aspectjrt for the AspectJ one.
Both are declared dependencies of the modules that need them, so both are
already on the test JVM's own classpath by the time the test runs. Looking
them up by path inside the local repository was resolution reinvented, and
it needed maven-resolver, an injected LocalRepositoryProvider, a
DefaultRepositorySystemSession, and a maven.repo.local system property
handed down from surefire to do it.

Asking the class loader where a class came from replaces all of that. The
pom comment asking for exactly this - "it would be preferable for the tests
to resolve it directly" - has been there since the dependency was added.

plexus-compiler-test now depends on no part of Maven at all.

API: getLocalArtifactPath is gone, both overloads, replaced by getJarPath.
A subclass wanting a jar on the compiler classpath names a class in it
rather than its coordinates.

Verified: mvn clean install on JDK 25, whole reactor green. AspectJCompilerTest
compiles ExternalDeps.java, which imports commons-lang, and asserts
ExternalDeps.class among its outputs - so both classpath entries are load
bearing, not merely appended.
@slachiewicz slachiewicz added the maintenance Cleanup, refactoring or other internal change label Aug 18, 2026
The TCK hands the compiler under test a classpath holding one library, so
that ExternalDeps.java has something external to resolve. That library was
commons-lang 2.6, whose last release was 2011 and which is the last
Dependabot alert on this repository that comes from a real dependency.

commons-lang3 3.20.0 serves the same purpose: StringUtils.upperCase, the
only method the fixture calls, is present in both. Nothing here tests
commons-lang itself.

plexus-compilers/pom.xml declared it a second time, for a reason its own
comment gives - "is required in the local repository" - that stopped being
true when the TCK started resolving its classpath through the class loader.
The remaining declaration in plexus-compiler-test reaches the compiler
modules on its own.

Verified: mvn clean install on JDK 25, whole reactor green; dependency:tree
across the reactor mentions no commons-lang. AspectJCompilerTest, and the
eclipse and javac tests, still assert ExternalDeps.class among their
outputs, so the swapped import is genuinely being resolved.
@slachiewicz slachiewicz changed the title Find test classpath jars through the class loader Take Maven, and commons-lang, out of the compiler TCK Aug 18, 2026
@slachiewicz slachiewicz changed the title Take Maven, and commons-lang, out of the compiler TCK Remove the Maven and commons-lang dependencies from the compiler TCK Aug 18, 2026
@slachiewicz slachiewicz added the dependencies Pull requests that update a dependency file label Aug 18, 2026
@slachiewicz
slachiewicz merged commit 8a81355 into master Aug 18, 2026
36 checks passed
@slachiewicz
slachiewicz deleted the tck-no-maven branch August 18, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file maintenance Cleanup, refactoring or other internal change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant