diff --git a/pom.xml b/pom.xml
index ebe3967..14851b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@ under the License.
maven-source-plugin
- 3.1.1-SNAPSHOT
+ 3.2.0-SNAPSHOT
maven-plugin
Apache Maven Source Plugin
@@ -110,12 +110,17 @@ under the License.
org.apache.maven
maven-archiver
- 3.4.0
+ 3.5.0
org.codehaus.plexus
plexus-archiver
- 4.1.0
+ 4.2.1
+
+
+ org.codehaus.plexus
+ plexus-utils
+ 3.3.0
@@ -161,6 +166,7 @@ under the License.
install
+ true
diff --git a/src/it/reproducible/invoker.properties b/src/it/reproducible/invoker.properties
new file mode 100644
index 0000000..0b9ee6a
--- /dev/null
+++ b/src/it/reproducible/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.goals=source:jar deploy:deploy
diff --git a/src/it/reproducible/pom.xml b/src/it/reproducible/pom.xml
new file mode 100644
index 0000000..7a42e57
--- /dev/null
+++ b/src/it/reproducible/pom.xml
@@ -0,0 +1,64 @@
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its
+ reproducible
+ 1.0
+
+ Test for reproducibility of jar
+
+
+ UTF-8
+ 2019-08-21T18:28:52Z
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ @project.version@
+
+
+
+
+ false
+
+
+
+
+
+ maven-deploy-plugin
+ 2.8.2
+
+
+ mine::default::file://${basedir}/target/repo
+
+
+
+
+
+
diff --git a/src/it/reproducible/src/main/resources/Uppercase.txt b/src/it/reproducible/src/main/resources/Uppercase.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/Uppercase.txt
@@ -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/reproducible/src/main/resources/dir-A/A2.txt b/src/it/reproducible/src/main/resources/dir-A/A2.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-A/A2.txt
@@ -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/reproducible/src/main/resources/dir-A/A4.txt b/src/it/reproducible/src/main/resources/dir-A/A4.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-A/A4.txt
@@ -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/reproducible/src/main/resources/dir-A/a1.txt b/src/it/reproducible/src/main/resources/dir-A/a1.txt
new file mode 100644
index 0000000..ca0e172
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-A/a1.txt
@@ -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.
+
+# 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/reproducible/src/main/resources/dir-A/a3.txt b/src/it/reproducible/src/main/resources/dir-A/a3.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-A/a3.txt
@@ -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/reproducible/src/main/resources/dir-C/C.txt b/src/it/reproducible/src/main/resources/dir-C/C.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-C/C.txt
@@ -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/reproducible/src/main/resources/dir-b/B2/B2.txt b/src/it/reproducible/src/main/resources/dir-b/B2/B2.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-b/B2/B2.txt
@@ -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/reproducible/src/main/resources/dir-b/B4/B4.txt b/src/it/reproducible/src/main/resources/dir-b/B4/B4.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-b/B4/B4.txt
@@ -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/reproducible/src/main/resources/dir-b/b.txt b/src/it/reproducible/src/main/resources/dir-b/b.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-b/b.txt
@@ -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/reproducible/src/main/resources/dir-b/b1/b1.txt b/src/it/reproducible/src/main/resources/dir-b/b1/b1.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-b/b1/b1.txt
@@ -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/reproducible/src/main/resources/dir-b/b3/b3.txt b/src/it/reproducible/src/main/resources/dir-b/b3/b3.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-b/b3/b3.txt
@@ -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/reproducible/src/main/resources/dir-d/d.txt b/src/it/reproducible/src/main/resources/dir-d/d.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/dir-d/d.txt
@@ -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/reproducible/src/main/resources/executable.txt b/src/it/reproducible/src/main/resources/executable.txt
new file mode 100755
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/executable.txt
@@ -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/reproducible/src/main/resources/lowercase.txt b/src/it/reproducible/src/main/resources/lowercase.txt
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/src/it/reproducible/src/main/resources/lowercase.txt
@@ -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/reproducible/verify.groovy b/src/it/reproducible/verify.groovy
new file mode 100644
index 0000000..648d05a
--- /dev/null
+++ b/src/it/reproducible/verify.groovy
@@ -0,0 +1,77 @@
+
+/*
+ * 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 org.apache.commons.compress.archivers.zip.*;
+
+File deployDir = new File( basedir, 'target/repo/org/apache/maven/its/reproducible/1.0' )
+
+assert deployDir.exists()
+
+File sha1File = new File( deployDir, 'reproducible-1.0-sources.jar.sha1' )
+
+assert deployDir.exists()
+
+String sha1 = sha1File.text
+
+StringBuffer r = new StringBuffer()
+r.append( "reproducible-1.0-sources.jar sha1 = $sha1\n\n" )
+
+File jarFile = new File( deployDir, 'reproducible-1.0-sources.jar' )
+ZipFile zipFile = new ZipFile( jarFile );
+
+r.append( 'encoding: ' + zipFile.getEncoding() + '\n' )
+r.append( 'timezone offset (minutes): ' + new Date().getTimezoneOffset() + '\n' )
+r.append( 'M size (cmp) crc java time date time zip time mode name -comment; extra\n' )
+
+String describeExtra( ZipExtraField[] extras )
+{
+ StringBuffer b = new StringBuffer()
+ b.append( extras.length )
+ for( ZipExtraField extra : extras )
+ {
+ b.append( sprintf( " [%s]%x", extra.getHeaderId().toString(), getLocalFileDataData() ) )
+ }
+ return b.toString()
+}
+
+long javaToDosTime( Date d )
+{
+ int year = d.getYear() + 1900;
+ if ( year < 1980 )
+ {
+ return ZipEntry.DOSTIME_BEFORE_1980;
+ }
+ return ( year - 1980 ) << 25 | ( d.getMonth() + 1 ) << 21 |
+ d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
+ d.getSeconds() >> 1;
+}
+
+for ( ZipArchiveEntry zae : zipFile.getEntries() )
+{
+ r.append( sprintf( "%d %4d (%3d) %8x %d %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;
+
// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
@@ -270,6 +280,9 @@ protected void packageSources( List theProjects )
}
MavenArchiver archiver = createArchiver();
+
+ // configure for Reproducible Builds based on outputTimestamp value
+ archiver.configureReproducible( outputTimestamp );
for ( MavenProject pItem : theProjects )
{
@@ -408,6 +421,8 @@ protected MavenArchiver createArchiver()
{
MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver( jarArchiver );
+ archiver.setCreatedBy( "Maven Source Plugin", "org.apache.maven.plugins", "maven-source-plugin" );
+ archiver.setBuildJdkSpecDefaultEntry( false );
if ( project.getBuild() != null )
{