You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2021/04/03 21:56:21 UTC

[maven-source-plugin] branch MSOURCES-121 updated (f32513d -> 0a883f5)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MSOURCES-121
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git.


 discard f32513d  [MSOURCES-121] - Check for duplicated addition of the same file  - Added solution.
 discard b58a381  [MSOURCES-121] - Check for duplicated addition of the same file  - Added IT to check for failing in case of executing twice.
     add 6e715b1  [MSOURCES-95] Source JAR is re-created even if sources are not changed
     add 32f122a  MSOURCES-120 make output jar file binary Reproducible
     add 816ebc4  MSOURCES-120 fix reproducible IT: remove plugin version from pom.xml
     add 2a74824  [maven-release-plugin] prepare release maven-source-plugin-3.2.0
     add 5b4e02f  [maven-release-plugin] prepare for next development iteration
     add 258d666  MSOURCES-122 make output independant from OS newline
     add d5b9878  [MSOURCES-123] set archiver reproducible mode earlier
     add c954a7e  make build as reproducible as possible for now
     add a59a2e4  [maven-release-plugin] prepare release maven-source-plugin-3.2.1
     add e8eaa79  [maven-release-plugin] prepare for next development iteration
     add 85dd30a  [MSOURCES-126] delete non-reproducible generated META-INF/NOTICE
     add 0f34f68  [MSOURCES-126] use m-remote-resources-p reproducible version
     add 46c7923  update parent pom
     add a601bf9  added README
     add 4cd00a4  fixed typo
     add a6db31c  added ASF GitHub config
     add 630994d  fixed broken links (MPIR 3)
     add b677bb8  README improvement
     add ae6876a  update ASF CI url
     add 03652d3  update ASF CI url
     add 2233597  Fix some sonar findings
     add 90a0aae  Bump junit from 4.12 to 4.13
     add 2dfe117  Bump plexus-archiver from 4.2.1 to 4.2.2
     add 673014c  Bump maven-assembly-plugin from 3.2.0 to 3.3.0
     add 1c23f60  Fix issues reported by IDE
     add 9d10d0c  Update Plexus Archiver to 4.2.3 to solve JDK-8177809
     new 7b7d37d  [MSOURCES-121] - Check for duplicated addition of the same file  - Added IT to check for failing in case of executing twice.
     new 0a883f5  [MSOURCES-121] - Check for duplicated addition of the same file  - Added solution.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f32513d)
            \
             N -- N -- N   refs/heads/MSOURCES-121 (0a883f5)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .asf.yaml                                          | 26 ++++++
 README.md                                          | 99 ++++++++++++++++++++++
 pom.xml                                            | 56 ++++++++++--
 .../invoker.properties                             |  3 +-
 .../pom.xml                                        | 10 ++-
 .../MSOURCES-95/src/main/java/.gitignore}          |  3 +-
 .../src/main/resources/main.properties             |  0
 .../MSOURCES-95/src/test/java/.gitignore}          |  3 +-
 .../src/test}/resources/main.properties            |  0
 .../AppTest.java => it/MSOURCES-95/verify.groovy}  | 46 +++-------
 .../invoker.properties}                            |  1 +
 .../pom.xml => reproducible/parent-pom.xml}        | 16 ++--
 .../pom.xml                                        | 40 +++++++--
 .../reproducible/src/main/resources/Uppercase.txt  |  1 +
 .../reproducible/src/main/resources/dir-A/A2.txt   |  1 +
 .../reproducible/src/main/resources/dir-A/A4.txt   |  1 +
 .../reproducible/src/main/resources/dir-A/a1.txt   |  1 +
 .../reproducible/src/main/resources/dir-A/a3.txt   |  1 +
 src/it/reproducible/src/main/resources/dir-C/C.txt |  1 +
 .../src/main/resources/dir-b/B2/B2.txt             |  1 +
 .../src/main/resources/dir-b/B4/B4.txt             |  1 +
 src/it/reproducible/src/main/resources/dir-b/b.txt |  1 +
 .../src/main/resources/dir-b/b1/b1.txt             |  1 +
 .../src/main/resources/dir-b/b3/b3.txt             |  1 +
 src/it/reproducible/src/main/resources/dir-d/d.txt |  1 +
 .../reproducible/src/main/resources/executable.txt |  1 +
 .../reproducible/src/main/resources/lowercase.txt  |  1 +
 src/it/reproducible/verify.groovy                  | 75 ++++++++++++++++
 .../plugins/source/AbstractSourceJarMojo.java      | 46 +++++-----
 .../plugins/source/AggregatorSourceJarMojo.java    |  1 +
 src/site/apt/index.apt.vm                          |  8 +-
 .../source/AbstractSourcePluginTestCase.java       |  2 +-
 .../maven/plugins/source/stubs/Project001Stub.java |  4 +-
 .../maven/plugins/source/stubs/Project003Stub.java |  4 +-
 .../maven/plugins/source/stubs/Project007Stub.java |  4 +-
 .../maven/plugins/source/stubs/Project009Stub.java |  4 +-
 .../maven/plugins/source/stubs/Project010Stub.java |  4 +-
 37 files changed, 370 insertions(+), 99 deletions(-)
 create mode 100644 .asf.yaml
 create mode 100644 README.md
 copy src/it/{jar-with-archive-config => MSOURCES-95}/invoker.properties (70%)
 copy src/it/{verify-parameter-goal-jar-no-fork => MSOURCES-95}/pom.xml (83%)
 mode change 100755 => 100644
 copy src/{test/resources/unit/project-003/src/main/resources/excluded-file.txt => it/MSOURCES-95/src/main/java/.gitignore} (87%)
 copy src/it/{test-jar => MSOURCES-95}/src/main/resources/main.properties (100%)
 copy src/{test/resources/unit/project-003/src/main/resources/excluded-file.txt => it/MSOURCES-95/src/test/java/.gitignore} (87%)
 copy src/it/{test-jar/src/main => MSOURCES-95/src/test}/resources/main.properties (100%)
 copy src/{test/resources/unit/project-001/src/test/java/foo/project001/AppTest.java => it/MSOURCES-95/verify.groovy} (55%)
 copy src/it/{MSOURCES-121/src/test/resources/test.properties => reproducible/invoker.properties} (92%)
 copy src/it/{manifest-content/pom.xml => reproducible/parent-pom.xml} (80%)
 copy src/it/{jar-without-descriptor-config => reproducible}/pom.xml (50%)
 create mode 100644 src/it/reproducible/src/main/resources/Uppercase.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-A/A2.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-A/A4.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-A/a1.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-A/a3.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-C/C.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-b/B2/B2.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-b/B4/B4.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-b/b.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-b/b1/b1.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-b/b3/b3.txt
 create mode 100644 src/it/reproducible/src/main/resources/dir-d/d.txt
 create mode 100755 src/it/reproducible/src/main/resources/executable.txt
 create mode 100644 src/it/reproducible/src/main/resources/lowercase.txt
 create mode 100644 src/it/reproducible/verify.groovy

[maven-source-plugin] 01/02: [MSOURCES-121] - Check for duplicated addition of the same file - Added IT to check for failing in case of executing twice.

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MSOURCES-121
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git

commit 7b7d37d7c8e1a0f9ab9a8db4ebee6d1592760c2b
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun May 19 16:27:49 2019 +0200

    [MSOURCES-121] - Check for duplicated addition of the same file
     - Added IT to check for failing in case of executing twice.
---
 src/it/MSOURCES-121/invoker.properties             | 17 ++++++
 src/it/MSOURCES-121/pom.xml                        | 65 ++++++++++++++++++++++
 src/it/MSOURCES-121/src/main/java/MyClass.java     | 23 ++++++++
 .../src/main/resources/main.properties             | 17 ++++++
 src/it/MSOURCES-121/src/test/java/MyTest.java      | 23 ++++++++
 .../src/test/resources/test.properties             | 17 ++++++
 6 files changed, 162 insertions(+)

diff --git a/src/it/MSOURCES-121/invoker.properties b/src/it/MSOURCES-121/invoker.properties
new file mode 100644
index 0000000..2668a60
--- /dev/null
+++ b/src/it/MSOURCES-121/invoker.properties
@@ -0,0 +1,17 @@
+# 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/MSOURCES-121/pom.xml b/src/it/MSOURCES-121/pom.xml
new file mode 100644
index 0000000..f1274f9
--- /dev/null
+++ b/src/it/MSOURCES-121/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.sources</groupId>
+  <artifactId>jar-no-fork</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test for multiple attachments of files</name>
+	<description>This build should fail based on the duplicate
+   execution with  the same configuration. This will errornously
+   add the classifier/file twice times.
+   MSOURCES-121.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>attach-sources-1</id>
+            <goals>
+              <goal>jar-no-fork</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>attach-sources-2</id>
+            <goals>
+              <goal>jar-no-fork</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/MSOURCES-121/src/main/java/MyClass.java b/src/it/MSOURCES-121/src/main/java/MyClass.java
new file mode 100644
index 0000000..4945381
--- /dev/null
+++ b/src/it/MSOURCES-121/src/main/java/MyClass.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+public class MyClass
+{
+
+}
diff --git a/src/it/MSOURCES-121/src/main/resources/main.properties b/src/it/MSOURCES-121/src/main/resources/main.properties
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/MSOURCES-121/src/main/resources/main.properties
@@ -0,0 +1,17 @@
+# 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.
+
diff --git a/src/it/MSOURCES-121/src/test/java/MyTest.java b/src/it/MSOURCES-121/src/test/java/MyTest.java
new file mode 100644
index 0000000..9d124be
--- /dev/null
+++ b/src/it/MSOURCES-121/src/test/java/MyTest.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+public class MyTest
+{
+
+}
diff --git a/src/it/MSOURCES-121/src/test/resources/test.properties b/src/it/MSOURCES-121/src/test/resources/test.properties
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/MSOURCES-121/src/test/resources/test.properties
@@ -0,0 +1,17 @@
+# 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.
+

[maven-source-plugin] 02/02: [MSOURCES-121] - Check for duplicated addition of the same file - Added solution.

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MSOURCES-121
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git

commit 0a883f5b58b59f8497c24430313caee179e1396f
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun May 19 18:45:49 2019 +0200

    [MSOURCES-121] - Check for duplicated addition of the same file
     - Added solution.
---
 .../maven/plugins/source/AbstractSourceJarMojo.java | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
index a5433d6..72c475a 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -28,6 +28,7 @@ import java.util.List;
 
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
@@ -320,6 +321,16 @@ public abstract class AbstractSourceJarMojo
 
             if ( attach )
             {
+                for ( Artifact attachedArtifact : project.getAttachedArtifacts() )
+                {
+                    if ( isAlreadyAttached( attachedArtifact, project, getClassifier() ) )
+                    {
+                        getLog().error( "We have duplicated artifacts attached." );
+                        throw new MojoExecutionException( "Presumably you have configured maven-source-plugn "
+                                + "to execute twice times in your build. You have to configure a classifier "
+                                + "for at least on of them." );
+                    }
+                }
                 projectHelper.attachArtifact( project, getType(), getClassifier(), outputFile );
             }
             else
@@ -333,6 +344,16 @@ public abstract class AbstractSourceJarMojo
         }
     }
 
+    private boolean isAlreadyAttached( Artifact artifact, MavenProject checkProject, String classifier )
+    {
+        return artifact.getType().equals( getType() )
+                && artifact.getGroupId().equals( checkProject.getGroupId() )
+                && artifact.getArtifactId().equals( checkProject.getArtifactId() )
+                && artifact.getVersion().equals( checkProject.getVersion() )
+                && ( artifact.getClassifier() != null
+                ? artifact.getClassifier().equals( classifier ) : false );
+    }
+
     /**
      * @param p {@link MavenProject}
      * @param archiver {@link Archiver}