This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git
commit 48cb77d655334522b44e10bbe1c0b86d90c9c586 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 4 22:56:09 2026 +0000 Add real assertions to 16 ITs and merge 5 duplicates Fixes #1406. The use-default-excludes, default-excludes-unspecified and default-directory-unspecified ITs now create the .svn directory they claim to exclude; the seven bugs/massembly-* ITs get verify scripts that assert what each issue was about. Assertions avoid dependency versions so they hold on Maven 3 and 4. --- .../classpath-descriptor/verify.groovy | 58 +++++++++++++++ .../descriptorDirectoryScan/verify.groovy} | 23 +----- .../outputFileNameMapping-simple/verify.groovy} | 18 +---- .../massembly-306}/verify.groovy | 26 ++----- src/it/projects/bugs/massembly-324/verify.groovy | 33 ++++++++ .../App.java => bugs/massembly-559/verify.groovy} | 22 +++--- src/it/projects/bugs/massembly-580/verify.groovy | 44 +++++++++++ .../massembly-730}/verify.groovy | 23 +++--- .../massembly-737}/verify.groovy | 14 ++-- src/it/projects/bugs/massembly-739/verify.groovy | 41 ++++++++++ .../component-dependencySet/verify.groovy} | 22 +++--- .../component-moduleSet}/verify.groovy | 22 +++--- .../assembly/pom.xml | 1 + .../assembly/src/assemble/bin-mixed.xml} | 2 +- .../custom-handler-withFileEntries/verify.groovy | 59 ++------------- .../assembly/a.properties | 18 ----- .../assembly/pom.xml | 65 ---------------- .../assembly/src/config/a/file.txt | 1 - .../assembly/src/config/b/file.txt | 2 - .../handler-def/pom.xml | 35 --------- .../main/resources/META-INF/plexus/components.xml | 34 --------- .../invoker.properties | 22 ------ .../custom-handler-withMixedEntries/pom.xml | 36 --------- .../custom-handler-withMixedEntries/verify.groovy | 73 ------------------ .../dependency-sets/massembly-345/verify.groovy | 15 +++- .../mid-artifactId-wildcard-massembly570/pom.xml | 27 +++++++ .../src/main/assembly/bin-multiple.xml} | 2 +- .../verify.groovy | 7 ++ .../multiple-wildcard-includes/pom.xml | 87 ---------------------- .../multiple-wildcard-includes/verify.groovy | 24 ------ .../multimodule-unix-lineEndings/child/pom.xml | 1 + .../child/src/main/assembly/src-crlf.xml} | 2 +- .../setup.groovy | 0 .../multimodule-unix-lineEndings/verify.groovy | 43 +++++------ .../multimodule-win-lineEndings/child/pom.xml | 55 -------------- .../child/src/main/assembly-resources/test.txt | 2 - .../file-sets/multimodule-win-lineEndings/pom.xml | 38 ---------- .../src/main/assembly/bin.xml | 37 --------- .../fileset-to-tar-massembly-722/verify.groovy | 49 ++++++++++++ .../manifest-with-customEntry/verify.groovy | 10 ++- .../manifest-with-mainClass/pom.xml | 69 ----------------- .../src/test/java/test/AppTest.java | 38 ---------- .../massembly-317}/verify.groovy | 19 ++--- .../multimodule/massembly-474/verify.groovy | 44 +++++++++++ .../assembly/pom.xml | 1 + .../assembly/src/main/assembly/src.xml | 0 .../verify.groovy | 7 +- .../assembly/pom.xml | 70 ----------------- .../child-level1-project1/pom.xml | 37 --------- .../src/main/java/test/App.java | 33 -------- .../src/test/java/test/AppTest.java | 38 ---------- .../child-level2-project1/pom.xml | 50 ------------- .../src/main/java/test/App.java | 33 -------- .../src/test/java/test/AppTest.java | 38 ---------- .../child-level1-project2/pom.xml | 37 --------- .../two-levels-includeBaseDir-withSrc/pom.xml | 42 ----------- .../src/assemble/src.xml | 51 ------------- 57 files changed, 431 insertions(+), 1269 deletions(-) diff --git a/src/it/projects/basic-features/classpath-descriptor/verify.groovy b/src/it/projects/basic-features/classpath-descriptor/verify.groovy new file mode 100644 index 00000000..6fd0aeda --- /dev/null +++ b/src/it/projects/basic-features/classpath-descriptor/verify.groovy @@ -0,0 +1,58 @@ +/* + * 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 java.util.zip.ZipFile +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream +import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream + +// the "src" descriptorRef is built in three formats; each archive holds the project sources under test-1.0/ +def tarNames( InputStream compressed ) +{ + def names = [] + TarArchiveInputStream tar = new TarArchiveInputStream( compressed ) + try + { + for ( def entry = tar.nextTarEntry; entry != null; entry = tar.nextTarEntry ) + { + names << entry.name + } + } + finally + { + tar.close() + } + return names +} + +File zip = new File( basedir, "target/test-1.0-src.zip" ) +assert zip.isFile() : "Missing " + zip +def zipNames = [] +new ZipFile( zip ).withCloseable { z -> zipNames = Collections.list( z.entries() ).collect { it.name } } +assert zipNames.contains( "test-1.0/pom.xml" ) : "zip entries: " + zipNames + +File tgz = new File( basedir, "target/test-1.0-src.tar.gz" ) +assert tgz.isFile() : "Missing " + tgz +def tgzNames = tarNames( new GzipCompressorInputStream( new FileInputStream( tgz ) ) ) +assert tgzNames.contains( "test-1.0/pom.xml" ) : "tar.gz entries: " + tgzNames + +File tbz = new File( basedir, "target/test-1.0-src.tar.bz2" ) +assert tbz.isFile() : "Missing " + tbz +def tbzNames = tarNames( new BZip2CompressorInputStream( new FileInputStream( tbz ) ) ) +assert tbzNames.contains( "test-1.0/pom.xml" ) : "tar.bz2 entries: " + tbzNames diff --git a/src/it/projects/dependency-sets/multiple-wildcard-includes/src/test/java/test/AppTest.java b/src/it/projects/basic-features/descriptorDirectoryScan/verify.groovy similarity index 72% rename from src/it/projects/dependency-sets/multiple-wildcard-includes/src/test/java/test/AppTest.java rename to src/it/projects/basic-features/descriptorDirectoryScan/verify.groovy index 8b760291..d551b62d 100644 --- a/src/it/projects/dependency-sets/multiple-wildcard-includes/src/test/java/test/AppTest.java +++ b/src/it/projects/basic-features/descriptorDirectoryScan/verify.groovy @@ -1,5 +1,3 @@ -package test; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,20 +17,7 @@ package test; * under the License. */ - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * Unit test for simple App. - */ -public class AppTest { - /** - * Rigourous Test :-) - */ - @Test - public void testApp() - { - assertTrue( true ); - } -} +// src/assemble/bin.xml is found by scanning descriptorSourceDirectory; readme.txt next to it is not a descriptor +File dir = new File( basedir, "target/parent-1.0-bindir" ) +assert dir.isDirectory() : "Assembly of the scanned descriptor is missing: " + dir +assert new File( dir, "commons-logging.jar" ).isFile() diff --git a/src/it/projects/dependency-sets/multiple-wildcard-includes/src/main/java/test/App.java b/src/it/projects/basic-features/outputFileNameMapping-simple/verify.groovy similarity index 73% rename from src/it/projects/dependency-sets/multiple-wildcard-includes/src/main/java/test/App.java rename to src/it/projects/basic-features/outputFileNameMapping-simple/verify.groovy index d0442f33..5977aa4e 100644 --- a/src/it/projects/dependency-sets/multiple-wildcard-includes/src/main/java/test/App.java +++ b/src/it/projects/basic-features/outputFileNameMapping-simple/verify.groovy @@ -1,5 +1,3 @@ -package test; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,15 +17,7 @@ package test; * under the License. */ - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} +// ${artifact.artifactId}.${artifact.extension} drops the version from the file name +File dir = new File( basedir, "target/parent-1.0-bindir" ) +assert dir.isDirectory() : "Missing assembly directory " + dir +assert dir.list().sort() == [ "commons-logging.jar" ] : "Entries: " + dir.list() diff --git a/src/it/projects/mojo-configuration/manifest-with-mainClass/verify.groovy b/src/it/projects/bugs/massembly-306/verify.groovy similarity index 56% rename from src/it/projects/mojo-configuration/manifest-with-mainClass/verify.groovy rename to src/it/projects/bugs/massembly-306/verify.groovy index 071f08db..6d2b30d8 100644 --- a/src/it/projects/mojo-configuration/manifest-with-mainClass/verify.groovy +++ b/src/it/projects/bugs/massembly-306/verify.groovy @@ -17,23 +17,13 @@ * under the License. */ -import java.io.*; -import java.util.jar.*; -import java.util.*; -import java.net.*; +import java.util.zip.ZipFile -File file = new File( basedir, "target/manifest-with-mainClass-1-jar-with-dependencies.jar" ); +// MASSEMBLY-306: log4j-api is declared as a version range with scope provided, so jar-with-dependencies leaves it out +File jar = new File( basedir, "target/massembly-306-1-jar-with-dependencies.jar" ) +assert jar.isFile() : "Missing " + jar +def names = [] +new ZipFile( jar ).withCloseable { z -> names = Collections.list( z.entries() ).collect { it.name } } -System.out.println( "file: " + file + " exists? " + file.exists() ); - -JarFile jarFile = new JarFile( file ); - -Manifest mf = jarFile.getManifest(); - -Attributes attrs = mf.getMainAttributes(); - -String mainClass = (String) attrs.get( Attributes.Name.MAIN_CLASS ); - -System.out.println( "Got Main-Class: " + mainClass ); - -return "test.App".equals( mainClass ); +assert names.contains( "org/junit/jupiter/api/Test.class" ) : "The compile scope dependency is missing" +assert !names.any { it.startsWith( "org/apache/logging/log4j/" ) } : "The provided dependency log4j-api was packed into the jar" diff --git a/src/it/projects/bugs/massembly-324/verify.groovy b/src/it/projects/bugs/massembly-324/verify.groovy new file mode 100644 index 00000000..873290bc --- /dev/null +++ b/src/it/projects/bugs/massembly-324/verify.groovy @@ -0,0 +1,33 @@ +/* + * 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 java.util.zip.ZipFile + +// MASSEMBLY-324: runtime dependencies end up in WEB-INF/lib below the base directory spring-<version> +File zip = new File( basedir, "target/project2-0.0.1-SNAPSHOT-bin.zip" ) +assert zip.isFile() : "Missing " + zip +def names = [] +new ZipFile( zip ).withCloseable { z -> names = Collections.list( z.entries() ).collect { it.name } } + +String lib = "spring-0.0.1-SNAPSHOT/WEB-INF/lib/" +def libFiles = names.findAll { it.startsWith( lib ) && !it.endsWith( "/" ) }.collect { it.substring( lib.length() ) } +assert libFiles.any { it ==~ /maven-shared-io-.*\.jar/ } : "maven-shared-io is missing from WEB-INF/lib: " + names +assert libFiles.contains( "project2-0.0.1-SNAPSHOT.jar" ) : "The project artifact is missing from WEB-INF/lib: " + names +assert !libFiles.any { it.contains( "/" ) } : "Unexpected nested entries in WEB-INF/lib: " + libFiles +assert names.every { it.startsWith( "spring-0.0.1-SNAPSHOT/" ) } : "Entries outside of the base directory: " + names diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/src/main/java/org/apache/maven/plugin/assembly/test/App.java b/src/it/projects/bugs/massembly-559/verify.groovy similarity index 54% rename from src/it/projects/file-sets/multimodule-win-lineEndings/src/main/java/org/apache/maven/plugin/assembly/test/App.java rename to src/it/projects/bugs/massembly-559/verify.groovy index 3b568c3d..ff9c4159 100644 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/src/main/java/org/apache/maven/plugin/assembly/test/App.java +++ b/src/it/projects/bugs/massembly-559/verify.groovy @@ -1,5 +1,3 @@ -package org.apache.maven.plugin.assembly.test; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,15 +17,17 @@ package org.apache.maven.plugin.assembly.test; * under the License. */ +import java.util.zip.ZipFile -/** - * Hello world! - * - */ -public class App +// MASSEMBLY-559: the first dependencySet takes junit:* with transitive dependencies, the second one the direct ones only +File zip = new File( basedir, "target/test-assembly-transitive-bug-0.0.1-SNAPSHOT.zip" ) +assert zip.isFile() : "Missing " + zip +def names = [] +new ZipFile( zip ).withCloseable { z -> names = Collections.list( z.entries() ).collect { it.name } } + +String root = "test-assembly-transitive-bug-0.0.1-SNAPSHOT/" +for ( String dir : [ "junit-only", "no-transitive" ] ) { - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } + def files = names.findAll { it.startsWith( root + dir + "/" ) && !it.endsWith( "/" ) } + assert files == [ root + dir + "/junit-dep.jar" ] : dir + " contains " + files } diff --git a/src/it/projects/bugs/massembly-580/verify.groovy b/src/it/projects/bugs/massembly-580/verify.groovy new file mode 100644 index 00000000..1ce1a524 --- /dev/null +++ b/src/it/projects/bugs/massembly-580/verify.groovy @@ -0,0 +1,44 @@ +/* + * 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.ZipArchiveEntry +import org.apache.commons.compress.archivers.zip.ZipFile + +// MASSEMBLY-580: fileMode 0644 and directoryMode 0750 of the dependencySet are applied to the zip entries +File zip = new File( basedir, "target/project-deploy.zip" ) +assert zip.isFile() : "Missing " + zip + +ZipFile zf = new ZipFile( zip ) +try +{ + ZipArchiveEntry dir = zf.getEntry( "webapps/" ) + assert dir != null : "Missing directory entry webapps/" + assert ( dir.unixMode & 0777 ) == 0750 : "Mode of webapps/: " + Integer.toOctalString( dir.unixMode & 0777 ) + + def files = zf.entries.toList().findAll { it.name.startsWith( "webapps/" ) && !it.directory } + assert files.any { it.name == "webapps/commons-fileupload.jar" } : "Entries: " + zf.entries.toList()*.name + for ( ZipArchiveEntry file : files ) + { + assert ( file.unixMode & 0777 ) == 0644 : "Mode of " + file.name + ": " + Integer.toOctalString( file.unixMode & 0777 ) + } +} +finally +{ + zf.close() +} diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy b/src/it/projects/bugs/massembly-730/verify.groovy similarity index 52% copy from src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy copy to src/it/projects/bugs/massembly-730/verify.groovy index 78f3727a..f24b87b1 100644 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy +++ b/src/it/projects/bugs/massembly-730/verify.groovy @@ -17,18 +17,15 @@ * under the License. */ -import java.nio.charset.StandardCharsets -import java.nio.file.Files +import java.util.zip.ZipFile -String expected = "1\r\nchild" -for ( String name : [ "test.txt", "mac2win.txt" ] ) -{ - File file = new File( basedir, "child/target/child-1-src/" + name ) - assert file.exists() : "Filtered file from file-set: " + file + " is missing." +// MASSEMBLY-730: jar-with-dependencies of a project depending on the PostgreSQL driver; the tests that run after +// packaging (see the pom) ran green, so the jar is complete and holds the driver classes +File jar = new File( basedir, "target/issue-mvn-assembly-plugin-730-jar-with-dependencies.jar" ) +assert jar.isFile() : "Missing " + jar +def names = [] +new ZipFile( jar ).withCloseable { z -> names = Collections.list( z.entries() ).collect { it.name } } - String actual = new String( Files.readAllBytes( file.toPath() ), StandardCharsets.UTF_8 ) - assert actual == expected : - "Contents of " + name + ": '" + actual + "' should contain exactly one windows newline: '\\r\\n'." -} - -return true; +assert names.contains( "META-INF/MANIFEST.MF" ) +assert names.contains( "org/postgresql/Driver.class" ) : "The driver is missing from the jar" +assert names.contains( "META-INF/services/java.sql.Driver" ) : "The driver registration is missing from the jar" diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.groovy b/src/it/projects/bugs/massembly-737/verify.groovy similarity index 62% rename from src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.groovy rename to src/it/projects/bugs/massembly-737/verify.groovy index aac21f25..aa96b3c5 100644 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/verify.groovy +++ b/src/it/projects/bugs/massembly-737/verify.groovy @@ -17,11 +17,13 @@ * under the License. */ -String finalName = "assembly/target/assembly-1.0-SNAPSHOT-src/assembly-1.0-SNAPSHOT" -String rootDir = finalName + "/modules/" +import java.util.zip.ZipFile -assert new File( basedir, rootDir + "child-level1-project1/pom.xml" ).exists() +// MASSEMBLY-737: a war assembled from the unpacked project artifact (which is a war itself) keeps WEB-INF/web.xml +File war = new File( basedir, "target/massembly-737-0.0.1-SNAPSHOT-deployable.war" ) +assert war.isFile() : "Missing " + war +def names = [] +new ZipFile( war ).withCloseable { z -> names = Collections.list( z.entries() ).collect { it.name } } -assert new File( basedir, rootDir + "child-level1-project2/pom.xml" ).exists() - -assert new File( basedir, rootDir + "child-level2-project1/pom.xml" ).exists() +assert names.contains( "WEB-INF/web.xml" ) : "Entries: " + names +assert names.contains( "META-INF/MANIFEST.MF" ) diff --git a/src/it/projects/bugs/massembly-739/verify.groovy b/src/it/projects/bugs/massembly-739/verify.groovy new file mode 100644 index 00000000..1e348d92 --- /dev/null +++ b/src/it/projects/bugs/massembly-739/verify.groovy @@ -0,0 +1,41 @@ +/* + * 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.ZipArchiveEntry +import org.apache.commons.compress.archivers.zip.ZipFile + +// MASSEMBLY-739: directory entries of the zip got mode 000, which makes the extracted directories unusable +File zip = new File( basedir, "target/assembly-739-bug-1.0.0-SNAPSHOT-conapp.zip" ) +assert zip.isFile() : "Missing " + zip + +ZipFile zf = new ZipFile( zip ) +try +{ + def dirs = zf.entries.toList().findAll { it.directory } + assert dirs*.name.containsAll( [ "assembly-739-bug-1.0.0-SNAPSHOT/lib/", "assembly-739-bug-1.0.0-SNAPSHOT/bin/" ] ) : "Entries: " + zf.entries.toList()*.name + for ( ZipArchiveEntry dir : dirs ) + { + // the exact bits depend on the umask of the build; the owner has to be able to enter and list the directory + assert ( dir.unixMode & 0700 ) == 0700 : "Mode of " + dir.name + ": " + Integer.toOctalString( dir.unixMode & 0777 ) + } +} +finally +{ + zf.close() +} diff --git a/src/it/projects/mojo-configuration/manifest-with-mainClass/src/main/java/test/App.java b/src/it/projects/components/component-dependencySet/verify.groovy similarity index 55% rename from src/it/projects/mojo-configuration/manifest-with-mainClass/src/main/java/test/App.java rename to src/it/projects/components/component-dependencySet/verify.groovy index d0442f33..3ed3a5f0 100644 --- a/src/it/projects/mojo-configuration/manifest-with-mainClass/src/main/java/test/App.java +++ b/src/it/projects/components/component-dependencySet/verify.groovy @@ -1,5 +1,3 @@ -package test; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,15 +17,15 @@ package test; * under the License. */ - -/** - * Hello world! - * - */ -public class App +// dependency versions are not part of what is verified: "maven-monitor-2.2.0.jar" becomes "maven-monitor.jar" +def normalized( File dir ) { - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } + return dir.list().collect { it.replaceAll( /-\d[\w.\-]*\.jar$/, ".jar" ) }.sort() } + +// the dependencySet comes from a componentDescriptor, scope test selects the test dependency and its dependencies +File dir = new File( basedir, "target/parent-1-bin/parent-1" ) +assert dir.isDirectory() : "Missing assembly directory " + dir +def names = normalized( dir ) +assert names.contains( "junit-jupiter-api.jar" ) : "Entries: " + dir.list() +assert names.contains( "parent.jar" ) : "The project artifact is missing: " + dir.list() diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy b/src/it/projects/components/component-moduleSet/verify.groovy similarity index 53% copy from src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy copy to src/it/projects/components/component-moduleSet/verify.groovy index 78f3727a..aef4a973 100644 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy +++ b/src/it/projects/components/component-moduleSet/verify.groovy @@ -17,18 +17,16 @@ * under the License. */ -import java.nio.charset.StandardCharsets -import java.nio.file.Files - -String expected = "1\r\nchild" -for ( String name : [ "test.txt", "mac2win.txt" ] ) +// dependency versions are not part of what is verified: "maven-monitor-2.2.0.jar" becomes "maven-monitor.jar" +def normalized( File dir ) { - File file = new File( basedir, "child/target/child-1-src/" + name ) - assert file.exists() : "Filtered file from file-set: " + file + " is missing." - - String actual = new String( Files.readAllBytes( file.toPath() ), StandardCharsets.UTF_8 ) - assert actual == expected : - "Contents of " + name + ": '" + actual + "' should contain exactly one windows newline: '\\r\\n'." + return dir.list().collect { it.replaceAll( /-\d[\w.\-]*\.jar$/, ".jar" ) }.sort() } -return true; +// the moduleSet comes from a componentDescriptor and includes only test:child1, with its test dependencies +File dir = new File( basedir, "child2/target/child2-1-bin" ) +assert dir.isDirectory() : "Missing assembly directory " + dir +def names = normalized( dir ) +assert names.contains( "child1.jar" ) : "Entries: " + dir.list() +assert names.contains( "junit-jupiter-api.jar" ) : "Entries: " + dir.list() +assert !names.contains( "child2.jar" ) : "child2 is not part of the moduleSet: " + dir.list() diff --git a/src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/pom.xml b/src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/pom.xml index 9a6d02b4..c8ed4989 100644 --- a/src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/pom.xml +++ b/src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/pom.xml @@ -47,6 +47,7 @@ under the License. <configuration> <descriptors> <descriptor>src/assemble/bin.xml</descriptor> + <descriptor>src/assemble/bin-mixed.xml</descriptor> </descriptors> </configuration> diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/assemble/bin.xml b/src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/src/assemble/bin-mixed.xml similarity index 98% rename from src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/assemble/bin.xml rename to src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/src/assemble/bin-mixed.xml index 56f9d9f1..e6ede6b0 100644 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/assemble/bin.xml +++ b/src/it/projects/container-descriptors/custom-handler-withFileEntries/assembly/src/assemble/bin-mixed.xml @@ -21,7 +21,7 @@ under the License. <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - <id>bin</id> + <id>bin-mixed</id> <formats> <format>dir</format> diff --git a/src/it/projects/container-descriptors/custom-handler-withFileEntries/verify.groovy b/src/it/projects/container-descriptors/custom-handler-withFileEntries/verify.groovy index d3805816..8a0238ab 100644 --- a/src/it/projects/container-descriptors/custom-handler-withFileEntries/verify.groovy +++ b/src/it/projects/container-descriptors/custom-handler-withFileEntries/verify.groovy @@ -17,57 +17,12 @@ * under the License. */ -import java.io.*; - -boolean result = true; - -try +// "bin" lists both files as <file> entries, "bin-mixed" lists one as <file> and the other as <fileSet> +for ( String assemblyId : [ "bin", "bin-mixed" ] ) { - File a = new File( basedir, "assembly/target/assembly-1-bin/file.txt"); - File b = new File( basedir, "assembly/target/assembly-1-bin/b/file.txt"); - - if(result && !a.exists() ) { - System.out.println( "File: " + a + " should have been generated, but was not." ); - result = false; - } - - if(result) { - BufferedReader r = new BufferedReader(new FileReader(a)); - String s = null; - - boolean foundA = false; - boolean foundB = false; - while( ( s = r.readLine() ) != null ) - { - if ( s.equals( "file A" ) ) { - foundA = true; - } - else if ( s.equals( "file B" ) ) { - foundB = true; - } - - if ( foundA && foundB ) - { - result = true; - break; - } - } - - if ( !result ) - { - System.out.println( "File: " + a + " should contain lines:\nfile A\nfile B\n\n ...but didn't." ); - } - } - - if(result && b.exists() ) { - System.out.println( "File: " + b + " should not exist, but does." ); - result = false; - } + File a = new File( basedir, "assembly/target/assembly-1-" + assemblyId + "/file.txt" ); + File b = new File( basedir, "assembly/target/assembly-1-" + assemblyId + "/b/file.txt" ); + assert a.exists() : "File: " + a + " should have been generated, but was not."; + assert !b.exists() : "File: " + b + " should not exist, but does."; } -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; +return true; diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/a.properties b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/a.properties deleted file mode 100644 index aa0aca58..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/a.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - -testProp=boo diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/pom.xml b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/pom.xml deleted file mode 100644 index 9a6d02b4..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?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> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - </parent> - - <groupId>org.test</groupId> - <version>1</version> - <artifactId>assembly</artifactId> - - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - - <dependencies> - <dependency> - <groupId>org.test</groupId> - <artifactId>handler-def</artifactId> - <version>1</version> - </dependency> - </dependencies> - - <configuration> - <descriptors> - <descriptor>src/assemble/bin.xml</descriptor> - </descriptors> - </configuration> - - <executions> - <execution> - <id>assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/config/a/file.txt b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/config/a/file.txt deleted file mode 100644 index d5941d04..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/config/a/file.txt +++ /dev/null @@ -1 +0,0 @@ -file A diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/config/b/file.txt b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/config/b/file.txt deleted file mode 100644 index 81794e3c..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/assembly/src/config/b/file.txt +++ /dev/null @@ -1,2 +0,0 @@ -file B - diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/handler-def/pom.xml b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/handler-def/pom.xml deleted file mode 100644 index 71818da8..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/handler-def/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?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> - - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - </parent> - - <groupId>org.test</groupId> - <version>1</version> - <artifactId>handler-def</artifactId> - -</project> diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/handler-def/src/main/resources/META-INF/plexus/components.xml b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/handler-def/src/main/resources/META-INF/plexus/components.xml deleted file mode 100644 index 791c2fc5..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/handler-def/src/main/resources/META-INF/plexus/components.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version='1.0'?> -<!-- -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. ---> - -<component-set> - <components> - <component> - <role>org.apache.maven.plugins.assembly.filter.ContainerDescriptorHandler</role> - <role-hint>file.txt</role-hint> - <implementation>org.apache.maven.plugins.assembly.filter.SimpleAggregatingDescriptorHandler</implementation> - <configuration> - <filePattern>.*file.txt</filePattern> - <outputPath>file.txt</outputPath> - <commentChars>#</commentChars> - </configuration> - </component> - </components> -</component-set> diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/invoker.properties b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/invoker.properties deleted file mode 100644 index 91a7b514..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/invoker.properties +++ /dev/null @@ -1,22 +0,0 @@ -# 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.project.1=handler-def -invoker.goals.1=install - -invoker.project.2=assembly -invoker.goals.2=package - diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/pom.xml b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/pom.xml deleted file mode 100644 index 4269f701..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version='1.0'?> -<!-- -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> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - </parent> - - <groupId>org.test</groupId> - <artifactId>custom-handler-withMixedEntries</artifactId> - <packaging>pom</packaging> - <version>1</version> - <name>custom-handler-withMixedEntries</name> - -</project> diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.groovy b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.groovy deleted file mode 100644 index d3805816..00000000 --- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.groovy +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 java.io.*; - -boolean result = true; - -try -{ - File a = new File( basedir, "assembly/target/assembly-1-bin/file.txt"); - File b = new File( basedir, "assembly/target/assembly-1-bin/b/file.txt"); - - if(result && !a.exists() ) { - System.out.println( "File: " + a + " should have been generated, but was not." ); - result = false; - } - - if(result) { - BufferedReader r = new BufferedReader(new FileReader(a)); - String s = null; - - boolean foundA = false; - boolean foundB = false; - while( ( s = r.readLine() ) != null ) - { - if ( s.equals( "file A" ) ) { - foundA = true; - } - else if ( s.equals( "file B" ) ) { - foundB = true; - } - - if ( foundA && foundB ) - { - result = true; - break; - } - } - - if ( !result ) - { - System.out.println( "File: " + a + " should contain lines:\nfile A\nfile B\n\n ...but didn't." ); - } - } - - if(result && b.exists() ) { - System.out.println( "File: " + b + " should not exist, but does." ); - result = false; - } -} -catch( IOException e ) -{ - e.printStackTrace(); - result = false; -} - -return result; diff --git a/src/it/projects/dependency-sets/massembly-345/verify.groovy b/src/it/projects/dependency-sets/massembly-345/verify.groovy index 4a820d3d..40ce5c86 100644 --- a/src/it/projects/dependency-sets/massembly-345/verify.groovy +++ b/src/it/projects/dependency-sets/massembly-345/verify.groovy @@ -17,9 +17,16 @@ * under the License. */ -import java.io.*; +import java.util.zip.ZipFile -// verify that the ear is created -result = new File( basedir, "target/massembly-345-1-bin.ear" ).exists(); +// archiverConfig <appxml> is the application.xml of the ear +File ear = new File( basedir, "target/massembly-345-1-bin.ear" ) +assert ear.exists() : "Missing " + ear -return result; +new ZipFile( ear ).withCloseable { z -> + def entry = z.getEntry( "META-INF/application.xml" ) + assert entry != null : "META-INF/application.xml is missing from the ear" + String actual = z.getInputStream( entry ).getText( "UTF-8" ) + String configured = new File( basedir, "src/main/resources/application.xml" ).getText( "UTF-8" ) + assert actual.replace( "\r\n", "\n" ) == configured.replace( "\r\n", "\n" ) : "application.xml differs from the configured appxml" +} diff --git a/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/pom.xml b/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/pom.xml index e98b95b4..70972064 100644 --- a/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/pom.xml +++ b/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/pom.xml @@ -45,6 +45,32 @@ under the License. <artifactId>maven-jar-plugin</artifactId> <version>3.0.0</version> </dependency> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-provider-api</artifactId> + <version> 1.0-beta-4</version> + </dependency> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>1.0-beta-4</version> + </dependency> + <dependency> + <groupId>org.apache.maven.reporting</groupId> + <artifactId>maven-reporting-impl</artifactId> + <version>3.0.0</version> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-vfs</groupId> + <artifactId>commons-vfs</artifactId> + <version> 1.0</version> + </dependency> </dependencies> <build> @@ -61,6 +87,7 @@ under the License. <configuration> <descriptors> <descriptor>src/main/assembly/bin.xml</descriptor> + <descriptor>src/main/assembly/bin-multiple.xml</descriptor> </descriptors> </configuration> </execution> diff --git a/src/it/projects/dependency-sets/multiple-wildcard-includes/src/main/assembly/bin.xml b/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/src/main/assembly/bin-multiple.xml similarity index 98% rename from src/it/projects/dependency-sets/multiple-wildcard-includes/src/main/assembly/bin.xml rename to src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/src/main/assembly/bin-multiple.xml index d9186c83..0157e559 100644 --- a/src/it/projects/dependency-sets/multiple-wildcard-includes/src/main/assembly/bin.xml +++ b/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/src/main/assembly/bin-multiple.xml @@ -21,7 +21,7 @@ under the License. <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - <id>bin</id> + <id>multiple</id> <formats> <format>dir</format> </formats> diff --git a/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/verify.groovy b/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/verify.groovy index d545c6e1..5b2ff3e9 100644 --- a/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/verify.groovy +++ b/src/it/projects/dependency-sets/mid-artifactId-wildcard-massembly570/verify.groovy @@ -24,3 +24,10 @@ assert cleanPluginJar.exists() : 'Missing maven-clean-plugin (should be included def jarPluginJar = new File( dir, "maven-jar-plugin-3.0.0.jar") assert jarPluginJar.exists() : 'Missing maven-jar-plugin (should be included via wildcard pattern).' + +// MASSEMBLY-241: several wildcard includes in one dependencySet (second descriptor, assembly id "multiple") +File multipleDir = new File( basedir, "target/mid-artifactId-wildcard-massembly570-1-multiple/maven-libs" ) +def wagonProviderJar = new File( multipleDir, 'wagon-provider-api-1.0-beta-4.jar' ) +assert wagonProviderJar.exists() : 'Wagon provider jar is missing (should be included via include wildcard pattern).' +def reportingImplJar = new File( multipleDir, 'maven-reporting-impl-3.0.0.jar' ) +assert reportingImplJar.exists() : 'Reporting implementation jar is missing (should be included via include wildcard pattern).' diff --git a/src/it/projects/dependency-sets/multiple-wildcard-includes/pom.xml b/src/it/projects/dependency-sets/multiple-wildcard-includes/pom.xml deleted file mode 100644 index 719d8b41..00000000 --- a/src/it/projects/dependency-sets/multiple-wildcard-includes/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version='1.0'?> -<!-- -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> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - </parent> - <artifactId>massembly-241</artifactId> - <name>massembly-241</name> - - <dependencies> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-provider-api</artifactId> - <version> 1.0-beta-4</version> - </dependency> - <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-webdav-jackrabbit</artifactId> - <version>1.0-beta-4</version> - </dependency> - <dependency> - <groupId>org.apache.maven.reporting</groupId> - <artifactId>maven-reporting-impl</artifactId> - <version>3.0.0</version> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-vfs</groupId> - <artifactId>commons-vfs</artifactId> - <version> 1.0</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>assemly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <descriptors> - <descriptor>src/main/assembly/bin.xml</descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/src/it/projects/dependency-sets/multiple-wildcard-includes/verify.groovy b/src/it/projects/dependency-sets/multiple-wildcard-includes/verify.groovy deleted file mode 100644 index b56a4d7c..00000000 --- a/src/it/projects/dependency-sets/multiple-wildcard-includes/verify.groovy +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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. - */ - -def wagonProviderJar = new File( basedir, 'target/massembly-241-1-bin/maven-libs/wagon-provider-api-1.0-beta-4.jar' ) -assert wagonProviderJar.exists() : 'Wagon provider jar is missing (should be included via include wildcard pattern).' - -def reportingImplJar = new File( basedir, 'target/massembly-241-1-bin/maven-libs/maven-reporting-impl-3.0.0.jar' ) -assert reportingImplJar.exists() : 'Reporting implementation jar is missing (should be included via include wildcard pattern).' diff --git a/src/it/projects/file-sets/multimodule-unix-lineEndings/child/pom.xml b/src/it/projects/file-sets/multimodule-unix-lineEndings/child/pom.xml index 1b9ebbf0..0b1fe5d1 100644 --- a/src/it/projects/file-sets/multimodule-unix-lineEndings/child/pom.xml +++ b/src/it/projects/file-sets/multimodule-unix-lineEndings/child/pom.xml @@ -38,6 +38,7 @@ under the License. <configuration> <descriptors> <descriptor>src/main/assembly/src.xml</descriptor> + <descriptor>src/main/assembly/src-crlf.xml</descriptor> </descriptors> </configuration> <executions> diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/child/src/main/assembly/src.xml b/src/it/projects/file-sets/multimodule-unix-lineEndings/child/src/main/assembly/src-crlf.xml similarity index 98% rename from src/it/projects/file-sets/multimodule-win-lineEndings/child/src/main/assembly/src.xml rename to src/it/projects/file-sets/multimodule-unix-lineEndings/child/src/main/assembly/src-crlf.xml index 5de4d336..9c718e44 100644 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/child/src/main/assembly/src.xml +++ b/src/it/projects/file-sets/multimodule-unix-lineEndings/child/src/main/assembly/src-crlf.xml @@ -21,7 +21,7 @@ under the License. <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - <id>src</id> + <id>src-crlf</id> <formats> <format>dir</format> </formats> diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/setup.groovy b/src/it/projects/file-sets/multimodule-unix-lineEndings/setup.groovy similarity index 100% rename from src/it/projects/file-sets/multimodule-win-lineEndings/setup.groovy rename to src/it/projects/file-sets/multimodule-unix-lineEndings/setup.groovy diff --git a/src/it/projects/file-sets/multimodule-unix-lineEndings/verify.groovy b/src/it/projects/file-sets/multimodule-unix-lineEndings/verify.groovy index 4f9e5074..da28d90a 100644 --- a/src/it/projects/file-sets/multimodule-unix-lineEndings/verify.groovy +++ b/src/it/projects/file-sets/multimodule-unix-lineEndings/verify.groovy @@ -17,36 +17,27 @@ * under the License. */ -File f = new File( basedir, "child/target/child-1-src/test.txt" ); +import java.nio.charset.StandardCharsets +import java.nio.file.Files -if ( !f.exists() ) +// the unix descriptor (assembly id "src") and the crlf descriptor (assembly id "src-crlf") run in the same build +for ( String name : [ "test.txt", "mac2win.txt" ] ) { - System.out.println( "Filtered file from file-set: " + f + " is missing." ); - return false; -} - -StringBuffer sb = new StringBuffer(); + File file = new File( basedir, "child/target/child-1-src/" + name ) + assert file.exists() : "Filtered file from file-set: " + file + " is missing." -FileReader reader = new FileReader( f ); -char[] cbuf = new char[16]; -int read = -1; -while( ( read = reader.read( cbuf ) ) > -1 ) -{ - sb.append( cbuf, 0, read ); + String actual = new String( Files.readAllBytes( file.toPath() ), StandardCharsets.UTF_8 ) + assert actual == "1\nchild" : + "Contents of " + name + ": '" + actual + "' should contain exactly one unix newline: '\\n'." } -reader.close(); - -System.out.println( "Contents of test.txt: '" + sb.toString() + "' should contain the unix newline: '\\n'." ); - -if ( sb.toString().indexOf( "1\nchild" ) == -1 ) -{ - System.out.println( "test.txt has wrong line ending" ); - return false; -} -if ( sb.toString().indexOf( "child\n" ) > -1 ) +for ( String name : [ "test.txt", "mac2win.txt" ] ) { - System.out.println( "test.txt has an extra line ending at the end of the file" ); - return false; + File file = new File( basedir, "child/target/child-1-src-crlf/" + name ) + assert file.exists() : "Filtered file from file-set: " + file + " is missing." + + String actual = new String( Files.readAllBytes( file.toPath() ), StandardCharsets.UTF_8 ) + assert actual == "1\r\nchild" : + "Contents of " + name + ": '" + actual + "' should contain exactly one windows newline: '\\r\\n'." } -return true; +return true diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/child/pom.xml b/src/it/projects/file-sets/multimodule-win-lineEndings/child/pom.xml deleted file mode 100644 index 1b9ebbf0..00000000 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/child/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?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> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - <relativePath>../../../../it-project-parent/pom.xml</relativePath> - </parent> - - <artifactId>child</artifactId> - <packaging>jar</packaging> - - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>src/main/assembly/src.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>single-assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/child/src/main/assembly-resources/test.txt b/src/it/projects/file-sets/multimodule-win-lineEndings/child/src/main/assembly-resources/test.txt deleted file mode 100644 index 67b7ddb3..00000000 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/child/src/main/assembly-resources/test.txt +++ /dev/null @@ -1,2 +0,0 @@ -${project.version} -${project.artifactId} \ No newline at end of file diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/pom.xml b/src/it/projects/file-sets/multimodule-win-lineEndings/pom.xml deleted file mode 100644 index 62562b3f..00000000 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?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> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - <relativePath>../../../it-project-parent/pom.xml</relativePath> - </parent> - - <artifactId>filtered-multimodule-parent</artifactId> - <packaging>pom</packaging> - - <modules> - <module>child</module> - </modules> - -</project> diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/src/main/assembly/bin.xml b/src/it/projects/file-sets/multimodule-win-lineEndings/src/main/assembly/bin.xml deleted file mode 100644 index 7e9b9529..00000000 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/src/main/assembly/bin.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version='1.0'?> -<!-- -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. ---> - -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - <id>bin</id> - <formats> - <format>dir</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - <dependencySets> - <dependencySet> - <scope>${test}</scope> - <outputDirectory>lib</outputDirectory> - <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> - <unpack>false</unpack> - </dependencySet> - </dependencySets> -</assembly> diff --git a/src/it/projects/filtering-feature/fileset-to-tar-massembly-722/verify.groovy b/src/it/projects/filtering-feature/fileset-to-tar-massembly-722/verify.groovy new file mode 100644 index 00000000..c04ade9f --- /dev/null +++ b/src/it/projects/filtering-feature/fileset-to-tar-massembly-722/verify.groovy @@ -0,0 +1,49 @@ +/* + * 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.tar.TarArchiveInputStream + +// a filtered fileSet written to a tar used to crash the build (MASSEMBLY-722) +File tarFile = new File( basedir, "target/maven-assembly-plugin-2.5-crash-0.0.1-SNAPSHOT-prod.tar" ) +assert tarFile.isFile() : "Missing " + tarFile + +String content = null +TarArchiveInputStream tar = new TarArchiveInputStream( new FileInputStream( tarFile ) ) +try +{ + for ( def entry = tar.nextTarEntry; entry != null; entry = tar.nextTarEntry ) + { + if ( entry.name.endsWith( "/config/my.properties" ) ) + { + content = new String( org.apache.commons.compress.utils.IOUtils.toByteArray( tar ), "ISO-8859-1" ) + } + } +} +finally +{ + tar.close() +} +assert content != null : "config/my.properties is missing from the tar" + +def props = new Properties() +props.load( new StringReader( content ) ) +// the filter from project.build.filters is applied; the other filter file is not part of this build +assert props.getProperty( "environment" ) == "test-environment" : content +assert props.getProperty( "value.test" ) == "test.value" : content +assert props.getProperty( "value.prod" ) == '${filtered.prod}' : content diff --git a/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy b/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy index 5343be0a..5c50c1c9 100644 --- a/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy +++ b/src/it/projects/mojo-configuration/manifest-with-customEntry/verify.groovy @@ -36,4 +36,12 @@ String mode = (String) attrs.get( new Attributes.Name( "mode" ) ); System.out.println( "Got mode: " + mode ); -return "development".equals( mode ); +assert "development".equals( mode ) : "Manifest entry mode: " + mode; + +String mainClass = (String) attrs.get( Attributes.Name.MAIN_CLASS ); + +System.out.println( "Got Main-Class: " + mainClass ); + +assert "test.App".equals( mainClass ) : "Manifest Main-Class: " + mainClass; + +return true; diff --git a/src/it/projects/mojo-configuration/manifest-with-mainClass/pom.xml b/src/it/projects/mojo-configuration/manifest-with-mainClass/pom.xml deleted file mode 100644 index 7a72da0b..00000000 --- a/src/it/projects/mojo-configuration/manifest-with-mainClass/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version='1.0'?> -<!-- -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: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' xmlns='http://maven.apache.org/POM/4.0.0'> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - </parent> - - <groupId>test</groupId> - <artifactId>manifest-with-mainClass</artifactId> - <packaging>jar</packaging> - <version>1</version> - <name>Maven Quick Start Archetype</name> - <url>http://maven.apache.org</url> - <dependencies> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - <archive> - <manifest> - <mainClass>test.App</mainClass> - </manifest> - </archive> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> - diff --git a/src/it/projects/mojo-configuration/manifest-with-mainClass/src/test/java/test/AppTest.java b/src/it/projects/mojo-configuration/manifest-with-mainClass/src/test/java/test/AppTest.java deleted file mode 100644 index 8b760291..00000000 --- a/src/it/projects/mojo-configuration/manifest-with-mainClass/src/test/java/test/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package test; - -/* - * 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.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * Unit test for simple App. - */ -public class AppTest { - /** - * Rigourous Test :-) - */ - @Test - public void testApp() - { - assertTrue( true ); - } -} diff --git a/src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy b/src/it/projects/multimodule/massembly-317/verify.groovy similarity index 57% rename from src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy rename to src/it/projects/multimodule/massembly-317/verify.groovy index 78f3727a..74ae323a 100644 --- a/src/it/projects/file-sets/multimodule-win-lineEndings/verify.groovy +++ b/src/it/projects/multimodule/massembly-317/verify.groovy @@ -17,18 +17,13 @@ * under the License. */ -import java.nio.charset.StandardCharsets -import java.nio.file.Files - -String expected = "1\r\nchild" -for ( String name : [ "test.txt", "mac2win.txt" ] ) +// dependency versions are not part of what is verified: "maven-monitor-2.2.0.jar" becomes "maven-monitor.jar" +def normalized( File dir ) { - File file = new File( basedir, "child/target/child-1-src/" + name ) - assert file.exists() : "Filtered file from file-set: " + file + " is missing." - - String actual = new String( Files.readAllBytes( file.toPath() ), StandardCharsets.UTF_8 ) - assert actual == expected : - "Contents of " + name + ": '" + actual + "' should contain exactly one windows newline: '\\r\\n'." + return dir.list().collect { it.replaceAll( /-\d[\w.\-]*\.jar$/, ".jar" ) }.sort() } -return true; +// binaries of every module plus the junit-jupiter-api dependency, selected by useStrictFiltering +File dir = new File( basedir, "target/my-app-1.0-SNAPSHOT-bin/my-app-1.0-SNAPSHOT/server/default" ) +assert dir.isDirectory() : "Missing assembly directory " + dir +assert normalized( dir ) == [ "junit-jupiter-api.jar", "my-app-module1.jar", "my-app-module2.jar" ] : "Entries: " + dir.list() diff --git a/src/it/projects/multimodule/massembly-474/verify.groovy b/src/it/projects/multimodule/massembly-474/verify.groovy new file mode 100644 index 00000000..b1c456d5 --- /dev/null +++ b/src/it/projects/multimodule/massembly-474/verify.groovy @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// dependency versions are not part of what is verified: "maven-monitor-2.2.0.jar" becomes "maven-monitor.jar" +def normalized( File dir ) +{ + return dir.list().collect { it.replaceAll( /-\d[\w.\-]*\.jar$/, ".jar" ) }.sort() +} + +// each of the three assemblies (client, server and the combination of both) gets only its own libraries +File target = new File( basedir, "descriptor/target" ) + +def expected = [ + "all" : [ "client/lib/maven-monitor.jar", "client/lib/modul-client.jar", "server/lib/maven-default-skin.jar", "server/lib/modul-server.jar" ], + "client" : [ "client/lib/maven-monitor.jar", "client/lib/modul-client.jar" ], + "server" : [ "server/lib/maven-default-skin.jar", "server/lib/modul-server.jar" ] +] + +for ( String id : expected.keySet() ) +{ + File dir = new File( target, "distribution-0.0.1-SNAPSHOT-" + id ) + assert dir.isDirectory() : "Missing assembly directory " + dir + def files = [] + dir.eachFileRecurse( groovy.io.FileType.FILES ) { f -> + files << dir.toPath().relativize( f.toPath() ).toString().replace( File.separator, "/" ).replaceAll( /-\d[\w.\-]*\.jar$/, ".jar" ) + } + assert files.sort() == expected[ id ] : "Assembly " + id + " contains " + files +} diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/assembly/pom.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/assembly/pom.xml index 932e4afb..d5b65686 100644 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/assembly/pom.xml +++ b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/assembly/pom.xml @@ -48,6 +48,7 @@ <configuration> <descriptors> <descriptor>src/main/assembly/bin.xml</descriptor> + <descriptor>src/main/assembly/src.xml</descriptor> </descriptors> </configuration> </plugin> diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/assembly/src/main/assembly/src.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/assembly/src/main/assembly/src.xml similarity index 100% rename from src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/assembly/src/main/assembly/src.xml rename to src/it/projects/multimodule/two-levels-includeBaseDir-withBin/assembly/src/main/assembly/src.xml diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy index e9d89d00..ca73d1c6 100644 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy +++ b/src/it/projects/multimodule/two-levels-includeBaseDir-withBin/verify.groovy @@ -22,4 +22,9 @@ String rootDir = finalName + "/modules/" assert new File( basedir, rootDir + "child-level1-project1-1.0-SNAPSHOT.jar" ).exists() -assert new File( basedir, rootDir + "child-level2-project1-1.0-SNAPSHOT.jar" ).exists() \ No newline at end of file +assert new File( basedir, rootDir + "child-level2-project1-1.0-SNAPSHOT.jar" ).exists() +// the "src" descriptor runs in the same build: sources of every module, nested modules included +String srcRoot = "assembly/target/assembly-1.0-SNAPSHOT-src/assembly-1.0-SNAPSHOT/modules/" +assert new File( basedir, srcRoot + "child-level1-project1/pom.xml" ).exists() +assert new File( basedir, srcRoot + "child-level1-project2/pom.xml" ).exists() +assert new File( basedir, srcRoot + "child-level2-project1/pom.xml" ).exists() diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/assembly/pom.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/assembly/pom.xml deleted file mode 100644 index 753cdeb9..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/assembly/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?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> - <parent> - <groupId>test</groupId> - <artifactId>two-levels-includeBaseDir-withSrc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <artifactId>assembly</artifactId> - <packaging>pom</packaging> - - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptors> - <descriptor>src/main/assembly/src.xml</descriptor> - </descriptors> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>test</groupId> - <artifactId>child-level1-project1</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>test</groupId> - <artifactId>child-level1-project2</artifactId> - <version>1.0-SNAPSHOT</version> - <type>pom</type> - </dependency> - </dependencies> -</project> diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/pom.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/pom.xml deleted file mode 100644 index dd0a8004..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?><project> - -<!-- -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. ---> - - <parent> - <groupId>test</groupId> - <artifactId>two-levels-includeBaseDir-withSrc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>child-level1-project1</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/src/main/java/test/App.java b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/src/main/java/test/App.java deleted file mode 100644 index d0442f33..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/src/main/java/test/App.java +++ /dev/null @@ -1,33 +0,0 @@ -package test; - -/* - * 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. - */ - - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/src/test/java/test/AppTest.java b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/src/test/java/test/AppTest.java deleted file mode 100644 index 8b760291..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project1/src/test/java/test/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package test; - -/* - * 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.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * Unit test for simple App. - */ -public class AppTest { - /** - * Rigourous Test :-) - */ - @Test - public void testApp() - { - assertTrue( true ); - } -} diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/pom.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/pom.xml deleted file mode 100644 index 729d4bc4..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0"?><project> - -<!-- -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. ---> - - <parent> - <artifactId>child-level1-project2</artifactId> - <groupId>test</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>child-level2-project1</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptors> - <descriptor>../../src/assemble/src.xml</descriptor> - </descriptors> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/src/main/java/test/App.java b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/src/main/java/test/App.java deleted file mode 100644 index d0442f33..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/src/main/java/test/App.java +++ /dev/null @@ -1,33 +0,0 @@ -package test; - -/* - * 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. - */ - - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/src/test/java/test/AppTest.java b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/src/test/java/test/AppTest.java deleted file mode 100644 index 8b760291..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/child-level2-project1/src/test/java/test/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package test; - -/* - * 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.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; -/** - * Unit test for simple App. - */ -public class AppTest { - /** - * Rigourous Test :-) - */ - @Test - public void testApp() - { - assertTrue( true ); - } -} diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/pom.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/pom.xml deleted file mode 100644 index 3d622ef2..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/child-level1-project2/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?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> - <parent> - <groupId>test</groupId> - <artifactId>two-levels-includeBaseDir-withSrc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>child-level1-project2</artifactId> - <version>1.0-SNAPSHOT</version> - - <packaging>pom</packaging> - - <modules> - <module>child-level2-project1</module> - </modules> -</project> diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/pom.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/pom.xml deleted file mode 100644 index c38f78d2..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?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> - <parent> - <groupId>org.apache.maven.plugin.assembly.test</groupId> - <artifactId>it-project-parent</artifactId> - <version>1</version> - </parent> - - <groupId>test</groupId> - <artifactId>two-levels-includeBaseDir-withSrc</artifactId> - <version>1.0-SNAPSHOT</version> - - <packaging>pom</packaging> - - <modules> - <module>child-level1-project1</module> - <module>child-level1-project2</module> - <module>assembly</module> - </modules> - -</project> diff --git a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/src/assemble/src.xml b/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/src/assemble/src.xml deleted file mode 100644 index e999e3a4..00000000 --- a/src/it/projects/multimodule/two-levels-includeBaseDir-withSrc/src/assemble/src.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version='1.0'?> -<!-- -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. ---> - - -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> - <id>src</id> - <formats> - <format>dir</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <moduleSets> - <moduleSet> - <useAllReactorProjects>true</useAllReactorProjects> - <includeSubModules>true</includeSubModules> - - <sources> - <excludeSubModuleDirectories>true</excludeSubModuleDirectories> - <includeModuleDirectory>true</includeModuleDirectory> - <outputDirectoryMapping>modules/${module.artifactId}</outputDirectoryMapping> - - <fileSets> - <fileSet> - <excludes> - <exclude>**/target/**</exclude> - <exclude>**/.svn/**</exclude> - </excludes> - </fileSet> - </fileSets> - </sources> - </moduleSet> - </moduleSets> -</assembly>
