Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@
<name>Apache Maven JAR Plugin</name>
<description>Builds a Java Archive (JAR) file from the compiled project classes and resources.</description>

<developers>
<developer>
<id>evenisse</id>
<name>Emmanuel Venisse</name>
<email>evenisse@apache.org</email>
<roles>
<role>Java Developer</role>
</roles>
</developer>
<developer>
<id>desruisseaux</id>
<name>Martin Desruisseaux</name>
<email>desruisseaux@apache.org</email>
<organization>Geomatys</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>+1</timezone>
</developer>
</developers>
<contributors>
<contributor>
<name>Jerome Lacoste</name>
Expand Down Expand Up @@ -132,6 +152,12 @@
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-support</artifactId>
<version>${mavenVersion}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-api-xml</artifactId>
Expand All @@ -144,11 +170,6 @@
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>file-management</artifactId>
<version>${mavenFileManagementVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-archiver</artifactId>
Expand Down Expand Up @@ -213,7 +234,7 @@
<!--
! The manifest specification does not describe any method for writing comments into the manifest.
-->
<exclude>src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF</exclude>
<exclude>src/it/mjar-71-01/src/main/my-custom-dir/some-manifest.mf</exclude>
<exclude>src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF</exclude>
</excludes>
</configuration>
Expand Down
3 changes: 1 addition & 2 deletions src/it/MJAR-260-invalid-automatic-module-name/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ try
String[] snippets = new String[] {
"[INFO] BUILD FAILURE",
"[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin",
"Caused by: org.apache.maven.api.plugin.MojoException: Error assembling JAR",
"Caused by: org.codehaus.plexus.archiver.jar.ManifestException: Invalid automatic module name: 'in-valid.name.with.new.keyword'"
"Caused by: org.apache.maven.api.plugin.MojoException: Invalid automatic module name: \"in-valid.name.with.new.keyword\"."
};

System.out.println("\nVerifying log snippets...");
Expand Down
10 changes: 4 additions & 6 deletions src/it/MJAR-275-reproducible-module-info/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
# 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+
# The --date option needed for reproducible build is available only since Java 19.
invoker.java.version = 19+
4 changes: 2 additions & 2 deletions src/it/MJAR-292-detect-mjar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
</manifest>
<manifestEntries>
<!--
We override this config since we are detecting the versioned area,
The output JAR should contain `Multi-Release: true`
For verifying that this entry will be overridden.
If users really want to disable multi-release, they should set <detectMultiReleaseJar> to false.
-->
<Multi-Release>false</Multi-Release>
</manifestEntries>
Expand Down
1 change: 1 addition & 0 deletions src/it/MJAR-292-disable-detect-mjar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<mainClass>myproject.HelloWorld</mainClass>
</manifest>
</archive>
<detectMultiReleaseJar>false</detectMultiReleaseJar>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion src/it/MJAR-30-include/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ try
{
String artifactName = artifactNames[i];
if ( !contents.contains( artifactName ) )
{
{
System.err.println( "Artifact[" + artifactName + "] not found in jar archive" );
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/it/MJAR-70-recreation/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if ( buildLog.exists() ) {
int jarPluginExecutions = 0;
String[] lines = buildLogContent.split( "\n" );
for ( String line : lines ) {
if ( line.contains( "Building jar:" ) && line.contains( "MJAR-70-recreation-1.0-SNAPSHOT.jar" ) ) {
if ( line.contains( "Building JAR:" ) && line.contains( "MJAR-70-recreation-1.0-SNAPSHOT.jar" ) ) {
jarPluginExecutions++;
System.out.println( "Found JAR creation: " + line );
}
Expand Down
4 changes: 2 additions & 2 deletions src/it/mjar-71-01/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ under the License.
<version>1.0</version>
<packaging>jar</packaging>
<name>it-mjar-71</name>
<description>Test that the default manifest is added by default if found under target/classes. Can also be overriden.</description>
<description>Test that the specified manifest is used.</description>
<url>http://maven.apache.org</url>

<build>
Expand All @@ -36,7 +36,7 @@ under the License.
<version>@project.version@</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<manifestFile>src/main/my-custom-dir/some-manifest.mf</manifestFile>
</archive>
</configuration>
</plugin>
Expand Down
16 changes: 8 additions & 8 deletions src/it/mjar-71-01/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ try
// Only compare files
if ( entry.getName().equals( "META-INF/MANIFEST.MF" ) )
{
String manifest = IOUtils.toString( jar.getInputStream ( entry ) );
int index = manifest.indexOf( "Archiver-Version: foobar-1.23456" );
if ( index <= 0 )
{
System.err.println( "MANIFEST doesn't contain: 'Archiver-Version: foobar-1.23456'" );
return false;
}
return true;
String manifest = IOUtils.toString( jar.getInputStream ( entry ) );
int index = manifest.indexOf( "Archiver-Version: foobar-1.23456" );
if ( index <= 0 )
{
System.err.println( "MANIFEST doesn't contain: 'Archiver-Version: foobar-1.23456'" );
return false;
}
return true;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/it/mjar-71-02/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ under the License.
<version>1.0</version>
<packaging>jar</packaging>
<name>it-mjar-71-02</name>
<description>Test that the default manifest is not added when found under target/classes but support is disabled.</description>
<description>Test that the manifest found under target/classes is automatically used.</description>
<url>http://maven.apache.org</url>

<build>
Expand Down
16 changes: 8 additions & 8 deletions src/it/mjar-71-02/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ try
// Only compare files
if ( entry.getName().equals ( "META-INF/MANIFEST.MF" ) )
{
String manifest = IOUtils.toString( jar.getInputStream ( entry ) );
int index = manifest.indexOf( "Archiver-Version: foobar-1.23456" );
if ( index > 0 )
{
System.err.println( "MANIFEST contains: 'Archiver-Version: foobar-1.23456', but shouldn't" );
return false;
}
return true;
String manifest = IOUtils.toString( jar.getInputStream ( entry ) );
int index = manifest.indexOf( "Archiver-Version: foobar-1.23456" );
if ( index <= 0 )
{
System.err.println( "MANIFEST doesn't contain: 'Archiver-Version: foobar-1.23456'" );
return false;
}
return true;
}
}
}
Expand Down
67 changes: 67 additions & 0 deletions src/it/multi-module/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?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.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.plugins</groupId>
<artifactId>multi-module</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Multi-module</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>4.0.0-beta-3</version>
<configuration>
<!-- TODO: remove source and target after we identified where Maven inherits those values. -->
<source />
<target />
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<mainClass>foo.bar/foo.MainFile</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<sources>
<source>
<module>foo.bar</module>
<directory>src/foo.bar/main/java</directory>
</source>
<source>
<module>foo.bar.more</module>
<directory>src/foo.bar.more/main/java</directory>
</source>
</sources>
</build>
</project>
19 changes: 19 additions & 0 deletions src/it/multi-module/src/foo.bar.more/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -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.
*/
module foo.bar.more {}
29 changes: 29 additions & 0 deletions src/it/multi-module/src/foo.bar.more/main/java/more/MainFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 more;

/**
* Test {@code &lt;Source&gt;}.
* Another {@code &lt;Source&gt;}.
*/
public class MainFile {
public static void main(String[] args) {
System.out.println("MainFile of more");
}
}
29 changes: 29 additions & 0 deletions src/it/multi-module/src/foo.bar/main/java/foo/MainFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 foo;

/**
* Test {@code &lt;Source&gt;}.
* Another {@code &lt;Source&gt;}.
*/
public class MainFile {
public static void main(String[] args) {
System.out.println("MainFile");
}
}
19 changes: 19 additions & 0 deletions src/it/multi-module/src/foo.bar/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -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.
*/
module foo.bar {}
Loading
Loading