From c37b9d5035c27dbdb7beb63df0c5a79468326889 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 18 Jun 2016 14:08:37 +0000 Subject: [PATCH 001/128] [maven-release-plugin] prepare for next development iteration git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1749048 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 10bf7d6f..5eda7045 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ under the License. maven-jar-plugin - 3.0.2 + 3.0.3-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -54,9 +54,9 @@ under the License. - scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-jar-plugin-3.0.2 - scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-jar-plugin-3.0.2 - http://svn.apache.org/viewvc/maven/plugins/tags/maven-jar-plugin-3.0.2 + scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jar-plugin/ + scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jar-plugin/ + http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/ JIRA From 51c27646616424890dac53a4823a92b3948406ec Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sun, 17 Jul 2016 10:17:01 +0000 Subject: [PATCH 002/128] [MJAR-221] Link to wiki page should be removed now that Codehaus is shut down git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1753049 13f79535-47bb-0310-9956-ffa450edef68 --- src/site/apt/index.apt.vm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index 44826915..dc0d4679 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -75,9 +75,7 @@ ${project.name} * Usage General instructions on how to use the JAR Plugin can be found on the {{{./usage.html}usage page}}. Some more - specific use cases are described in the examples given below. Last but not least, users occasionally contribute - additional examples, tips or errata to the - {{{http://docs.codehaus.org/display/MAVENUSER/JAR+Plugin}plugin's wiki page}}. + specific use cases are described in the examples given below. In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel free to contact the {{{./mail-lists.html}user mailing list}}. The posts to the mailing list are archived and could From 1b8ec7601165cefcccae761b443ad1cd8144931d Mon Sep 17 00:00:00 2001 From: Christian Schulte Date: Sun, 18 Dec 2016 00:49:25 +0000 Subject: [PATCH 003/128] o Updated to latest parent SNAPSHOT. git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1774838 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5eda7045..67e0b29f 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ under the License. maven-plugins org.apache.maven.plugins - 30 + 31-SNAPSHOT ../../pom/maven/maven-plugins/pom.xml From d3c95b57ee843b63e2cd48017358da67ff4859ad Mon Sep 17 00:00:00 2001 From: Christian Schulte Date: Sun, 18 Dec 2016 03:37:05 +0000 Subject: [PATCH 004/128] o Reverted last commit to reset to release version parent's. git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1774844 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 67e0b29f..5eda7045 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ under the License. maven-plugins org.apache.maven.plugins - 31-SNAPSHOT + 30 ../../pom/maven/maven-plugins/pom.xml From 2d8ac6c1acbdaaa770b8a111fc54540ed29a1117 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 15 Apr 2017 10:20:29 +0000 Subject: [PATCH 005/128] [MJAR-235] Update life cycle bound plugin versions o Updated maven-resources-plugin from 2.7 to 3.0.2 o Updated maven-compiler-plugin from 3.5.1 to 3.6.1 git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1791488 13f79535-47bb-0310-9956-ffa450edef68 --- .../filtered-resources/META-INF/plexus/components.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/filtered-resources/META-INF/plexus/components.xml b/src/main/filtered-resources/META-INF/plexus/components.xml index 2665d7f7..247bbc58 100644 --- a/src/main/filtered-resources/META-INF/plexus/components.xml +++ b/src/main/filtered-resources/META-INF/plexus/components.xml @@ -67,16 +67,16 @@ - org.apache.maven.plugins:maven-resources-plugin:2.7:resources + org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources - org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile + org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile - org.apache.maven.plugins:maven-resources-plugin:2.7:testResources + org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources - org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:3.6.1:testCompile org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test From 3530af6d54f4c743cc49b58ba71eccd81b060eec Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 15 Apr 2017 10:52:33 +0000 Subject: [PATCH 006/128] [MJAR-326] Keep maven-compiler-plugin to 3.5.1 based on JDK9 issues o Undone the update of the maven-compiler-plugin in previous commit [MJAR-235] which can cause issues related to JDK9 git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1791489 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/filtered-resources/META-INF/plexus/components.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/filtered-resources/META-INF/plexus/components.xml b/src/main/filtered-resources/META-INF/plexus/components.xml index 247bbc58..27b855b3 100644 --- a/src/main/filtered-resources/META-INF/plexus/components.xml +++ b/src/main/filtered-resources/META-INF/plexus/components.xml @@ -70,13 +70,13 @@ org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources - org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile + org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources - org.apache.maven.plugins:maven-compiler-plugin:3.6.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test From 8c06fe4d29f86c0721d424e05d6b23241a23656a Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 16 Sep 2017 16:37:39 +0000 Subject: [PATCH 007/128] [MJAR-237] Navigation link "Creating an Executable JAR File" is wrong. o Fixed two links git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1808567 13f79535-47bb-0310-9956-ffa450edef68 --- src/site/site.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/site/site.xml b/src/site/site.xml index 7c868e1b..38bb007b 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -33,9 +33,9 @@ under the License. - + - + From 78c9ab7ad4226ceb0983a63ccbff306337f8bf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 9 Dec 2017 19:31:11 +0100 Subject: [PATCH 008/128] moved to git --- .gitignore | 15 +++++++++++++++ Jenkinsfile | 20 ++++++++++++++++++++ pom.xml | 11 ++++++++--- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 Jenkinsfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..f79c9285 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +target/ +.project +.classpath +.settings/ +.svn/ +bin/ +# Intellij +*.ipr +*.iml +.idea +out/ +.DS_Store +/bootstrap +/dependencies.xml +.java-version diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..09ac70f1 --- /dev/null +++ b/Jenkinsfile @@ -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. + */ + +asfMavenTlpStdBuild() diff --git a/pom.xml b/pom.xml index 5eda7045..c78fabea 100644 --- a/pom.xml +++ b/pom.xml @@ -54,14 +54,19 @@ under the License. - scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jar-plugin/ - scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-jar-plugin/ - http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/ + scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git + scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git + https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} + HEAD JIRA https://issues.apache.org/jira/browse/MJAR + + Jenkins + https://builds.apache.org/job/maven-box/job/maven-jar-plugin/ + apache.website From 4d5bdd86004b529d307df8ad1537d6c5b289fc70 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Fri, 22 Dec 2017 20:26:50 +0100 Subject: [PATCH 009/128] [MJAR-243] - maven-archiver 3.1.1 to 3.2.0 o Based on the update we have to life JDK version to 7 o Needed also to update plexus-archiver and plexus-utils to keep them in sync based on the transitive dependencies. o Bumped version to 3.1.0 --- pom.xml | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index c78fabea..772bfdc1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,25 +1,28 @@ - + 4.0.0 @@ -30,7 +33,7 @@ under the License. maven-jar-plugin - 3.0.3-SNAPSHOT + 3.1.0-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -75,8 +78,10 @@ under the License. - 3.1.1 + 3.2.0 3.0 + 1.7 + 1.7 @@ -106,15 +111,20 @@ under the License. maven-plugin-annotations provided + org.codehaus.plexus plexus-archiver - 3.4 + 3.5 org.codehaus.plexus plexus-utils - 3.0.24 + 3.1.0 junit From 5868117fc3a466ce0fbbb633b4f556ebe86ecb22 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Fri, 22 Dec 2017 20:26:50 +0100 Subject: [PATCH 010/128] [MJAR-243] - maven-archiver 3.1.1 to 3.2.0 o Based on the update we have to life JDK version to 7 o Needed also to update plexus-archiver and plexus-utils to keep them in sync based on the transitive dependencies. o Bumped version to 3.1.0 From 3b771db5df7ceee3d35c20b2168dd73f84f0a290 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Tue, 13 Feb 2018 19:53:34 +0100 Subject: [PATCH 011/128] [MJAR-246] - Upgrade parent to 31 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 772bfdc1..f7e86432 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-plugins org.apache.maven.plugins - 30 + 31 ../../pom/maven/maven-plugins/pom.xml From 39fc58f506136dea2ec1354dca18661a590d0984 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Wed, 28 Mar 2018 20:41:03 +0200 Subject: [PATCH 012/128] [MJAR-249] - Get Build working on JDK 10 o Need to upgrade maven-surefire/failsafe plugin to 2.21.0 to get it working in JDK 10. --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index f7e86432..26f8d5eb 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,7 @@ 3.0 1.7 1.7 + 2.21.0 From 3ec43fddd0aceb62b985fb9ff59bbeb6efd6d312 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Wed, 28 Mar 2018 20:20:59 +0200 Subject: [PATCH 013/128] [MJAR-245] - Additional attached jar: role of classifyer o Added explanations about test jar o Added missing classifier in example. --- src/site/apt/examples/create-test-jar.apt.vm | 33 ++++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/site/apt/examples/create-test-jar.apt.vm b/src/site/apt/examples/create-test-jar.apt.vm index 27b3f0d3..5b7d9621 100644 --- a/src/site/apt/examples/create-test-jar.apt.vm +++ b/src/site/apt/examples/create-test-jar.apt.vm @@ -28,15 +28,15 @@ How to create a jar containing test classes - When you want to create a jar containing test-classes, you would probably want to reuse those classes. + When you want to create a jar containing , you would probably want to reuse those classes. There are two ways to solve this: - * Create an attached jar with the test-classes from the current project and loose its transitive <<>>-scoped dependencies. + * Create an attached jar with the from the current project and loose its transitive <<>>-scoped dependencies. - * Create a separate project with the test-classes. + * Create a separate project with the . [] - + * The easy way You can produce a jar which will include your test classes and resources. @@ -75,6 +75,7 @@ How to create a jar containing test classes groupId artifactId + tests test-jar version test @@ -84,9 +85,18 @@ How to create a jar containing test classes +-----------------+ + Based on such configuration there will be two jar files generated. The first one contains the + classes from <<>> whereas the second one will contain the classes from <<>>. + The generated jar files follow the naming schema <<>> for the first one and + <<>> for the second one. The parts <<>>, <<>> + will be replaced by the values given within your project <<>> file. The <<>> + will be set to <<>> which is a default of the maven-jar-plugin which can be changed if you need by + using the configuration in the jar goal + {{{../test-jar-mojo.html}using the configuration in the jar goal}}. + <> The downside of this solution is that you don't get the transitive <<>>-scoped dependencies automatically. Maven only resolves the <<>>-time dependencies, so you'll have to add all the other required <<>>-scoped dependencies by hand. - + * The preferred way In order to let Maven resolve all <<>>-scoped transitive dependencies you should create a separate project. @@ -100,14 +110,17 @@ How to create a jar containing test classes +-----------------+ - * Move the sources files from <<>> you want to share from the original project to the <<>> of this project. + * Move the sources files from <<>> you want to share from + the original project to the <<>> of this project. The same type of movement counts for the resources as well of course. - * Move the required <<>>-scoped dependencies and from the original project to this project and remove the scope (i.e. changing it to the <<>>-scope). - And yes, that means that the junit dependency (or any other testing framework dependency) gets the default scope too. - You'll probably need to add some project specific dependencies as well to let it all compile again. + * Move the required <<>>-scoped dependencies and from the original + project to this project and remove the scope (i.e. changing it to the <<>>-scope). + And yes, that means that the junit dependency (or any other testing + framework dependency) gets the default scope too. You'll probably need + to add some project specific dependencies as well to let it all compile again. - Now you have your reusable test-classes and you can refer to it as you're used to: + Now you have your reusable and you can refer to it as you're used to: +-----------------+ From e62592db03d8cb6f53840f2a04729806a34b2ef6 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Thu, 5 Apr 2018 22:28:00 +0200 Subject: [PATCH 014/128] Change the usage of properties to control javaVersion. --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 26f8d5eb..7adb4c44 100644 --- a/pom.xml +++ b/pom.xml @@ -80,8 +80,7 @@ 3.2.0 3.0 - 1.7 - 1.7 + 7 2.21.0 From b41aea6f8fecbf79677d73c2c1c37ddcef6273e7 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Fri, 6 Apr 2018 19:56:02 +0200 Subject: [PATCH 015/128] Fixed JavaDoc issue. --- src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java index ed4cc9a1..601b7698 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java @@ -46,7 +46,7 @@ protected void setUp() /** * tests the proper discovery and configuration of the mojo * - * @throws Exception + * @throws Exception in case of an error. */ public void testJarTestEnvironment() throws Exception From 2bddc168ae20f6aa159330e287a3b731665c4a9d Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Fri, 6 Apr 2018 20:18:02 +0200 Subject: [PATCH 016/128] [maven-release-plugin] prepare release maven-jar-plugin-3.1.0 --- pom.xml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7adb4c44..316a03b7 100644 --- a/pom.xml +++ b/pom.xml @@ -19,10 +19,7 @@ under the License. --> - + 4.0.0 @@ -33,7 +30,7 @@ maven-jar-plugin - 3.1.0-SNAPSHOT + 3.1.0 maven-plugin Apache Maven JAR Plugin @@ -60,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - HEAD + maven-jar-plugin-3.1.0 JIRA From 5ab5d2ad7cc7452e28456e4d7bb8fbc883c4b018 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Fri, 6 Apr 2018 20:18:24 +0200 Subject: [PATCH 017/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 316a03b7..8a762bb1 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.1.0 + 3.1.1-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - maven-jar-plugin-3.1.0 + HEAD JIRA From ae90c7be5de555dfb73d70f8d221fdbd218440e7 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Tue, 10 Apr 2018 18:06:02 +0200 Subject: [PATCH 018/128] [MNGSITE-332] - Changed download templates of plugins not to reference .md5 anymore --- src/site/xdoc/download.xml.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 09d4f421..cf13dc93 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -108,7 +108,7 @@ under the License. ${project.name} ${project.version} (Source zip) maven/plugins/${project.artifactId}-${project.version}-source-release.zip - maven/plugins/${project.artifactId}-${project.version}-source-release.zip.md5 + maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1 maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc From a5c9a86a0c5e5a04a70819f85126dc650d49abf9 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Thu, 17 May 2018 21:15:55 +0200 Subject: [PATCH 019/128] [MJAR-252] - Upgrade plexus-archiver to 3.6.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8a762bb1..444a8eb3 100644 --- a/pom.xml +++ b/pom.xml @@ -116,7 +116,7 @@ org.codehaus.plexus plexus-archiver - 3.5 + 3.6.0 org.codehaus.plexus From 4929dc1fbf0d0c078bace9847cc0dbcffa9ba146 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 14 Apr 2018 21:31:52 +0200 Subject: [PATCH 020/128] [MJAR-251] - Add documentation information for GitHub --- .github/pull_request_template.md | 29 ++++++++++ CONTRIBUTING.md | 91 ++++++++++++++++++++++++++++++ README.md | 97 ++++++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 CONTRIBUTING.md create mode 100644 README.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..c94da7b5 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,29 @@ +Following this checklist to help us incorporate your +contribution quickly and easily: + + - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MJAR) filed + for the change (usually before you start working on it). Trivial changes like typos do not + require a JIRA issue. Your pull request should address just this issue, without + pulling in other changes. + - [ ] Each commit in the pull request should have a meaningful subject line and body. + - [ ] Format the pull request title like `[MJAR-XXX] - Fixes bug in ApproximateQuantiles`, + where you replace `MJAR-XXX` with the appropriate JIRA issue. Best practice + is to use the JIRA issue title in the pull request title and in the first line of the + commit message. + - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. + - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will + be performed on your pull request automatically. + - [ ] You have run the integration tests successfully (`mvn -Prun-its clean verify`). + +If your pull request is about ~20 lines of code you don't need to sign an +[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure +please ask on the developers list. + +To make clear that you license your contribution under +the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) +you have to acknowledge this by using the following check-box. + + - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) + + - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..23dc8847 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,91 @@ + +Contributing to Apache Maven Jar Plugin +====================== + +You have found a bug or you have an idea for a cool new feature? Contributing +code is a great way to give something back to the open source community. Before +you dig right into the code, there are a few guidelines that we need +contributors to follow so that we can have a chance of keeping on top of +things. + +Some of the ideas are documented in the [Maven Wiki][maven-wiki] +which might be interesting to read and for further discussion. + +Getting Started +--------------- + ++ Make sure you have a [JIRA account](https://issues.apache.org/jira/). ++ Make sure you have a [GitHub account](https://github.com/signup/free). ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list](https://maven.apache.org/mail-lists.html) first. + This way you can make sure you're not wasting your time on something that isn't + considered to be in Apache Maven's scope. ++ Submit a ticket for your issue, assuming one does not already exist. + + Clearly describe the issue, including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making and Submitting Changes +-------------- + +We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the +main channel of communication for contributors. +There are some guidelines which will make applying PRs easier for us: ++ Create a topic branch from where you want to base your work (this is usually the master branch). + Push your changes to a topic branch in your fork of the repository. ++ Make commits of logical units. ++ Respect the original code style: by using the same [codestyle][code-style], + patches should only highlight the actual difference, not being disturbed by any formatting issues: + + Only use spaces for indentation. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. + If you feel the source code should be reformatted, create a separate PR for this change. + + Check for unnecessary whitespace with `git diff --check` before committing. ++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. +``` +[MJAR-XXX] - Subject of the JIRA Ticket + Optional supplemental description. +``` ++ Make sure you have added the necessary tests (JUnit/IT) for your changes. ++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. ++ Submit a pull request to the repository in the Apache organization. ++ Update your JIRA ticket and include a link to the pull request in the ticket. + +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. + +Making Trivial Changes +---------------------- + +For changes of a trivial nature to comments and documentation, it is not always +necessary to create a new ticket in JIRA. In this case, it is appropriate to +start the first line of a commit with '(doc)' instead of a ticket number. + +Additional Resources +-------------------- + ++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) ++ [Apache Maven Jar JIRA project page](https://issues.apache.org/jira/projects/MJAR/) ++ [Contributor License Agreement][cla] ++ [General GitHub documentation](https://help.github.com/) ++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) ++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ #Maven IRC channel on freenode.org + +[dev-ml-list]: https://maven.apache.org/mail-lists.html +[code-style]: https://maven.apache.org/developers/conventions/code.html +[cla]: https://www.apache.org/licenses/#clas +[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index diff --git a/README.md b/README.md new file mode 100644 index 00000000..595ead92 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ + +Contributing to Apache Maven JAR Plugin +====================== + +[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] +[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven.plugins%22%20AND%20a%3A%22maven-jar-plugin%22) +[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?style=flat-square)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?style=flat-square)][test-results] + + +You have found a bug or you have an idea for a cool new feature? Contributing +code is a great way to give something back to the open source community. Before +you dig right into the code, there are a few guidelines that we need +contributors to follow so that we can have a chance of keeping on top of +things. + +Getting Started +--------------- + ++ Make sure you have a [JIRA account](https://issues.apache.org/jira/). ++ Make sure you have a [GitHub account](https://github.com/signup/free). ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list](https://maven.apache.org/mail-lists.html) first. + This way you can make sure you're not wasting your time on something that isn't + considered to be in Apache Maven's scope. ++ Submit a ticket for your issue, assuming one does not already exist. + + Clearly describe the issue, including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making and Submitting Changes +-------------- + +We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the +main channel of communication for contributors. +There are some guidelines which will make applying PRs easier for us: ++ Create a topic branch from where you want to base your work (this is usually the master branch). + Push your changes to a topic branch in your fork of the repository. ++ Make commits of logical units. ++ Respect the original code style: by using the same [codestyle][code-style], + patches should only highlight the actual difference, not being disturbed by any formatting issues: + + Only use spaces for indentation. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. + If you feel the source code should be reformatted, create a separate PR for this change. + + Check for unnecessary whitespace with `git diff --check` before committing. ++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. +``` +[MJAR-XXX] - Subject of the JIRA Ticket + Optional supplemental description. +``` ++ Make sure you have added the necessary tests (JUnit/IT) for your changes. ++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. ++ Submit a pull request to the repository in the Apache organization. ++ Update your JIRA ticket and include a link to the pull request in the ticket. + +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. + +Making Trivial Changes +---------------------- + +For changes of a trivial nature to comments and documentation, it is not always +necessary to create a new ticket in JIRA. In this case, it is appropriate to +start the first line of a commit with '(doc)' instead of a ticket number. + +Additional Resources +-------------------- + ++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) ++ [Apache Maven Help JIRA project page](https://issues.apache.org/jira/projects/MJAR/) ++ [Contributor License Agreement][cla] ++ [General GitHub documentation](https://help.github.com/) ++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) ++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ #Maven IRC channel on freenode.org + +[license]: https://www.apache.org/licenses/LICENSE-2.0 +[dev-ml-list]: https://maven.apache.org/mail-lists.html +[code-style]: https://maven.apache.org/developers/conventions/code.html +[cla]: https://www.apache.org/licenses/#clas +[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index +[test-results]: https://builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master/lastCompletedBuild/testReport/ +[build]: https://builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master/ From b227a9700608fe00eaddc20c0cd2418316a2abf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 19 Jun 2018 00:02:19 +0200 Subject: [PATCH 021/128] [INFRA-16467] move components documentation out of CMS space --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 444a8eb3..f24d2179 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ apache.website - scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/components/${maven.site.path} + scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path} From 1a8fb5de363038569cec1fd70b90af36a986d049 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 21 Jul 2018 11:13:04 +0200 Subject: [PATCH 022/128] Fixed link to mailing list. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 595ead92..0f31a022 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Additional Resources + #Maven IRC channel on freenode.org [license]: https://www.apache.org/licenses/LICENSE-2.0 -[dev-ml-list]: https://maven.apache.org/mail-lists.html +[dev-ml-list]: https://maven.apache.org/mailing-lists.html [code-style]: https://maven.apache.org/developers/conventions/code.html [cla]: https://www.apache.org/licenses/#clas [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index From d9bba2d73dbf33328ae12edcd4b0e6fc0e0403f8 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sun, 29 Jul 2018 00:06:00 +0200 Subject: [PATCH 023/128] [MJAR-255] - Upgrade maven-plugins parent to version 32 --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f24d2179..039577ab 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ maven-plugins org.apache.maven.plugins - 31 + 32 ../../pom/maven/maven-plugins/pom.xml @@ -78,7 +78,6 @@ 3.2.0 3.0 7 - 2.21.0 @@ -182,6 +181,8 @@ clean package + true + true From d5b5a3f0b3448d10b5a48f612122d4755e253ede Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Thu, 9 Aug 2018 19:02:34 +0200 Subject: [PATCH 024/128] [MJAR-256] - Upgrade JUnit to 4.12 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 039577ab..44f906fd 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,7 @@ junit junit - 4.11 + 4.12 test From 9556e9feb098c248e457adadb41648440352b1ae Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 1 Sep 2018 11:49:26 +0200 Subject: [PATCH 025/128] Added exclusion for JDK9 based on JDK Bug. --- src/it/MJAR-70-no-recreation/invoker.properties | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/it/MJAR-70-no-recreation/invoker.properties b/src/it/MJAR-70-no-recreation/invoker.properties index 7036df7d..b0879dab 100644 --- a/src/it/MJAR-70-no-recreation/invoker.properties +++ b/src/it/MJAR-70-no-recreation/invoker.properties @@ -16,5 +16,10 @@ # under the License. # NOTE: The first time, we run up to "integration-test" phase which includes the AntRun execution which saves the -# timestamp of the first JAR for comparision with the timestamp of the JAR from the final "package" invocation. +# timestamp of the first JAR for comparison with the timestamp of the JAR from the final "package" invocation. +# Note: +# Currently the timestamp comparison does not work cause based on a Bug in JDK +# https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8177809 +# So we exclude JDK 1.9 +invoker.java.version = 1.9- invoker.goals = clean integration-test package From 2572d71e6e1f1adf3ace2b623b34b622d5c0ebb9 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 1 Sep 2018 12:41:44 +0200 Subject: [PATCH 026/128] Using asfMavenTlpPlgnBuild instead of asfMavenTlpStdBuild --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 09ac70f1..e9f05f7d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,4 +17,4 @@ * under the License. */ -asfMavenTlpStdBuild() +asfMavenTlpPlgnBuild() From 869e1f88bd6aab65f778fa5d645d345afa190e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 29 Aug 2018 14:42:27 +0200 Subject: [PATCH 027/128] [MNGSITE-341] use https for sigs, hashes and KEYS --- src/site/xdoc/download.xml.vm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index cf13dc93..7047d2c6 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -34,7 +34,7 @@ under the License.

In order to guard against corrupted downloads/installations, it is highly recommended to verify the signature - of the release bundles against the public KEYS used by the Apache Maven + of the release bundles against the public KEYS used by the Apache Maven developers.

${project.name} is distributed under the Apache License, version 2.0.

@@ -108,8 +108,8 @@ under the License. ${project.name} ${project.version} (Source zip) maven/plugins/${project.artifactId}-${project.version}-source-release.zip - maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1 - maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc + maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1 + maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc From ee7556c313cbbbff639692b39fc6ca137f32816e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 29 Aug 2018 14:53:27 +0200 Subject: [PATCH 028/128] [MPOM-205] use sha512 checksums instead of sha1 --- src/site/xdoc/download.xml.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 7047d2c6..3f710359 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -108,7 +108,7 @@ under the License. ${project.name} ${project.version} (Source zip) maven/plugins/${project.artifactId}-${project.version}-source-release.zip - maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1 + maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha512 maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc From 58a570ad7d16767cd47181eefe304f2e83dc88b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 16 Sep 2018 21:31:11 +0200 Subject: [PATCH 029/128] upgraded parent POM from 32 to 33 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 44f906fd..45b8a107 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ maven-plugins org.apache.maven.plugins - 32 + 33 ../../pom/maven/maven-plugins/pom.xml From b59d531921cbbbf3ee280ccfcec3657525d8fe26 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Fri, 16 Nov 2018 13:12:56 +0100 Subject: [PATCH 030/128] [MJAR-260] Upgrade to Archiver 3.3.0 and add ITs This PR updates the dependency to the version `3.3.0` of the Maven Archiver and introduces two integration tests that a) verify that JAR containing a valid name is created and b) that no JAR file is created when it would contain an invalid automatic module name. Addresses https://issues.apache.org/jira/browse/MJAR-260 --- pom.xml | 2 +- .../invoker.properties | 18 +++++ .../pom.xml | 46 +++++++++++++ .../src/main/java/myproject/HelloWorld.java | 36 ++++++++++ .../verify.bsh | 69 +++++++++++++++++++ .../pom.xml | 46 +++++++++++++ .../src/main/java/myproject/HelloWorld.java | 36 ++++++++++ .../verify.bsh | 52 ++++++++++++++ 8 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 src/it/MJAR-260-invalid-automatic-module-name/invoker.properties create mode 100644 src/it/MJAR-260-invalid-automatic-module-name/pom.xml create mode 100644 src/it/MJAR-260-invalid-automatic-module-name/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-260-invalid-automatic-module-name/verify.bsh create mode 100644 src/it/MJAR-260-valid-automatic-module-name/pom.xml create mode 100644 src/it/MJAR-260-valid-automatic-module-name/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-260-valid-automatic-module-name/verify.bsh diff --git a/pom.xml b/pom.xml index 45b8a107..428e3447 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ - 3.2.0 + 3.3.0 3.0 7 diff --git a/src/it/MJAR-260-invalid-automatic-module-name/invoker.properties b/src/it/MJAR-260-invalid-automatic-module-name/invoker.properties new file mode 100644 index 00000000..4789d911 --- /dev/null +++ b/src/it/MJAR-260-invalid-automatic-module-name/invoker.properties @@ -0,0 +1,18 @@ +# 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.buildResult=failure diff --git a/src/it/MJAR-260-invalid-automatic-module-name/pom.xml b/src/it/MJAR-260-invalid-automatic-module-name/pom.xml new file mode 100644 index 00000000..4046808a --- /dev/null +++ b/src/it/MJAR-260-invalid-automatic-module-name/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + org.apache.maven.plugins + mjar260-invalid-automatic-module-name + MJAR-260-invalid-automatic-module-name + jar + 1.0-SNAPSHOT + + jar plugin it + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + in-valid.name.with.new.keyword + + + + + + + diff --git a/src/it/MJAR-260-invalid-automatic-module-name/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-260-invalid-automatic-module-name/src/main/java/myproject/HelloWorld.java new file mode 100644 index 00000000..fd0ad83c --- /dev/null +++ b/src/it/MJAR-260-invalid-automatic-module-name/src/main/java/myproject/HelloWorld.java @@ -0,0 +1,36 @@ +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( "Hi!" ); + } +} \ No newline at end of file diff --git a/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh b/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh new file mode 100644 index 00000000..2096dc19 --- /dev/null +++ b/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh @@ -0,0 +1,69 @@ + +/* + * 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.io.*; +import java.nio.file.*; +import java.util.*; +import java.util.jar.*; +import org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + File target = new File( basedir, "target" ); + if ( !target.exists() || !target.isDirectory() ) + { + System.err.println( "target file is missing or not a directory." ); + return false; + } + + File artifact = new File( target, "mjar260-invalid-automatic-module-name-1.0-SNAPSHOT.jar" ); + if ( artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "artifact file is created or a directory." ); + return false; + } + + String log = new String(Files.readAllBytes(basedir.toPath().resolve("build.log")), "UTF-8"); + String[] snippets = new String[] { + "[INFO] BUILD FAILURE", + "[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin", + "Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR", + "Caused by: org.codehaus.plexus.archiver.jar.ManifestException: Invalid automatic module name: 'in-valid.name.with.new.keyword'" + }; + + System.out.println("\nVerifying log snippets..."); + for (String snippet : snippets) { + if (!log.contains(snippet)) { + System.err.println("XXX| Snippet `" + snippet + "` not found"); + result = false; + continue; + } + System.out.println(" | `" + snippet + "` found in log"); + } +} +catch( Throwable e ) +{ + e.printStackTrace(); + result = false; +} + +return result; diff --git a/src/it/MJAR-260-valid-automatic-module-name/pom.xml b/src/it/MJAR-260-valid-automatic-module-name/pom.xml new file mode 100644 index 00000000..ede7f616 --- /dev/null +++ b/src/it/MJAR-260-valid-automatic-module-name/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + org.apache.maven.plugins + mjar260-valid-automatic-module-name + MJAR-260-valid-automatic-module-name + jar + 1.0-SNAPSHOT + + jar plugin it + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + valid.automatic.module.name + + + + + + + diff --git a/src/it/MJAR-260-valid-automatic-module-name/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-260-valid-automatic-module-name/src/main/java/myproject/HelloWorld.java new file mode 100644 index 00000000..fd0ad83c --- /dev/null +++ b/src/it/MJAR-260-valid-automatic-module-name/src/main/java/myproject/HelloWorld.java @@ -0,0 +1,36 @@ +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( "Hi!" ); + } +} \ No newline at end of file diff --git a/src/it/MJAR-260-valid-automatic-module-name/verify.bsh b/src/it/MJAR-260-valid-automatic-module-name/verify.bsh new file mode 100644 index 00000000..86db5ede --- /dev/null +++ b/src/it/MJAR-260-valid-automatic-module-name/verify.bsh @@ -0,0 +1,52 @@ + +/* + * 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.io.*; +import java.util.*; +import java.util.jar.*; +import org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + File target = new File( basedir, "target" ); + if ( !target.exists() || !target.isDirectory() ) + { + System.err.println( "target file is missing or not a directory." ); + return false; + } + + File artifact = new File( target, "mjar260-valid-automatic-module-name-1.0-SNAPSHOT.jar" ); + if ( !artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "artifact file is missing or a directory." ); + return false; + } + + +} +catch( Throwable e ) +{ + e.printStackTrace(); + result = false; +} + +return result; From 867041bb4eb862317b031fcf92971cd0a8b9ab25 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Thu, 6 Dec 2018 17:23:16 +0100 Subject: [PATCH 031/128] [MJAR-261] - Upgrade plexus-archiver 3.7.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 428e3447..1ba89892 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ org.codehaus.plexus plexus-archiver - 3.6.0 + 3.7.0 org.codehaus.plexus From e07216551316bc4cbbc7ae31c41bd494612b8c23 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 8 Dec 2018 12:45:42 +0100 Subject: [PATCH 032/128] [maven-release-plugin] prepare release maven-jar-plugin-3.1.1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1ba89892..6cd661b2 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.1.1-SNAPSHOT + 3.1.1 maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - HEAD + maven-jar-plugin-3.1.1 JIRA From bc84ec046173efccd2694da66923c1821822ede3 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sat, 8 Dec 2018 12:46:02 +0100 Subject: [PATCH 033/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6cd661b2..fc23b176 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.1.1 + 3.1.2-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - maven-jar-plugin-3.1.1 + HEAD JIRA From 660cb854c104f92e6816285ba52b15e260fd2a26 Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Sat, 5 Jan 2019 11:31:41 +0100 Subject: [PATCH 034/128] (doc) fix broken link --- CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23dc8847..a959f20e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,9 +31,9 @@ Getting Started + Make sure you have a [JIRA account](https://issues.apache.org/jira/). + Make sure you have a [GitHub account](https://github.com/signup/free). -+ If you're planning to implement a new feature, it makes sense to discuss your changes - on the [dev list](https://maven.apache.org/mail-lists.html) first. - This way you can make sure you're not wasting your time on something that isn't ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list](https://maven.apache.org/mail-lists.html) first. + This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Maven's scope. + Submit a ticket for your issue, assuming one does not already exist. + Clearly describe the issue, including steps to reproduce when it is a bug. @@ -44,7 +44,7 @@ Making and Submitting Changes -------------- We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the -main channel of communication for contributors. +main channel of communication for contributors. There are some guidelines which will make applying PRs easier for us: + Create a topic branch from where you want to base your work (this is usually the master branch). Push your changes to a topic branch in your fork of the repository. @@ -52,7 +52,7 @@ There are some guidelines which will make applying PRs easier for us: + Respect the original code style: by using the same [codestyle][code-style], patches should only highlight the actual difference, not being disturbed by any formatting issues: + Only use spaces for indentation. - + Create minimal diffs - disable on save actions like reformat source code or organize imports. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted, create a separate PR for this change. + Check for unnecessary whitespace with `git diff --check` before committing. + Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. @@ -85,7 +85,7 @@ Additional Resources + [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) + #Maven IRC channel on freenode.org -[dev-ml-list]: https://maven.apache.org/mail-lists.html +[dev-ml-list]: https://maven.apache.org/mailing-lists.html [code-style]: https://maven.apache.org/developers/conventions/code.html [cla]: https://www.apache.org/licenses/#clas [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index From 13d5a9ec187d813262d88a52f1ac0b8ca7d790d5 Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Sat, 5 Jan 2019 11:05:34 +0100 Subject: [PATCH 035/128] removing MockArtifact, not used --- .../maven/plugins/jar/MockArtifact.java | 303 ------------------ 1 file changed, 303 deletions(-) delete mode 100644 src/test/java/org/apache/maven/plugins/jar/MockArtifact.java diff --git a/src/test/java/org/apache/maven/plugins/jar/MockArtifact.java b/src/test/java/org/apache/maven/plugins/jar/MockArtifact.java deleted file mode 100644 index fac8d624..00000000 --- a/src/test/java/org/apache/maven/plugins/jar/MockArtifact.java +++ /dev/null @@ -1,303 +0,0 @@ -package org.apache.maven.plugins.jar; - -/* - * 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.io.File; -import java.util.Collection; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; - -/** - * @todo move to maven-artifact-test - */ -class MockArtifact - implements Artifact -{ - private String groupId; - - private String artifactId; - - private String version; - - private File file; - - private String scope; - - private String type; - - private String classifier; - - private String baseVersion; - - public String getGroupId() - { - return groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public String getVersion() - { - return version; - } - - public void setVersion( String string ) - { - this.version = string; - } - - public String getScope() - { - return scope; - } - - public String getType() - { - return type; - } - - public String getClassifier() - { - return classifier; - } - - public boolean hasClassifier() - { - return classifier != null; - } - - public File getFile() - { - return file; - } - - public void setFile( File file ) - { - this.file = file; - } - - public String getBaseVersion() - { - return baseVersion; - } - - public void setBaseVersion( String string ) - { - this.baseVersion = string; - } - - public String getId() - { - return null; - } - - public String getDependencyConflictId() - { - return null; - } - - public void addMetadata( ArtifactMetadata artifactMetadata ) - { - // intentionally empty. - } - - public Collection getMetadataList() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setRepository( ArtifactRepository artifactRepository ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactRepository getRepository() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void updateVersion( String string, ArtifactRepository artifactRepository ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public String getDownloadUrl() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setDownloadUrl( String string ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactFilter getDependencyFilter() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setDependencyFilter( ArtifactFilter artifactFilter ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactHandler getArtifactHandler() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public List getDependencyTrail() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setDependencyTrail( List list ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void setScope( String string ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public VersionRange getVersionRange() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setVersionRange( VersionRange versionRange ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void selectVersion( String string ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isSnapshot() - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setResolved( boolean b ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isResolved() - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setResolvedVersion( String string ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void setArtifactHandler( ArtifactHandler artifactHandler ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isRelease() - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setRelease( boolean b ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public List getAvailableVersions() - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setAvailableVersions( List list ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isOptional() - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setOptional( boolean b ) - { - //To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactVersion getSelectedVersion() - throws OverConstrainedVersionException - { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isSelectedVersionKnown() - throws OverConstrainedVersionException - { - return false; //To change body of implemented methods use File | Settings | File Templates. - } - - public void setGroupId( String groupId ) - { - this.groupId = groupId; - } - - public void setArtifactId( String artifactId ) - { - this.artifactId = artifactId; - } - - public void setType( String type ) - { - this.type = type; - } - - public void setClassifier( String classifier ) - { - this.classifier = classifier; - } - - public int compareTo( Artifact o ) - { - return 0; - } - - public ArtifactMetadata getMetadata( Class metadataClass ) - { - return null; - } -} From 78dbb2918fcb2086fe5601eb95bb294bcc274639 Mon Sep 17 00:00:00 2001 From: Plamen Totev Date: Sun, 30 Sep 2018 19:29:13 +0300 Subject: [PATCH 036/128] [MJAR-238] Allow setting of module main class Closes #2 from plamentotev:modular-jar-files --- pom.xml | 6 ++ .../invoker.properties | 18 +++++ .../MJAR-238-modular-jar-main-class/pom.xml | 57 ++++++++++++++ .../src/main/java/module-info.java | 22 ++++++ .../src/main/java/myproject/HelloWorld.java | 36 +++++++++ .../verify.bsh | 75 +++++++++++++++++++ .../maven/plugins/jar/AbstractJarMojo.java | 44 ++++++++++- src/site/apt/usage.apt.vm | 19 +++++ 8 files changed, 274 insertions(+), 3 deletions(-) create mode 100644 src/it/MJAR-238-modular-jar-main-class/invoker.properties create mode 100644 src/it/MJAR-238-modular-jar-main-class/pom.xml create mode 100644 src/it/MJAR-238-modular-jar-main-class/src/main/java/module-info.java create mode 100644 src/it/MJAR-238-modular-jar-main-class/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-238-modular-jar-main-class/verify.bsh diff --git a/pom.xml b/pom.xml index fc23b176..461636f3 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,7 @@ 3.3.0 + 3.0.0 3.0 7 @@ -96,6 +97,11 @@ maven-artifact ${mavenVersion} + + org.apache.maven.shared + file-management + ${mavenFileManagementVersion} + org.apache.maven maven-archiver diff --git a/src/it/MJAR-238-modular-jar-main-class/invoker.properties b/src/it/MJAR-238-modular-jar-main-class/invoker.properties new file mode 100644 index 00000000..95117185 --- /dev/null +++ b/src/it/MJAR-238-modular-jar-main-class/invoker.properties @@ -0,0 +1,18 @@ +# 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+ diff --git a/src/it/MJAR-238-modular-jar-main-class/pom.xml b/src/it/MJAR-238-modular-jar-main-class/pom.xml new file mode 100644 index 00000000..ebb31f6b --- /dev/null +++ b/src/it/MJAR-238-modular-jar-main-class/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + org.apache.maven.plugins + mjar-238-modular-jar-main-class + mjar-238-modular-jar-main-class + Verifies that the modular descriptor main class is set for modular Jar files + jar + 1.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + myproject.HelloWorld + + + + + + + + + + maven-compiler-plugin + + 1.9 + 1.9 + + + + + + diff --git a/src/it/MJAR-238-modular-jar-main-class/src/main/java/module-info.java b/src/it/MJAR-238-modular-jar-main-class/src/main/java/module-info.java new file mode 100644 index 00000000..fa450345 --- /dev/null +++ b/src/it/MJAR-238-modular-jar-main-class/src/main/java/module-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ + +module myproject { + exports myproject; +} diff --git a/src/it/MJAR-238-modular-jar-main-class/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-238-modular-jar-main-class/src/main/java/myproject/HelloWorld.java new file mode 100644 index 00000000..fd0ad83c --- /dev/null +++ b/src/it/MJAR-238-modular-jar-main-class/src/main/java/myproject/HelloWorld.java @@ -0,0 +1,36 @@ +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( "Hi!" ); + } +} \ No newline at end of file diff --git a/src/it/MJAR-238-modular-jar-main-class/verify.bsh b/src/it/MJAR-238-modular-jar-main-class/verify.bsh new file mode 100644 index 00000000..7774fe23 --- /dev/null +++ b/src/it/MJAR-238-modular-jar-main-class/verify.bsh @@ -0,0 +1,75 @@ +/* + * 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.io.*; +import java.lang.module.*; +import java.util.jar.*; + +boolean result = true; +JarFile jar; + +try +{ + File target = new File( basedir, "target" ); + if ( !target.exists() || !target.isDirectory() ) + { + System.err.println( "target file is missing or not a directory." ); + return false; + } + + File artifact = new File( target, "mjar-238-modular-jar-main-class-1.0-SNAPSHOT.jar" ); + if ( !artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "artifact file is missing or a directory." ); + return false; + } + + jar = new JarFile( artifact ); + + Attributes manifest = jar.getManifest().getMainAttributes(); + + if ( !"myproject.HelloWorld".equals( manifest.get( Attributes.Name.MAIN_CLASS ) ) ) + { + System.err.println( "Manifest main class attribute not equals myproject.HelloWorld" ); + return false; + } + + InputStream moduleDescriptorInputStream = jar.getInputStream( jar.getEntry( "module-info.class" ) ); + ModuleDescriptor moduleDescriptor = ModuleDescriptor.read( moduleDescriptorInputStream ); + + if ( !"myproject.HelloWorld".equals( moduleDescriptor.mainClass().orElse( null ) ) ) + { + System.err.println( "Module descriptor main class not equals myproject.HelloWorld" ); + return false; + } +} +catch( Throwable e ) +{ + e.printStackTrace(); + result = false; +} +finally +{ + if ( jar != null ) + { + jar.close(); + } +} + +return result; 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 a70591e1..27633509 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -28,10 +28,14 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; +import org.apache.maven.shared.model.fileset.FileSet; +import org.apache.maven.shared.model.fileset.util.FileSetManager; import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.jar.JarArchiver; import java.io.File; +import java.util.Arrays; +import java.util.Map; /** * Base class for creating a jar from project classes. @@ -47,6 +51,8 @@ public abstract class AbstractJarMojo private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" }; + private static final String MODULE_DESCRIPTOR_FILE_NAME = "module-info.class"; + /** * List of files to include. Specified as fileset patterns which are relative to the input directory whose contents * is being packaged into the JAR. @@ -76,8 +82,8 @@ public abstract class AbstractJarMojo /** * The Jar archiver. */ - @Component( role = Archiver.class, hint = "jar" ) - private JarArchiver jarArchiver; + @Component + private Map archivers; /** * The {@link {MavenProject}. @@ -201,9 +207,41 @@ public File createArchive() { File jarFile = getJarFile( outputDirectory, finalName, getClassifier() ); + FileSetManager fileSetManager = new FileSetManager(); + FileSet jarContentFileSet = new FileSet(); + jarContentFileSet.setDirectory( getClassesDirectory().getAbsolutePath() ); + jarContentFileSet.setIncludes( Arrays.asList( getIncludes() ) ); + jarContentFileSet.setExcludes( Arrays.asList( getExcludes() ) ); + + boolean containsModuleDescriptor = false; + String[] includedFiles = fileSetManager.getIncludedFiles( jarContentFileSet ); + for ( String includedFile : includedFiles ) + { + // 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; + } + } + MavenArchiver archiver = new MavenArchiver(); - archiver.setArchiver( jarArchiver ); + if ( containsModuleDescriptor ) + { + archiver.setArchiver( (JarArchiver) archivers.get( "mjar" ) ); + } + else + { + archiver.setArchiver( (JarArchiver) archivers.get( "jar" ) ); + } archiver.setOutputFile( jarFile ); diff --git a/src/site/apt/usage.apt.vm b/src/site/apt/usage.apt.vm index 69ab5718..ee7284b8 100644 --- a/src/site/apt/usage.apt.vm +++ b/src/site/apt/usage.apt.vm @@ -78,3 +78,22 @@ mvn package the {{{/guides/introduction/introduction-to-the-lifecycle.html}Maven Build Life Cycle}}. For full documentation, click {{{./plugin-info.html}here}}. + +* Modular JAR files + + The {{{https://openjdk.java.net/projects/jigsaw/spec/}Java Platform Module System (JPMS)}} introduced + {{{https://cr.openjdk.java.net/~mr/jigsaw/spec/jar.html}changes in the JAR file specifications}} + as well - Modular JAR files. Modular JAR files are JAR files with <<>> file in the root directory + (or in the versioned area for multi-release JAR files). If the project contains <<>> + the resulting JAR will be a Modular JAR without a need for any configuration regardless of the plugin version used. + + Starting with version 3.1.2, if the JAR file contains <<>>, this plugin will update + the modular descriptor (<<>>) with additional attributes such as the list of packages included + and will validate the resulting modular descriptor (for example if all services provided by the module are actually + included in the JAR file). The most notable additional attribute added is the module main class. + If the JAR manifest contains <<>> attribute this plugin will set the module main class to the same value + (for example how to set it read {{{../../shared/maven-archiver/examples/classpath.html}Make The Jar Executable}}). + Internally the plugin uses the JDK <<>> tool so in order to add the additional attributes and to + verify the modular descriptor Maven should be run with JDK version 9 or newer. If version 8 or earlier is used + the resulting JAR still will be Modular JAR (as it contains <<>>) but no additional attributes + will be added and no validation will be performed. From 8164b8a7372501f5f81a00b5d011a19410107b46 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Wed, 8 May 2019 21:44:49 +0200 Subject: [PATCH 037/128] [MJAR-259] - Archiving to jar is very slow o Upgraded maven-archiver to 3.4.0 o Upgraded plexus-archiver to 4.1.0 o Upgraded plexus-utils to 3.2.0 o Added maven-shared-utils 3.2.1 to override the one which is used by file-management. o Fixed IT's which relied on "Created-By" in MANIFEST.MF Removed deprecated IMPLEMENTATION_VENDOR_ID in MANIFEST --- pom.xml | 24 ++++++++++++++++++------ src/it/MJAR-228/verify.bsh | 6 ------ src/it/manifest-content/verify.bsh | 14 +------------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 461636f3..fa285d2f 100644 --- a/pom.xml +++ b/pom.xml @@ -75,8 +75,8 @@ - 3.3.0 3.0.0 + 3.4.0 3.0 7 @@ -118,16 +118,28 @@ ! so we define it here explicit to make sure we get the ! correct version for plexus-archiver and plexus-utils. --> + - org.codehaus.plexus - plexus-archiver - 3.7.0 + org.apache.maven.shared + maven-shared-utils + 3.2.1 org.codehaus.plexus - plexus-utils - 3.1.0 + plexus-archiver + 4.1.0 + + org.codehaus.plexus + plexus-utils + 3.2.0 + junit junit diff --git a/src/it/MJAR-228/verify.bsh b/src/it/MJAR-228/verify.bsh index 09eb0a2a..f0aaa2cc 100644 --- a/src/it/MJAR-228/verify.bsh +++ b/src/it/MJAR-228/verify.bsh @@ -45,12 +45,6 @@ try Attributes manifest = jar.getManifest().getMainAttributes(); - if ( !manifest.getValue( new Attributes.Name( "Created-By" ) ).startsWith( "Apache Maven" ) ) - { - System.err.println( "Created-By not equals Apache Maven" ); - return false; - } - if ( !"myproject.HelloWorld".equals( manifest.get( Attributes.Name.MAIN_CLASS ) ) ) { System.err.println( Attributes.Name.MAIN_CLASS.toString() + " not equals myproject.HelloWorld" ); diff --git a/src/it/manifest-content/verify.bsh b/src/it/manifest-content/verify.bsh index 122bfa54..dfd1842b 100644 --- a/src/it/manifest-content/verify.bsh +++ b/src/it/manifest-content/verify.bsh @@ -25,6 +25,7 @@ import org.codehaus.plexus.util.*; boolean result = true; + try { File target = new File( basedir, "target" ); @@ -45,13 +46,6 @@ try Attributes manifest = jar.getManifest().getMainAttributes(); - if ( !manifest.getValue( new Attributes.Name( "Created-By" ) ).startsWith( "Apache Maven" ) ) - { - System.err.println( "Created-By not equals Apache Maven" ); - return false; - } - - if ( !"manifest-content-it".equals( manifest.get( Attributes.Name.SPECIFICATION_TITLE ) ) ) { System.err.println( Attributes.Name.SPECIFICATION_TITLE.toString() + " not equals manifest-content-it" ); @@ -84,12 +78,6 @@ try return false; } - if ( !"org.apache.maven.plugins".equals( manifest.get( Attributes.Name.IMPLEMENTATION_VENDOR_ID ) ) ) - { - System.err.println( Attributes.Name.IMPLEMENTATION_VENDOR_ID.toString() + " not equals org.apache.maven.plugins" ); - return false; - } - if ( !"jar plugin it".equals( manifest.get( Attributes.Name.IMPLEMENTATION_VENDOR ) ) ) { System.err.println( Attributes.Name.IMPLEMENTATION_VENDOR.toString() + " not equals jar plugin it" ); From 783d893461888533f64893c7e999f3b6c1608b0f Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Wed, 8 May 2019 22:13:58 +0200 Subject: [PATCH 038/128] [maven-release-plugin] prepare release maven-jar-plugin-3.1.2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fa285d2f..e99bdd6c 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.1.2-SNAPSHOT + 3.1.2 maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - HEAD + maven-jar-plugin-3.1.2 JIRA From 80f58a84aacff6e671f5a601d62a3a3800b507dc Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Wed, 8 May 2019 22:14:18 +0200 Subject: [PATCH 039/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e99bdd6c..9c05f0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.1.2 + 3.1.3-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - maven-jar-plugin-3.1.2 + HEAD JIRA From 64c5e6530b4712cd95501fffb2de6bb1a202cd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 21 Sep 2019 18:59:12 +0200 Subject: [PATCH 040/128] MJAR-263 make output jars reproducible like m-source-p --- pom.xml | 17 ++++++++--------- .../maven/plugins/jar/AbstractJarMojo.java | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 9c05f0b3..dbb1d331 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.1.3-SNAPSHOT + 3.2.0-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -76,7 +76,7 @@ 3.0.0 - 3.4.0 + 3.5.0 3.0 7 @@ -133,13 +133,13 @@ org.codehaus.plexus plexus-archiver - 4.1.0 + 4.2.1 - - org.codehaus.plexus - plexus-utils - 3.2.0 - + + org.codehaus.plexus + plexus-utils + 3.3.0 + junit junit @@ -199,7 +199,6 @@ clean package - true true 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 27633509..68da0ecd 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -140,6 +140,16 @@ public abstract class AbstractJarMojo @Parameter( defaultValue = "false" ) private boolean skipIfEmpty; + /** + * Timestamp for reproducible output archive entries, either formatted as ISO 8601 + * yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like + * SOURCE_DATE_EPOCH). + * + * @since 3.2.0 + */ + @Parameter( defaultValue = "${project.build.outputTimestamp}" ) + private String outputTimestamp; + /** * Return the specific output directory to serve as the root for the archive. * @return get classes directory. @@ -233,6 +243,7 @@ public File createArchive() } MavenArchiver archiver = new MavenArchiver(); + archiver.setCreatedBy( "Maven Jar Plugin", "org.apache.maven.plugins", "maven-jar-plugin" ); if ( containsModuleDescriptor ) { @@ -245,6 +256,9 @@ public File createArchive() archiver.setOutputFile( jarFile ); + // configure for Reproducible Builds based on outputTimestamp value + archiver.configureReproducible( outputTimestamp ); + archive.setForced( forceCreation ); try From d91fff882f19b0ba9ba90aceca53447cada824ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 29 Oct 2019 22:47:00 +0100 Subject: [PATCH 041/128] [maven-release-plugin] prepare release maven-jar-plugin-3.2.0 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dbb1d331..ebcd1529 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.2.0-SNAPSHOT + 3.2.0 maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - HEAD + maven-jar-plugin-3.2.0 JIRA From e036eb2a511c6771c172b23d9d33c5563f1d7ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 29 Oct 2019 22:47:26 +0100 Subject: [PATCH 042/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ebcd1529..897ef480 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.2.0 + 3.2.1-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - maven-jar-plugin-3.2.0 + HEAD JIRA From 603fc7cd761af12c4543861a3f0edcabae5bedcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 7 Apr 2020 23:23:46 +0200 Subject: [PATCH 043/128] [MJAR-270] make build Reproducible --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 897ef480..95efe079 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ maven-plugins org.apache.maven.plugins - 33 + 34 ../../pom/maven/maven-plugins/pom.xml @@ -79,6 +79,7 @@ 3.5.0 3.0 7 + 2020-04-07T21:04:00Z From 92586ccba42734e7a158b5434cca95a33de2c70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 11 Apr 2020 16:53:33 +0200 Subject: [PATCH 044/128] fixed link to mailing lists --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f31a022..6ec4ad93 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -Contributing to Apache Maven JAR Plugin +Contributing to [Apache Maven JAR Plugin](https://maven.apache.org/plugins/maven-jar-plugin/) ====================== [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] @@ -35,7 +35,7 @@ Getting Started + Make sure you have a [JIRA account](https://issues.apache.org/jira/). + Make sure you have a [GitHub account](https://github.com/signup/free). + If you're planning to implement a new feature, it makes sense to discuss your changes - on the [dev list](https://maven.apache.org/mail-lists.html) first. + on the [dev list][ml-list] first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Maven's scope. + Submit a ticket for your issue, assuming one does not already exist. @@ -46,7 +46,7 @@ Getting Started Making and Submitting Changes -------------- -We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the +We accept Pull Requests via GitHub. The [developer mailing list][ml-list] is the main channel of communication for contributors. There are some guidelines which will make applying PRs easier for us: + Create a topic branch from where you want to base your work (this is usually the master branch). @@ -89,7 +89,7 @@ Additional Resources + #Maven IRC channel on freenode.org [license]: https://www.apache.org/licenses/LICENSE-2.0 -[dev-ml-list]: https://maven.apache.org/mailing-lists.html +[ml-list]: https://maven.apache.org/mailing-lists.html [code-style]: https://maven.apache.org/developers/conventions/code.html [cla]: https://www.apache.org/licenses/#clas [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index From d5c579757005074cf27bdb7eae1fba68f8e0f651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 11 Apr 2020 21:20:10 +0200 Subject: [PATCH 045/128] added ASF Jira badge --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ec4ad93..c1ef6aee 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Contributing to [Apache Maven JAR Plugin](https://maven.apache.org/plugins/maven-jar-plugin/) ====================== +[![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MJAR.json)][jira] [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven.plugins%22%20AND%20a%3A%22maven-jar-plugin%22) [![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?style=flat-square)][build] @@ -81,13 +82,14 @@ Additional Resources -------------------- + [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) -+ [Apache Maven Help JIRA project page](https://issues.apache.org/jira/projects/MJAR/) ++ [Apache Maven Help JIRA project page][jira] + [Contributor License Agreement][cla] + [General GitHub documentation](https://help.github.com/) + [GitHub pull request documentation](https://help.github.com/send-pull-requests/) + [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) + #Maven IRC channel on freenode.org +[jira]: https://issues.apache.org/jira/projects/MJAR/ [license]: https://www.apache.org/licenses/LICENSE-2.0 [ml-list]: https://maven.apache.org/mailing-lists.html [code-style]: https://maven.apache.org/developers/conventions/code.html From 7c1d027af2e0a9739eb297afa85b3c0a50af2309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 11 Apr 2020 21:36:32 +0200 Subject: [PATCH 046/128] fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1ef6aee..391d9576 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Additional Resources -------------------- + [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) -+ [Apache Maven Help JIRA project page][jira] ++ [Apache Maven JAR Plugin JIRA project page][jira] + [Contributor License Agreement][cla] + [General GitHub documentation](https://help.github.com/) + [GitHub pull request documentation](https://help.github.com/send-pull-requests/) From bbcffc55b70965476cf041e36eb12f73648ad9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 12 Apr 2020 12:40:00 +0200 Subject: [PATCH 047/128] added ASF GitHub config --- .asf.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .asf.yaml diff --git a/.asf.yaml b/.asf.yaml new file mode 100644 index 00000000..e7b043ef --- /dev/null +++ b/.asf.yaml @@ -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. +# +# see https://s.apache.org/asfyaml +github: + description: "Apache Maven JAR Plugin" + homepage: https://maven.apache.org/plugins/maven-jar-plugin/ + labels: + - java + - build-management + - maven-plugins + - maven-jar-plugin + - maven From 8ae862722e1013c075262c1c4bc603174b686191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 12 Apr 2020 15:14:28 +0200 Subject: [PATCH 048/128] fixed broken links (MPIR 3) --- src/site/apt/index.apt.vm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index dc0d4679..5f63cb74 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -78,16 +78,16 @@ ${project.name} specific use cases are described in the examples given below. In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel - free to contact the {{{./mail-lists.html}user mailing list}}. The posts to the mailing list are archived and could + free to contact the {{{./mailing-lists.html}user mailing list}}. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching - the {{{./mail-lists.html}mail archive}}. + the {{{./mailing-lists.html}mail archive}}. If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our - {{{./issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your + {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our - {{{./source-repository.html}source repository}} and will find supplementary information in the + {{{./scm.html}source repository}} and will find supplementary information in the {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. * Archiver Configuration From e07675a0678ebe876c453944592b1fb9723f6881 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 13 Apr 2020 10:33:07 -0400 Subject: [PATCH 049/128] [MNGSITE-393] remove more pre Maven 3 content @eolivelli --- src/site/apt/index.apt.vm | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index 5f63cb74..be03d36d 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -38,39 +38,6 @@ ${project.name} * {{{./test-jar-mojo.html}jar:test-jar}} create a jar file for your project test classes . - [] - -* Major Version Upgrade to version 3.0.0 - - Please note that the following parameter has been completely removed from the plugin configuration: - - * useDefaultManifestFile - - If you need to define your own <> file you can simply achieve that via - {{{http://maven.apache.org/shared/maven-archiver/index.html}Maven Archiver}} configuration - like in the following example: - -+-----------------+ - - ... - - - - org.apache.maven.plugins - maven-jar-plugin - ${project.version} - - - \${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - ... - - - - ... - -+-----------------+ * Usage From 536e2e3c4aa837cc99f46738d039805b1bb6b220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 13 Apr 2020 22:21:19 +0200 Subject: [PATCH 050/128] README improvement --- CONTRIBUTING.md | 91 ------------------------------------------------- README.md | 6 ++-- 2 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index a959f20e..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,91 +0,0 @@ - -Contributing to Apache Maven Jar Plugin -====================== - -You have found a bug or you have an idea for a cool new feature? Contributing -code is a great way to give something back to the open source community. Before -you dig right into the code, there are a few guidelines that we need -contributors to follow so that we can have a chance of keeping on top of -things. - -Some of the ideas are documented in the [Maven Wiki][maven-wiki] -which might be interesting to read and for further discussion. - -Getting Started ---------------- - -+ Make sure you have a [JIRA account](https://issues.apache.org/jira/). -+ Make sure you have a [GitHub account](https://github.com/signup/free). -+ If you're planning to implement a new feature, it makes sense to discuss your changes - on the [dev list](https://maven.apache.org/mail-lists.html) first. - This way you can make sure you're not wasting your time on something that isn't - considered to be in Apache Maven's scope. -+ Submit a ticket for your issue, assuming one does not already exist. - + Clearly describe the issue, including steps to reproduce when it is a bug. - + Make sure you fill in the earliest version that you know has the issue. -+ Fork the repository on GitHub. - -Making and Submitting Changes --------------- - -We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the -main channel of communication for contributors. -There are some guidelines which will make applying PRs easier for us: -+ Create a topic branch from where you want to base your work (this is usually the master branch). - Push your changes to a topic branch in your fork of the repository. -+ Make commits of logical units. -+ Respect the original code style: by using the same [codestyle][code-style], - patches should only highlight the actual difference, not being disturbed by any formatting issues: - + Only use spaces for indentation. - + Create minimal diffs - disable on save actions like reformat source code or organize imports. - If you feel the source code should be reformatted, create a separate PR for this change. - + Check for unnecessary whitespace with `git diff --check` before committing. -+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. -``` -[MJAR-XXX] - Subject of the JIRA Ticket - Optional supplemental description. -``` -+ Make sure you have added the necessary tests (JUnit/IT) for your changes. -+ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. -+ Submit a pull request to the repository in the Apache organization. -+ Update your JIRA ticket and include a link to the pull request in the ticket. - -If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. - -Making Trivial Changes ----------------------- - -For changes of a trivial nature to comments and documentation, it is not always -necessary to create a new ticket in JIRA. In this case, it is appropriate to -start the first line of a commit with '(doc)' instead of a ticket number. - -Additional Resources --------------------- - -+ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) -+ [Apache Maven Jar JIRA project page](https://issues.apache.org/jira/projects/MJAR/) -+ [Contributor License Agreement][cla] -+ [General GitHub documentation](https://help.github.com/) -+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) -+ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) -+ #Maven IRC channel on freenode.org - -[dev-ml-list]: https://maven.apache.org/mailing-lists.html -[code-style]: https://maven.apache.org/developers/conventions/code.html -[cla]: https://www.apache.org/licenses/#clas -[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index diff --git a/README.md b/README.md index 391d9576..837bf842 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Contributing to [Apache Maven JAR Plugin](https://maven.apache.org/plugins/maven [![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MJAR.json)][jira] [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] -[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven.plugins%22%20AND%20a%3A%22maven-jar-plugin%22) -[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?style=flat-square)][build] -[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?style=flat-square)][test-results] +[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-jar-plugin) +[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?)][test-results] You have found a bug or you have an idea for a cool new feature? Contributing From 27ad1dbe981e76115dc6fc2758fbaf9a1b213a16 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sat, 4 Jul 2020 08:13:18 -0400 Subject: [PATCH 051/128] compat not needed (#10) * compat not needed * fix up indent --- pom.xml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 95efe079..6743a49e 100644 --- a/pom.xml +++ b/pom.xml @@ -136,23 +136,17 @@ plexus-archiver 4.2.1 - - org.codehaus.plexus - plexus-utils - 3.3.0 - + + org.codehaus.plexus + plexus-utils + 3.3.0 + junit junit 4.12 test - - org.apache.maven - maven-compat - ${mavenVersion} - test - org.apache.maven.plugin-testing maven-plugin-testing-harness From 0e3d1f72b243df48fa3f3720067542770a169591 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sat, 4 Jul 2020 08:59:04 -0400 Subject: [PATCH 052/128] ignore .checkstyle (#12) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f79c9285..7495d7e2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ out/ /bootstrap /dependencies.xml .java-version +.checkstyle From 9459558149dcce81514f5fab29a40bf6cdfa8f9e Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sat, 4 Jul 2020 09:10:10 -0400 Subject: [PATCH 053/128] Two minor dependency updates (#11) * update JUnit * update plexus archiver --- pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 6743a49e..3443a446 100644 --- a/pom.xml +++ b/pom.xml @@ -134,17 +134,17 @@ org.codehaus.plexus plexus-archiver - 4.2.1 + 4.2.2 + + + org.codehaus.plexus + plexus-utils + 3.3.0 - - org.codehaus.plexus - plexus-utils - 3.3.0 - junit junit - 4.12 + 4.13 test From 2a2b37169e5a0996ad5f594bceeba8d2fbf3f061 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sat, 4 Jul 2020 09:09:11 -0400 Subject: [PATCH 054/128] simplify test --- .../apache/maven/plugins/jar/JarMojoTest.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java index 601b7698..8fc256c3 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java @@ -34,26 +34,14 @@ public class JarMojoTest { private File testPom = new File( getBasedir(), "src/test/resources/unit/jar-basic-test/pom.xml" ); - protected void setUp() - throws Exception - { - - // required for mojo lookups to work - super.setUp(); - - } - /** - * tests the proper discovery and configuration of the mojo + * Tests the discovery and configuration of the mojo. * - * @throws Exception in case of an error. + * @throws Exception in case of an error */ public void testJarTestEnvironment() throws Exception { - - // File pom = new File( getBasedir(), "src/test/resources/unit/clean/pom.xml" ); - JarMojo mojo = (JarMojo) lookupMojo( "jar", testPom ); assertNotNull( mojo ); From dd116eb31a8db958dd0cb26d569b3dba1a2863bc Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sat, 4 Jul 2020 10:36:25 -0400 Subject: [PATCH 055/128] fix link to issue tracker (#14) It was 404 --- src/site/apt/index.apt.vm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index be03d36d..6b7bd44c 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -29,7 +29,7 @@ ${project.name} This plugin provides the capability to build jars. - If you like to sign jars please use the + To sign jars, use the {{{/plugins/maven-jarsigner-plugin/}Maven Jarsigner Plugin}}. * Goals Overview @@ -42,24 +42,24 @@ ${project.name} * Usage General instructions on how to use the JAR Plugin can be found on the {{{./usage.html}usage page}}. Some more - specific use cases are described in the examples given below. + specific use cases are described in the examples below. In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel free to contact the {{{./mailing-lists.html}user mailing list}}. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the {{{./mailing-lists.html}mail archive}}. - If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our - {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your + If you feel like the plugin is missing a feature or has a defect, you can file a feature request or bug report in our + {{{https://issues.apache.org/jira/projects/MJAR/issues}issue tracker}}. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, - entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. + entire debug logs, POMs, or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our {{{./scm.html}source repository}} and will find supplementary information in the {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. * Archiver Configuration - The plugin use Maven Archiver to handle jar content and manifest configuration. + The plugin uses Maven Archiver to handle jar content and manifest configuration. You can have a look at the {{{/shared/maven-archiver/}Maven Archiver Documentation}} to understand how to setup this. From f99acf76a17ee020a705bea3c56316836c465fc9 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 5 Jul 2020 14:14:20 -0400 Subject: [PATCH 056/128] update minimum Maven version to 3.1.0 --- pom.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3443a446..47e681e7 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ 3.0.0 3.5.0 - 3.0 + 3.1.0 7 2020-04-07T21:04:00Z @@ -150,7 +150,13 @@ org.apache.maven.plugin-testing maven-plugin-testing-harness - 2.1 + 3.1.0 + test + + + org.apache.maven + maven-compat + ${mavenVersion} test
From 3586300c9a455f193738ced7c95da0937d369231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Fri, 28 Aug 2020 09:36:58 +0200 Subject: [PATCH 057/128] update ASF CI url --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 837bf842..7a55304f 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ Contributing to [Apache Maven JAR Plugin](https://maven.apache.org/plugins/maven [![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MJAR.json)][jira] [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-jar-plugin) -[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?)][build] -[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master.svg?)][test-results] +[![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][test-results] You have found a bug or you have an idea for a cool new feature? Contributing @@ -95,5 +95,5 @@ Additional Resources [code-style]: https://maven.apache.org/developers/conventions/code.html [cla]: https://www.apache.org/licenses/#clas [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index -[test-results]: https://builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master/lastCompletedBuild/testReport/ -[build]: https://builds.apache.org/job/maven-box/job/maven-jar-plugin/job/master/ +[test-results]: https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master/lastCompletedBuild/testReport/ +[build]: https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master/ From 94d752200a2a90e953f8255599e13cc967fd7823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 29 Aug 2020 10:21:24 +0200 Subject: [PATCH 058/128] update ASF CI url --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 47e681e7..de495d21 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@
Jenkins - https://builds.apache.org/job/maven-box/job/maven-jar-plugin/ + https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/ From 9b8044c5e878dd3f60fe50afe9784e7f9492c30d Mon Sep 17 00:00:00 2001 From: Michael Boyles Date: Fri, 18 Sep 2020 21:34:36 +0100 Subject: [PATCH 059/128] (doc) fixed duplicate link text Closes #16 --- src/site/apt/examples/create-test-jar.apt.vm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/site/apt/examples/create-test-jar.apt.vm b/src/site/apt/examples/create-test-jar.apt.vm index 5b7d9621..cc82ea53 100644 --- a/src/site/apt/examples/create-test-jar.apt.vm +++ b/src/site/apt/examples/create-test-jar.apt.vm @@ -91,7 +91,6 @@ How to create a jar containing test classes <<>> for the second one. The parts <<>>, <<>> will be replaced by the values given within your project <<>> file. The <<>> will be set to <<>> which is a default of the maven-jar-plugin which can be changed if you need by - using the configuration in the jar goal {{{../test-jar-mojo.html}using the configuration in the jar goal}}. <> The downside of this solution is that you don't get the transitive <<>>-scoped dependencies automatically. From 1fa79d0e581fef8879aa9a0aa088531661ac5a40 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 19 Sep 2020 09:12:39 +0200 Subject: [PATCH 060/128] Bump maven-shared-utils from 3.2.1 to 3.3.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index de495d21..445fa740 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ org.apache.maven.shared maven-shared-utils - 3.2.1 + 3.3.3 org.codehaus.plexus From 4bf3895e89ba620fcdb0205b2bb700f97eb7ec86 Mon Sep 17 00:00:00 2001 From: rfscholte Date: Sat, 17 Oct 2020 11:07:57 +0200 Subject: [PATCH 061/128] Update plexus archiver (to solve JDK-8177809) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 445fa740..5f95e5ec 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,7 @@ org.codehaus.plexus plexus-archiver - 4.2.2 + 4.2.3 org.codehaus.plexus From 4027e40376031d8be01abddeb21de16e98ea0c58 Mon Sep 17 00:00:00 2001 From: Romain Manni-Bucau Date: Wed, 2 Dec 2020 09:48:50 +0100 Subject: [PATCH 062/128] [MJAR-276] don't log useless warning when jar creation is forced and directory does not exist --- .../java/org/apache/maven/plugins/jar/AbstractJarMojo.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 68da0ecd..d7b298ff 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -266,7 +266,10 @@ public File createArchive() File contentDirectory = getClassesDirectory(); if ( !contentDirectory.exists() ) { - getLog().warn( "JAR will be empty - no content was marked for inclusion!" ); + if ( !forceCreation ) + { + getLog().warn( "JAR will be empty - no content was marked for inclusion!" ); + } } else { From 9989a352d3f4cb7c411eb0110dd326acc4029885 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Wed, 31 Mar 2021 17:35:09 +0000 Subject: [PATCH 063/128] docs: grammar @khmarbaise --- src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java b/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java index 5c904497..10a7c38f 100644 --- a/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java @@ -53,7 +53,7 @@ public class TestJarMojo private File testClassesDirectory; /** - * Classifier to used for {@code test-jar}. + * Classifier to use for {@code test-jar}. */ @Parameter( defaultValue = "tests" ) private String classifier; From 69a2821c866efa5f7f500573ffddad2e21476acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 25 Jul 2021 11:30:45 +0200 Subject: [PATCH 064/128] update CI url --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a55304f..602fab83 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ Contributing to [Apache Maven JAR Plugin](https://maven.apache.org/plugins/maven [![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MJAR.json)][jira] [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-jar-plugin) -[![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][build] -[![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][test-results] +[![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][test-results] You have found a bug or you have an idea for a cool new feature? Contributing @@ -95,5 +95,5 @@ Additional Resources [code-style]: https://maven.apache.org/developers/conventions/code.html [cla]: https://www.apache.org/licenses/#clas [maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index -[test-results]: https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master/lastCompletedBuild/testReport/ -[build]: https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master/ +[test-results]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master/lastCompletedBuild/testReport/ +[build]: https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master/ From cc5256e33ebc24cb54aa786892857d22c46ebddd Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 14 Oct 2021 11:19:50 +1000 Subject: [PATCH 065/128] add gh actions Signed-off-by: Olivier Lamy --- .github/dependabot.yml | 27 ++++++++++++++++++++++ .github/workflows/maven.yml | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/maven.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..9c761915 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,27 @@ +# 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. + +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 00000000..8994aa78 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,46 @@ +# 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. + +name: GitHub CI + +on: [push, pull_request] + +jobs: + build: + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + java: [8, 11, 17] + jdk: [temurin, zulu] + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: ${{ matrix.jdk }} + java-version: ${{ matrix.java }} + cache: 'maven' + + - name: Build with Maven + run: mvn verify --errors --batch-mode --show-version -P run-its From bf30b44a9fabf82389764afee459689dc08d5892 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 02:18:58 +0000 Subject: [PATCH 066/128] Bump maven-shared-utils from 3.3.3 to 3.3.4 Bumps [maven-shared-utils](https://github.com/apache/maven-shared-utils) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/apache/maven-shared-utils/releases) - [Commits](https://github.com/apache/maven-shared-utils/compare/maven-shared-utils-3.3.3...maven-shared-utils-3.3.4) --- updated-dependencies: - dependency-name: org.apache.maven.shared:maven-shared-utils dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5f95e5ec..01422650 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ org.apache.maven.shared maven-shared-utils - 3.3.3 + 3.3.4 org.codehaus.plexus From fa0b0be7a20a3231fca4384bc8704f161db4d6f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 03:41:45 +0000 Subject: [PATCH 067/128] Bump plexus-archiver from 4.2.3 to 4.2.5 Bumps [plexus-archiver](https://github.com/codehaus-plexus/plexus-archiver) from 4.2.3 to 4.2.5. - [Release notes](https://github.com/codehaus-plexus/plexus-archiver/releases) - [Changelog](https://github.com/codehaus-plexus/plexus-archiver/blob/master/ReleaseNotes.md) - [Commits](https://github.com/codehaus-plexus/plexus-archiver/compare/plexus-archiver-4.2.3...plexus-archiver-4.2.5) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-archiver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5f95e5ec..b89f2ed6 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,7 @@ org.codehaus.plexus plexus-archiver - 4.2.3 + 4.2.5 org.codehaus.plexus From 9c93c7e20cda6a64d6eec663d1ba2f687b79a3d1 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 15 Oct 2021 11:47:12 +1000 Subject: [PATCH 068/128] use shared gh action (#24) Signed-off-by: Olivier Lamy --- .github/workflows/maven.yml | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 8994aa78..04dabf26 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,26 +21,5 @@ on: [push, pull_request] jobs: build: - - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - java: [8, 11, 17] - jdk: [temurin, zulu] - fail-fast: false - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout - uses: actions/checkout@v2.3.4 - - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: ${{ matrix.jdk }} - java-version: ${{ matrix.java }} - cache: 'maven' - - - name: Build with Maven - run: mvn verify --errors --batch-mode --show-version -P run-its + name: Verify + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify-with-its.yml@main From ce233813295be29bbb642b3c62e6988ea64b11ad Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 15 Oct 2021 18:45:12 +1000 Subject: [PATCH 069/128] ignore dependabot branches Signed-off-by: Olivier Lamy --- .github/workflows/maven.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 04dabf26..79fd7b51 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -17,7 +17,11 @@ name: GitHub CI -on: [push, pull_request] +on: + push: + branches-ignore: + - dependabot/** + pull_request: jobs: build: From a7cfde955c340d33529afecf99c3c18f9b82841b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 02:24:46 +0000 Subject: [PATCH 070/128] Bump junit from 4.13 to 4.13.2 Bumps [junit](https://github.com/junit-team/junit4) from 4.13 to 4.13.2. - [Release notes](https://github.com/junit-team/junit4/releases) - [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.2.md) - [Commits](https://github.com/junit-team/junit4/compare/r4.13...r4.13.2) --- updated-dependencies: - dependency-name: junit:junit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 775576c2..5468533f 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ junit junit - 4.13 + 4.13.2 test From a49629478c6e4f3efb34c2d6fbbbdca8aa3d09fc Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Thu, 28 Oct 2021 03:48:15 +0200 Subject: [PATCH 071/128] use shared gh action - v1 (#28) --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 79fd7b51..f0828015 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,4 +26,4 @@ on: jobs: build: name: Verify - uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify-with-its.yml@main + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v1 From 34d62b64243bfc96765e774937757aa6dd1e26ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 02:41:02 +0000 Subject: [PATCH 072/128] Bump maven-archiver from 3.5.0 to 3.5.1 Bumps [maven-archiver](https://github.com/apache/maven-archiver) from 3.5.0 to 3.5.1. - [Release notes](https://github.com/apache/maven-archiver/releases) - [Commits](https://github.com/apache/maven-archiver/compare/maven-archiver-3.5.0...maven-archiver-3.5.1) --- updated-dependencies: - dependency-name: org.apache.maven:maven-archiver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5468533f..6ffb18e6 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ 3.0.0 - 3.5.0 + 3.5.1 3.1.0 7 2020-04-07T21:04:00Z From e44e5f2c2bf9a0b76bf4dedcba676cbd7b6e6a11 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Wed, 5 Jan 2022 18:32:51 +0100 Subject: [PATCH 073/128] [MJAR-282] Upgrade Maven Archiver to 3.5.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6ffb18e6..8dd152b2 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ 3.0.0 - 3.5.1 + 3.5.2 3.1.0 7 2020-04-07T21:04:00Z From 0fb2bf0ff2b83d7b8e7efcb08160793fa91af5e4 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Wed, 5 Jan 2022 19:17:22 +0100 Subject: [PATCH 074/128] Proper uppercase JAR --- src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d7b298ff..5b7ca642 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -243,7 +243,7 @@ public File createArchive() } MavenArchiver archiver = new MavenArchiver(); - archiver.setCreatedBy( "Maven Jar Plugin", "org.apache.maven.plugins", "maven-jar-plugin" ); + archiver.setCreatedBy( "Maven JAR Plugin", "org.apache.maven.plugins", "maven-jar-plugin" ); if ( containsModuleDescriptor ) { From 50a8e0b1cd43f5b4319226a7579c6feee063698d Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Wed, 5 Jan 2022 19:21:37 +0100 Subject: [PATCH 075/128] [maven-release-plugin] prepare release maven-jar-plugin-3.2.1 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 8dd152b2..f4562621 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.2.1-SNAPSHOT + 3.2.1 maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - HEAD + maven-jar-plugin-3.2.1 JIRA @@ -79,7 +79,7 @@ 3.5.2 3.1.0 7 - 2020-04-07T21:04:00Z + 2022-01-05T18:21:27Z From 95bc15b7a08b639ba282930b6d92a85e504af2e8 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Wed, 5 Jan 2022 19:21:46 +0100 Subject: [PATCH 076/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index f4562621..1c5e5be2 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.2.1 + 3.2.2-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - maven-jar-plugin-3.2.1 + HEAD JIRA @@ -79,7 +79,7 @@ 3.5.2 3.1.0 7 - 2022-01-05T18:21:27Z + 2022-01-05T18:21:46Z From a3e424db42892f9d605f856f26be1f1a1ed37cf0 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 8 Jan 2022 22:03:47 +0100 Subject: [PATCH 077/128] [MJAR-283] Upgrade Plexus Utils to 3.3.1 --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1c5e5be2..a6c526a9 100644 --- a/pom.xml +++ b/pom.xml @@ -139,7 +139,8 @@ org.codehaus.plexus plexus-utils - 3.3.0 + 3.3.1 + runtime junit From 7bb0bfc631fce48feb59c80baa9b64b26cd64627 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 8 Jan 2022 22:16:55 +0100 Subject: [PATCH 078/128] [MJAR-284] Remove override for Plexus Archiver --- pom.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index a6c526a9..b98fce99 100644 --- a/pom.xml +++ b/pom.xml @@ -117,7 +117,7 @@ + + 0.0.0.M2a 7 2022-01-08T21:19:21Z @@ -87,16 +90,25 @@ org.apache.maven maven-plugin-api ${mavenVersion} + provided org.apache.maven maven-core ${mavenVersion} + provided org.apache.maven maven-artifact ${mavenVersion} + provided + + + org.apache.maven + maven-model + ${mavenVersion} + provided org.apache.maven.shared diff --git a/src/it/MJAR-30-excludes/verify.bsh b/src/it/MJAR-30-excludes/verify.groovy similarity index 94% rename from src/it/MJAR-30-excludes/verify.bsh rename to src/it/MJAR-30-excludes/verify.groovy index b2a46079..8470d218 100644 --- a/src/it/MJAR-30-excludes/verify.bsh +++ b/src/it/MJAR-30-excludes/verify.groovy @@ -41,9 +41,9 @@ try return false; } - String[] artifactNames = new String[] { "default-configuration.properties", "META-INF/MANIFEST.MF", + String[] artifactNames = [ "default-configuration.properties", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-03/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-03/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-03/pom.xml" ]; Set contents = new HashSet(); diff --git a/src/it/MJAR-30-fullcontent/verify.bsh b/src/it/MJAR-30-fullcontent/verify.groovy similarity index 95% rename from src/it/MJAR-30-fullcontent/verify.bsh rename to src/it/MJAR-30-fullcontent/verify.groovy index b8d30160..a64ef949 100644 --- a/src/it/MJAR-30-fullcontent/verify.bsh +++ b/src/it/MJAR-30-fullcontent/verify.groovy @@ -41,10 +41,10 @@ try return false; } - String[] artifactNames = new String[] { "default-configuration.properties", + String[] artifactNames = [ "default-configuration.properties", "foo/project001/App.class", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-01/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-01/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-01/pom.xml" ]; Set contents = new HashSet(); diff --git a/src/it/MJAR-30-include/verify.bsh b/src/it/MJAR-30-include/verify.groovy similarity index 94% rename from src/it/MJAR-30-include/verify.bsh rename to src/it/MJAR-30-include/verify.groovy index ae3a05e2..258b205e 100644 --- a/src/it/MJAR-30-include/verify.bsh +++ b/src/it/MJAR-30-include/verify.groovy @@ -41,9 +41,9 @@ try return false; } - String[] artifactNames = new String[] { "service/TestInterface.class", "META-INF/MANIFEST.MF", + String[] artifactNames = [ "service/TestInterface.class", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-02/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-02/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-30-02/pom.xml" ]; Set contents = new HashSet(); diff --git a/src/it/MJAR-60/verify.bsh b/src/it/MJAR-60/verify.groovy similarity index 100% rename from src/it/MJAR-60/verify.bsh rename to src/it/MJAR-60/verify.groovy diff --git a/src/it/MJAR-80-exclude/verify.bsh b/src/it/MJAR-80-exclude/verify.groovy similarity index 96% rename from src/it/MJAR-80-exclude/verify.bsh rename to src/it/MJAR-80-exclude/verify.groovy index 824872e4..063dd30f 100644 --- a/src/it/MJAR-80-exclude/verify.bsh +++ b/src/it/MJAR-80-exclude/verify.groovy @@ -48,10 +48,10 @@ try return false; } - String[] artifactNames = new String[] { "test-default-configuration.properties", + String[] artifactNames = [ "test-default-configuration.properties", "foo/project003/AppTest.class", "foo/project003/AppIntegrationTest.class", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-03/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-03/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-03/pom.xml" ]; Set contents = new HashSet(); diff --git a/src/it/MJAR-80-fullcontent/verify.bsh b/src/it/MJAR-80-fullcontent/verify.groovy similarity index 95% rename from src/it/MJAR-80-fullcontent/verify.bsh rename to src/it/MJAR-80-fullcontent/verify.groovy index d8784e22..6cafc8dd 100644 --- a/src/it/MJAR-80-fullcontent/verify.bsh +++ b/src/it/MJAR-80-fullcontent/verify.groovy @@ -48,10 +48,10 @@ try return false; } - String[] artifactNames = new String[] { "test-default-configuration.properties", + String[] artifactNames = [ "test-default-configuration.properties", "foo/project003/AppTest.class", "foo/project003/AppIntegrationTest.class", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-01/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-01/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-01/pom.xml" ]; Set contents = new HashSet(); diff --git a/src/it/MJAR-80-include/verify.bsh b/src/it/MJAR-80-include/verify.groovy similarity index 95% rename from src/it/MJAR-80-include/verify.bsh rename to src/it/MJAR-80-include/verify.groovy index 04d7121c..ff62d499 100644 --- a/src/it/MJAR-80-include/verify.bsh +++ b/src/it/MJAR-80-include/verify.groovy @@ -48,10 +48,10 @@ try return false; } - String[] artifactNames = new String[] { "foo/project003/AppIntegrationTest.class", + String[] artifactNames = [ "foo/project003/AppIntegrationTest.class", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-02/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-02/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-mjar-80-02/pom.xml" ]; Set contents = new HashSet(); diff --git a/src/it/manifest-content/verify.bsh b/src/it/manifest-content/verify.grovy similarity index 100% rename from src/it/manifest-content/verify.bsh rename to src/it/manifest-content/verify.grovy diff --git a/src/it/mjar-71-01/verify.bsh b/src/it/mjar-71-01/verify.groovy similarity index 100% rename from src/it/mjar-71-01/verify.bsh rename to src/it/mjar-71-01/verify.groovy diff --git a/src/it/mjar-71-02/verify.bsh b/src/it/mjar-71-02/verify.groovy similarity index 100% rename from src/it/mjar-71-02/verify.bsh rename to src/it/mjar-71-02/verify.groovy diff --git a/src/it/project-004/verify.bsh b/src/it/project-004/verify.groovy similarity index 94% rename from src/it/project-004/verify.bsh rename to src/it/project-004/verify.groovy index ede03208..e5f5506b 100644 --- a/src/it/project-004/verify.bsh +++ b/src/it/project-004/verify.groovy @@ -41,10 +41,10 @@ try return false; } - String[] artifactNames = new String[] { "service/TestInterface.class", + String[] artifactNames = [ "service/TestInterface.class", "service/impl/TestImplementation.class", "TestCompile1.class", "notIncluded.xml", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-project-004/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-project-004/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-project-004/pom.xml" ]; Set contents = new HashSet(); @@ -84,10 +84,10 @@ try return false; } - artifactNames = new String[] { "service/TestInterface.class", + artifactNames = [ "service/TestInterface.class", "META-INF/MANIFEST.MF", "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-project-004/pom.properties", - "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-project-004/pom.xml" }; + "META-INF/maven/org.apache.maven.plugins/maven-jar-plugin-test-project-004/pom.xml" ]; contents = new HashSet(); From ee59a73ec865af0ca41a2feb5f225b9bc6d5dced Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sat, 14 May 2022 14:19:02 +1000 Subject: [PATCH 089/128] [MJAR-280] Java 8 minimum (#29) * [MJAR-280] Java 8 minimum * bump version to 3.3.0 Signed-off-by: Olivier Lamy --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9e4c7990..ef8091f4 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.2.3-SNAPSHOT + 3.3.0-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -81,7 +81,7 @@ 0.0.0.M2a - 7 + 8 2022-01-08T21:19:21Z From bf52a81d80b3236ac7a074234f84da9c631f98c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 02:24:22 +0000 Subject: [PATCH 090/128] Bump plexus-utils from 3.3.1 to 3.4.2 Bumps [plexus-utils](https://github.com/codehaus-plexus/plexus-utils) from 3.3.1 to 3.4.2. - [Release notes](https://github.com/codehaus-plexus/plexus-utils/releases) - [Commits](https://github.com/codehaus-plexus/plexus-utils/compare/plexus-utils-3.3.1...plexus-utils-3.4.2) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-utils dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ef8091f4..359c3e8f 100644 --- a/pom.xml +++ b/pom.xml @@ -147,7 +147,7 @@ org.codehaus.plexus plexus-utils - 3.3.1 + 3.4.2 runtime From 78a28dd7873d0d8eb7c6684963ab860aa51f2c07 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 14 Jun 2022 21:27:33 +0200 Subject: [PATCH 091/128] Ignore Maven Core updates --- .github/dependabot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9c761915..d7c9cd4e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -21,6 +21,9 @@ updates: directory: "/" schedule: interval: "daily" + ignore: + # Ignore Maven Core updates + - dependency-name: "org.apache.maven:*" - package-ecosystem: "github-actions" directory: "/" schedule: From b6fe3eb5d32c92f9b1169d9dbe75fc41fb0ce149 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 May 2022 04:19:54 +0000 Subject: [PATCH 092/128] Bump junit from 4.11 to 4.13.2 in /src/it/MJAR-228 --- src/it/MJAR-228/pom.xml | 2 +- src/it/MJAR-228/verify.bsh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/it/MJAR-228/pom.xml b/src/it/MJAR-228/pom.xml index fbba5b66..4508032e 100644 --- a/src/it/MJAR-228/pom.xml +++ b/src/it/MJAR-228/pom.xml @@ -31,7 +31,7 @@ junit junit - 4.11 + 4.13.2 diff --git a/src/it/MJAR-228/verify.bsh b/src/it/MJAR-228/verify.bsh index f0aaa2cc..7365c851 100644 --- a/src/it/MJAR-228/verify.bsh +++ b/src/it/MJAR-228/verify.bsh @@ -50,10 +50,10 @@ try System.err.println( Attributes.Name.MAIN_CLASS.toString() + " not equals myproject.HelloWorld" ); return false; } - if ( !"lib/junit-4.11.jar lib/hamcrest-core-1.3.jar".equals( manifest.get( Attributes.Name.CLASS_PATH ) ) ) + if ( !"lib/junit-4.13.2.jar lib/hamcrest-core-1.3.jar".equals( manifest.get( Attributes.Name.CLASS_PATH ) ) ) { System.err.println( Attributes.Name.CLASS_PATH.toString() + - " not equals lib/junit-4.11.jar lib/hamcrest-core-1.3.jar" ); + " not equals lib/junit-4.13.2.jar lib/hamcrest-core-1.3.jar" ); return false; } From c02be208f3f4422ed0e9990e56602e3ee7d246a0 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Sat, 2 Jul 2022 11:16:01 +0200 Subject: [PATCH 093/128] [MJAR-278] Update plugin (requires Maven 3.2.5+) (#19) Update plugin: * make it Java8 * requires Maven 3.2.5+ * maven bits scope set to provided * update file-management 3.1.0 * update maven-archiver 3.6.0 --- pom.xml | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 359c3e8f..86cb9cc7 100644 --- a/pom.xml +++ b/pom.xml @@ -75,13 +75,8 @@ - 3.0.0 - 3.5.2 - 3.1.0 - - - 0.0.0.M2a 8 + 3.2.5 2022-01-08T21:19:21Z @@ -113,12 +108,12 @@ org.apache.maven.shared file-management - ${mavenFileManagementVersion} + 3.1.0 org.apache.maven maven-archiver - ${mavenArchiverVersion} + 3.6.0 @@ -126,30 +121,13 @@ maven-plugin-annotations provided - - - - org.apache.maven.shared - maven-shared-utils - 3.3.4 - runtime - org.codehaus.plexus - plexus-utils - 3.4.2 - runtime + plexus-archiver + 4.3.0 + + junit junit @@ -159,7 +137,7 @@ org.apache.maven.plugin-testing maven-plugin-testing-harness - 3.1.0 + 3.3.0 test From 46c017dc0ca2e35536dfe98f682184ed38a20633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Mon, 6 Jun 2022 14:02:17 +0200 Subject: [PATCH 094/128] [MJAR-275] - Fix outputTimestamp not applied to module-info; breaks reproducible builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 5 -- .../invoker.properties | 21 +++++ .../MJAR-275-reproducible-module-info/pom.xml | 77 +++++++++++++++++++ .../src/main/java/myproject/HelloWorld.java | 37 +++++++++ .../src/main/java9/module-info.java | 22 ++++++ .../verify.groovy | 65 ++++++++++++++++ .../maven/plugins/jar/AbstractJarMojo.java | 9 ++- 7 files changed, 227 insertions(+), 9 deletions(-) create mode 100644 src/it/MJAR-275-reproducible-module-info/invoker.properties create mode 100644 src/it/MJAR-275-reproducible-module-info/pom.xml create mode 100644 src/it/MJAR-275-reproducible-module-info/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-275-reproducible-module-info/src/main/java9/module-info.java create mode 100644 src/it/MJAR-275-reproducible-module-info/verify.groovy diff --git a/pom.xml b/pom.xml index 86cb9cc7..bcb14f56 100644 --- a/pom.xml +++ b/pom.xml @@ -121,11 +121,6 @@ maven-plugin-annotations provided - - org.codehaus.plexus - plexus-archiver - 4.3.0 - diff --git a/src/it/MJAR-275-reproducible-module-info/invoker.properties b/src/it/MJAR-275-reproducible-module-info/invoker.properties new file mode 100644 index 00000000..71eea457 --- /dev/null +++ b/src/it/MJAR-275-reproducible-module-info/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. + +# NOTE: Requires Java 10+ to compile the module declaration for Java 9+, +# this is due that compiling the module declaration generates a +# module descriptor with the JDK version on it, making it unreproducible. +invoker.java.version = 10+ diff --git a/src/it/MJAR-275-reproducible-module-info/pom.xml b/src/it/MJAR-275-reproducible-module-info/pom.xml new file mode 100644 index 00000000..c25061c5 --- /dev/null +++ b/src/it/MJAR-275-reproducible-module-info/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + org.apache.maven.plugins + mjar-275-reproducible-multi-release-modular-jar + mjar-275-reproducible-multi-release-modular-jar + Verifies that the modular descriptor is reproducible (timestamp is set) + jar + 1.0-SNAPSHOT + + + UTF-8 + 2022-06-26T13: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 + + + + + + + + diff --git a/src/it/MJAR-275-reproducible-module-info/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-275-reproducible-module-info/src/main/java/myproject/HelloWorld.java new file mode 100644 index 00000000..01f29914 --- /dev/null +++ b/src/it/MJAR-275-reproducible-module-info/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( "Hi!" ); + } +} \ No newline at end of file diff --git a/src/it/MJAR-275-reproducible-module-info/src/main/java9/module-info.java b/src/it/MJAR-275-reproducible-module-info/src/main/java9/module-info.java new file mode 100644 index 00000000..fa450345 --- /dev/null +++ b/src/it/MJAR-275-reproducible-module-info/src/main/java9/module-info.java @@ -0,0 +1,22 @@ +/* + * 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. + */ + +module myproject { + exports myproject; +} diff --git a/src/it/MJAR-275-reproducible-module-info/verify.groovy b/src/it/MJAR-275-reproducible-module-info/verify.groovy new file mode 100644 index 00000000..f6bce523 --- /dev/null +++ b/src/it/MJAR-275-reproducible-module-info/verify.groovy @@ -0,0 +1,65 @@ +/* + * 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.io.*; +import java.lang.module.*; +import java.nio.file.attribute.FileTime; +import java.time.Instant; +import java.util.*; +import java.util.jar.*; + +File target = new File( basedir, "target" ) + +assert target.exists() +assert target.isDirectory() + +File artifact = new File( target, "mjar-275-reproducible-multi-release-modular-jar-1.0-SNAPSHOT.jar" ); + +assert artifact.exists() +assert artifact.isFile() + +JarFile jar = new JarFile( artifact ); + +Attributes manifest = jar.getManifest().getMainAttributes(); + +assert "myproject.HelloWorld".equals( manifest.get( Attributes.Name.MAIN_CLASS ) ) + +InputStream moduleDescriptorInputStream = jar.getInputStream( jar.getEntry( "META-INF/versions/9/module-info.class" ) ); +ModuleDescriptor moduleDescriptor = ModuleDescriptor.read( moduleDescriptorInputStream ); + +assert "myproject.HelloWorld".equals( moduleDescriptor.mainClass().orElse( null ) ) + +// Normalize to UTC +long normalizeUTC( String timestamp ) +{ + long millis = Instant.parse( timestamp ).toEpochMilli(); + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis( millis ); + return millis - ( cal.get( Calendar.ZONE_OFFSET ) + cal.get( Calendar.DST_OFFSET ) ); +} + +// All entries should have the same timestamp +FileTime expectedTimestamp = FileTime.fromMillis( normalizeUTC( "2022-06-26T13:25:58Z" ) ); +Enumeration entries = jar.entries(); +while ( entries.hasMoreElements() ) +{ + assert expectedTimestamp.equals( entries.nextElement().getLastModifiedTime() ) +} + +jar.close(); 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 5b7ca642..588dad86 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -141,9 +141,10 @@ public abstract class AbstractJarMojo private boolean skipIfEmpty; /** - * Timestamp for reproducible output archive entries, either formatted as ISO 8601 - * yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like - * SOURCE_DATE_EPOCH). + * Timestamp for reproducible output archive entries, either formatted as ISO 8601 extended offset date-time + * (e.g. in UTC such as '2011-12-03T10:15:30Z' or with an offset '2019-10-05T20:37:42+06:00'), + * or as an int representing seconds since the epoch + * (like SOURCE_DATE_EPOCH). * * @since 3.2.0 */ @@ -257,7 +258,7 @@ public File createArchive() archiver.setOutputFile( jarFile ); // configure for Reproducible Builds based on outputTimestamp value - archiver.configureReproducible( outputTimestamp ); + archiver.configureReproducibleBuild( outputTimestamp ); archive.setForced( forceCreation ); From 414849196259fb34c621b0cdaa0a9e923ca9bc42 Mon Sep 17 00:00:00 2001 From: Russell Howe Date: Sun, 14 Aug 2022 12:26:43 +0100 Subject: [PATCH 095/128] Code simplifications in AbstractMojo (#47) * Replace StringBuilder with string concatenation in AbstractJarMojo#getJarFile * Simplify archiver selection * Simplify projectHasAlreadySetAnArtifact in AbstractJarMojo Inverting this test leads to a more readable flow. * Simplify hasClassifier We can remove all branching from this method and return the check directly. --- .../maven/plugins/jar/AbstractJarMojo.java | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) 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 588dad86..d54386b8 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -196,16 +196,17 @@ protected File getJarFile( File basedir, String resultFinalName, String classifi throw new IllegalArgumentException( "finalName is not allowed to be null" ); } - StringBuilder fileName = new StringBuilder( resultFinalName ); - + String fileName; if ( hasClassifier() ) { - fileName.append( "-" ).append( classifier ); + fileName = resultFinalName + "-" + classifier + ".jar"; + } + else + { + fileName = resultFinalName + ".jar"; } - fileName.append( ".jar" ); - - return new File( basedir, fileName.toString() ); + return new File( basedir, fileName ); } /** @@ -243,18 +244,11 @@ public File createArchive() } } + String archiverName = containsModuleDescriptor ? "mjar" : "jar"; + MavenArchiver archiver = new MavenArchiver(); archiver.setCreatedBy( "Maven JAR Plugin", "org.apache.maven.plugins", "maven-jar-plugin" ); - - if ( containsModuleDescriptor ) - { - archiver.setArchiver( (JarArchiver) archivers.get( "mjar" ) ); - } - else - { - archiver.setArchiver( (JarArchiver) archivers.get( "jar" ) ); - } - + archiver.setArchiver( (JarArchiver) archivers.get( archiverName ) ); archiver.setOutputFile( jarFile ); // configure for Reproducible Builds based on outputTimestamp value @@ -328,14 +322,12 @@ public void execute() private boolean projectHasAlreadySetAnArtifact() { - if ( getProject().getArtifact().getFile() != null ) - { - return getProject().getArtifact().getFile().isFile(); - } - else + if ( getProject().getArtifact().getFile() == null ) { return false; } + + return getProject().getArtifact().getFile().isFile(); } /** @@ -343,13 +335,7 @@ private boolean projectHasAlreadySetAnArtifact() */ protected boolean hasClassifier() { - boolean result = false; - if ( getClassifier() != null && getClassifier().trim().length() > 0 ) - { - result = true; - } - - return result; + return getClassifier() != null && getClassifier().trim().length() > 0; } private String[] getIncludes() From 56344da36ed291eff940b9e326c2f740e21f79be Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 18 Aug 2022 20:26:46 +1000 Subject: [PATCH 096/128] use shared action v3 (#49) --- .github/workflows/maven-verify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml index bbd77865..4d67fdcf 100644 --- a/.github/workflows/maven-verify.yml +++ b/.github/workflows/maven-verify.yml @@ -24,4 +24,4 @@ on: jobs: build: name: Verify - uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2 + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3 From 5fd2fc96f1d671f113b08ec7dfbf5b97a80f3763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Wed, 24 Aug 2022 11:08:29 +0200 Subject: [PATCH 097/128] [MJAR-291] - Upgrade Parent to 37 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 2 +- src/it/MJAR-162/pom.xml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bcb14f56..19de695c 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ maven-plugins org.apache.maven.plugins - 36 + 37 diff --git a/src/it/MJAR-162/pom.xml b/src/it/MJAR-162/pom.xml index 63c48325..cd268163 100644 --- a/src/it/MJAR-162/pom.xml +++ b/src/it/MJAR-162/pom.xml @@ -32,12 +32,17 @@ junit junit - 3.8.1 + 4.13.2 test
+ + org.apache.maven.plugins + maven-resources-plugin + 3.3.0 + org.apache.maven.plugins maven-jar-plugin From 120412767b4677acf93243b1aa01e34799df5409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Thu, 18 Aug 2022 11:43:03 +0200 Subject: [PATCH 098/128] [MJAR-290] - Update Plexus Utils to 3.4.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 19de695c..ca35e0c1 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,11 @@ maven-archiver 3.6.0
+ + org.codehaus.plexus + plexus-utils + 3.4.2 + org.apache.maven.plugin-tools From fb2299a6dc12078af33983414474292bab531ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Thu, 25 Aug 2022 12:24:31 +0200 Subject: [PATCH 099/128] Restore mavenArchiverVersion property used in the site MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ca35e0c1..3bf72357 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,7 @@ 8 3.2.5 + 3.6.0 2022-01-08T21:19:21Z @@ -113,7 +114,7 @@ org.apache.maven maven-archiver - 3.6.0 + ${mavenArchiverVersion} org.codehaus.plexus From d68df4b277d9afcbbe4700690fd6c7584cec4149 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Mon, 12 Sep 2022 17:53:10 +0200 Subject: [PATCH 100/128] [maven-release-plugin] prepare release maven-jar-plugin-3.3.0 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 3bf72357..7add2677 100644 --- a/pom.xml +++ b/pom.xml @@ -26,11 +26,11 @@ maven-plugins org.apache.maven.plugins 37 - + maven-jar-plugin - 3.3.0-SNAPSHOT + 3.3.0 maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - HEAD + maven-jar-plugin-3.3.0 JIRA @@ -78,7 +78,7 @@ 8 3.2.5 3.6.0 - 2022-01-08T21:19:21Z + 2022-09-12T15:53:02Z From fd2bf9d9b80e9dcdcee22b8e7f435f9d7e4fa9a8 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Mon, 12 Sep 2022 17:53:21 +0200 Subject: [PATCH 101/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7add2677..73cb8866 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ maven-jar-plugin - 3.3.0 + 3.3.1-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -57,7 +57,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} - maven-jar-plugin-3.3.0 + HEAD JIRA @@ -78,7 +78,7 @@ 8 3.2.5 3.6.0 - 2022-09-12T15:53:02Z + 2022-09-12T15:53:21Z From 6eda00939b31aeddcb28cd49763a28ba86fdce5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Wed, 2 Nov 2022 23:26:41 +0100 Subject: [PATCH 102/128] add Reproducible Builds badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 602fab83..81fe13d4 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Contributing to [Apache Maven JAR Plugin](https://maven.apache.org/plugins/maven [![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MJAR.json)][jira] [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-jar-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-jar-plugin) +[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-jar-plugin/README.md) [![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][build] [![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-jar-plugin/job/master.svg?)][test-results] From 44f90d4bb3cdf064ce827f48d27fe2e5b1a27124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Wed, 21 Dec 2022 14:17:46 +0100 Subject: [PATCH 103/128] [MJAR-292] - Detect MRJAR and add manifest entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- .../invoker.properties | 20 ++++ .../MJAR-292-detect-mjar-no-versions/pom.xml | 93 ++++++++++++++++ .../src/main/java/myproject/HelloWorld.java | 37 +++++++ .../src/main/java/myproject/Utils.java | 32 ++++++ .../verify.groovy | 26 +++++ .../MJAR-292-detect-mjar/invoker.properties | 20 ++++ src/it/MJAR-292-detect-mjar/pom.xml | 101 ++++++++++++++++++ .../src/main/java/myproject/HelloWorld.java | 37 +++++++ .../src/main/java/myproject/Utils.java | 32 ++++++ .../src/main/java10/myproject/Utils.java | 33 ++++++ .../src/main/java9/myproject/Utils.java | 33 ++++++ src/it/MJAR-292-detect-mjar/verify.groovy | 26 +++++ .../invoker.properties | 21 ++++ src/it/MJAR-292-disable-detect-mjar/pom.xml | 93 ++++++++++++++++ .../src/main/java/myproject/HelloWorld.java | 37 +++++++ .../src/main/java/myproject/Utils.java | 32 ++++++ .../src/main/java10/myproject/Utils.java | 33 ++++++ .../src/main/java9/myproject/Utils.java | 33 ++++++ .../verify.groovy | 26 +++++ .../maven/plugins/jar/AbstractJarMojo.java | 43 +++++--- 20 files changed, 793 insertions(+), 15 deletions(-) create mode 100644 src/it/MJAR-292-detect-mjar-no-versions/invoker.properties create mode 100644 src/it/MJAR-292-detect-mjar-no-versions/pom.xml create mode 100644 src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-292-detect-mjar-no-versions/src/main/java/myproject/Utils.java create mode 100644 src/it/MJAR-292-detect-mjar-no-versions/verify.groovy create mode 100644 src/it/MJAR-292-detect-mjar/invoker.properties create mode 100644 src/it/MJAR-292-detect-mjar/pom.xml create mode 100644 src/it/MJAR-292-detect-mjar/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-292-detect-mjar/src/main/java/myproject/Utils.java create mode 100644 src/it/MJAR-292-detect-mjar/src/main/java10/myproject/Utils.java create mode 100644 src/it/MJAR-292-detect-mjar/src/main/java9/myproject/Utils.java create mode 100644 src/it/MJAR-292-detect-mjar/verify.groovy create mode 100644 src/it/MJAR-292-disable-detect-mjar/invoker.properties create mode 100644 src/it/MJAR-292-disable-detect-mjar/pom.xml create mode 100644 src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-292-disable-detect-mjar/src/main/java/myproject/Utils.java create mode 100644 src/it/MJAR-292-disable-detect-mjar/src/main/java10/myproject/Utils.java create mode 100644 src/it/MJAR-292-disable-detect-mjar/src/main/java9/myproject/Utils.java create mode 100644 src/it/MJAR-292-disable-detect-mjar/verify.groovy 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 00000000..d41b77b4 --- /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 00000000..7a82a2d9 --- /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 00000000..85a84d82 --- /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 00000000..eea2683a --- /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 00000000..8578151b --- /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 00000000..dbd7d90c --- /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 00000000..f3e1165d --- /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 00000000..85a84d82 --- /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 00000000..eea2683a --- /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 00000000..b0bf5c78 --- /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 00000000..613f10cc --- /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 00000000..a06ef63d --- /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 00000000..034f5aa8 --- /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 00000000..7a82a2d9 --- /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 00000000..85a84d82 --- /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 00000000..eea2683a --- /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 00000000..b0bf5c78 --- /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 00000000..613f10cc --- /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 00000000..8578151b --- /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 d54386b8..a1483ac7 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(); From 4b888dd8b2642f33404bcea96f203b33c7929c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Sat, 28 Jan 2023 19:56:05 +0100 Subject: [PATCH 104/128] [MJAR-293] Update Parent to 39 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 16 +- src/it/MJAR-70-no-recreation/pom.xml | 7 + .../maven/plugins/jar/AbstractJarMojo.java | 210 ++++++++---------- .../org/apache/maven/plugins/jar/JarMojo.java | 37 +-- .../apache/maven/plugins/jar/TestJarMojo.java | 49 ++-- .../apache/maven/plugins/jar/JarMojoTest.java | 23 +- 6 files changed, 153 insertions(+), 189 deletions(-) diff --git a/pom.xml b/pom.xml index 73cb8866..6ae87560 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ - - + - 4.0.0 - maven-plugins org.apache.maven.plugins - 37 + maven-plugins + 39 maven-jar-plugin - 3.3.1-SNAPSHOT + 3.4.0-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -42,10 +40,10 @@ jerome@coffeebreaks.org CoffeeBreaks http://www.coffeebreaks.org - +1 Java Developer + +1 @@ -56,8 +54,8 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git - https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} HEAD + https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} JIRA @@ -152,8 +150,8 @@ - src/main/filtered-resources true + src/main/filtered-resources diff --git a/src/it/MJAR-70-no-recreation/pom.xml b/src/it/MJAR-70-no-recreation/pom.xml index 24a7c665..95e29ca1 100644 --- a/src/it/MJAR-70-no-recreation/pom.xml +++ b/src/it/MJAR-70-no-recreation/pom.xml @@ -34,6 +34,13 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + org.apache.maven.plugins maven-antrun-plugin 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 a1483ac7..ab2a50ff 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugins.jar; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ * "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 + * 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 @@ -18,6 +16,12 @@ * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugins.jar; + +import java.io.File; +import java.nio.file.FileSystems; +import java.util.Arrays; +import java.util.Map; import org.apache.maven.archiver.MavenArchiveConfiguration; import org.apache.maven.archiver.MavenArchiver; @@ -33,24 +37,17 @@ import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.jar.JarArchiver; -import java.io.File; -import java.nio.file.FileSystems; -import java.util.Arrays; -import java.util.Map; - /** * Base class for creating a jar from project classes. * * @author Emmanuel Venisse * @version $Id$ */ -public abstract class AbstractJarMojo - extends AbstractMojo -{ +public abstract class AbstractJarMojo extends AbstractMojo { - private static final String[] DEFAULT_EXCLUDES = new String[] { "**/package.html" }; + private static final String[] DEFAULT_EXCLUDES = new String[] {"**/package.html"}; - private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" }; + private static final String[] DEFAULT_INCLUDES = new String[] {"**/**"}; private static final String MODULE_DESCRIPTOR_FILE_NAME = "module-info.class"; @@ -73,13 +70,13 @@ public abstract class AbstractJarMojo /** * Directory containing the generated JAR. */ - @Parameter( defaultValue = "${project.build.directory}", required = true ) + @Parameter(defaultValue = "${project.build.directory}", required = true) private File outputDirectory; /** * Name of the generated JAR. */ - @Parameter( defaultValue = "${project.build.finalName}", readonly = true ) + @Parameter(defaultValue = "${project.build.finalName}", readonly = true) private String finalName; /** @@ -89,15 +86,15 @@ public abstract class AbstractJarMojo private Map archivers; /** - * The {@link {MavenProject}. + * The {@link MavenProject}. */ - @Parameter( defaultValue = "${project}", readonly = true, required = true ) + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; /** * The {@link MavenSession}. */ - @Parameter( defaultValue = "${session}", readonly = true, required = true ) + @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; /** @@ -111,10 +108,11 @@ public abstract class AbstractJarMojo * Using this property will fail your build cause it has been removed from the plugin configuration. See the * Major Version Upgrade to version 3.0.0 for the * plugin. - * + * * @deprecated For version 3.0.0 this parameter is only defined here to break the build if you use it! */ - @Parameter( property = "jar.useDefaultManifestFile", defaultValue = "false" ) + @Parameter(property = "jar.useDefaultManifestFile", defaultValue = "false") + @Deprecated private boolean useDefaultManifestFile; /** @@ -134,13 +132,13 @@ public abstract class AbstractJarMojo * Starting with 3.0.0 the property has been renamed from jar.forceCreation to * maven.jar.forceCreation. */ - @Parameter( property = "maven.jar.forceCreation", defaultValue = "false" ) + @Parameter(property = "maven.jar.forceCreation", defaultValue = "false") private boolean forceCreation; /** * Skip creating empty archives. */ - @Parameter( defaultValue = "false" ) + @Parameter(defaultValue = "false") private boolean skipIfEmpty; /** @@ -151,16 +149,16 @@ public abstract class AbstractJarMojo * * @since 3.2.0 */ - @Parameter( defaultValue = "${project.build.outputTimestamp}" ) + @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 + * @since 3.4.0 */ - @Parameter( property = "maven.jar.detectMultiReleaseJar", defaultValue = "true" ) + @Parameter(property = "maven.jar.detectMultiReleaseJar", defaultValue = "true") private boolean detectMultiReleaseJar; /** @@ -170,10 +168,11 @@ public abstract class AbstractJarMojo protected abstract File getClassesDirectory(); /** - * @return the {@link #project} + * Return the {@link #project MavenProject} + * + * @return the MavenProject. */ - protected final MavenProject getProject() - { + protected final MavenProject getProject() { return project; } @@ -197,28 +196,17 @@ protected final MavenProject getProject() * @param classifier an optional classifier * @return the file to generate */ - protected File getJarFile( File basedir, String resultFinalName, String classifier ) - { - if ( basedir == null ) - { - throw new IllegalArgumentException( "basedir is not allowed to be null" ); + protected File getJarFile(File basedir, String resultFinalName, String classifier) { + if (basedir == null) { + throw new IllegalArgumentException("basedir is not allowed to be null"); } - if ( resultFinalName == null ) - { - throw new IllegalArgumentException( "finalName is not allowed to be null" ); + if (resultFinalName == null) { + throw new IllegalArgumentException("finalName is not allowed to be null"); } - String fileName; - if ( hasClassifier() ) - { - fileName = resultFinalName + "-" + classifier + ".jar"; - } - else - { - fileName = resultFinalName + ".jar"; - } + String fileName = resultFinalName + (hasClassifier() ? "-" + classifier : "") + ".jar"; - return new File( basedir, fileName ); + return new File(basedir, fileName); } /** @@ -226,24 +214,22 @@ protected File getJarFile( File basedir, String resultFinalName, String classifi * @return The instance of File for the created archive file. * @throws MojoExecutionException in case of an error. */ - public File createArchive() - throws MojoExecutionException - { - File jarFile = getJarFile( outputDirectory, finalName, getClassifier() ); + public File createArchive() throws MojoExecutionException { + File jarFile = getJarFile(outputDirectory, finalName, getClassifier()); FileSetManager fileSetManager = new FileSetManager(); FileSet jarContentFileSet = new FileSet(); - jarContentFileSet.setDirectory( getClassesDirectory().getAbsolutePath() ); - jarContentFileSet.setIncludes( Arrays.asList( getIncludes() ) ); - jarContentFileSet.setExcludes( Arrays.asList( getExcludes() ) ); + jarContentFileSet.setDirectory(getClassesDirectory().getAbsolutePath()); + jarContentFileSet.setIncludes(Arrays.asList(getIncludes())); + jarContentFileSet.setExcludes(Arrays.asList(getExcludes())); - String[] includedFiles = fileSetManager.getIncludedFiles( jarContentFileSet ); + String[] includedFiles = fileSetManager.getIncludedFiles(jarContentFileSet); - if ( detectMultiReleaseJar && Arrays.stream( includedFiles ).anyMatch( p -> p.startsWith( "META-INF" + SEPARATOR - + "versions" + SEPARATOR ) ) ) - { - getLog().debug( "Adding 'Multi-Release: true' manifest entry." ); - archive.addManifestEntry( "Multi-Release", "true" ); + if (detectMultiReleaseJar + && Arrays.stream(includedFiles) + .anyMatch(p -> p.startsWith("META-INF" + SEPARATOR + "versions" + SEPARATOR))) { + 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 @@ -255,43 +241,36 @@ public File createArchive() // 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 ) ); + Arrays.stream(includedFiles).anyMatch(p -> p.endsWith(MODULE_DESCRIPTOR_FILE_NAME)); String archiverName = containsModuleDescriptor ? "mjar" : "jar"; MavenArchiver archiver = new MavenArchiver(); - archiver.setCreatedBy( "Maven JAR Plugin", "org.apache.maven.plugins", "maven-jar-plugin" ); - archiver.setArchiver( (JarArchiver) archivers.get( archiverName ) ); - archiver.setOutputFile( jarFile ); + archiver.setCreatedBy("Maven JAR Plugin", "org.apache.maven.plugins", "maven-jar-plugin"); + archiver.setArchiver((JarArchiver) archivers.get(archiverName)); + archiver.setOutputFile(jarFile); // configure for Reproducible Builds based on outputTimestamp value - archiver.configureReproducibleBuild( outputTimestamp ); + archiver.configureReproducibleBuild(outputTimestamp); - archive.setForced( forceCreation ); + archive.setForced(forceCreation); - try - { + try { File contentDirectory = getClassesDirectory(); - if ( !contentDirectory.exists() ) - { - if ( !forceCreation ) - { - getLog().warn( "JAR will be empty - no content was marked for inclusion!" ); + if (!contentDirectory.exists()) { + if (!forceCreation) { + getLog().warn("JAR will be empty - no content was marked for inclusion!"); } - } - else - { - archiver.getArchiver().addDirectory( contentDirectory, getIncludes(), getExcludes() ); + } else { + archiver.getArchiver().addDirectory(contentDirectory, getIncludes(), getExcludes()); } - archiver.createArchive( session, project, archive ); + archiver.createArchive(session, project, archive); return jarFile; - } - catch ( Exception e ) - { + } catch (Exception e) { // TODO: improve error handling - throw new MojoExecutionException( "Error assembling JAR", e ); + throw new MojoExecutionException("Error assembling JAR", e); } } @@ -299,44 +278,34 @@ public File createArchive() * Generates the JAR. * @throws MojoExecutionException in case of an error. */ - public void execute() - throws MojoExecutionException - { - if ( useDefaultManifestFile ) - { - throw new MojoExecutionException( "You are using 'useDefaultManifestFile' which has been removed" - + " from the maven-jar-plugin. " - + "Please see the >>Major Version Upgrade to version 3.0.0<< on the plugin site." ); + @Override + public void execute() throws MojoExecutionException { + if (useDefaultManifestFile) { + throw new MojoExecutionException("You are using 'useDefaultManifestFile' which has been removed" + + " from the maven-jar-plugin. " + + "Please see the >>Major Version Upgrade to version 3.0.0<< on the plugin site."); } - if ( skipIfEmpty && ( !getClassesDirectory().exists() || getClassesDirectory().list().length < 1 ) ) - { - getLog().info( "Skipping packaging of the " + getType() ); - } - else - { + if (skipIfEmpty + && (!getClassesDirectory().exists() || getClassesDirectory().list().length < 1)) { + getLog().info("Skipping packaging of the " + getType()); + } else { File jarFile = createArchive(); - if ( hasClassifier() ) - { - projectHelper.attachArtifact( getProject(), getType(), getClassifier(), jarFile ); - } - else - { - if ( projectHasAlreadySetAnArtifact() ) - { - throw new MojoExecutionException( "You have to use a classifier " - + "to attach supplemental artifacts to the project instead of replacing them." ); + if (hasClassifier()) { + projectHelper.attachArtifact(getProject(), getType(), getClassifier(), jarFile); + } else { + if (projectHasAlreadySetAnArtifact()) { + throw new MojoExecutionException("You have to use a classifier " + + "to attach supplemental artifacts to the project instead of replacing them."); } - getProject().getArtifact().setFile( jarFile ); + getProject().getArtifact().setFile(jarFile); } } } - private boolean projectHasAlreadySetAnArtifact() - { - if ( getProject().getArtifact().getFile() == null ) - { + private boolean projectHasAlreadySetAnArtifact() { + if (getProject().getArtifact().getFile() == null) { return false; } @@ -344,26 +313,23 @@ private boolean projectHasAlreadySetAnArtifact() } /** - * @return true in case where the classifier is not {@code null} and contains something else than white spaces. + * Return {@code true} in case where the classifier is not {@code null} and contains something else than white spaces. + * + * @return {@code true} if the classifier is set. */ - protected boolean hasClassifier() - { - return getClassifier() != null && getClassifier().trim().length() > 0; + protected boolean hasClassifier() { + return getClassifier() != null && !getClassifier().trim().isEmpty(); } - private String[] getIncludes() - { - if ( includes != null && includes.length > 0 ) - { + private String[] getIncludes() { + if (includes != null && includes.length > 0) { return includes; } return DEFAULT_INCLUDES; } - private String[] getExcludes() - { - if ( excludes != null && excludes.length > 0 ) - { + private String[] getExcludes() { + if (excludes != null && excludes.length > 0) { return excludes; } return DEFAULT_EXCLUDES; diff --git a/src/main/java/org/apache/maven/plugins/jar/JarMojo.java b/src/main/java/org/apache/maven/plugins/jar/JarMojo.java index 4172028b..7ce06d4e 100644 --- a/src/main/java/org/apache/maven/plugins/jar/JarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/JarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugins.jar; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ * "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 + * 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 @@ -18,35 +16,38 @@ * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugins.jar; + +import java.io.File; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; -import java.io.File; - /** * Build a JAR from the current project. * * @author Emmanuel Venisse * @version $Id$ */ -@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true, - requiresDependencyResolution = ResolutionScope.RUNTIME ) -public class JarMojo - extends AbstractJarMojo -{ +@Mojo( + name = "jar", + defaultPhase = LifecyclePhase.PACKAGE, + requiresProject = true, + threadSafe = true, + requiresDependencyResolution = ResolutionScope.RUNTIME) +public class JarMojo extends AbstractJarMojo { /** * Directory containing the classes and resource files that should be packaged into the JAR. */ - @Parameter( defaultValue = "${project.build.outputDirectory}", required = true ) + @Parameter(defaultValue = "${project.build.outputDirectory}", required = true) private File classesDirectory; /** * Classifier to add to the artifact generated. If given, the artifact will be attached * as a supplemental artifact. - * If not given this will create the main artifact which is the default behavior. + * If not given this will create the main artifact which is the default behavior. * If you try to do that a second time without using a classifier the build will fail. */ @Parameter @@ -55,24 +56,24 @@ public class JarMojo /** * {@inheritDoc} */ - protected String getClassifier() - { + @Override + protected String getClassifier() { return classifier; } /** * {@inheritDoc} */ - protected String getType() - { + @Override + protected String getType() { return "jar"; } /** * {@inheritDoc} */ - protected File getClassesDirectory() - { + @Override + protected File getClassesDirectory() { return classesDirectory; } } diff --git a/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java b/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java index 10a7c38f..96b5ac36 100644 --- a/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/TestJarMojo.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugins.jar; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ * "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 + * 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 @@ -18,8 +16,10 @@ * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugins.jar; import java.io.File; + import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -33,67 +33,66 @@ * @version $Id$ */ // CHECKSTYLE_OFF: LineLength -@Mojo( name = "test-jar", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST ) +@Mojo( + name = "test-jar", + defaultPhase = LifecyclePhase.PACKAGE, + requiresProject = true, + threadSafe = true, + requiresDependencyResolution = ResolutionScope.TEST) // CHECKSTYLE_ON: LineLength -public class TestJarMojo - extends AbstractJarMojo -{ +public class TestJarMojo extends AbstractJarMojo { /** * Set this to true to bypass test-jar generation. Its use is NOT RECOMMENDED, but quite * convenient on occasion. */ - @Parameter( property = "maven.test.skip" ) + @Parameter(property = "maven.test.skip") private boolean skip; /** * Directory containing the test classes and resource files that should be packaged into the JAR. */ - @Parameter( defaultValue = "${project.build.testOutputDirectory}", required = true ) + @Parameter(defaultValue = "${project.build.testOutputDirectory}", required = true) private File testClassesDirectory; /** * Classifier to use for {@code test-jar}. */ - @Parameter( defaultValue = "tests" ) + @Parameter(defaultValue = "tests") private String classifier; /** * {@inheritDoc} */ - protected String getClassifier() - { + @Override + protected String getClassifier() { return classifier; } /** * {@inheritDoc} */ - protected String getType() - { + @Override + protected String getType() { return "test-jar"; } /** * {@inheritDoc} */ - protected File getClassesDirectory() - { + @Override + protected File getClassesDirectory() { return testClassesDirectory; } /** * {@inheritDoc} */ - public void execute() - throws MojoExecutionException - { - if ( skip ) - { - getLog().info( "Skipping packaging of the test-jar" ); - } - else - { + @Override + public void execute() throws MojoExecutionException { + if (skip) { + getLog().info("Skipping packaging of the test-jar"); + } else { super.execute(); } } diff --git a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java index 8fc256c3..11c0696e 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java @@ -1,5 +1,3 @@ -package org.apache.maven.plugins.jar; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -9,7 +7,7 @@ * "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 + * 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 @@ -18,35 +16,30 @@ * specific language governing permissions and limitations * under the License. */ +package org.apache.maven.plugins.jar; import java.io.File; import org.apache.maven.plugin.testing.AbstractMojoTestCase; -import org.apache.maven.plugins.jar.JarMojo; /** * Test for {@link JarMojo} * * @version $Id$ */ -public class JarMojoTest - extends AbstractMojoTestCase -{ - private File testPom = new File( getBasedir(), "src/test/resources/unit/jar-basic-test/pom.xml" ); +public class JarMojoTest extends AbstractMojoTestCase { + private File testPom = new File(getBasedir(), "src/test/resources/unit/jar-basic-test/pom.xml"); /** * Tests the discovery and configuration of the mojo. * * @throws Exception in case of an error */ - public void testJarTestEnvironment() - throws Exception - { - JarMojo mojo = (JarMojo) lookupMojo( "jar", testPom ); + public void testJarTestEnvironment() throws Exception { + JarMojo mojo = (JarMojo) lookupMojo("jar", testPom); - assertNotNull( mojo ); + assertNotNull(mojo); - assertEquals( "foo", mojo.getProject().getGroupId() ); + assertEquals("foo", mojo.getProject().getGroupId()); } - } From 2860c8b4b745a2f211b69df4c225fd7081ce9d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 24 Apr 2023 12:08:57 +0200 Subject: [PATCH 105/128] Auto-link MJAR Jira --- .asf.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.asf.yaml b/.asf.yaml index e7b043ef..0f0ff737 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -24,3 +24,14 @@ github: - maven-plugins - maven-jar-plugin - maven + enabled_merge_buttons: + squash: true + merge: false + rebase: true + autolink_jira: + - MJAR +notifications: + commits: commits@maven.apache.org + issues: issues@maven.apache.org + pullrequests: issues@maven.apache.org + jira_options: link label comment From 7934b483d654e17b5e6983cc4caf6afe24f1a23d Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Wed, 4 Oct 2023 11:49:52 +0000 Subject: [PATCH 106/128] Remove dependency on plexus (#63) * remove unused imports * switch to Apache commons IO --- pom.xml | 11 ++++++----- src/it/MJAR-162/verify.bsh | 1 - src/it/MJAR-183/verify.bsh | 1 - src/it/MJAR-199-change-classifier/verify.bsh | 1 - src/it/MJAR-199/verify.bsh | 1 - src/it/MJAR-228/verify.bsh | 1 - .../MJAR-260-invalid-automatic-module-name/verify.bsh | 1 - .../MJAR-260-valid-automatic-module-name/verify.bsh | 1 - src/it/MJAR-30-excludes/verify.groovy | 1 - src/it/MJAR-30-fullcontent/verify.groovy | 1 - src/it/MJAR-30-include/verify.groovy | 1 - src/it/MJAR-60/verify.groovy | 4 ++-- src/it/MJAR-80-exclude/verify.groovy | 1 - src/it/MJAR-80-fullcontent/verify.groovy | 1 - src/it/MJAR-80-include/verify.groovy | 1 - src/it/MJAR-82/verify.bsh | 1 - src/it/manifest-content/verify.grovy | 1 - src/it/mjar-139/verify.bsh | 1 - src/it/mjar-71-01/verify.groovy | 4 ++-- src/it/mjar-71-02/verify.groovy | 4 ++-- src/it/mjar-90/verify.bsh | 1 - src/it/project-004/verify.groovy | 1 - 22 files changed, 12 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index 6ae87560..3681e085 100644 --- a/pom.xml +++ b/pom.xml @@ -114,11 +114,6 @@ maven-archiver ${mavenArchiverVersion} - - org.codehaus.plexus - plexus-utils - 3.4.2 - org.apache.maven.plugin-tools @@ -145,6 +140,12 @@ ${mavenVersion} test + + commons-io + commons-io + 2.14.0 + test +
diff --git a/src/it/MJAR-162/verify.bsh b/src/it/MJAR-162/verify.bsh index d339c673..d4f0f82f 100644 --- a/src/it/MJAR-162/verify.bsh +++ b/src/it/MJAR-162/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-183/verify.bsh b/src/it/MJAR-183/verify.bsh index a9aeea50..a024918f 100644 --- a/src/it/MJAR-183/verify.bsh +++ b/src/it/MJAR-183/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-199-change-classifier/verify.bsh b/src/it/MJAR-199-change-classifier/verify.bsh index 2f82c46d..27dc60cc 100644 --- a/src/it/MJAR-199-change-classifier/verify.bsh +++ b/src/it/MJAR-199-change-classifier/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-199/verify.bsh b/src/it/MJAR-199/verify.bsh index 18c8b254..e788c149 100644 --- a/src/it/MJAR-199/verify.bsh +++ b/src/it/MJAR-199/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-228/verify.bsh b/src/it/MJAR-228/verify.bsh index 7365c851..9fe1b9c9 100644 --- a/src/it/MJAR-228/verify.bsh +++ b/src/it/MJAR-228/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh b/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh index 2096dc19..32538953 100644 --- a/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh +++ b/src/it/MJAR-260-invalid-automatic-module-name/verify.bsh @@ -22,7 +22,6 @@ import java.io.*; import java.nio.file.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-260-valid-automatic-module-name/verify.bsh b/src/it/MJAR-260-valid-automatic-module-name/verify.bsh index 86db5ede..0618e581 100644 --- a/src/it/MJAR-260-valid-automatic-module-name/verify.bsh +++ b/src/it/MJAR-260-valid-automatic-module-name/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-30-excludes/verify.groovy b/src/it/MJAR-30-excludes/verify.groovy index 8470d218..dafd74f2 100644 --- a/src/it/MJAR-30-excludes/verify.groovy +++ b/src/it/MJAR-30-excludes/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-30-fullcontent/verify.groovy b/src/it/MJAR-30-fullcontent/verify.groovy index a64ef949..89ad38d9 100644 --- a/src/it/MJAR-30-fullcontent/verify.groovy +++ b/src/it/MJAR-30-fullcontent/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-30-include/verify.groovy b/src/it/MJAR-30-include/verify.groovy index 258b205e..28d3e5f3 100644 --- a/src/it/MJAR-30-include/verify.groovy +++ b/src/it/MJAR-30-include/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-60/verify.groovy b/src/it/MJAR-60/verify.groovy index 04d1975d..76f19fe8 100644 --- a/src/it/MJAR-60/verify.groovy +++ b/src/it/MJAR-60/verify.groovy @@ -21,7 +21,7 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; +import org.apache.commons.io.*; boolean result = true; @@ -51,7 +51,7 @@ try // Only compare files if ( entry.getName().equals( "META-INF/MANIFEST.MF" ) ) { - String manifest = IOUtil.toString( jar.getInputStream ( entry ) ); + String manifest = IOUtils.toString( jar.getInputStream ( entry ) ); int index = manifest.indexOf( "Class-Path: config/" ); if ( index <= 0 ) { diff --git a/src/it/MJAR-80-exclude/verify.groovy b/src/it/MJAR-80-exclude/verify.groovy index 063dd30f..8d72e1b5 100644 --- a/src/it/MJAR-80-exclude/verify.groovy +++ b/src/it/MJAR-80-exclude/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-80-fullcontent/verify.groovy b/src/it/MJAR-80-fullcontent/verify.groovy index 6cafc8dd..47523b53 100644 --- a/src/it/MJAR-80-fullcontent/verify.groovy +++ b/src/it/MJAR-80-fullcontent/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-80-include/verify.groovy b/src/it/MJAR-80-include/verify.groovy index ff62d499..09294a55 100644 --- a/src/it/MJAR-80-include/verify.groovy +++ b/src/it/MJAR-80-include/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/MJAR-82/verify.bsh b/src/it/MJAR-82/verify.bsh index 2afd430b..acdbfd9d 100644 --- a/src/it/MJAR-82/verify.bsh +++ b/src/it/MJAR-82/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; import org.codehaus.plexus.util.cli.*; import org.codehaus.plexus.util.FileUtils; diff --git a/src/it/manifest-content/verify.grovy b/src/it/manifest-content/verify.grovy index ccf3f5a8..2da7753b 100644 --- a/src/it/manifest-content/verify.grovy +++ b/src/it/manifest-content/verify.grovy @@ -22,7 +22,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; import java.util.zip.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/mjar-139/verify.bsh b/src/it/mjar-139/verify.bsh index 0af748a3..8d5555b7 100644 --- a/src/it/mjar-139/verify.bsh +++ b/src/it/mjar-139/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/mjar-71-01/verify.groovy b/src/it/mjar-71-01/verify.groovy index b62fe5d6..97f78e88 100644 --- a/src/it/mjar-71-01/verify.groovy +++ b/src/it/mjar-71-01/verify.groovy @@ -21,7 +21,7 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; +import org.apache.commons.io.*; boolean result = true; @@ -51,7 +51,7 @@ try // Only compare files if ( entry.getName().equals( "META-INF/MANIFEST.MF" ) ) { - String manifest = IOUtil.toString( jar.getInputStream ( entry ) ); + String manifest = IOUtils.toString( jar.getInputStream ( entry ) ); int index = manifest.indexOf( "Archiver-Version: foobar-1.23456" ); if ( index <= 0 ) { diff --git a/src/it/mjar-71-02/verify.groovy b/src/it/mjar-71-02/verify.groovy index ada2d78d..33e40531 100644 --- a/src/it/mjar-71-02/verify.groovy +++ b/src/it/mjar-71-02/verify.groovy @@ -21,7 +21,7 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; +import org.apache.commons.io.*; boolean result = true; @@ -51,7 +51,7 @@ try // Only compare files if ( entry.getName().equals ( "META-INF/MANIFEST.MF" ) ) { - String manifest = IOUtil.toString( jar.getInputStream ( entry ) ); + String manifest = IOUtils.toString( jar.getInputStream ( entry ) ); int index = manifest.indexOf( "Archiver-Version: foobar-1.23456" ); if ( index > 0 ) { diff --git a/src/it/mjar-90/verify.bsh b/src/it/mjar-90/verify.bsh index c1e93022..7560e222 100644 --- a/src/it/mjar-90/verify.bsh +++ b/src/it/mjar-90/verify.bsh @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; diff --git a/src/it/project-004/verify.groovy b/src/it/project-004/verify.groovy index e5f5506b..6989c03e 100644 --- a/src/it/project-004/verify.groovy +++ b/src/it/project-004/verify.groovy @@ -21,7 +21,6 @@ import java.io.*; import java.util.*; import java.util.jar.*; -import org.codehaus.plexus.util.*; boolean result = true; From b96b75bcf0404cdc7d6231a87880ccefdd894fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Wed, 1 Nov 2023 16:41:05 +0100 Subject: [PATCH 107/128] [MJAR-298] Update Maven-Archiver to 3.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3681e085..c58cb681 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ 8 3.2.5 - 3.6.0 + 3.6.1 2022-09-12T15:53:21Z From de65c39495c9da5b7d018229603d97d6ba3ba3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Wed, 1 Nov 2023 16:36:18 +0100 Subject: [PATCH 108/128] [MJAR-297] Update Parent to 40 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c58cb681..5eff7139 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.maven.plugins maven-plugins - 39 + 40 @@ -146,6 +146,12 @@ 2.14.0 test + + org.codehaus.plexus + plexus-xml + 3.0.0 + test + From 0cbcfd42e26207331cc3ad831a3888cb04591f07 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Tue, 14 Nov 2023 10:01:59 +0100 Subject: [PATCH 109/128] [MJAR-299] - Upgrade maven-plugin parent to 41 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5eff7139..1082146c 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.maven.plugins maven-plugins - 40 + 41 From 63f9c982d49f046519088490d7a8af5a7cd647fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 02:52:39 +0000 Subject: [PATCH 110/128] Bump commons-io:commons-io from 2.14.0 to 2.15.1 Bumps commons-io:commons-io from 2.14.0 to 2.15.1. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1082146c..667ea5c3 100644 --- a/pom.xml +++ b/pom.xml @@ -143,7 +143,7 @@ commons-io commons-io - 2.14.0 + 2.15.1 test From adf1c76a8944899ea5049eca6f004ff3ccad8148 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:26:16 +0000 Subject: [PATCH 111/128] Bump apache/maven-gh-actions-shared from 2 to 4 Bumps [apache/maven-gh-actions-shared](https://github.com/apache/maven-gh-actions-shared) from 2 to 4. - [Commits](https://github.com/apache/maven-gh-actions-shared/commits/v4) --- updated-dependencies: - dependency-name: apache/maven-gh-actions-shared dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/maven-verify.yml | 2 +- .github/workflows/release-drafter.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml index 4d67fdcf..932827cf 100644 --- a/.github/workflows/maven-verify.yml +++ b/.github/workflows/maven-verify.yml @@ -24,4 +24,4 @@ on: jobs: build: name: Verify - uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3 + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 32115399..5205f96e 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -25,4 +25,4 @@ on: jobs: update_release_draft: - uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v2 + uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4 From fa4330fa687a98b1fa43c9bc8a574408b2ffe40b Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 19 Mar 2024 20:50:40 +0100 Subject: [PATCH 112/128] [MJAR-62] Set Build-Jdk according to used toolchain --- pom.xml | 39 +++++--- src/it/MJAR-62-toolchain/invoker.properties | 18 ++++ src/it/MJAR-62-toolchain/pom.xml | 68 +++++++++++++ .../src/main/java/myproject/HelloWorld.java | 36 +++++++ src/it/MJAR-62-toolchain/verify.groovy | 26 +++++ .../maven/plugins/jar/AbstractJarMojo.java | 19 ++++ .../jar/ToolchainsJdkSpecification.java | 99 +++++++++++++++++++ .../apache/maven/plugins/jar/JarMojoTest.java | 20 ++-- .../plugins/jar/ToolchainsJdkVersionTest.java | 88 +++++++++++++++++ 9 files changed, 392 insertions(+), 21 deletions(-) create mode 100644 src/it/MJAR-62-toolchain/invoker.properties create mode 100644 src/it/MJAR-62-toolchain/pom.xml create mode 100644 src/it/MJAR-62-toolchain/src/main/java/myproject/HelloWorld.java create mode 100644 src/it/MJAR-62-toolchain/verify.groovy create mode 100644 src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java create mode 100644 src/test/java/org/apache/maven/plugins/jar/ToolchainsJdkVersionTest.java diff --git a/pom.xml b/pom.xml index 667ea5c3..12f3007e 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,18 @@ 2022-09-12T15:53:21Z + + + + org.junit + junit-bom + 5.10.1 + pom + import + + + + org.apache.maven @@ -123,33 +135,31 @@ - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter-api test org.apache.maven.plugin-testing maven-plugin-testing-harness - 3.3.0 + 4.0.0-alpha-2 test - org.apache.maven - maven-compat - ${mavenVersion} + org.mockito + mockito-core + 4.11.0 test - commons-io - commons-io - 2.15.1 + org.mockito + mockito-junit-jupiter + 4.11.0 test org.codehaus.plexus plexus-xml - 3.0.0 test @@ -178,6 +188,13 @@ + + + + org.eclipse.sisu + sisu-maven-plugin + + diff --git a/src/it/MJAR-62-toolchain/invoker.properties b/src/it/MJAR-62-toolchain/invoker.properties new file mode 100644 index 00000000..9904dcce --- /dev/null +++ b/src/it/MJAR-62-toolchain/invoker.properties @@ -0,0 +1,18 @@ +# 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.toolchain.jdk.version = 17 \ No newline at end of file diff --git a/src/it/MJAR-62-toolchain/pom.xml b/src/it/MJAR-62-toolchain/pom.xml new file mode 100644 index 00000000..610d560e --- /dev/null +++ b/src/it/MJAR-62-toolchain/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + org.apache.maven.plugins + mjar-62 + MJAR-62 + jar + 1.0-SNAPSHOT + + jar plugin it + + + + + junit + junit + 4.13.2 + + + + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 17 + + + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + diff --git a/src/it/MJAR-62-toolchain/src/main/java/myproject/HelloWorld.java b/src/it/MJAR-62-toolchain/src/main/java/myproject/HelloWorld.java new file mode 100644 index 00000000..fd0ad83c --- /dev/null +++ b/src/it/MJAR-62-toolchain/src/main/java/myproject/HelloWorld.java @@ -0,0 +1,36 @@ +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( "Hi!" ); + } +} \ No newline at end of file diff --git a/src/it/MJAR-62-toolchain/verify.groovy b/src/it/MJAR-62-toolchain/verify.groovy new file mode 100644 index 00000000..4fdf714c --- /dev/null +++ b/src/it/MJAR-62-toolchain/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.JarFile + +def mrjar = new JarFile(new File(basedir, 'target/mjar-62-1.0-SNAPSHOT.jar')) +def manifest = mrjar.manifest.mainAttributes + +assert manifest.getValue("Build-Jdk-Spec") == "17" +assert manifest.getValue("Build-Tool-Jdk-Spec") == System.getProperty("java.specification.version") 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 ab2a50ff..47b8bde2 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -22,6 +22,7 @@ import java.nio.file.FileSystems; import java.util.Arrays; import java.util.Map; +import java.util.Optional; import org.apache.maven.archiver.MavenArchiveConfiguration; import org.apache.maven.archiver.MavenArchiver; @@ -34,6 +35,7 @@ import org.apache.maven.project.MavenProjectHelper; import org.apache.maven.shared.model.fileset.FileSet; import org.apache.maven.shared.model.fileset.util.FileSetManager; +import org.apache.maven.toolchain.ToolchainManager; import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.jar.JarArchiver; @@ -53,6 +55,12 @@ public abstract class AbstractJarMojo extends AbstractMojo { private static final String SEPARATOR = FileSystems.getDefault().getSeparator(); + @Component + private ToolchainsJdkSpecification toolchainsJdkSpecification; + + @Component + private ToolchainManager toolchainManager; + /** * List of files to include. Specified as fileset patterns which are relative to the input directory whose contents * is being packaged into the JAR. @@ -250,6 +258,17 @@ public File createArchive() throws MojoExecutionException { archiver.setArchiver((JarArchiver) archivers.get(archiverName)); archiver.setOutputFile(jarFile); + Optional.ofNullable(toolchainManager.getToolchainFromBuildContext("jdk", session)) + .ifPresent(toolchain -> toolchainsJdkSpecification + .getJDKSpecification(toolchain) + .ifPresent(jdkSpec -> { + archive.addManifestEntry("Build-Jdk-Spec", jdkSpec); + archive.addManifestEntry( + "Build-Tool-Jdk-Spec", System.getProperty("java.specification.version")); + archiver.setBuildJdkSpecDefaultEntry(false); + getLog().info("Set Build-Jdk-Spec based on toolchain in maven-jar-plugin " + toolchain); + })); + // configure for Reproducible Builds based on outputTimestamp value archiver.configureReproducibleBuild(outputTimestamp); diff --git a/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java b/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java new file mode 100644 index 00000000..8872632c --- /dev/null +++ b/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java @@ -0,0 +1,99 @@ +/* + * 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. + */ +package org.apache.maven.plugins.jar; + +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import org.apache.maven.toolchain.Toolchain; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Component provided JDK specification based on toolchains. + */ +@Named +@Singleton +class ToolchainsJdkSpecification { + + private final Logger logger = LoggerFactory.getLogger(ToolchainsJdkSpecification.class); + + private final Map cache = new HashMap<>(); + + public synchronized Optional getJDKSpecification(Toolchain toolchain) { + Optional javacPath = getJavacPath(toolchain); + return javacPath.map(path -> cache.computeIfAbsent(path, this::getSpecForPath)); + } + + private Optional getJavacPath(Toolchain toolchain) { + return Optional.ofNullable(toolchain.findTool("javac")).map(Paths::get).map(this::getCanonicalPath); + } + + private Path getCanonicalPath(Path path) { + try { + return path.toRealPath(); + } catch (IOException e) { + if (path.getParent() != null) { + return getCanonicalPath(path.getParent()).resolve(path.getFileName()); + } else { + throw new UncheckedIOException(e); + } + } + } + + private String getSpecForPath(Path path) { + try { + Commandline cl = new Commandline(path.toString()); + cl.createArg().setValue("-version"); + CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer(); + CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer(); + CommandLineUtils.executeCommandLine(cl, out, err); + String version = out.getOutput().trim(); + if (version.isEmpty()) { + version = err.getOutput().trim(); + } + if (version.startsWith("javac ")) { + version = version.substring(6); + if (version.startsWith("1.")) { + version = version.substring(0, 3); + } else { + version = version.substring(0, 2); + } + return version; + } else { + logger.warn("Unrecognized output form " + path + " -version - " + version); + return null; + } + } catch (CommandLineException | IndexOutOfBoundsException e) { + logger.warn("Failed to execute: " + path + " - " + e.getMessage()); + return null; + } + } +} diff --git a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java index 11c0696e..b8b57e88 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarMojoTest.java @@ -18,28 +18,28 @@ */ package org.apache.maven.plugins.jar; -import java.io.File; +import org.apache.maven.plugin.testing.junit5.InjectMojo; +import org.apache.maven.plugin.testing.junit5.MojoTest; +import org.junit.jupiter.api.Test; -import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; /** * Test for {@link JarMojo} * * @version $Id$ */ -public class JarMojoTest extends AbstractMojoTestCase { - private File testPom = new File(getBasedir(), "src/test/resources/unit/jar-basic-test/pom.xml"); +@MojoTest +class JarMojoTest { /** * Tests the discovery and configuration of the mojo. - * - * @throws Exception in case of an error */ - public void testJarTestEnvironment() throws Exception { - JarMojo mojo = (JarMojo) lookupMojo("jar", testPom); - + @Test + @InjectMojo(goal = "jar", pom = "classpath:/unit/jar-basic-test/pom.xml") + void testJarTestEnvironment(JarMojo mojo) { assertNotNull(mojo); - assertEquals("foo", mojo.getProject().getGroupId()); } } diff --git a/src/test/java/org/apache/maven/plugins/jar/ToolchainsJdkVersionTest.java b/src/test/java/org/apache/maven/plugins/jar/ToolchainsJdkVersionTest.java new file mode 100644 index 00000000..0d504ed1 --- /dev/null +++ b/src/test/java/org/apache/maven/plugins/jar/ToolchainsJdkVersionTest.java @@ -0,0 +1,88 @@ +/* + * 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. + */ +package org.apache.maven.plugins.jar; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Locale; +import java.util.Optional; + +import org.apache.maven.toolchain.Toolchain; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class ToolchainsJdkVersionTest { + + @Mock + private Toolchain toolchain; + + private final ToolchainsJdkSpecification toolchainsJdkSpecification = new ToolchainsJdkSpecification(); + + @Test + void shouldReturnCorrectSpec() { + + Path javacPath = getJavacPath(); + Assumptions.assumeTrue(Files.isExecutable(javacPath)); + + when(toolchain.findTool("javac")).thenReturn(javacPath.toString()); + + Optional jdkVersion = toolchainsJdkSpecification.getJDKSpecification(toolchain); + Assertions.assertTrue(jdkVersion.isPresent()); + Assertions.assertEquals(System.getProperty("java.specification.version"), jdkVersion.get()); + } + + @Test + void shouldReturnEmptySpec() { + + when(toolchain.findTool("javac")).thenReturn(null); + + Optional jdkVersion = toolchainsJdkSpecification.getJDKSpecification(toolchain); + Assertions.assertFalse(jdkVersion.isPresent()); + } + + private String getJavaCName() { + if (System.getProperty("os.name", "").toLowerCase(Locale.ROOT).startsWith("win")) { + return "javac.exe"; + } else { + return "javac"; + } + } + + private Path getJavacPath() { + String javaCName = getJavaCName(); + + String javaHome = System.getProperty("java.home"); + + Path javacPath = Paths.get(javaHome, "bin", javaCName); + if (Files.isExecutable(javacPath)) { + return javacPath; + } + + // try with jre + return Paths.get(javaHome, "../bin", javaCName); + } +} From 1b958d1804fa894eb4838c13b0532742751e5836 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 26 Mar 2024 22:51:17 +0100 Subject: [PATCH 113/128] [MJAR-302] Require Maven 3.6.3 --- pom.xml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 12f3007e..57edaf99 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,7 @@ 8 - 3.2.5 + 3.6.3 3.6.1 2022-09-12T15:53:21Z @@ -186,6 +186,29 @@ + + org.apache.maven.plugins + maven-plugin-report-plugin + + + + 3.3.0 + 3.2.5 + 1.8 + + + 3.2.1 - 3.2.2 + 3.1.0 + 1.7 + + + 3.0.0 - 3.2.0 + 3.0 + 1.7 + + + + From 8dd0d3f176fb28aa779cd2ddec9c342e834f38c6 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Thu, 28 Mar 2024 21:12:29 +0100 Subject: [PATCH 114/128] [MJAR-298] Update Maven-Archiver to 3.6.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 57edaf99..94bedd02 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ 8 3.6.3 - 3.6.1 + 3.6.2 2022-09-12T15:53:21Z From 845c12071f2ec733c985c3d0eab3e48b1c15a486 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 02:15:54 +0000 Subject: [PATCH 115/128] Bump org.junit:junit-bom from 5.10.1 to 5.10.2 Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.10.1 to 5.10.2. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.10.1...r5.10.2) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 94bedd02..f89f1ddb 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ org.junit junit-bom - 5.10.1 + 5.10.2 pom import From ee85d599e14cbc69b71c65ade07b57f616217b57 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sat, 30 Mar 2024 09:45:30 +0100 Subject: [PATCH 116/128] [MJAR-303] Cleanup declared dependencies --- pom.xml | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index f89f1ddb..79616772 100644 --- a/pom.xml +++ b/pom.xml @@ -92,6 +92,7 @@ + org.apache.maven maven-plugin-api @@ -110,12 +111,15 @@ ${mavenVersion} provided + + - org.apache.maven - maven-model - ${mavenVersion} + org.apache.maven.plugin-tools + maven-plugin-annotations provided + + org.apache.maven.shared file-management @@ -126,11 +130,28 @@ maven-archiver ${mavenArchiverVersion} - + + - org.apache.maven.plugin-tools - maven-plugin-annotations - provided + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-archiver + 4.9.2 + + + + + javax.inject + javax.inject + 1 + + + org.slf4j + slf4j-api + 1.7.36 From aeffa392dd83040cde908c633b0ce2406850193b Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sat, 30 Mar 2024 11:32:20 +0100 Subject: [PATCH 117/128] [MJAR-304] Refresh download page --- src/site/site.xml | 6 +- src/site/xdoc/download.xml.vm | 117 ++++++++++------------------------ 2 files changed, 36 insertions(+), 87 deletions(-) diff --git a/src/site/site.xml b/src/site/site.xml index 38bb007b..fcb02d6a 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -19,9 +19,9 @@ specific language governing permissions and limitations under the License. --> - + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.1 http://maven.apache.org/xsd/decoration-1.8.1.xsd"> @@ -29,7 +29,7 @@ under the License. - + diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 3f710359..8f28f053 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -23,102 +23,51 @@ under the License. Download ${project.name} Source +
-

${project.name} ${project.version} is distributed in source format. Use a source archive if you intend to build - ${project.name} yourself. Otherwise, simply use the ready-made binary artifacts from central repository.

- -

You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24 - hours to reach all mirrors.

- -

In order to guard against corrupted downloads/installations, it is highly recommended to - verify the signature - of the release bundles against the public KEYS used by the Apache Maven - developers.

+

${project.name} ${project.version} is distributed in source format.

-

${project.name} is distributed under the Apache License, version 2.0.

+

Use a source archive if you intend to build ${project.name} yourself.

-

We strongly encourage our users to configure a Maven repository mirror closer to their location, please read How to Use Mirrors for Repositories.

- - - - -

- [if-any logo] - - logo - - [end] - The currently selected mirror is - [preferred]. - If you encounter a problem with this mirror, - please select another mirror. - If all mirrors are failing, there are - backup - mirrors - (at the end of the mirrors list) that should be available. -

+

Otherwise, simply use the ready-made binary artifacts from central repository.

-
- Other mirrors: - - -
+

${project.name} is distributed under the Apache License, version 2.0.

-

- You may also consult the - complete list of - mirrors. + + +

This is the current stable version of ${project.name}.

+ + + + + + + + + + + + + + + + + + +
LinkChecksumSignature
${project.name} ${project.version} (Source zip)${project.artifactId}-${project.version}-source-release.zip${project.artifactId}-${project.version}-source-release.zip.sha512${project.artifactId}-${project.version}-source-release.zip.asc
+ +

It is essential that you verify the integrity of the downloaded file + using the checksum (.sha512 file) + or using the signature (.asc file) against the public KEYS used by the Apache Maven developers.

- - - -

This is the current stable version of ${project.name}.

- - - - - - - - - - - - - - - - - - -
LinkChecksumSignature
${project.name} ${project.version} (Source zip)maven/plugins/${project.artifactId}-${project.version}-source-release.zipmaven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha512maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc
-
- -

Older non-recommended releases can be found on our archive site.

- +

It is strongly recommended to use the latest release version of ${project.name} to take advantage of the newest features and bug fixes.

+

Older non-recommended releases can be found on our archive site.

From ddfb635b55ec1ad23f83c4884a743b4a6c80a273 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 9 Apr 2024 00:41:13 +0200 Subject: [PATCH 118/128] [MJAR-306] Use properties for plugins versions in LifecycleMapping properties are defined in parent --- .../META-INF/plexus/components.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/filtered-resources/META-INF/plexus/components.xml b/src/main/filtered-resources/META-INF/plexus/components.xml index 27b855b3..e428cbe0 100644 --- a/src/main/filtered-resources/META-INF/plexus/components.xml +++ b/src/main/filtered-resources/META-INF/plexus/components.xml @@ -67,28 +67,28 @@ - org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources + org.apache.maven.plugins:maven-resources-plugin:${version.maven-resources-plugin}:resources - org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile + org.apache.maven.plugins:maven-compiler-plugin:${version.maven-compiler-plugin}:compile - org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources + org.apache.maven.plugins:maven-resources-plugin:${version.maven-resources-plugin}:testResources - org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:${version.maven-compiler-plugin}:testCompile - org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test + org.apache.maven.plugins:maven-surefire-plugin:${version.maven-surefire}:test org.apache.maven.plugins:maven-jar-plugin:${project.version}:jar - org.apache.maven.plugins:maven-install-plugin:2.5.2:install + org.apache.maven.plugins:maven-install-plugin:${version.maven-install-plugin}:install - org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy + org.apache.maven.plugins:maven-deploy-plugin:${version.maven-deploy-plugin}:deploy From 5e31b9933a68a44b180a499636f7f43c8521648c Mon Sep 17 00:00:00 2001 From: redzi Date: Tue, 9 Apr 2024 23:00:14 +0200 Subject: [PATCH 119/128] [MJAR-296] Allow including files excluded by default. (#67) * [MJAR-296] Allow including files excluded by default. * Improve implementation * Fix ITs * fix docs after review --------- Co-authored-by: Slawomir Jaranowski --- src/it/MJAR-296-exclude-default/pom.xml | 58 ++++++++++++++++++ src/it/MJAR-296-exclude-default/setup.groovy | 29 +++++++++ .../src/main/java/Foo.java | 31 ++++++++++ src/it/MJAR-296-exclude-default/verify.groovy | 31 ++++++++++ .../pom.xml | 61 +++++++++++++++++++ .../setup.groovy | 29 +++++++++ .../src/main/java/Foo.java | 31 ++++++++++ .../verify.groovy | 33 ++++++++++ .../maven/plugins/jar/AbstractJarMojo.java | 45 +++++++++++++- 9 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 src/it/MJAR-296-exclude-default/pom.xml create mode 100644 src/it/MJAR-296-exclude-default/setup.groovy create mode 100644 src/it/MJAR-296-exclude-default/src/main/java/Foo.java create mode 100644 src/it/MJAR-296-exclude-default/verify.groovy create mode 100644 src/it/MJAR-296-suppress-default-excludes/pom.xml create mode 100644 src/it/MJAR-296-suppress-default-excludes/setup.groovy create mode 100644 src/it/MJAR-296-suppress-default-excludes/src/main/java/Foo.java create mode 100644 src/it/MJAR-296-suppress-default-excludes/verify.groovy diff --git a/src/it/MJAR-296-exclude-default/pom.xml b/src/it/MJAR-296-exclude-default/pom.xml new file mode 100644 index 00000000..1cdf068f --- /dev/null +++ b/src/it/MJAR-296-exclude-default/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.maven.plugins + mjar-296-exclude-default + mjar-296-suppress-default-excludes + Verifies that the resulting jar not includes files excluded by default + jar + 1.0-SNAPSHOT + + + UTF-8 + 2023-11-19T13:25:58Z + + + + + + + org.apache.maven.plugins + maven-resources-plugin + @version.maven-resources-plugin@ + + false + + + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + diff --git a/src/it/MJAR-296-exclude-default/setup.groovy b/src/it/MJAR-296-exclude-default/setup.groovy new file mode 100644 index 00000000..ab30042c --- /dev/null +++ b/src/it/MJAR-296-exclude-default/setup.groovy @@ -0,0 +1,29 @@ +import java.nio.file.Files +import java.nio.file.Paths + +/* + * 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. + */ + +// excluded files are not copied by m-invoker-p - so we need create one + +def resDir = basedir.toPath().resolve("src/main/resources") +Files.createDirectories(resDir) +Files.createFile(resDir.resolve(".cvsignore")) + +return true diff --git a/src/it/MJAR-296-exclude-default/src/main/java/Foo.java b/src/it/MJAR-296-exclude-default/src/main/java/Foo.java new file mode 100644 index 00000000..f939fa6a --- /dev/null +++ b/src/it/MJAR-296-exclude-default/src/main/java/Foo.java @@ -0,0 +1,31 @@ + +/* + * 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 Foo +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/it/MJAR-296-exclude-default/verify.groovy b/src/it/MJAR-296-exclude-default/verify.groovy new file mode 100644 index 00000000..9599b984 --- /dev/null +++ b/src/it/MJAR-296-exclude-default/verify.groovy @@ -0,0 +1,31 @@ +/* + * 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 target = new File(basedir, "target") + +def cvsignore = new File(target, "classes/.cvsignore") +assert cvsignore.exists() + +def artifact = new File(target, "mjar-296-exclude-default-1.0-SNAPSHOT.jar") +assert artifact.exists() + +def jar = new JarFile(artifact) +assert ".cvsignore" !in jar.entries()*.name diff --git a/src/it/MJAR-296-suppress-default-excludes/pom.xml b/src/it/MJAR-296-suppress-default-excludes/pom.xml new file mode 100644 index 00000000..9ff5b450 --- /dev/null +++ b/src/it/MJAR-296-suppress-default-excludes/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + org.apache.maven.plugins + mjar-296-suppress-default-excludes + mjar-296-suppress-default-excludes + Verifies that the resulting jar includes files excluded by default + jar + 1.0-SNAPSHOT + + + UTF-8 + 2023-11-19T13:25:58Z + + + + + + + org.apache.maven.plugins + maven-resources-plugin + @version.maven-resources-plugin@ + + false + + + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + false + + + + + diff --git a/src/it/MJAR-296-suppress-default-excludes/setup.groovy b/src/it/MJAR-296-suppress-default-excludes/setup.groovy new file mode 100644 index 00000000..324bf2bb --- /dev/null +++ b/src/it/MJAR-296-suppress-default-excludes/setup.groovy @@ -0,0 +1,29 @@ +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths + +/* + * 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. + */ + +// excluded files are not copied by m-invoker-p - so we need create one +def resDir = basedir.toPath().resolve("src/main/resources") +Files.createDirectories(resDir) +Files.createFile(resDir.resolve(".cvsignore")) + +return true diff --git a/src/it/MJAR-296-suppress-default-excludes/src/main/java/Foo.java b/src/it/MJAR-296-suppress-default-excludes/src/main/java/Foo.java new file mode 100644 index 00000000..f939fa6a --- /dev/null +++ b/src/it/MJAR-296-suppress-default-excludes/src/main/java/Foo.java @@ -0,0 +1,31 @@ + +/* + * 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 Foo +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/it/MJAR-296-suppress-default-excludes/verify.groovy b/src/it/MJAR-296-suppress-default-excludes/verify.groovy new file mode 100644 index 00000000..806c90ef --- /dev/null +++ b/src/it/MJAR-296-suppress-default-excludes/verify.groovy @@ -0,0 +1,33 @@ +/* + * 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 target = new File(basedir, "target") + +def cvsignore = new File(target, "classes/.cvsignore") +assert cvsignore.exists() + +def artifact = new File(target, "mjar-296-suppress-default-excludes-1.0-SNAPSHOT.jar") +assert artifact.exists() + +def jar = new JarFile(artifact) +assert ".cvsignore" in jar.entries()*.name + + 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 47b8bde2..9a2bc229 100644 --- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java @@ -38,6 +38,7 @@ import org.apache.maven.toolchain.ToolchainManager; import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.jar.JarArchiver; +import org.codehaus.plexus.archiver.util.DefaultFileSet; /** * Base class for creating a jar from project classes. @@ -169,6 +170,38 @@ public abstract class AbstractJarMojo extends AbstractMojo { @Parameter(property = "maven.jar.detectMultiReleaseJar", defaultValue = "true") private boolean detectMultiReleaseJar; + /** + * If set to {@code false}, the files and directories that by default are excluded from the resulting archive, + * like {@code .gitignore}, {@code .cvsignore} etc. will be included. + * This means all files like the following will be included. + *
    + *
  • Misc: **/*~, **/#*#, **/.#*, **/%*%, **/._*
  • + *
  • CVS: **/CVS, **/CVS/**, **/.cvsignore
  • + *
  • RCS: **/RCS, **/RCS/**
  • + *
  • SCCS: **/SCCS, **/SCCS/**
  • + *
  • VSSercer: **/vssver.scc
  • + *
  • MKS: **/project.pj
  • + *
  • SVN: **/.svn, **/.svn/**
  • + *
  • GNU: **/.arch-ids, **/.arch-ids/**
  • + *
  • Bazaar: **/.bzr, **/.bzr/**
  • + *
  • SurroundSCM: **/.MySCMServerInfo
  • + *
  • Mac: **/.DS_Store
  • + *
  • Serena Dimension: **/.metadata, **/.metadata/**
  • + *
  • Mercurial: **/.hg, **/.hg/**
  • + *
  • Git: **/.git, **/.git/**
  • + *
  • Bitkeeper: **/BitKeeper, **/BitKeeper/**, **/ChangeSet, + * **/ChangeSet/**
  • + *
  • Darcs: **/_darcs, **/_darcs/**, **/.darcsrepo, + * **/.darcsrepo/****/-darcs-backup*, **/.darcs-temp-mail + *
+ * + * @see DEFAULTEXCLUDES + * + * @since 3.4.0 + */ + @Parameter(defaultValue = "true") + private boolean addDefaultExcludes; + /** * Return the specific output directory to serve as the root for the archive. * @return get classes directory. @@ -281,7 +314,7 @@ public File createArchive() throws MojoExecutionException { getLog().warn("JAR will be empty - no content was marked for inclusion!"); } } else { - archiver.getArchiver().addDirectory(contentDirectory, getIncludes(), getExcludes()); + archiver.getArchiver().addFileSet(getFileSet(contentDirectory)); } archiver.createArchive(session, project, archive); @@ -353,4 +386,14 @@ private String[] getExcludes() { } return DEFAULT_EXCLUDES; } + + private org.codehaus.plexus.archiver.FileSet getFileSet(File contentDirectory) { + DefaultFileSet fileSet = DefaultFileSet.fileSet(contentDirectory) + .prefixed("") + .includeExclude(getIncludes(), getExcludes()) + .includeEmptyDirs(true); + + fileSet.setUsingDefaultExcludes(addDefaultExcludes); + return fileSet; + } } From 992f44a2ef710326a6b98e18d4e40f724bea5f90 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 9 Apr 2024 23:17:47 +0200 Subject: [PATCH 120/128] [maven-release-plugin] prepare release maven-jar-plugin-3.4.0 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 79616772..e1d46988 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-jar-plugin - 3.4.0-SNAPSHOT + 3.4.0 maven-plugin Apache Maven JAR Plugin @@ -54,7 +54,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git - HEAD + maven-jar-plugin-3.4.0 https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} @@ -76,7 +76,7 @@ 8 3.6.3 3.6.2 - 2022-09-12T15:53:21Z + 2024-04-09T21:17:42Z From 902d4c55a19f301c31a4e187fbd798d4f847cb19 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 9 Apr 2024 23:17:55 +0200 Subject: [PATCH 121/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e1d46988..8b55c976 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-jar-plugin - 3.4.0 + 3.4.1-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -54,7 +54,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git - maven-jar-plugin-3.4.0 + HEAD https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} @@ -76,7 +76,7 @@ 8 3.6.3 3.6.2 - 2024-04-09T21:17:42Z + 2024-04-09T21:17:54Z From 52111cc9250fc5876f4a6570a48bc679d099d8e2 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 16 Apr 2024 22:24:56 +0200 Subject: [PATCH 122/128] [MJAR-307] Wrong version of commons-io cause a ClassNotFound o.a.commons.io.file.attribute.FileTimes (#83) * ITs for MJAR-307 - try to reproduce * Add timestamp (#84) * Add timestamp * Add timestamp format --------- Co-authored-by: Delany * Fix a bug --------- Co-authored-by: Delany Co-authored-by: Delany --- pom.xml | 5 ++ src/it/MJAR-307/pom.xml | 47 +++++++++++++++++++ .../src/main/java/foo/project003/App.java | 32 +++++++++++++ src/it/MJAR-307/verify.groovy | 25 ++++++++++ 4 files changed, 109 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/pom.xml b/pom.xml index 8b55c976..bbb9847c 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 new file mode 100644 index 00000000..d0c36edc --- /dev/null +++ b/src/it/MJAR-307/pom.xml @@ -0,0 +1,47 @@ + + + + 4.0.0 + + org.apache.maven.plugins.jar.it + mjar-307 + jar + 1.0 + it-mjar-307 + + Wrong version of commons-io cause a ClassNotFoundException: org.apache.commons.io.file.attribute.FileTimes + + + yyyyMMdd + ${maven.build.timestamp} + + + + + + org.apache.maven.plugins + maven-jar-plugin + @project.version@ + + + + + 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 00000000..3a3d1665 --- /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 00000000..d75e626d --- /dev/null +++ b/src/it/MJAR-307/verify.groovy @@ -0,0 +1,25 @@ +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() From 325b2990308f08d4a2b3010cafe8bb55304ef53c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 22:58:38 +0200 Subject: [PATCH 123/128] [MJAR-308] Bump org.apache.maven.plugins:maven-plugins from 41 to 42 (#85) * Bump org.apache.maven.plugins:maven-plugins from 41 to 42 Bumps [org.apache.maven.plugins:maven-plugins](https://github.com/apache/maven-parent) from 41 to 42. - [Release notes](https://github.com/apache/maven-parent/releases) - [Commits](https://github.com/apache/maven-parent/commits) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-plugins dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Cleanups after new parent --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Slawomir Jaranowski --- pom.xml | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index bbb9847c..6ef182a3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.maven.plugins maven-plugins - 41 + 42 @@ -81,13 +81,6 @@ - - org.junit - junit-bom - 5.10.2 - pom - import - commons-io commons-io @@ -212,29 +205,6 @@ - - org.apache.maven.plugins - maven-plugin-report-plugin - - - - 3.3.0 - 3.2.5 - 1.8 - - - 3.2.1 - 3.2.2 - 3.1.0 - 1.7 - - - 3.0.0 - 3.2.0 - 3.0 - 1.7 - - - - From 8b29adc0e420b1da1495791c9d5bb9399590cc51 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 16 Apr 2024 23:03:52 +0200 Subject: [PATCH 124/128] [maven-release-plugin] prepare release maven-jar-plugin-3.4.1 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 6ef182a3..e06e4475 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-jar-plugin - 3.4.1-SNAPSHOT + 3.4.1 maven-plugin Apache Maven JAR Plugin @@ -54,7 +54,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git - HEAD + maven-jar-plugin-3.4.1 https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} @@ -76,7 +76,7 @@ 8 3.6.3 3.6.2 - 2024-04-09T21:17:54Z + 2024-04-16T21:03:47Z From a5554bb21e9528b3f3dfa5b97473f2af99045e73 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 16 Apr 2024 23:04:00 +0200 Subject: [PATCH 125/128] [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e06e4475..00e191a0 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-jar-plugin - 3.4.1 + 3.4.2-SNAPSHOT maven-plugin Apache Maven JAR Plugin @@ -54,7 +54,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git - maven-jar-plugin-3.4.1 + HEAD https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} @@ -76,7 +76,7 @@ 8 3.6.3 3.6.2 - 2024-04-16T21:03:47Z + 2024-04-16T21:04:00Z From e9c98a4dd95b79088fe5264d3e5dbba1342ddb80 Mon Sep 17 00:00:00 2001 From: Robin Jansohn Date: Fri, 17 May 2024 14:26:23 +0200 Subject: [PATCH 126/128] [MJAR-310] fixed toolchain version detection when toolchain paths contain white spaces --- pom.xml | 4 -- .../jar/ToolchainsJdkSpecification.java | 45 ++++++++++++------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 00e191a0..afd49d66 100644 --- a/pom.xml +++ b/pom.xml @@ -130,10 +130,6 @@ - - org.codehaus.plexus - plexus-utils - org.codehaus.plexus plexus-archiver diff --git a/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java b/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java index 8872632c..ef992ab0 100644 --- a/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java +++ b/src/main/java/org/apache/maven/plugins/jar/ToolchainsJdkSpecification.java @@ -21,7 +21,10 @@ import javax.inject.Named; import javax.inject.Singleton; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.nio.file.Path; import java.nio.file.Paths; @@ -30,9 +33,6 @@ import java.util.Optional; import org.apache.maven.toolchain.Toolchain; -import org.codehaus.plexus.util.cli.CommandLineException; -import org.codehaus.plexus.util.cli.CommandLineUtils; -import org.codehaus.plexus.util.cli.Commandline; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,15 +70,12 @@ private Path getCanonicalPath(Path path) { private String getSpecForPath(Path path) { try { - Commandline cl = new Commandline(path.toString()); - cl.createArg().setValue("-version"); - CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer(); - CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer(); - CommandLineUtils.executeCommandLine(cl, out, err); - String version = out.getOutput().trim(); - if (version.isEmpty()) { - version = err.getOutput().trim(); - } + ProcessBuilder processBuilder = new ProcessBuilder(path.toString(), "-version"); + processBuilder.redirectErrorStream(true); + Process process = processBuilder.start(); + String version = readOutput(process.getInputStream()).trim(); + process.waitFor(); + if (version.startsWith("javac ")) { version = version.substring(6); if (version.startsWith("1.")) { @@ -88,12 +85,26 @@ private String getSpecForPath(Path path) { } return version; } else { - logger.warn("Unrecognized output form " + path + " -version - " + version); - return null; + logger.warn("Unrecognized output from {}: {}", processBuilder.command(), version); } - } catch (CommandLineException | IndexOutOfBoundsException e) { - logger.warn("Failed to execute: " + path + " - " + e.getMessage()); - return null; + } catch (IndexOutOfBoundsException | IOException e) { + logger.warn("Failed to execute: {} - {}", path, e.getMessage()); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + + return null; + } + + private String readOutput(InputStream inputstream) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(inputstream)); + + StringBuilder output = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + output.append(line + System.lineSeparator()); } + + return output.toString(); } } From 99584ce9cff9d87d73c12df81d40a982d75845ff Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Mon, 3 Jun 2024 18:42:39 +0200 Subject: [PATCH 127/128] Build with Maven 4 --- .github/workflows/maven-verify.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml index 932827cf..065619be 100644 --- a/.github/workflows/maven-verify.yml +++ b/.github/workflows/maven-verify.yml @@ -25,3 +25,6 @@ jobs: build: name: Verify uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 + with: + maven4-enabled: true + From 95007e86d205703d898aa0fb5d24ae3df0c25789 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 16 Jun 2024 14:09:42 +0200 Subject: [PATCH 128/128] [maven-release-plugin] prepare release maven-jar-plugin-3.4.2 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index afd49d66..910e227d 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-jar-plugin - 3.4.2-SNAPSHOT + 3.4.2 maven-plugin Apache Maven JAR Plugin @@ -54,7 +54,7 @@ scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-jar-plugin.git - HEAD + maven-jar-plugin-3.4.2 https://github.com/apache/maven-jar-plugin/tree/${project.scm.tag} @@ -76,7 +76,7 @@ 8 3.6.3 3.6.2 - 2024-04-16T21:04:00Z + 2024-06-16T12:09:37Z