Compare commits
28 Commits
Author | SHA256 | Date | |
---|---|---|---|
02df442efa | |||
faf802e726 | |||
990b5eac1a | |||
82be6853a6 | |||
965a2103dc | |||
a63287332f | |||
8357f71b5f | |||
9a5f609688 | |||
cbde43e471 | |||
5da9d2beef | |||
dadbd2c225 | |||
1fb345de68 | |||
b1c672a73a | |||
67fd2cd473 | |||
0d3f944895 | |||
0d50e5e1a4 | |||
1d190bcf17 | |||
8eb1944e06 | |||
9b282ad9cd | |||
a9834a436e | |||
c9f716004b | |||
efc18d5d44 | |||
c3f36a51e4 | |||
73af195b70 | |||
8c0cb92e44 | |||
11ee017250 | |||
27fc68ff12 | |||
2150ccc3a0 |
@@ -1,54 +0,0 @@
|
||||
--- maven-archiver-3.6.3/src/main/java/org/apache/maven/archiver/MavenArchiver.java 2025-07-24 11:19:55.246162093 +0200
|
||||
+++ maven-archiver-3.6.3/src/main/java/org/apache/maven/archiver/MavenArchiver.java 2025-07-24 11:21:19.107011760 +0200
|
||||
@@ -597,7 +597,9 @@
|
||||
|
||||
String automaticModuleName = manifest.getMainSection().getAttributeValue("Automatic-Module-Name");
|
||||
if (automaticModuleName != null) {
|
||||
- if (!isValidModuleName(automaticModuleName)) {
|
||||
+ if (automaticModuleName.isEmpty()) {
|
||||
+ manifest.getMainSection().removeAttribute("Automatic-Module-Name");
|
||||
+ } else if (!isValidModuleName(automaticModuleName)) {
|
||||
throw new ManifestException("Invalid automatic module name: '" + automaticModuleName + "'");
|
||||
}
|
||||
}
|
||||
--- maven-archiver-3.6.3/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java 2025-07-24 11:19:55.246960737 +0200
|
||||
+++ maven-archiver-3.6.3/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java 2025-07-24 11:21:19.107155460 +0200
|
||||
@@ -563,9 +563,37 @@
|
||||
}
|
||||
|
||||
/*
|
||||
- * Test to make sure that manifest sections are present in the manifest prior to the archive has been created.
|
||||
+ * Test to make sure that empty Automatic-Module-Name will result in no
|
||||
+ * Automatic-Module-Name attribute at all, but that the archive will be created.
|
||||
*/
|
||||
@Test
|
||||
+ void testManifestWithEmptyAutomaticModuleName() throws Exception {
|
||||
+ File jarFile = new File("target/test/dummy.jar");
|
||||
+ JarArchiver jarArchiver = getCleanJarArchiver(jarFile);
|
||||
+
|
||||
+ MavenArchiver archiver = getMavenArchiver(jarArchiver);
|
||||
+
|
||||
+ MavenSession session = getDummySession();
|
||||
+ MavenProject project = getDummyProject();
|
||||
+ MavenArchiveConfiguration config = new MavenArchiveConfiguration();
|
||||
+
|
||||
+ Map<String, String> manifestEntries = new HashMap<>();
|
||||
+ manifestEntries.put("Automatic-Module-Name", "");
|
||||
+ config.setManifestEntries(manifestEntries);
|
||||
+
|
||||
+ archiver.createArchive(session, project, config);
|
||||
+ assertThat(jarFile).exists();
|
||||
+
|
||||
+ final Manifest jarFileManifest = getJarFileManifest(jarFile);
|
||||
+ Attributes manifest = jarFileManifest.getMainAttributes();
|
||||
+
|
||||
+ assertThat(manifest).doesNotContainKey(new Attributes.Name("Automatic-Module-Name"));
|
||||
+ }
|
||||
+
|
||||
+ //
|
||||
+ // Test to make sure that manifest sections are present in the manifest prior to the archive has been created.
|
||||
+ //
|
||||
+ @Test
|
||||
void testManifestSections() throws Exception {
|
||||
MavenArchiver archiver = new MavenArchiver();
|
||||
|
BIN
maven-archiver-3.6.1-source-release.zip
(Stored with Git LFS)
BIN
maven-archiver-3.6.1-source-release.zip
(Stored with Git LFS)
Binary file not shown.
BIN
maven-archiver-3.6.3-source-release.zip
(Stored with Git LFS)
BIN
maven-archiver-3.6.3-source-release.zip
(Stored with Git LFS)
Binary file not shown.
@@ -1,79 +0,0 @@
|
||||
--- maven-archiver-3.6.3/pom.xml 2025-07-25 08:59:38.427807182 +0200
|
||||
+++ maven-archiver-3.6.3/pom.xml 2025-07-25 08:59:51.766807935 +0200
|
||||
@@ -115,4 +115,22 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
+
|
||||
+ <build>
|
||||
+ <pluginManagement>
|
||||
+ <plugins>
|
||||
+ <plugin>
|
||||
+ <groupId>org.apache.maven.plugins</groupId>
|
||||
+ <artifactId>maven-surefire-plugin</artifactId>
|
||||
+ <configuration>
|
||||
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||
+ <excludedEnvironmentVariables>
|
||||
+ <excludedEnvironmentVariable>SOURCE_DATE_EPOCH</excludedEnvironmentVariable>
|
||||
+ </excludedEnvironmentVariables>
|
||||
+ </configuration>
|
||||
+ </plugin>
|
||||
+ </plugins>
|
||||
+ </pluginManagement>
|
||||
+ </build>
|
||||
+
|
||||
</project>
|
||||
--- maven-archiver-3.6.3/src/main/java/org/apache/maven/archiver/MavenArchiver.java 2025-07-25 08:59:38.426221268 +0200
|
||||
+++ maven-archiver-3.6.3/src/main/java/org/apache/maven/archiver/MavenArchiver.java 2025-07-25 09:00:55.991543025 +0200
|
||||
@@ -66,7 +66,6 @@
|
||||
*
|
||||
* @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
|
||||
* @author kama
|
||||
- * @version $Id: $Id
|
||||
*/
|
||||
public class MavenArchiver {
|
||||
|
||||
@@ -745,6 +744,9 @@
|
||||
* <p>Either as {@link java.time.format.DateTimeFormatter#ISO_OFFSET_DATE_TIME} or as a number representing seconds
|
||||
* since the epoch (like <a href="https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH</a>).
|
||||
*
|
||||
+ * <p>Since 3.6.4, if not configured or disabled, the {@code SOURCE_DATE_EPOCH} environment variable is used as
|
||||
+ * a fallback value, to ease forcing Reproducible Build externally when the build has not enabled it natively in POM.
|
||||
+ *
|
||||
* @param outputTimestamp the value of {@code ${project.build.outputTimestamp}} (may be {@code null})
|
||||
* @return the parsed timestamp as an {@code Optional<Instant>}, {@code empty} if input is {@code null} or input
|
||||
* contains only 1 character (not a number)
|
||||
@@ -753,12 +755,19 @@
|
||||
* the valid range 1980-01-01T00:00:02Z to 2099-12-31T23:59:59Z as defined by
|
||||
* <a href="https://pkwaredownloads.blob.core.windows.net/pem/APPNOTE.txt">ZIP application note</a>,
|
||||
* section 4.4.6.
|
||||
+ * @see <a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=74682318">Maven Wiki "Reproducible/Verifiable
|
||||
+ * Builds"</a>
|
||||
*/
|
||||
public static Optional<Instant> parseBuildOutputTimestamp(String outputTimestamp) {
|
||||
- // Fail-fast on nulls
|
||||
+ // Fail fast on null and no timestamp configured (1 character configuration is useful to override
|
||||
+ // a full value during pom inheritance)
|
||||
+ if (outputTimestamp == null || (outputTimestamp.length() < 2 && !isNumeric(outputTimestamp))) {
|
||||
+ // Reproducible Builds not configured or disabled => fallback to SOURCE_DATE_EPOCH env
|
||||
+ outputTimestamp = System.getenv("SOURCE_DATE_EPOCH");
|
||||
if (outputTimestamp == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
+ }
|
||||
|
||||
// Number representing seconds since the epoch
|
||||
if (isNumeric(outputTimestamp)) {
|
||||
@@ -771,12 +780,6 @@
|
||||
return Optional.of(date);
|
||||
}
|
||||
|
||||
- // no timestamp configured (1 character configuration is useful to override a full value during pom
|
||||
- // inheritance)
|
||||
- if (outputTimestamp.length() < 2) {
|
||||
- return Optional.empty();
|
||||
- }
|
||||
-
|
||||
try {
|
||||
// Parse the date in UTC such as '2011-12-03T10:15:30Z' or with an offset '2019-10-05T20:37:42+06:00'.
|
||||
final Instant date = OffsetDateTime.parse(outputTimestamp)
|
Reference in New Issue
Block a user