This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MARTIFACT-75_2
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git

commit c3dcd37b04ecde5af8d5f957d3114a2a06502b60
Author: Hervé Boutemy <hbout...@apache.org>
AuthorDate: Mon Oct 21 07:39:35 2024 +0100

    [MARTIFACT-75] fix jar artifacts detection
---
 .../maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
 
b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
index e7892a0..33610d6 100644
--- 
a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
+++ 
b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java
@@ -47,7 +47,6 @@ import 
org.eclipse.aether.AbstractForwardingRepositorySystemSession;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.ArtifactProperties;
 import org.eclipse.aether.artifact.DefaultArtifact;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.repository.WorkspaceReader;
@@ -59,17 +58,15 @@ import org.eclipse.aether.resolution.ArtifactResult;
  * Utility to download reference artifacts and download or generate reference 
buildinfo.
  */
 class ReferenceBuildinfoUtil {
-    private static final Set<String> JAR_TYPES;
+    private static final Set<String> JAR_EXTENSIONS;
 
     static {
         Set<String> types = new HashSet<>();
         types.add("jar");
-        types.add("test-jar");
         types.add("war");
         types.add("ear");
         types.add("rar");
-        types.add("maven-plugin");
-        JAR_TYPES = Collections.unmodifiableSet(types);
+        JAR_EXTENSIONS = Collections.unmodifiableSet(types);
     }
 
     private final Log log;
@@ -127,7 +124,7 @@ class ReferenceBuildinfoUtil {
                 referenceArtifacts.put(artifact, file);
 
                 // guess Java version and OS
-                if ((javaVersion == null) && 
JAR_TYPES.contains(artifact.getProperty(ArtifactProperties.TYPE, "jar"))) {
+                if ((javaVersion == null) && 
JAR_EXTENSIONS.contains(artifact.getExtension())) {
                     ReproducibleEnv env = extractEnv(file, artifact);
                     if ((env != null) && (env.javaVersion != null)) {
                         javaVersion = env.javaVersion;

Reply via email to