diff --git a/pom.xml b/pom.xml index 82d7e0a..34510db 100644 --- a/pom.xml +++ b/pom.xml @@ -216,6 +216,7 @@ --> src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF + src/it/MJAR-557-detect-mjar/src/main/resources/META-INF/versions/9/test.txt diff --git a/src/it/MJAR-557-detect-mjar/invoker.properties b/src/it/MJAR-557-detect-mjar/invoker.properties new file mode 100644 index 0000000..25d1d93 --- /dev/null +++ b/src/it/MJAR-557-detect-mjar/invoker.properties @@ -0,0 +1,20 @@ +# 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. +# +invoker.java.version = 9+ +invoker.name = MJAR-557 Detect MRJAR on Windows +invoker.description = Checks the Multi-Release attribute is true when META-INF/versions/ is present diff --git a/src/it/MJAR-557-detect-mjar/pom.xml b/src/it/MJAR-557-detect-mjar/pom.xml new file mode 100644 index 0000000..289fb05 --- /dev/null +++ b/src/it/MJAR-557-detect-mjar/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + org.apache.maven.plugins + mjar-557-detect-multi-release + 1.0-SNAPSHOT + jar + MJAR-557 Multi-release JAR detection on Windows + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + diff --git a/src/it/MJAR-557-detect-mjar/src/main/resources/META-INF/versions/9/test.txt b/src/it/MJAR-557-detect-mjar/src/main/resources/META-INF/versions/9/test.txt new file mode 100644 index 0000000..26786c2 --- /dev/null +++ b/src/it/MJAR-557-detect-mjar/src/main/resources/META-INF/versions/9/test.txt @@ -0,0 +1 @@ +Test file for multi-release JAR detection diff --git a/src/it/MJAR-557-detect-mjar/verify.groovy b/src/it/MJAR-557-detect-mjar/verify.groovy new file mode 100644 index 0000000..596c7d9 --- /dev/null +++ b/src/it/MJAR-557-detect-mjar/verify.groovy @@ -0,0 +1,30 @@ +/* + * 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. + */ + +import java.util.jar.* + +def jarFile = new File(basedir, 'target/mjar-557-detect-multi-release-1.0-SNAPSHOT.jar') +assert jarFile.exists() +assert jarFile.isFile() + +new JarFile(jarFile).withCloseable { mrjar -> + def manifest = mrjar.manifest.mainAttributes + assert manifest.getValue(Attributes.Name.MULTI_RELEASE) == "true", + "Expected Multi-Release: true but got: " + manifest.getValue(Attributes.Name.MULTI_RELEASE) +}