jvm-profiling-tools / ap-loader

Packages async-profiler with binaries for all platforms in a single JAR
Apache License 2.0
128 stars 10 forks source link

ap-loader qualifier usage is problematic with mvn versions:update-properties #4

Closed ginkel closed 1 year ago

ginkel commented 1 year ago

Hi there,

when referencing ap-loader from a Maven POM

<properties>
  <ap-loader.version>2.9-2-all</ap-loader.version>
</properties>

[...]

<dependency>
  <groupId>me.bechberger</groupId>
  <artifactId>ap-loader</artifactId>
  <version>${ap-loader.version}</version>
</dependency>

and afterwards running mvn -U versions:update-properties to update all dependencies to their current version, the -macos variant is chosen over the -all variant:

-        <ap-loader.version>2.9-2-all</ap-loader.version>
+        <ap-loader.version>2.9-2-macos</ap-loader.version>

This is due to the way Maven interprets qualifiers in versions using alphabetical sorting (cf. https://www.mojohaus.org/versions/versions-maven-plugin/version-rules.html).

One possible solution would be to pull the variant into the artifact name so that the qualifier only contains the ap-loader version, such as:

<dependency>
  <groupId>me.bechberger</groupId>
  <artifactId>ap-loader-all</artifactId>
  <version>2.9-2</version>
</dependency>

Thanks, Thilo

P.S.: Using the classifier could also be an option

parttimenerd commented 1 year ago

This sounds like a good idea, I'll try to work on it soon.

parttimenerd commented 1 year ago

I'm going with your artifactId proposal. The snapshot repo now contains some artifacts, but I have to get the actual file names in this artifact correct, before I release it.

parttimenerd commented 1 year ago

I hope I fixed the bug you reported :) But please confirm that this is the case