You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2019/06/19 19:42:13 UTC

[maven-source-plugin] branch MSOURCES-95 updated (5a3ba9a -> 987b24c)

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

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


 discard 5a3ba9a  [MSOURCES-95] Source JAR is re-created even if sources are not changed
     new 987b24c  [MSOURCES-95] Source JAR is re-created even if sources are not changed

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   (5a3ba9a)
            \
             N -- N -- N   refs/heads/MSOURCES-95 (987b24c)

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 1 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:
 src/it/MSOURCES-95/verify.groovy | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)


[maven-source-plugin] 01/01: [MSOURCES-95] Source JAR is re-created even if sources are not changed

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

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

commit 987b24cf6b596b60f3c66dc65cdf47efea8d6730
Author: Plamen Totev <pl...@gmail.com>
AuthorDate: Sun Jun 10 21:42:00 2018 +0300

    [MSOURCES-95] Source JAR is re-created even if sources are not changed
    
    If there is an empty source directory (such as
    generated-sources/annotations for example) the sources JAR will be
    re-created even if the sources have not changed. The reason is the
    default include pattern: "**/*". It does not include the directory
    itself and if the directory is empty there is no way for
    Plexus Archiver to know if the archive is up to date
    (no file or directory to compare with the last modification time
    of the archive),
    so it does the safe thing and re-creates the archive.
    
    Change the default includes pattern to "**/**". That will cause the
    empty directory itself (generated-sources/annotations in our example)
    to be considered when checking the last modification date so the
    archive will not be re-created if it is up to date. Please note that
    the change of the pattern will not change what is included in the
    archive -- the directory itself will not be included, only its content.
    
    This closes #2
---
 src/it/MSOURCES-95/invoker.properties              | 19 +++++++++
 src/it/MSOURCES-95/pom.xml                         | 46 ++++++++++++++++++++++
 src/it/MSOURCES-95/src/main/java/.gitignore        | 19 +++++++++
 .../MSOURCES-95/src/main/resources/main.properties | 17 ++++++++
 src/it/MSOURCES-95/src/test/java/.gitignore        | 19 +++++++++
 .../MSOURCES-95/src/test/resources/main.properties | 17 ++++++++
 src/it/MSOURCES-95/verify.groovy                   | 34 ++++++++++++++++
 .../plugins/source/AbstractSourceJarMojo.java      |  2 +-
 8 files changed, 172 insertions(+), 1 deletion(-)

diff --git a/src/it/MSOURCES-95/invoker.properties b/src/it/MSOURCES-95/invoker.properties
new file mode 100644
index 0000000..6996f12
--- /dev/null
+++ b/src/it/MSOURCES-95/invoker.properties
@@ -0,0 +1,19 @@
+# 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.goals.1=${project.groupId}:${project.artifactId}:${project.version}:jar-no-fork ${project.groupId}:${project.artifactId}:${project.version}:test-jar-no-fork
+invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:jar-no-fork ${project.groupId}:${project.artifactId}:${project.version}:test-jar-no-fork
diff --git a/src/it/MSOURCES-95/pom.xml b/src/it/MSOURCES-95/pom.xml
new file mode 100644
index 0000000..e16d8c6
--- /dev/null
+++ b/src/it/MSOURCES-95/pom.xml
@@ -0,0 +1,46 @@
+<?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-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.source</groupId>
+  <artifactId>empty-source-directory</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test that empty source directory does not mark the JAR as outdated</name>
+
+  <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>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/MSOURCES-95/src/main/java/.gitignore b/src/it/MSOURCES-95/src/main/java/.gitignore
new file mode 100644
index 0000000..d318bb3
--- /dev/null
+++ b/src/it/MSOURCES-95/src/main/java/.gitignore
@@ -0,0 +1,19 @@
+# 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.
+
+# This file is added just because git does not support
+# empty directories and we need empty directory for the test.
\ No newline at end of file
diff --git a/src/it/MSOURCES-95/src/main/resources/main.properties b/src/it/MSOURCES-95/src/main/resources/main.properties
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/MSOURCES-95/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-95/src/test/java/.gitignore b/src/it/MSOURCES-95/src/test/java/.gitignore
new file mode 100644
index 0000000..d318bb3
--- /dev/null
+++ b/src/it/MSOURCES-95/src/test/java/.gitignore
@@ -0,0 +1,19 @@
+# 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.
+
+# This file is added just because git does not support
+# empty directories and we need empty directory for the test.
\ No newline at end of file
diff --git a/src/it/MSOURCES-95/src/test/resources/main.properties b/src/it/MSOURCES-95/src/test/resources/main.properties
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/MSOURCES-95/src/test/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-95/verify.groovy b/src/it/MSOURCES-95/verify.groovy
new file mode 100644
index 0000000..c8df515
--- /dev/null
+++ b/src/it/MSOURCES-95/verify.groovy
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+File buildLog = new File( basedir, 'build.log' )
+
+File buildDirectory = new File( basedir, 'target' )
+File sourcesJarFile = new File ( buildDirectory, 'empty-source-directory-1.0-SNAPSHOT-sources.jar' )
+File testSourcesJarFile = new File ( buildDirectory, 'empty-source-directory-1.0-SNAPSHOT-test-sources.jar' )
+
+assert buildLog.exists()
+
+// Make sure the jars are created on the first build
+assert buildLog.text.contains( " Building jar: ${sourcesJarFile}" )
+assert buildLog.text.contains( " Building jar: ${testSourcesJarFile}" )
+
+// Make sure the jars are not re-created on subsequent builds
+assert buildLog.text.contains( " Archive ${sourcesJarFile} is uptodate" )
+assert buildLog.text.contains( " Archive ${testSourcesJarFile} is uptodate" )
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 7ae43c5..844c1fc 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -50,7 +50,7 @@ import org.codehaus.plexus.util.FileUtils;
 public abstract class AbstractSourceJarMojo
     extends AbstractMojo
 {
-    private static final String[] DEFAULT_INCLUDES = new String[] { "**/*" };
+    private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" };
 
     private static final String[] DEFAULT_EXCLUDES = new String[] {};