RFR: 8086: Some refactoring for jmc/core [v8]

Christoph Langer clanger at openjdk.org
Sat Jun 17 05:33:13 UTC 2023


On Fri, 16 Jun 2023 15:52:46 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:

>> core/pom.xml line 423:
>> 
>>> 421: 			<plugin>
>>> 422: 				<groupId>org.apache.maven.plugins</groupId>
>>> 423: 				<artifactId>maven-install-plugin</artifactId>
>> 
>> I can reproduce this now;  something (I believe the maven-install-plugin) is causing the test jars to not end up where they're expected. I ran a super clean build (by additionally nuking my ~/.m2 to start from scratch), and ran into application build errors because application couldn't find the test jars.
>> 
>> 
>> [ERROR] Failed to execute goal on project org.openjdk.jmc.ui.common: Could not resolve dependencies for project org.openjdk.jmc:org.openjdk.jmc.ui.common:eclipse-plugin:9.0.0-SNAPSHOT: The following artifacts could not be resolved: org.openjdk.jmc:common.test:jar:9.0.0-SNAPSHOT, org.openjdk.jmc:flightrecorder.test:jar:9.0.0-SNAPSHOT: Could not find artifact org.openjdk.jmc:common.test:jar:9.0.0-SNAPSHOT -> [Help 1]
>> 
>> I played around with this PR a bit today, and ended up at a point where if I remove the `maven-install-plugin` usage that has been added to core, my jars will end up in my m2 repo.
>> 
>> IIRC the CI on GitHub caches the maven repo, so if just testing this PR there's no overwriting of the test jars so they'll continue to be there for the application build.
>> 
>> With maven-install-plugin:
>> ![pull-495-before](https://github.com/openjdk/jmc/assets/10425301/eda5f04b-1f08-4dfd-aa12-89c06a344a7b)
>> 
>> Without:
>> ![pull-495-after](https://github.com/openjdk/jmc/assets/10425301/ff2ef06e-7758-49c4-9fef-d161931243a6)
>
> Although, the removal of those test jars is one of the features of this PR.
> 
> Does this need additional changes to application poms? For example, the application/pom.xml (as well as uitests and test.jemmy) lists a dependency on `common.test` [[0]](https://github.com/openjdk/jmc/blob/master/application/pom.xml#L147) and `flightrecorder.test`, which is causing the error. Simply removing those two dependencies and the build gets quite a bit farther, but eventually fails trying to resolve testlib.
> 
> [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath (default-validate-classpath) on project org.openjdk.jmc.rjmx.test: Execution default-validate-classpath of goal org.eclipse.tycho:tycho-compiler-plugin:3.0.4:validate-classpath failed: org.osgi.framework.BundleException: Bundle org.openjdk.jmc.rjmx.test cannot be resolved:org.openjdk.jmc.rjmx.test [128]
> [ERROR]   Unresolved requirement: Require-Bundle: org.openjdk.jmc.testlib
> 
> 
> [0] https://github.com/openjdk/jmc/blob/master/application/pom.xml#L147

Oh, this is a good catch. My change unveils an issue in the dependencies. The only test project that application tests should need from core is testlib. And also, testlib should only be seen in test projects but not in other application modules. I cleared this out and cleaned up some more dependency definitions in core.

I didn't see it (and the GHA build) because the m2 repository was not pruned before the build and the existing modules like common.test, which we would not install any more after this change, were still cached.

-------------

PR Review Comment: https://git.openjdk.org/jmc/pull/495#discussion_r1232965894


More information about the jmc-dev mailing list