From ff57ff8ae6d35e4c8080072b1f4e50ba30e95ccd Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 14 Apr 2024 23:52:03 +0200 Subject: [PATCH 1/3] ITs for MJAR-307 - try to reproduce --- src/it/MJAR-307/pom.xml | 57 +++++++++++++++++++ .../src/main/java/foo/project003/App.java | 32 +++++++++++ src/it/MJAR-307/verify.groovy | 32 +++++++++++ 3 files changed, 121 insertions(+) create mode 100644 src/it/MJAR-307/pom.xml create mode 100644 src/it/MJAR-307/src/main/java/foo/project003/App.java create mode 100644 src/it/MJAR-307/verify.groovy diff --git a/src/it/MJAR-307/pom.xml b/src/it/MJAR-307/pom.xml new file mode 100644 index 0000000..0f283ad --- /dev/null +++ b/src/it/MJAR-307/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + + org.apache.maven.plugins.jar.it + mjar-307 + jar + 1.0 + it-mjar-307 + + + 123 + sealed + + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + true + + true + + + ${build.number} + ${build.sealed} + + + + + + + + diff --git a/src/it/MJAR-307/src/main/java/foo/project003/App.java b/src/it/MJAR-307/src/main/java/foo/project003/App.java new file mode 100644 index 0000000..3a3d166 --- /dev/null +++ b/src/it/MJAR-307/src/main/java/foo/project003/App.java @@ -0,0 +1,32 @@ +package foo.project003; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/it/MJAR-307/verify.groovy b/src/it/MJAR-307/verify.groovy new file mode 100644 index 0000000..8629f97 --- /dev/null +++ b/src/it/MJAR-307/verify.groovy @@ -0,0 +1,32 @@ +import java.util.jar.JarFile + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def target = new File( basedir, "target" ); +def jarFile = new File( target, "mjar-307-1.0.jar" ); + +assert jarFile.exists() + +def jar = new JarFile(jarFile) +assert jar.getEntry("META-INF/INDEX.LIST") != null + +def manifest = jar.getManifest().getMainAttributes() +assert manifest.getValue("Implementation-Build") == "123" +assert manifest.getValue("Sealed") == "sealed" \ No newline at end of file From 3849d68c7d90705cca49e294b62fc168f224ae50 Mon Sep 17 00:00:00 2001 From: Delany Date: Mon, 15 Apr 2024 22:39:34 +0200 Subject: [PATCH 2/3] Add timestamp (#84) * Add timestamp * Add timestamp format --------- Co-authored-by: Delany --- src/it/MJAR-307/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/it/MJAR-307/pom.xml b/src/it/MJAR-307/pom.xml index 0f283ad..ec779e3 100644 --- a/src/it/MJAR-307/pom.xml +++ b/src/it/MJAR-307/pom.xml @@ -30,6 +30,8 @@ under the License. 123 sealed + yyyyMMdd + ${maven.build.timestamp} From 75872ef164774e5487e185ca7309e756b2e582a7 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Mon, 15 Apr 2024 23:09:10 +0200 Subject: [PATCH 3/3] Fix a bug --- pom.xml | 5 +++++ src/it/MJAR-307/pom.xml | 16 ++-------------- src/it/MJAR-307/verify.groovy | 7 ------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 8b55c97..bbb9847 100644 --- a/pom.xml +++ b/pom.xml @@ -88,6 +88,11 @@ pom import + + commons-io + commons-io + 2.16.1 + diff --git a/src/it/MJAR-307/pom.xml b/src/it/MJAR-307/pom.xml index ec779e3..d0c36ed 100644 --- a/src/it/MJAR-307/pom.xml +++ b/src/it/MJAR-307/pom.xml @@ -27,9 +27,9 @@ under the License. 1.0 it-mjar-307 + Wrong version of commons-io cause a ClassNotFoundException: org.apache.commons.io.file.attribute.FileTimes + - 123 - sealed yyyyMMdd ${maven.build.timestamp} @@ -40,18 +40,6 @@ under the License. org.apache.maven.plugins maven-jar-plugin @project.version@ - - - true - - true - - - ${build.number} - ${build.sealed} - - - diff --git a/src/it/MJAR-307/verify.groovy b/src/it/MJAR-307/verify.groovy index 8629f97..d75e626 100644 --- a/src/it/MJAR-307/verify.groovy +++ b/src/it/MJAR-307/verify.groovy @@ -23,10 +23,3 @@ def target = new File( basedir, "target" ); def jarFile = new File( target, "mjar-307-1.0.jar" ); assert jarFile.exists() - -def jar = new JarFile(jarFile) -assert jar.getEntry("META-INF/INDEX.LIST") != null - -def manifest = jar.getManifest().getMainAttributes() -assert manifest.getValue("Implementation-Build") == "123" -assert manifest.getValue("Sealed") == "sealed" \ No newline at end of file