diff --git a/src/it/MJAR-292-detect-mjar-no-versions/invoker.properties b/src/it/MJAR-292-detect-mjar-no-versions/invoker.properties
new file mode 100644
index 0000000..d41b77b
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar-no-versions/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 = 10+
+
+invoker.name = MJAR-292 Missing versions for MRJAR
+invoker.description = Checks the Multi-Release attribute is missing
\ No newline at end of file
diff --git a/src/it/MJAR-292-detect-mjar-no-versions/pom.xml b/src/it/MJAR-292-detect-mjar-no-versions/pom.xml
new file mode 100644
index 0000000..7a82a2d
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar-no-versions/pom.xml
@@ -0,0 +1,93 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins
+ mjar-292-detect-multi-release-jar
+ mjar-292-detect-multi-release-jar
+ Verifies that the multi-release jar contains the manifest entry
+ jar
+ 1.0-SNAPSHOT
+
+
+ UTF-8
+ 2022-12-22T13:25:58Z
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ @project.version@
+
+
+
+ myproject.HelloWorld
+
+
+
+
+
+
+
+
+
+ maven-compiler-plugin
+ 3.10.1
+
+ 8
+
+
+
+ java9
+
+ compile
+
+
+ 9
+
+ ${project.basedir}/src/main/java9
+
+ true
+
+
+
+ java10
+
+ compile
+
+
+ 10
+
+ ${project.basedir}/src/main/java10
+
+ true
+
+
+
+
+
+
+
+
diff --git a/src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/HelloWorld.java
new file mode 100644
index 0000000..85a84d8
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/HelloWorld.java
@@ -0,0 +1,37 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Hello World App.
+ */
+public class HelloWorld
+{
+
+ /**
+ * Main method.
+ *
+ * @param args Not used
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( new Utils().getJavaVersion() );
+ }
+}
\ No newline at end of file
diff --git a/src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/Utils.java b/src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/Utils.java
new file mode 100644
index 0000000..eea2683
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/Utils.java
@@ -0,0 +1,32 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println("Running Java 8 (base) version");
+ return System.getProperty( "java.specification.version" );
+ }
+}
diff --git a/src/it/MJAR-292-detect-mjar-no-versions/verify.groovy b/src/it/MJAR-292-detect-mjar-no-versions/verify.groovy
new file mode 100644
index 0000000..8578151
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar-no-versions/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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 mrjar = new JarFile(new File(basedir,'target/mjar-292-detect-multi-release-jar-1.0-SNAPSHOT.jar'))
+def manifest = mrjar.manifest.mainAttributes
+
+assert manifest.getValue( Attributes.Name.MAIN_CLASS ) == "myproject.HelloWorld"
+assert manifest.getValue( Attributes.Name.MULTI_RELEASE ) == null
diff --git a/src/it/MJAR-292-detect-mjar/invoker.properties b/src/it/MJAR-292-detect-mjar/invoker.properties
new file mode 100644
index 0000000..dbd7d90
--- /dev/null
+++ b/src/it/MJAR-292-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 = 10+
+
+invoker.name = MJAR-292 Detect MRJAR
+invoker.description = Checks the Multi-Release attribute is true
\ No newline at end of file
diff --git a/src/it/MJAR-292-detect-mjar/pom.xml b/src/it/MJAR-292-detect-mjar/pom.xml
new file mode 100644
index 0000000..f3e1165
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar/pom.xml
@@ -0,0 +1,101 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins
+ mjar-292-detect-multi-release-jar
+ mjar-292-detect-multi-release-jar
+ Verifies that the multi-release jar contains the manifest entry
+ jar
+ 1.0-SNAPSHOT
+
+
+ UTF-8
+ 2022-12-22T13:25:58Z
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ @project.version@
+
+
+
+ myproject.HelloWorld
+ true
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+ maven-compiler-plugin
+ 3.10.1
+
+ 8
+
+
+
+ java9
+
+ compile
+
+
+ 9
+
+ ${project.basedir}/src/main/java9
+
+ true
+
+
+
+ java10
+
+ compile
+
+
+ 10
+
+ ${project.basedir}/src/main/java10
+
+ true
+
+
+
+
+
+
+
+
diff --git a/src/it/MJAR-292-detect-mjar/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-292-detect-mjar/src/main/java/myproject/HelloWorld.java
new file mode 100644
index 0000000..85a84d8
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar/src/main/java/myproject/HelloWorld.java
@@ -0,0 +1,37 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Hello World App.
+ */
+public class HelloWorld
+{
+
+ /**
+ * Main method.
+ *
+ * @param args Not used
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( new Utils().getJavaVersion() );
+ }
+}
\ No newline at end of file
diff --git a/src/it/MJAR-292-detect-mjar/src/main/java/myproject/Utils.java b/src/it/MJAR-292-detect-mjar/src/main/java/myproject/Utils.java
new file mode 100644
index 0000000..eea2683
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar/src/main/java/myproject/Utils.java
@@ -0,0 +1,32 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println("Running Java 8 (base) version");
+ return System.getProperty( "java.specification.version" );
+ }
+}
diff --git a/src/it/MJAR-292-detect-mjar/src/main/java10/myproject/Utils.java b/src/it/MJAR-292-detect-mjar/src/main/java10/myproject/Utils.java
new file mode 100644
index 0000000..b0bf5c7
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar/src/main/java10/myproject/Utils.java
@@ -0,0 +1,33 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println("Running Java 10+ version");
+ Runtime.Version runtimeVersion = Runtime.version();
+ return String.valueOf( runtimeVersion.feature() );
+ }
+}
diff --git a/src/it/MJAR-292-detect-mjar/src/main/java9/myproject/Utils.java b/src/it/MJAR-292-detect-mjar/src/main/java9/myproject/Utils.java
new file mode 100644
index 0000000..613f10c
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar/src/main/java9/myproject/Utils.java
@@ -0,0 +1,33 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println( "Running Java 9 version" );
+ Runtime.Version runtimeVersion = Runtime.version();
+ return String.valueOf( runtimeVersion.major() );
+ }
+}
diff --git a/src/it/MJAR-292-detect-mjar/verify.groovy b/src/it/MJAR-292-detect-mjar/verify.groovy
new file mode 100644
index 0000000..a06ef63
--- /dev/null
+++ b/src/it/MJAR-292-detect-mjar/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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 mrjar = new JarFile(new File(basedir,'target/mjar-292-detect-multi-release-jar-1.0-SNAPSHOT.jar'))
+def manifest = mrjar.manifest.mainAttributes
+
+assert manifest.getValue( Attributes.Name.MAIN_CLASS ) == "myproject.HelloWorld"
+assert manifest.getValue( Attributes.Name.MULTI_RELEASE ) == "true"
diff --git a/src/it/MJAR-292-disable-detect-mjar/invoker.properties b/src/it/MJAR-292-disable-detect-mjar/invoker.properties
new file mode 100644
index 0000000..034f5aa
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/invoker.properties
@@ -0,0 +1,21 @@
+# 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 = 10+
+invoker.goals = clean package -Dmaven.jar.detectMultiReleaseJar=false
+
+invoker.name = MJAR-292 MRJAR detection disabled
+invoker.description = Checks the Multi-Release attribute is not set
\ No newline at end of file
diff --git a/src/it/MJAR-292-disable-detect-mjar/pom.xml b/src/it/MJAR-292-disable-detect-mjar/pom.xml
new file mode 100644
index 0000000..7a82a2d
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/pom.xml
@@ -0,0 +1,93 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins
+ mjar-292-detect-multi-release-jar
+ mjar-292-detect-multi-release-jar
+ Verifies that the multi-release jar contains the manifest entry
+ jar
+ 1.0-SNAPSHOT
+
+
+ UTF-8
+ 2022-12-22T13:25:58Z
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ @project.version@
+
+
+
+ myproject.HelloWorld
+
+
+
+
+
+
+
+
+
+ maven-compiler-plugin
+ 3.10.1
+
+ 8
+
+
+
+ java9
+
+ compile
+
+
+ 9
+
+ ${project.basedir}/src/main/java9
+
+ true
+
+
+
+ java10
+
+ compile
+
+
+ 10
+
+ ${project.basedir}/src/main/java10
+
+ true
+
+
+
+
+
+
+
+
diff --git a/src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/HelloWorld.java
new file mode 100644
index 0000000..85a84d8
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/HelloWorld.java
@@ -0,0 +1,37 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Hello World App.
+ */
+public class HelloWorld
+{
+
+ /**
+ * Main method.
+ *
+ * @param args Not used
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( new Utils().getJavaVersion() );
+ }
+}
\ No newline at end of file
diff --git a/src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/Utils.java b/src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/Utils.java
new file mode 100644
index 0000000..eea2683
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/Utils.java
@@ -0,0 +1,32 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println("Running Java 8 (base) version");
+ return System.getProperty( "java.specification.version" );
+ }
+}
diff --git a/src/it/MJAR-292-disable-detect-mjar/src/main/java10/myproject/Utils.java b/src/it/MJAR-292-disable-detect-mjar/src/main/java10/myproject/Utils.java
new file mode 100644
index 0000000..b0bf5c7
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/src/main/java10/myproject/Utils.java
@@ -0,0 +1,33 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println("Running Java 10+ version");
+ Runtime.Version runtimeVersion = Runtime.version();
+ return String.valueOf( runtimeVersion.feature() );
+ }
+}
diff --git a/src/it/MJAR-292-disable-detect-mjar/src/main/java9/myproject/Utils.java b/src/it/MJAR-292-disable-detect-mjar/src/main/java9/myproject/Utils.java
new file mode 100644
index 0000000..613f10c
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/src/main/java9/myproject/Utils.java
@@ -0,0 +1,33 @@
+package myproject;
+
+/*
+ * 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.
+ */
+
+/**
+ * The classic Utils class.
+ */
+public class Utils
+{
+ public String getJavaVersion()
+ {
+ System.out.println( "Running Java 9 version" );
+ Runtime.Version runtimeVersion = Runtime.version();
+ return String.valueOf( runtimeVersion.major() );
+ }
+}
diff --git a/src/it/MJAR-292-disable-detect-mjar/verify.groovy b/src/it/MJAR-292-disable-detect-mjar/verify.groovy
new file mode 100644
index 0000000..8578151
--- /dev/null
+++ b/src/it/MJAR-292-disable-detect-mjar/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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 mrjar = new JarFile(new File(basedir,'target/mjar-292-detect-multi-release-jar-1.0-SNAPSHOT.jar'))
+def manifest = mrjar.manifest.mainAttributes
+
+assert manifest.getValue( Attributes.Name.MAIN_CLASS ) == "myproject.HelloWorld"
+assert manifest.getValue( Attributes.Name.MULTI_RELEASE ) == null
diff --git a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
index d54386b..a1483ac 100644
--- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
@@ -34,6 +34,7 @@
import org.codehaus.plexus.archiver.jar.JarArchiver;
import java.io.File;
+import java.nio.file.FileSystems;
import java.util.Arrays;
import java.util.Map;
@@ -53,6 +54,8 @@ public abstract class AbstractJarMojo
private static final String MODULE_DESCRIPTOR_FILE_NAME = "module-info.class";
+ private static final String SEPARATOR = FileSystems.getDefault().getSeparator();
+
/**
* List of files to include. Specified as fileset patterns which are relative to the input directory whose contents
* is being packaged into the JAR.
@@ -151,6 +154,15 @@ public abstract class AbstractJarMojo
@Parameter( defaultValue = "${project.build.outputTimestamp}" )
private String outputTimestamp;
+ /**
+ * If the JAR contains the {@code META-INF/versions} directory it will be detected as a multi-release JAR file
+ * ("MRJAR"), adding the {@code Multi-Release: true} attribute to the main section of the JAR MANIFEST.MF.
+ *
+ * @since 3.3.1
+ */
+ @Parameter( property = "maven.jar.detectMultiReleaseJar", defaultValue = "true" )
+ private boolean detectMultiReleaseJar;
+
/**
* Return the specific output directory to serve as the root for the archive.
* @return get classes directory.
@@ -225,25 +237,26 @@ public File createArchive()
jarContentFileSet.setIncludes( Arrays.asList( getIncludes() ) );
jarContentFileSet.setExcludes( Arrays.asList( getExcludes() ) );
- boolean containsModuleDescriptor = false;
String[] includedFiles = fileSetManager.getIncludedFiles( jarContentFileSet );
- for ( String includedFile : includedFiles )
+
+ if ( detectMultiReleaseJar && Arrays.stream( includedFiles ).anyMatch( p -> p.startsWith( "META-INF" + SEPARATOR
+ + "versions" + SEPARATOR ) ) )
{
- // May give false positives if the files is named as module descriptor
- // but is not in the root of the archive or in the versioned area
- // (and hence not actually a module descriptor).
- // That is fine since the modular Jar archiver will gracefully
- // handle such case.
- // And also such case is unlikely to happen as file ending
- // with "module-info.class" is unlikely to be included in Jar file
- // unless it is a module descriptor.
- if ( includedFile.endsWith( MODULE_DESCRIPTOR_FILE_NAME ) )
- {
- containsModuleDescriptor = true;
- break;
- }
+ getLog().debug( "Adding 'Multi-Release: true' manifest entry." );
+ archive.addManifestEntry( "Multi-Release", "true" );
}
+ // May give false positives if the files is named as module descriptor
+ // but is not in the root of the archive or in the versioned area
+ // (and hence not actually a module descriptor).
+ // That is fine since the modular Jar archiver will gracefully
+ // handle such case.
+ // And also such case is unlikely to happen as file ending
+ // with "module-info.class" is unlikely to be included in Jar file
+ // unless it is a module descriptor.
+ boolean containsModuleDescriptor =
+ Arrays.stream( includedFiles ).anyMatch( p -> p.endsWith( MODULE_DESCRIPTOR_FILE_NAME ) );
+
String archiverName = containsModuleDescriptor ? "mjar" : "jar";
MavenArchiver archiver = new MavenArchiver();