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 2022/01/09 01:43:17 UTC
[maven-jar-plugin] branch master updated: [MJAR-284] check META-INF/ and META-INF/MANIFEST.MF entries order
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-jar-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 8e61605 [MJAR-284] check META-INF/ and META-INF/MANIFEST.MF entries order
8e61605 is described below
commit 8e61605901cc371a74aaf33d711e6a6cfad00f68
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Jan 9 02:43:15 2022 +0100
[MJAR-284] check META-INF/ and META-INF/MANIFEST.MF entries order
---
.gitignore | 1 +
src/it/manifest-content/verify.bsh | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/.gitignore b/.gitignore
index 7495d7e..2a505ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ out/
/dependencies.xml
.java-version
.checkstyle
+/.factorypath
diff --git a/src/it/manifest-content/verify.bsh b/src/it/manifest-content/verify.bsh
index dfd1842..6c1cf72 100644
--- a/src/it/manifest-content/verify.bsh
+++ b/src/it/manifest-content/verify.bsh
@@ -21,6 +21,7 @@
import java.io.*;
import java.util.*;
import java.util.jar.*;
+import java.util.zip.*;
import org.codehaus.plexus.util.*;
boolean result = true;
@@ -42,6 +43,20 @@ try
return false;
}
+ ZipFile zip = new ZipFile( artifact );
+ Enumeration resultingEntries = zip.entries();
+ if ( !"META-INF/".equals( resultingEntries.nextElement().getName() ) )
+ {
+ System.err.println( "META-INF/ must be first zip entry" );
+ return false;
+ }
+ if ( !"META-INF/MANIFEST.MF".equals( resultingEntries.nextElement().getName() ) )
+ {
+ System.err.println( "META-INF/MANIFEST.MF must be first zip entry" );
+ return false;
+ }
+ zip.close();
+
JarFile jar = new JarFile( artifact );
Attributes manifest = jar.getManifest().getMainAttributes();