You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/06/23 23:35:41 UTC
[maven-artifact-plugin] branch master updated: detect OS through
pom.properties newline instead of MANIFEST.MF
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-artifact-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new df58646 detect OS through pom.properties newline instead of MANIFEST.MF
df58646 is described below
commit df58646d6af13127b0ebd9af76007fd328023609
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Wed Jun 24 01:35:34 2020 +0200
detect OS through pom.properties newline instead of MANIFEST.MF
---
.../plugins/artifact/buildinfo/ReferenceBuildinfoUtil.java | 13 +++++++------
1 file changed, 7 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 926bd38..cdc537b 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
@@ -130,7 +130,7 @@ public class ReferenceBuildinfoUtil
if ( manifest != null )
{
javaVersion = extractJavaVersion( manifest );
- osName = extractOsName( jar );
+ osName = extractOsName( artifact, jar );
}
else
{
@@ -213,24 +213,25 @@ public class ReferenceBuildinfoUtil
return null;
}
- private String extractOsName( JarFile jar )
+ private String extractOsName( Artifact a, JarFile jar )
{
- try ( InputStream in = jar.getInputStream( jar.getEntry( JarFile.MANIFEST_NAME ) ) )
+ String entryName = "META-INF/maven/" + a.getGroupId() + '/' + a.getArtifactId() + "/pom.properties";
+ try ( InputStream in = jar.getInputStream( jar.getEntry( entryName ) ) )
{
String content = IOUtil.toString( in, WriterFactory.UTF_8 );
log.debug( "Manifest content: " + content );
if ( content.contains( "\r\n" ) )
{
- return "Windows (from MANIFEST.MF newline)";
+ return "Windows (from pom.properties newline)";
}
else if ( content.contains( "\n" ) )
{
- return "Unix (from MANIFEST.MF newline)";
+ return "Unix (from pom.properties newline)";
}
}
catch ( IOException e )
{
- log.warn( "Unable to read MANIFEST.MF from " + jar, e );
+ log.warn( "Unable to read " + entryName + " from " + jar, e );
}
return null;
}