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-dependency-plugin.git
commit c30e966a97673ac6239020a609b52bd4679af57f Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Wed Nov 25 21:46:49 2026 +0000 Format Groovy IT scripts Formatting only: the CONVERSION-phase AST of every file is unchanged. See https://github.com/apache/maven-invoker-plugin/issues/811. --- .../analyze-excluded-classes/verify.groovy | 2 +- .../verify.groovy | 8 +-- .../verify.groovy | 4 +- .../verify.groovy | 18 +++--- .../projects/analyze-invalid-exclude/verify.groovy | 20 +++---- .../verify.groovy | 10 ++-- .../analyze-report-only-mdep-879/verify.groovy | 12 ++-- src/it/projects/analyze-report/verify.groovy | 10 ++-- .../verify.groovy | 6 +- src/it/projects/analyze/verify.groovy | 2 +- .../build-classpath-changeparams/verify.groovy | 36 ++++++------ .../verify.groovy | 10 ++-- .../verify.groovy | 27 +++++---- src/it/projects/build-classpath/verify.groovy | 36 ++++++------ src/it/projects/collect/verify.groovy | 8 ++- .../verify.groovy | 16 ++--- .../copy-dependencies-graphroots/verify.groovy | 12 +++- .../copy-dependencies-with-conflict/verify.groovy | 12 ++-- src/it/projects/copy-dependencies/verify.groovy | 68 ++++++++++------------ src/it/projects/copy-from-reactor/verify.groovy | 17 +++--- .../copy-from-remote-repository/setup.groovy | 11 ++-- .../copy-from-remote-repository/verify.groovy | 21 +++---- src/it/projects/copy-relocation/verify.groovy | 2 +- .../copy-unpack-remote-repositories/setup.groovy | 9 ++- .../copy-unpack-remote-repositories/verify.groovy | 10 ++-- src/it/projects/copy/verify.groovy | 2 +- .../projects/dependency-properties/verify.groovy | 22 +++---- .../get-artifact-maven-plugin/setup.groovy | 11 ++-- .../get-artifact-maven-plugin/verify.groovy | 13 ++--- .../get-artifact-no-transitive/setup.groovy | 9 ++- .../get-artifact-no-transitive/verify.groovy | 22 ++++--- src/it/projects/get-artifact/setup.groovy | 9 ++- src/it/projects/get-artifact/verify.groovy | 13 ++--- src/it/projects/get-classpath/setup.groovy | 18 +++--- src/it/projects/get-gav/setup.groovy | 12 ++-- src/it/projects/get-gav/verify.groovy | 13 ++--- .../setup.groovy | 9 ++- .../verify.groovy | 13 ++--- .../projects/get-remote-repositories/setup.groovy | 9 ++- .../projects/get-remote-repositories/verify.groovy | 13 ++--- .../go-offline-transitive-reactor/verify.groovy | 2 +- .../list-excludes-transitive/verify.groovy | 4 +- .../projects/list-includes-excludes/verify.groovy | 4 +- .../list-repositories-location/verify.groovy | 28 ++++----- src/it/projects/list-repositories/verify.groovy | 14 ++--- .../mdep-458-classifier-overwrite/verify.groovy | 12 ++-- .../mdep-480-unpack-overwrite-files/setup.groovy | 7 +-- .../mdep-480-unpack-overwrite-files/verify.groovy | 7 +-- .../projects/mdep-571-resolve-java9/verify.groovy | 6 +- .../mdep-572-unpack-tar-long-file/verify.groovy | 8 +-- .../verify.groovy | 10 ++-- .../verify.groovy | 6 +- .../mdep-586-unpacking-resources/verify.groovy | 6 +- .../verify.groovy | 16 ++--- .../mdep-589-exclude-reactor/verify.groovy | 12 ++-- .../setup.groovy | 12 ++-- .../verify.groovy | 15 +++-- .../mdep-593-copy-imported-boms/verify.groovy | 32 +++++++--- .../setup.groovy | 11 ++-- .../verify.groovy | 6 +- .../mdep-650-copy-version-range/verify.groovy | 6 +- .../verify.groovy | 24 ++++---- .../verify.groovy | 6 +- .../verify.groovy | 6 +- .../verify.groovy | 9 ++- .../setup.groovy | 2 +- .../verify.groovy | 4 +- .../verify.groovy | 8 +-- .../verify.groovy | 8 +-- .../purge-local-repository-bad-dep/verify.groovy | 23 ++++---- .../purge-local-repository-bad-pom/setup.groovy | 21 ++++--- .../purge-local-repository-bad-pom/verify.groovy | 20 +++---- .../purge-local-repository-include/verify.groovy | 24 ++++---- .../setup.groovy | 17 +++--- .../verify.groovy | 17 +++--- .../setup.groovy | 17 +++--- .../verify.groovy | 19 +++--- .../verify.groovy | 12 ++-- .../purge-local-repository-reresolve/verify.groovy | 20 +++---- .../setup.groovy | 16 ++--- .../verify.groovy | 12 ++-- .../verify.groovy | 20 +++---- .../setup.groovy | 10 ++-- .../verify.groovy | 11 ++-- .../projects/purge-local-repository/setup.groovy | 57 +++++++++--------- .../projects/purge-local-repository/verify.groovy | 28 +++++---- .../verify.groovy | 4 +- .../verify.groovy | 4 +- .../verify.groovy | 6 +- .../resolve-plugins-exclude-reactor/verify.groovy | 4 +- .../resolve-plugins-with-exclude/verify.groovy | 4 +- .../resolve-sources-test-jar/verify.groovy | 12 +++- src/it/projects/resolve-sources/verify.groovy | 20 +++++-- src/it/projects/resolve/verify.groovy | 16 +++-- src/it/projects/tree-dot-multimodule/verify.groovy | 4 +- src/it/projects/tree-multimodule/verify.groovy | 2 +- .../tree-verbose-multimodule/verify.groovy | 2 +- src/it/projects/unpack-custom-ear/verify.groovy | 4 +- .../unpack-from-remote-repository/setup.groovy | 11 ++-- .../unpack-from-remote-repository/verify.groovy | 19 +++--- src/it/projects/unpack/verify.groovy | 21 ++++--- 101 files changed, 673 insertions(+), 670 deletions(-) diff --git a/src/it/projects/analyze-excluded-classes/verify.groovy b/src/it/projects/analyze-excluded-classes/verify.groovy index 270b9272..d6f1c27e 100644 --- a/src/it/projects/analyze-excluded-classes/verify.groovy +++ b/src/it/projects/analyze-excluded-classes/verify.groovy @@ -17,7 +17,7 @@ * under the License. */ -File classFile = new File( basedir, "target/classes/Main.class" ) +File classFile = new File(basedir, "target/classes/Main.class") assert classFile.exists() assert classFile.isFile() : "Build was not forked, class missing " + classFile diff --git a/src/it/projects/analyze-exclusions-ci-friendly-version/verify.groovy b/src/it/projects/analyze-exclusions-ci-friendly-version/verify.groovy index 5f695922..90500e32 100644 --- a/src/it/projects/analyze-exclusions-ci-friendly-version/verify.groovy +++ b/src/it/projects/analyze-exclusions-ci-friendly-version/verify.groovy @@ -19,9 +19,9 @@ def logLines = new File(basedir, "build.log").readLines() def index = logLines.indexOf('[WARNING] test-module defines following unnecessary excludes') -assert index > 0: "no messages in log" +assert index> 0: "no messages in log" assert logLines[index..index + 2] == [ - '[WARNING] test-module defines following unnecessary excludes', - '[WARNING] org.apache.maven.its.dependency:b-with-dep:1.0.0', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion @ line: 39' + '[WARNING] test-module defines following unnecessary excludes', + '[WARNING] org.apache.maven.its.dependency:b-with-dep:1.0.0', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion @ line: 39' ] diff --git a/src/it/projects/analyze-exclusions-managed-dependencies/verify.groovy b/src/it/projects/analyze-exclusions-managed-dependencies/verify.groovy index f6366048..d9c66b0a 100644 --- a/src/it/projects/analyze-exclusions-managed-dependencies/verify.groovy +++ b/src/it/projects/analyze-exclusions-managed-dependencies/verify.groovy @@ -23,6 +23,8 @@ assert logLines.count('[ERROR] managed-exclusions defines following unnecessary // Maven 3.10 and 4 log BUILD FAILURE at ERROR, 3.9 at INFO assert logLines.count { it.endsWith('] BUILD SUCCESS') } == 1 assert logLines.count { it.endsWith('] BUILD FAILURE') } == 1 -assert logLines.any { it.startsWith('[ERROR] - org.apache.maven.its.dependency:c-without-dep @ line:') } +assert logLines.any { + it.startsWith('[ERROR] - org.apache.maven.its.dependency:c-without-dep @ line:') +} return true diff --git a/src/it/projects/analyze-invalid-exclude-multumodule-project/verify.groovy b/src/it/projects/analyze-invalid-exclude-multumodule-project/verify.groovy index b052186e..6a9ab2ca 100644 --- a/src/it/projects/analyze-invalid-exclude-multumodule-project/verify.groovy +++ b/src/it/projects/analyze-invalid-exclude-multumodule-project/verify.groovy @@ -20,12 +20,11 @@ static void checkMessagedInLogs(logLines, messages) { def index = logLines.indexOf(messages[0]) - assert index > 0: "no messages: '" + messages[0] + "' in log" + assert index> 0: "no messages: '" + messages[0] + "' in log" def logMessages = logLines[index..index + messages.size() - 1] assert logMessages == messages - } def file = new File(basedir, "build.log") @@ -34,17 +33,16 @@ assert file.exists() def logLines = buildLog = file.readLines() checkMessagedInLogs(logLines, [ - '[WARNING] Test defines following unnecessary excludes', - '[WARNING] org.apache.maven.its.dependency:a-with-dep:1.0.0', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion1 @ line: 52' + '[WARNING] Test defines following unnecessary excludes', + '[WARNING] org.apache.maven.its.dependency:a-with-dep:1.0.0', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion1 @ line: 52' ]) checkMessagedInLogs(logLines, [ - '[WARNING] test-module1 defines following unnecessary excludes', - '[WARNING] org.apache.maven.its.dependency:a-with-dep:1.0.0', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion2 @ line: 40', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion3 @ line: 48' - + '[WARNING] test-module1 defines following unnecessary excludes', + '[WARNING] org.apache.maven.its.dependency:a-with-dep:1.0.0', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion2 @ line: 40', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion3 @ line: 48' ]) assert logLines.count('[INFO] No problems with dependencies exclusions') == 1 diff --git a/src/it/projects/analyze-invalid-exclude/verify.groovy b/src/it/projects/analyze-invalid-exclude/verify.groovy index fb3c8c7a..71eab8cc 100644 --- a/src/it/projects/analyze-invalid-exclude/verify.groovy +++ b/src/it/projects/analyze-invalid-exclude/verify.groovy @@ -17,23 +17,23 @@ * under the License. */ -def file = new File(basedir, "build.log"); -assert file.exists(); +def file = new File(basedir, "build.log") +assert file.exists() def logLines = buildLog = file.readLines() def index = logLines.indexOf('[WARNING] test-module defines following unnecessary excludes') -assert index > 0: "no messages in log" +assert index> 0: "no messages in log" -def messages = logLines[index..index + 5]; +def messages = logLines[index..index + 5] assert messages == [ - '[WARNING] test-module defines following unnecessary excludes', - '[WARNING] org.apache.maven.its.dependency:a-with-dep:1.0.0', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion1 @ line: 46', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion2 @ line: 75', - '[WARNING] org.apache.maven.its.dependency:b-with-dep:1.0.0', - '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion3 @ line: 65' + '[WARNING] test-module defines following unnecessary excludes', + '[WARNING] org.apache.maven.its.dependency:a-with-dep:1.0.0', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion1 @ line: 46', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion2 @ line: 75', + '[WARNING] org.apache.maven.its.dependency:b-with-dep:1.0.0', + '[WARNING] - org.apache.maven.its.dependency:invalid-exclusion3 @ line: 65' ] diff --git a/src/it/projects/analyze-report-forced-usage-already-used-mdep-973/verify.groovy b/src/it/projects/analyze-report-forced-usage-already-used-mdep-973/verify.groovy index 29b9d0b4..b3809f46 100644 --- a/src/it/projects/analyze-report-forced-usage-already-used-mdep-973/verify.groovy +++ b/src/it/projects/analyze-report-forced-usage-already-used-mdep-973/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -File htmlFile = new File( basedir, "target/reports/dependency-analysis.html" ); -assert htmlFile.isFile() && htmlFile.length() > 0 : "Dependency analysis report missing " + htmlFile; +File htmlFile = new File(basedir, "target/reports/dependency-analysis.html") +assert htmlFile.isFile() && htmlFile.length() > 0 : "Dependency analysis report missing " + htmlFile -String log = new File( basedir, "build.log" ).getText( "UTF-8" ); +String log = new File( basedir, "build.log" ).getText( "UTF-8" ) assert log.contains( "Unneeded forced usage of org.apache.maven:maven-model" ) : - "expected a warning about the unneeded forced usage"; +"expected a warning about the unneeded forced usage" -return true; +return true diff --git a/src/it/projects/analyze-report-only-mdep-879/verify.groovy b/src/it/projects/analyze-report-only-mdep-879/verify.groovy index a448cf7e..8428177e 100644 --- a/src/it/projects/analyze-report-only-mdep-879/verify.groovy +++ b/src/it/projects/analyze-report-only-mdep-879/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -File htmlFile = new File( basedir, "target/reports/dependency-analysis.html" ); -assert htmlFile.isFile() && htmlFile.length() > 0 : "Dependency analysis report missing " + htmlFile; +File htmlFile = new File(basedir, "target/reports/dependency-analysis.html") +assert htmlFile.isFile() && htmlFile.length() > 0 : "Dependency analysis report missing " + htmlFile -String log = new File( basedir, "build.log" ).getText( "UTF-8" ); -assert log.contains( ":compile (default-compile)" ) : "expected the explicitly requested compile phase to run"; -assert !log.contains( ":testCompile (default-testCompile)" ) : "analyze-report-only must not fork test-compile"; +String log = new File( basedir, "build.log" ).getText( "UTF-8" ) +assert log.contains( ":compile (default-compile)" ) : "expected the explicitly requested compile phase to run" +assert !log.contains( ":testCompile (default-testCompile)" ) : "analyze-report-only must not fork test-compile" -return true; +return true diff --git a/src/it/projects/analyze-report/verify.groovy b/src/it/projects/analyze-report/verify.groovy index d82c0faf..482ca1a4 100644 --- a/src/it/projects/analyze-report/verify.groovy +++ b/src/it/projects/analyze-report/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -File htmlFile = new File( basedir, "target/reports/dependency-analysis.html" ); +File htmlFile = new File(basedir, "target/reports/dependency-analysis.html") -assert htmlFile.isFile() : "Dependency analysis file missing " + htmlFile; -assert htmlFile.length() > 0 : "Dependency analysis file empty " + htmlFile; +assert htmlFile.isFile() : "Dependency analysis file missing " + htmlFile +assert htmlFile.length() > 0 : "Dependency analysis file empty " + htmlFile -return true; +return true diff --git a/src/it/projects/analyze-testDependencyWithNonTestScope/verify.groovy b/src/it/projects/analyze-testDependencyWithNonTestScope/verify.groovy index ed8fb189..98c2428b 100644 --- a/src/it/projects/analyze-testDependencyWithNonTestScope/verify.groovy +++ b/src/it/projects/analyze-testDependencyWithNonTestScope/verify.groovy @@ -21,15 +21,15 @@ import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.select.Elements -File htmlFile = new File( basedir, "target/reports/dependency-analysis.html" ) +File htmlFile = new File(basedir, "target/reports/dependency-analysis.html") assert htmlFile.isFile() : "Dependency analysis file missing " + htmlFile assert htmlFile.length() > 0 : "Dependency analysis file empty " + htmlFile Document doc = Jsoup.parse( htmlFile, "UTF-8" ) Elements entry = doc.select( "#bodyColumn > section > section:nth-child(5) > table > tbody > tr.b" ) assert entry.size() == 1 : "Table entry under CompileScopedTestDependencies header has " + entry.size() + - " rows but exactly 1 was expected " + htmlFile +" rows but exactly 1 was expected " + htmlFile String groupId = entry.first().select( "td:nth-child(1)" ).text() assert groupId == "junit" : "Table entry under CompileScopedTestDependencies header groupId is not junit. Value is " + - groupId + " in " + htmlFile +groupId + " in " + htmlFile diff --git a/src/it/projects/analyze/verify.groovy b/src/it/projects/analyze/verify.groovy index 93e72b3f..bfd8dc69 100644 --- a/src/it/projects/analyze/verify.groovy +++ b/src/it/projects/analyze/verify.groovy @@ -17,7 +17,7 @@ * under the License. */ -File classFile = new File( basedir, "target/classes/Main.class" ) +File classFile = new File(basedir, "target/classes/Main.class") assert classFile.exists() assert classFile.isFile() : "Build was not forked, class missing " + classFile diff --git a/src/it/projects/build-classpath-changeparams/verify.groovy b/src/it/projects/build-classpath-changeparams/verify.groovy index 87aa8f58..8ef9ff55 100644 --- a/src/it/projects/build-classpath-changeparams/verify.groovy +++ b/src/it/projects/build-classpath-changeparams/verify.groovy @@ -17,30 +17,30 @@ * under the License. */ -import java.io.*; -import java.util.*; +import java.io.* +import java.util.* -import org.codehaus.plexus.util.*; +import org.codehaus.plexus.util.* -String classpath = new File( basedir, "target/classpath.txt" ).getText( "UTF-8" ); +String classpath = new File(basedir, "target/classpath.txt").getText("UTF-8") -classpath = StringUtils.replace( classpath, "PREFIX/", "" ); +classpath = StringUtils.replace(classpath, "PREFIX/", "") -List actual = Arrays.asList( classpath.split( ":" ) ); +List actual = Arrays.asList(classpath.split(":")) -List expected = new ArrayList(); -expected.add( "org.apache.maven.maven-profile-2.0.6.jar" ); -expected.add( "org.apache.maven.maven-model-2.0.6.jar" ); -expected.add( "org.codehaus.plexus.plexus-utils-1.4.1.jar" ); -expected.add( "org.codehaus.plexus.plexus-container-default-1.0-alpha-9-stable-1.jar" ); -expected.add( "junit.junit-3.8.1.jar" ); +List expected = new ArrayList() +expected.add("org.apache.maven.maven-profile-2.0.6.jar") +expected.add("org.apache.maven.maven-model-2.0.6.jar") +expected.add("org.codehaus.plexus.plexus-utils-1.4.1.jar") +expected.add("org.codehaus.plexus.plexus-container-default-1.0-alpha-9-stable-1.jar") +expected.add("junit.junit-3.8.1.jar") // dependency with classifier in pom -expected.add( "org.apache.maven.maven-project-2.0.6.jar" ); +expected.add("org.apache.maven.maven-project-2.0.6.jar") -System.out.println( "Checking classpath... " ); -System.out.println( "Actual : " + actual ); -System.out.println( "Expected: " + expected ); +System.out.println("Checking classpath... ") +System.out.println("Actual : " + actual) +System.out.println("Expected: " + expected) -assert actual.equals( expected ) : "Unexpected classpath"; +assert actual.equals(expected) : "Unexpected classpath" -return true; +return true diff --git a/src/it/projects/build-classpath-output-file-and-property/verify.groovy b/src/it/projects/build-classpath-output-file-and-property/verify.groovy index 3348e7a0..a808fa72 100644 --- a/src/it/projects/build-classpath-output-file-and-property/verify.groovy +++ b/src/it/projects/build-classpath-output-file-and-property/verify.groovy @@ -17,12 +17,12 @@ * under the License. */ -import java.io.*; +import java.io.* -String classpath = new File( basedir, "target/classpath.txt" ).getText( "UTF-8" ); -String expected = "PREFIX/get-artifact-1.0.jar:PREFIX/get-artifact-transitive-1.0.jar"; +String classpath = new File(basedir, "target/classpath.txt").getText("UTF-8") +String expected = "PREFIX/get-artifact-1.0.jar:PREFIX/get-artifact-transitive-1.0.jar" -assert classpath.equals( expected ) : "Unexpected classpath"; +assert classpath.equals(expected) : "Unexpected classpath" -return true; +return true diff --git a/src/it/projects/build-classpath-repository-layout/verify.groovy b/src/it/projects/build-classpath-repository-layout/verify.groovy index a5e241fb..0221e4f5 100644 --- a/src/it/projects/build-classpath-repository-layout/verify.groovy +++ b/src/it/projects/build-classpath-repository-layout/verify.groovy @@ -17,26 +17,33 @@ * under the License. */ -import java.io.*; -import java.util.*; +import java.io.* +import java.util.* -def read = { String name -> new File( basedir, "module-b/target/" + name ).text.trim() } +def read = { String name -> + new File(basedir, "module-b/target/" + name).text.trim() +} // no prefix: the reactor module is its build output, the other artifact is in the local repository -def noPrefix = read( "no-prefix.txt" ).split( File.pathSeparator ) as List +def noPrefix = read("no-prefix.txt").split(File.pathSeparator) as List assert noPrefix.size() == 2 -assert noPrefix.any { it.replace( '\\', '/' ).endsWith( "/module-a/target/module-a-1.0-SNAPSHOT.jar" ) } : noPrefix -assert noPrefix.any { it.replace( '\\', '/' ).endsWith( "/junit/junit/3.8.1/junit-3.8.1.jar" ) } : noPrefix +assert noPrefix.any { + it.replace('\\', '/').endsWith("/module-a/target/module-a-1.0-SNAPSHOT.jar") +} : noPrefix +assert noPrefix.any { + it.replace( '\\', '/' ).endsWith( "/junit/junit/3.8.1/junit-3.8.1.jar" ) +} : noPrefix assert noPrefix.every { !it.startsWith( "repository" ) } : noPrefix // prefix without layout: file names only assert read( "prefix-only.txt" ).split( File.pathSeparator ) as Set == - [ "repository" + File.separator + "module-a-1.0-SNAPSHOT.jar", - "repository" + File.separator + "junit-3.8.1.jar" ] as Set +["repository" + File.separator + "module-a-1.0-SNAPSHOT.jar", "repository" + File.separator + "junit-3.8.1.jar"] as Set // prefix with layout: the same for the reactor module and the external artifact assert read( "layout.txt" ).split( ":" ) as Set == - [ "repository/org/apache/maven/its/dependency/module-a/1.0-SNAPSHOT/module-a-1.0-SNAPSHOT.jar", - "repository/junit/junit/3.8.1/junit-3.8.1.jar" ] as Set +[ + "repository/org/apache/maven/its/dependency/module-a/1.0-SNAPSHOT/module-a-1.0-SNAPSHOT.jar", + "repository/junit/junit/3.8.1/junit-3.8.1.jar" +] as Set return true diff --git a/src/it/projects/build-classpath/verify.groovy b/src/it/projects/build-classpath/verify.groovy index 930a2349..90163d6f 100644 --- a/src/it/projects/build-classpath/verify.groovy +++ b/src/it/projects/build-classpath/verify.groovy @@ -17,30 +17,30 @@ * under the License. */ -import java.io.*; -import java.util.*; +import java.io.* +import java.util.* -import org.codehaus.plexus.util.*; +import org.codehaus.plexus.util.* -String classpath = new File( basedir, "target/classpath.txt" ).getText( "UTF-8" ); +String classpath = new File(basedir, "target/classpath.txt").getText("UTF-8") -classpath = StringUtils.replace( classpath, "PREFIX/", "" ); +classpath = StringUtils.replace(classpath, "PREFIX/", "") -List actual = Arrays.asList( classpath.split( ":" ) ); +List actual = Arrays.asList(classpath.split(":")) -List expected = new ArrayList(); -expected.add( "maven-profile-2.0.6.jar" ); -expected.add( "maven-model-2.0.6.jar" ); -expected.add( "plexus-utils-1.4.1.jar" ); -expected.add( "plexus-container-default-1.0-alpha-9-stable-1.jar" ); -expected.add( "junit-3.8.1.jar" ); +List expected = new ArrayList() +expected.add("maven-profile-2.0.6.jar") +expected.add("maven-model-2.0.6.jar") +expected.add("plexus-utils-1.4.1.jar") +expected.add("plexus-container-default-1.0-alpha-9-stable-1.jar") +expected.add("junit-3.8.1.jar") // dependency with classifier in pom -expected.add( "maven-project-2.0.6-sources.jar" ); +expected.add("maven-project-2.0.6-sources.jar") -System.out.println( "Checking classpath... " ); -System.out.println( "Actual : " + actual ); -System.out.println( "Expected: " + expected ); +System.out.println("Checking classpath... ") +System.out.println("Actual : " + actual) +System.out.println("Expected: " + expected) -assert actual.equals( expected ) : "Unexpected classpath"; +assert actual.equals(expected) : "Unexpected classpath" -return true; +return true diff --git a/src/it/projects/collect/verify.groovy b/src/it/projects/collect/verify.groovy index c1d2723a..212995bd 100644 --- a/src/it/projects/collect/verify.groovy +++ b/src/it/projects/collect/verify.groovy @@ -23,6 +23,10 @@ def artifacts = lines.findAll { it.contains(":jar:") } // the direct dependency and one that only the POM chain knows about assert artifacts.contains("org.apache.maven:maven-project:jar:2.0.6:compile") : "Expected the dependency in " + lines assert artifacts.contains("org.apache.maven:maven-model:jar:2.0.6:compile") : "Expected a transitive dependency in " + lines -assert !lines.any { it.startsWith("The following files have NOT been resolved") } : "Nothing may be unresolved in " + lines +assert !lines.any { + it.startsWith("The following files have NOT been resolved") +} : "Nothing may be unresolved in " + lines // collect reads POMs only, so no jar is resolved and no module name can be read from one -assert !artifacts.any { it.contains(" -- module ") } : "collect must not resolve jars: " + lines +assert !artifacts.any { + it.contains(" -- module ") +} : "collect must not resolve jars: " + lines diff --git a/src/it/projects/copy-and-unpack-with-alternate-local-repo/verify.groovy b/src/it/projects/copy-and-unpack-with-alternate-local-repo/verify.groovy index 1968fbbc..a80701c8 100644 --- a/src/it/projects/copy-and-unpack-with-alternate-local-repo/verify.groovy +++ b/src/it/projects/copy-and-unpack-with-alternate-local-repo/verify.groovy @@ -17,17 +17,17 @@ * under the License. */ -import java.io.*; +import java.io.* -File file = new File( basedir, "target/dependency/unpack-fixture-1.0.jar" ); +File file = new File(basedir, "target/dependency/unpack-fixture-1.0.jar") -assert file.isFile() : "Missing " + file; +assert file.isFile() : "Missing " + file -file = new File( basedir, "target/dependency/fixture" ); -assert file.isDirectory() : "Missing " + file; +file = new File( basedir, "target/dependency/fixture" ) +assert file.isDirectory() : "Missing " + file -file = new File( basedir, "target/repo/org/apache/maven/its/dependency/unpack-fixture/1.0/unpack-fixture-1.0.jar" ); -assert file.isFile() : "Missing " + file; +file = new File( basedir, "target/repo/org/apache/maven/its/dependency/unpack-fixture/1.0/unpack-fixture-1.0.jar" ) +assert file.isFile() : "Missing " + file -return true; +return true diff --git a/src/it/projects/copy-dependencies-graphroots/verify.groovy b/src/it/projects/copy-dependencies-graphroots/verify.groovy index 1d70b659..f39094ab 100644 --- a/src/it/projects/copy-dependencies-graphroots/verify.groovy +++ b/src/it/projects/copy-dependencies-graphroots/verify.groovy @@ -21,7 +21,11 @@ def targetFiles1 = ['a-with-dep-1.0.0.jar', 'b-with-dep-1.0.0.jar', 'c-without-d def directory1 = new File(basedir, 'target/it/copy-dep-test-1') // Get only file names from the directory (excludes subdirectories) -def actualFiles1 = directory1.listFiles().findAll { it.isFile() }.collect { it.name } +def actualFiles1 = directory1.listFiles().findAll { + it.isFile() +}.collect { + it.name +} // Check if the sets are identical and have exactly 3 files assert (actualFiles1.size() == 4 && actualFiles1.containsAll(targetFiles1)) @@ -31,7 +35,11 @@ def targetFiles2 = ['get-artifact-1.0.jar', 'get-artifact-transitive-1.0.jar'] def directory2 = new File(basedir, 'target/it/copy-dep-test-2') // Get only file names from the directory (excludes subdirectories) -def actualFiles2 = directory2.listFiles().findAll { it.isFile() }.collect { it.name } +def actualFiles2 = directory2.listFiles().findAll { + it.isFile() +}.collect { + it.name +} // Check if the sets are identical and have exactly 3 files assert (actualFiles2.size() == 2 && actualFiles2.containsAll(targetFiles2)) diff --git a/src/it/projects/copy-dependencies-with-conflict/verify.groovy b/src/it/projects/copy-dependencies-with-conflict/verify.groovy index 5a5234a3..d24df1e0 100644 --- a/src/it/projects/copy-dependencies-with-conflict/verify.groovy +++ b/src/it/projects/copy-dependencies-with-conflict/verify.groovy @@ -17,15 +17,15 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) -assert buildLog.contains( 'Multiple artifacts map to the same destination file' ) -assert buildLog.contains( 'org.apache.maven.its.dependency.a:conflict' ) -assert buildLog.contains( 'org.apache.maven.its.dependency.b:conflict' ) +String buildLog = file.getText("UTF-8") +assert buildLog.contains('Multiple artifacts map to the same destination file') +assert buildLog.contains('org.apache.maven.its.dependency.a:conflict') +assert buildLog.contains('org.apache.maven.its.dependency.b:conflict') -File copiedFile = new File( basedir, 'target/it/copy-dep-test-2/conflict-1.0.jar' ) +File copiedFile = new File(basedir, 'target/it/copy-dep-test-2/conflict-1.0.jar') assert !copiedFile.exists() return true diff --git a/src/it/projects/copy-dependencies/verify.groovy b/src/it/projects/copy-dependencies/verify.groovy index 0f11d70f..80dca5a7 100644 --- a/src/it/projects/copy-dependencies/verify.groovy +++ b/src/it/projects/copy-dependencies/verify.groovy @@ -17,29 +17,25 @@ * under the License. */ -import java.io.*; - -void checkExpected( File dir, String[] expectedFiles ) -{ - for ( String expectedFile : expectedFiles ) - { - File file = new File( dir, expectedFile ); - assert file.isFile() : "Missing file " + file; +import java.io.* + +void checkExpected(File dir, String[] expectedFiles) { + for (String expectedFile : expectedFiles) { + File file = new File(dir, expectedFile) + assert file.isFile() : "Missing file " + file } } -void checkExpected( File dir, String[] expectedFiles, String[] unexpectedFiles ) -{ - checkExpected( dir, expectedFiles ); +void checkExpected(File dir, String[] expectedFiles, String[] unexpectedFiles) { + checkExpected(dir, expectedFiles) - for ( String unexpectedFile : unexpectedFiles ) - { - File file = new File( dir, unexpectedFile ); - assert !file.isFile() : "Unexpected file " + file + " found"; + for (String unexpectedFile : unexpectedFiles) { + File file = new File(dir, unexpectedFile) + assert !file.isFile() : "Unexpected file " + file + " found" } } -File baseOutput = new File( basedir, "target/it" ); +File baseOutput = new File(basedir, "target/it") // test-1 @@ -54,39 +50,34 @@ String[] expectedFiles = [ "maven-artifact-2.0.6.pom", "maven-settings-2.0.6.jar", "maven-settings-2.0.6.pom" -]; +] String [] unexpectedFiles = [ "plexus-interpolation-1.11.jar", "plexus-interpolation-1.11.pom", "plexus-plexus-container-default-1.0-alpha-9-stable-1.jar", "plexus-plexus-container-default-1.0-alpha-9-stable-1.pom" -]; +] -checkExpected( new File( baseOutput, "copy-dep-test-1" ), expectedFiles, unexpectedFiles ); +checkExpected(new File(baseOutput, "copy-dep-test-1"), expectedFiles, unexpectedFiles) // test-2 -String [] expectedFiles2 = [ - "maven-model-2.0.6.jar", - "plexus-utils-1.4.1.jar" -]; +String [] expectedFiles2 = ["maven-model-2.0.6.jar", "plexus-utils-1.4.1.jar"] String [] unexpectedFiles2 = [ "plexus-utils-1.4.1.pom", "maven-model-2.0.6.pom", "maven-model-2.0.6-sources.jar", "maven-model-2.0.6-javadoc.jar" -]; +] -checkExpected( new File( baseOutput, "copy-dep-test-2" ), expectedFiles2, unexpectedFiles2 ); +checkExpected(new File(baseOutput, "copy-dep-test-2"), expectedFiles2, unexpectedFiles2) // test-3 -String [] expectedFiles3 = [ - "maven-model-2.0.6-sources.jar" -]; +String [] expectedFiles3 = ["maven-model-2.0.6-sources.jar"] String [] unexpectedFiles3 = [ "plexus-utils-1.4.1.pom", @@ -94,9 +85,9 @@ String [] unexpectedFiles3 = [ "maven-model-2.0.6-javadoc.jar", "maven-model-2.0.6.jar", "plexus-utils-1.4.1.jar" -]; +] -checkExpected( new File( baseOutput, "copy-dep-test-3" ), expectedFiles3, unexpectedFiles3 ); +checkExpected(new File(baseOutput, "copy-dep-test-3"), expectedFiles3, unexpectedFiles3) // repositoryLayout @@ -109,18 +100,21 @@ String [] expectedFiles4 = [ "org/codehaus/plexus/plexus-utils/maven-metadata-local.xml", "org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.jar", "org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.pom", - "org/apache/apache/5/apache-5.pom", // parent pom - "org/apache/maven/maven/2.0.6/maven-2.0.6.pom", // parent of maven-model - "org/apache/apache/3/apache-3.pom", // parent of parent of maven + "org/apache/apache/5/apache-5.pom", + // parent pom + "org/apache/maven/maven/2.0.6/maven-2.0.6.pom", + // parent of maven-model + "org/apache/apache/3/apache-3.pom", + // parent of parent of maven "org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom" // parent of plexus-utils -]; +] String [] unexpectedFiles4 = [ "plexus-utils-1.4.1.pom", "maven-model-2.0.6.pom", "org/apache/maven/maven-parent/5/maven-parent-5.pom", // parent of maven, excluded by artifactId -]; +] -checkExpected( new File( baseOutput, "repositoryLayout" ), expectedFiles4, unexpectedFiles4 ); +checkExpected(new File(baseOutput, "repositoryLayout"), expectedFiles4, unexpectedFiles4) -return true; +return true diff --git a/src/it/projects/copy-from-reactor/verify.groovy b/src/it/projects/copy-from-reactor/verify.groovy index 27949c19..1706fbf5 100644 --- a/src/it/projects/copy-from-reactor/verify.groovy +++ b/src/it/projects/copy-from-reactor/verify.groovy @@ -17,18 +17,15 @@ * under the License. */ -import java.io.*; +import java.io.* -File libDir = new File( basedir, "child-b/target/dependency" ); +File libDir = new File(basedir, "child-b/target/dependency") -String[] expectedFiles = [ - "child-a-1.0-SNAPSHOT.jar", -]; +String[] expectedFiles = ["child-a-1.0-SNAPSHOT.jar",] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( libDir, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(libDir, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/copy-from-remote-repository/setup.groovy b/src/it/projects/copy-from-remote-repository/setup.groovy index 672c3df4..e157243e 100644 --- a/src/it/projects/copy-from-remote-repository/setup.groovy +++ b/src/it/projects/copy-from-remote-repository/setup.groovy @@ -17,14 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -String[] foldersToDelete = [ - "org/apache/maven/its/dependency/fake-remote-copy" -]; +String[] foldersToDelete = ["org/apache/maven/its/dependency/fake-remote-copy"] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/copy-from-remote-repository/verify.groovy b/src/it/projects/copy-from-remote-repository/verify.groovy index 041efadf..8d56ec49 100644 --- a/src/it/projects/copy-from-remote-repository/verify.groovy +++ b/src/it/projects/copy-from-remote-repository/verify.groovy @@ -16,20 +16,17 @@ * specific language governing permissions and limitations * under the License. */ - -import java.io.*; -String[] expectedFiles = [ - "org/apache/maven/its/dependency/fake-remote-copy/1.0/fake-remote-copy-1.0.jar" -]; +import java.io.* -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +String[] expectedFiles = ["org/apache/maven/its/dependency/fake-remote-copy/1.0/fake-remote-copy-1.0.jar"] + +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -File copied = new File( basedir, "target/dependency/fake-remote-copy-1.0.jar" ); -assert copied.exists() : "Missing file " + copied; +File copied = new File(basedir, "target/dependency/fake-remote-copy-1.0.jar") +assert copied.exists() : "Missing file " + copied -return true; +return true diff --git a/src/it/projects/copy-relocation/verify.groovy b/src/it/projects/copy-relocation/verify.groovy index 672e5f1e..6b64df56 100644 --- a/src/it/projects/copy-relocation/verify.groovy +++ b/src/it/projects/copy-relocation/verify.groovy @@ -17,4 +17,4 @@ * under the License. */ -assert new File( basedir, 'target/dependency/ResourceArtifact-1.0.jar' ).isFile(); +assert new File(basedir, 'target/dependency/ResourceArtifact-1.0.jar').isFile() diff --git a/src/it/projects/copy-unpack-remote-repositories/setup.groovy b/src/it/projects/copy-unpack-remote-repositories/setup.groovy index 4672b4bd..6b42b581 100644 --- a/src/it/projects/copy-unpack-remote-repositories/setup.groovy +++ b/src/it/projects/copy-unpack-remote-repositories/setup.groovy @@ -17,15 +17,14 @@ * under the License. */ -import java.io.*; +import java.io.* String[] foldersToDelete = [ "org/apache/maven/its/dependency/remote-repositories-copy", "org/apache/maven/its/dependency/remote-repositories-unpack" -]; +] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/copy-unpack-remote-repositories/verify.groovy b/src/it/projects/copy-unpack-remote-repositories/verify.groovy index bd2e9248..d905a3e1 100644 --- a/src/it/projects/copy-unpack-remote-repositories/verify.groovy +++ b/src/it/projects/copy-unpack-remote-repositories/verify.groovy @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ - -assert new File( localRepositoryPath, 'org/apache/maven/its/dependency/remote-repositories-copy/1.0/remote-repositories-copy-1.0.jar' ).isFile() -assert new File( localRepositoryPath, 'org/apache/maven/its/dependency/remote-repositories-unpack/1.0/remote-repositories-unpack-1.0.jar' ).isFile() -assert new File( basedir, 'target/dependency/remote-repositories-copy-1.0.jar' ).isFile() -assert new File( basedir, 'target/unpacked/META-INF/MANIFEST.MF' ).isFile() +assert new File(localRepositoryPath, 'org/apache/maven/its/dependency/remote-repositories-copy/1.0/remote-repositories-copy-1.0.jar').isFile() +assert new File(localRepositoryPath, 'org/apache/maven/its/dependency/remote-repositories-unpack/1.0/remote-repositories-unpack-1.0.jar').isFile() + +assert new File(basedir, 'target/dependency/remote-repositories-copy-1.0.jar').isFile() +assert new File(basedir, 'target/unpacked/META-INF/MANIFEST.MF').isFile() diff --git a/src/it/projects/copy/verify.groovy b/src/it/projects/copy/verify.groovy index 37dc0192..46e983be 100644 --- a/src/it/projects/copy/verify.groovy +++ b/src/it/projects/copy/verify.groovy @@ -17,4 +17,4 @@ * under the License. */ -assert new File( basedir, 'target/dependency/a1-1.0.0.jar' ).isFile(); +assert new File(basedir, 'target/dependency/a1-1.0.0.jar').isFile() diff --git a/src/it/projects/dependency-properties/verify.groovy b/src/it/projects/dependency-properties/verify.groovy index cbd69482..d6951ba8 100644 --- a/src/it/projects/dependency-properties/verify.groovy +++ b/src/it/projects/dependency-properties/verify.groovy @@ -17,20 +17,20 @@ * under the License. */ -import java.io.*; +import java.io.* -File projectProperties = new File( basedir, "target/project.properties" ); +File projectProperties = new File(basedir, "target/project.properties") -Properties props = new Properties(); -projectProperties.withInputStream { props.load( it ) }; +Properties props = new Properties() +projectProperties.withInputStream { props.load(it) } -String fixtureJarPath = props.getProperty( "org.apache.maven.its.dependency:unpack-fixture:jar" ); -assert fixtureJarPath != null : "org.apache.maven.its.dependency:unpack-fixture:jar is null"; -assert (new File( fixtureJarPath )).isFile() : "unpack-fixture jar is not a file: " + fixtureJarPath; +String fixtureJarPath = props.getProperty("org.apache.maven.its.dependency:unpack-fixture:jar") +assert fixtureJarPath != null : "org.apache.maven.its.dependency:unpack-fixture:jar is null" +assert (new File( fixtureJarPath )).isFile() : "unpack-fixture jar is not a file: " + fixtureJarPath -String mavenArtifactPath = props.getProperty( "org.apache.maven:maven-artifact:jar" ); -assert mavenArtifactPath != null : "org.apache.maven:maven-artifact:jar is null"; -assert (new File( mavenArtifactPath )).isFile() : "maven-artifact jar is not a file: " + mavenArtifactPath; +String mavenArtifactPath = props.getProperty( "org.apache.maven:maven-artifact:jar" ) +assert mavenArtifactPath != null : "org.apache.maven:maven-artifact:jar is null" +assert (new File( mavenArtifactPath )).isFile() : "maven-artifact jar is not a file: " + mavenArtifactPath // bound through the mdep.properties.includeVersions user property assert "1.0".equals( props.getProperty( "org.apache.maven.its.dependency:unpack-fixture:jar.version" ) ) : "unpack-fixture version: " + props.getProperty( "org.apache.maven.its.dependency:unpack-fixture:jar.version" ) @@ -44,4 +44,4 @@ assert "1.5.1".equals( plexusUtilsVersion ) : "plexus-utils version: " + plexusU File interpolated = new File( basedir, "target/interpolated-2.0.9.properties" ) assert interpolated.isFile() : "version property not interpolated into a later plugin configuration" -return true; +return true diff --git a/src/it/projects/get-artifact-maven-plugin/setup.groovy b/src/it/projects/get-artifact-maven-plugin/setup.groovy index c25dd36e..b2504696 100644 --- a/src/it/projects/get-artifact-maven-plugin/setup.groovy +++ b/src/it/projects/get-artifact-maven-plugin/setup.groovy @@ -17,14 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -String[] foldersToDelete = [ - "org/apache/maven/its/dependency/get-artifact-maven-plugin" -]; +String[] foldersToDelete = ["org/apache/maven/its/dependency/get-artifact-maven-plugin"] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/get-artifact-maven-plugin/verify.groovy b/src/it/projects/get-artifact-maven-plugin/verify.groovy index 68d22435..302309a6 100644 --- a/src/it/projects/get-artifact-maven-plugin/verify.groovy +++ b/src/it/projects/get-artifact-maven-plugin/verify.groovy @@ -17,17 +17,16 @@ * under the License. */ -import java.io.*; +import java.io.* String[] expectedFiles = [ "org/apache/maven/its/dependency/get-artifact-maven-plugin/1.0/get-artifact-maven-plugin-1.0.jar", "org/apache/maven/its/dependency/get-artifact-maven-plugin/1.0/get-artifact-maven-plugin-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/get-artifact-no-transitive/setup.groovy b/src/it/projects/get-artifact-no-transitive/setup.groovy index 97fad394..fd8b932e 100644 --- a/src/it/projects/get-artifact-no-transitive/setup.groovy +++ b/src/it/projects/get-artifact-no-transitive/setup.groovy @@ -17,15 +17,14 @@ * under the License. */ -import java.io.*; +import java.io.* String[] foldersToDelete = [ "org/apache/maven/its/dependency/get-artifact-no-transitive-dep", "org/apache/maven/its/dependency/get-artifact-no-transitive-dep-transitive" -]; +] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/get-artifact-no-transitive/verify.groovy b/src/it/projects/get-artifact-no-transitive/verify.groovy index f0f82210..332b2f54 100644 --- a/src/it/projects/get-artifact-no-transitive/verify.groovy +++ b/src/it/projects/get-artifact-no-transitive/verify.groovy @@ -17,28 +17,26 @@ * under the License. */ -import java.io.*; +import java.io.* String[] expectedFiles = [ "org/apache/maven/its/dependency/get-artifact-no-transitive-dep/1.0/get-artifact-no-transitive-dep-1.0.jar", "org/apache/maven/its/dependency/get-artifact-no-transitive-dep/1.0/get-artifact-no-transitive-dep-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } String[] notExpectedFiles = [ "org/apache/maven/its/dependency/get-artifact-no-transitive-dep-transitive/1.0/get-artifact-no-transitive-dep-transitive-1.0.jar", "org/apache/maven/its/dependency/get-artifact-no-transitive-dep-transitive/1.0/get-artifact-no-transitive-dep-transitive-1.0.pom" -]; +] -for ( String notExpectedFile : notExpectedFiles ) -{ - File file = new File( localRepositoryPath, notExpectedFile ); - assert !file.isFile() : "Existing file " + file; +for (String notExpectedFile : notExpectedFiles) { + File file = new File(localRepositoryPath, notExpectedFile) + assert !file.isFile() : "Existing file " + file } -return true; +return true diff --git a/src/it/projects/get-artifact/setup.groovy b/src/it/projects/get-artifact/setup.groovy index 7008ab6e..6ec7f21a 100644 --- a/src/it/projects/get-artifact/setup.groovy +++ b/src/it/projects/get-artifact/setup.groovy @@ -17,15 +17,14 @@ * under the License. */ -import java.io.*; +import java.io.* String[] foldersToDelete = [ "org/apache/maven/its/dependency/get-artifact-dep", "org/apache/maven/its/dependency/get-artifact-dep-transitive" -]; +] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/get-artifact/verify.groovy b/src/it/projects/get-artifact/verify.groovy index b8b52708..6b23475b 100644 --- a/src/it/projects/get-artifact/verify.groovy +++ b/src/it/projects/get-artifact/verify.groovy @@ -17,19 +17,18 @@ * under the License. */ -import java.io.*; +import java.io.* String[] expectedFiles = [ "org/apache/maven/its/dependency/get-artifact-dep/1.0/get-artifact-dep-1.0.jar", "org/apache/maven/its/dependency/get-artifact-dep/1.0/get-artifact-dep-1.0.pom", "org/apache/maven/its/dependency/get-artifact-dep-transitive/1.0/get-artifact-dep-transitive-1.0.jar", "org/apache/maven/its/dependency/get-artifact-dep-transitive/1.0/get-artifact-dep-transitive-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/get-classpath/setup.groovy b/src/it/projects/get-classpath/setup.groovy index 06687709..27132800 100644 --- a/src/it/projects/get-classpath/setup.groovy +++ b/src/it/projects/get-classpath/setup.groovy @@ -16,17 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.FileUtils // forces the download: every artifact of the IT is removed from the local repository first -File dir = new File( localRepositoryPath, "org/apache/maven/its/dependency" ); -File[] artifacts = dir.listFiles( { File f -> f.getName().startsWith( "get-classpath-lib" ) } as FileFilter ); -if ( artifacts != null ) -{ - for ( File artifact : artifacts ) - { - FileUtils.deleteDirectory( artifact ); +File dir = new File(localRepositoryPath, "org/apache/maven/its/dependency") +File[] artifacts = dir.listFiles({ File f -> + f.getName().startsWith("get-classpath-lib") +} as FileFilter) +if (artifacts != null) { + for (File artifact : artifacts) { + FileUtils.deleteDirectory(artifact) } } -return true; +return true diff --git a/src/it/projects/get-gav/setup.groovy b/src/it/projects/get-gav/setup.groovy index 272c589a..593277a3 100644 --- a/src/it/projects/get-gav/setup.groovy +++ b/src/it/projects/get-gav/setup.groovy @@ -17,15 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -String[] foldersToDelete = [ - "org/apache/maven/its/dependency/get-gav-dep", - "org/apache/maven/its/dependency/get-gav-dep-transitive" -]; +String[] foldersToDelete = ["org/apache/maven/its/dependency/get-gav-dep", "org/apache/maven/its/dependency/get-gav-dep-transitive"] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/get-gav/verify.groovy b/src/it/projects/get-gav/verify.groovy index 134b747b..18f6f262 100644 --- a/src/it/projects/get-gav/verify.groovy +++ b/src/it/projects/get-gav/verify.groovy @@ -17,19 +17,18 @@ * under the License. */ -import java.io.*; +import java.io.* String[] expectedFiles = [ "org/apache/maven/its/dependency/get-gav-dep/1.0/get-gav-dep-1.0.jar", "org/apache/maven/its/dependency/get-gav-dep/1.0/get-gav-dep-1.0.pom", "org/apache/maven/its/dependency/get-gav-dep-transitive/1.0/get-gav-dep-transitive-1.0.jar", "org/apache/maven/its/dependency/get-gav-dep-transitive/1.0/get-gav-dep-transitive-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/get-remote-repositories-pom-config/setup.groovy b/src/it/projects/get-remote-repositories-pom-config/setup.groovy index da083037..74429702 100644 --- a/src/it/projects/get-remote-repositories-pom-config/setup.groovy +++ b/src/it/projects/get-remote-repositories-pom-config/setup.groovy @@ -17,15 +17,14 @@ * under the License. */ -import java.io.*; +import java.io.* String[] foldersToDelete = [ "org/apache/maven/its/dependency/get-remote-repositories-pom-config-dep", "org/apache/maven/its/dependency/get-remote-repositories-pom-config-dep-transitive" -]; +] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/get-remote-repositories-pom-config/verify.groovy b/src/it/projects/get-remote-repositories-pom-config/verify.groovy index 90cbf92e..d6bdb68f 100644 --- a/src/it/projects/get-remote-repositories-pom-config/verify.groovy +++ b/src/it/projects/get-remote-repositories-pom-config/verify.groovy @@ -17,19 +17,18 @@ * under the License. */ -import java.io.*; +import java.io.* String[] expectedFiles = [ "org/apache/maven/its/dependency/get-remote-repositories-pom-config-dep/1.0/get-remote-repositories-pom-config-dep-1.0.jar", "org/apache/maven/its/dependency/get-remote-repositories-pom-config-dep/1.0/get-remote-repositories-pom-config-dep-1.0.pom", "org/apache/maven/its/dependency/get-remote-repositories-pom-config-dep-transitive/1.0/get-remote-repositories-pom-config-dep-transitive-1.0.jar", "org/apache/maven/its/dependency/get-remote-repositories-pom-config-dep-transitive/1.0/get-remote-repositories-pom-config-dep-transitive-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/get-remote-repositories/setup.groovy b/src/it/projects/get-remote-repositories/setup.groovy index 4d6927b6..410d9894 100644 --- a/src/it/projects/get-remote-repositories/setup.groovy +++ b/src/it/projects/get-remote-repositories/setup.groovy @@ -17,15 +17,14 @@ * under the License. */ -import java.io.*; +import java.io.* String[] foldersToDelete = [ "org/apache/maven/its/dependency/get-remote-repositories-dep", "org/apache/maven/its/dependency/get-remote-repositories-dep-transitive" -]; +] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/get-remote-repositories/verify.groovy b/src/it/projects/get-remote-repositories/verify.groovy index 3987c76e..9def02b1 100644 --- a/src/it/projects/get-remote-repositories/verify.groovy +++ b/src/it/projects/get-remote-repositories/verify.groovy @@ -17,19 +17,18 @@ * under the License. */ -import java.io.*; +import java.io.* String[] expectedFiles = [ "org/apache/maven/its/dependency/get-remote-repositories-dep/1.0/get-remote-repositories-dep-1.0.jar", "org/apache/maven/its/dependency/get-remote-repositories-dep/1.0/get-remote-repositories-dep-1.0.pom", "org/apache/maven/its/dependency/get-remote-repositories-dep-transitive/1.0/get-remote-repositories-dep-transitive-1.0.jar", "org/apache/maven/its/dependency/get-remote-repositories-dep-transitive/1.0/get-remote-repositories-dep-transitive-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/go-offline-transitive-reactor/verify.groovy b/src/it/projects/go-offline-transitive-reactor/verify.groovy index 2fdc9ea4..b7558cee 100644 --- a/src/it/projects/go-offline-transitive-reactor/verify.groovy +++ b/src/it/projects/go-offline-transitive-reactor/verify.groovy @@ -23,4 +23,4 @@ assert buildLog.contains('Resolved dependency: go-offline-transitive-reactor-ext assert !buildLog.contains('Resolved dependency: go-offline-transitive-reactor-b-1.0.jar') assert !buildLog.contains('/go-offline-transitive-reactor-b-1.0.jar') assert !new File(localRepositoryPath, - 'org/apache/maven/its/dependency/go-offline-transitive-reactor-b/1.0/go-offline-transitive-reactor-b-1.0.jar').exists() +'org/apache/maven/its/dependency/go-offline-transitive-reactor-b/1.0/go-offline-transitive-reactor-b-1.0.jar').exists() diff --git a/src/it/projects/list-excludes-transitive/verify.groovy b/src/it/projects/list-excludes-transitive/verify.groovy index 275fc01d..98509852 100644 --- a/src/it/projects/list-excludes-transitive/verify.groovy +++ b/src/it/projects/list-excludes-transitive/verify.groovy @@ -19,7 +19,9 @@ import static org.assertj.core.api.Assertions.assertThat -def lines = new File(basedir, "target/transitive.txt").readLines().collect { it.trim() } +def lines = new File(basedir, "target/transitive.txt").readLines().collect { + it.trim() +} assertThat(lines).noneMatch { it.contains("list-excludes-holder") } assertThat(lines).contains("org.apache.maven.its.dependency:ResourceArtifact:jar:1.0:compile") diff --git a/src/it/projects/list-includes-excludes/verify.groovy b/src/it/projects/list-includes-excludes/verify.groovy index d2e64b3c..9397afda 100644 --- a/src/it/projects/list-includes-excludes/verify.groovy +++ b/src/it/projects/list-includes-excludes/verify.groovy @@ -23,7 +23,9 @@ def resolved = { String name -> new File(basedir, "target/" + name + ".txt").readLines() .collect { it.trim() } .findAll { it.startsWith("org.apache.maven.its.dependency:") } - .collect { it.replaceFirst(/^org\.apache\.maven\.its\.dependency:/, "") } + .collect { + it.replaceFirst(/^org\.apache\.maven\.its\.dependency:/, "") + } } assertThat(resolved("includes")).containsExactlyInAnyOrder("mdep510-dep:jar:1.0:compile", "version-range:jar:2.0:compile") diff --git a/src/it/projects/list-repositories-location/verify.groovy b/src/it/projects/list-repositories-location/verify.groovy index 4c034104..8fc25e58 100644 --- a/src/it/projects/list-repositories-location/verify.groovy +++ b/src/it/projects/list-repositories-location/verify.groovy @@ -17,31 +17,31 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) +String buildLog = file.getText("UTF-8") // Maven 3 reports the POM location as a plain path, Maven 4 as a file: URI, so compare only the path tail -void assertDeclared( String buildLog, String repo, String modelId, String pomTail ) -{ +void assertDeclared(String buildLog, String repo, String modelId, String pomTail) { List<String> lines = buildLog.readLines() - int index = lines.findIndexOf { it.contains( "* ${repo}" ) } + int index = lines.findIndexOf { it.contains("* ${repo}") } assert index >= 0 : "${repo} not listed" - String declared = lines[index + 1].replace( '\\', '/' ) + String declared = lines[index + 1].replace('\\', '/') assert declared ==~ /.* declared in \Q${modelId}\E \S*\Q${pomTail}\E:\d+/ : "unexpected location for ${repo}: ${declared}" } -assertDeclared( buildLog, "fake-remote-repository (http://localhost:2345, default, releases+snapshots)", "org.apache.maven.its.dependency:test:1.0-SNAPSHOT", "/list-repositories-location/pom.xml" ) -assertDeclared( buildLog, "fake-plugin-repository (http://localhost:3456, default, releases+snapshots)", "org.apache.maven.its.dependency:test:1.0-SNAPSHOT", "/list-repositories-location/pom.xml" ) -assertDeclared( buildLog, "parent-repository (http://localhost:2346, default, releases+snapshots)", "org.apache.maven.its.dependency:test-parent:1.0-SNAPSHOT", "/list-repositories-location/parent/pom.xml" ) -assertDeclared( buildLog, "parent-plugin-repository (http://localhost:3457, default, releases+snapshots)", "org.apache.maven.its.dependency:test-parent:1.0-SNAPSHOT", "/list-repositories-location/parent/pom.xml" ) +assertDeclared(buildLog, "fake-remote-repository (http://localhost:2345, default, releases+snapshots)", "org.apache.maven.its.dependency:test:1.0-SNAPSHOT", "/list-repositories-location/pom.xml") +assertDeclared(buildLog, "fake-plugin-repository (http://localhost:3456, default, releases+snapshots)", "org.apache.maven.its.dependency:test:1.0-SNAPSHOT", "/list-repositories-location/pom.xml") +assertDeclared(buildLog, "parent-repository (http://localhost:2346, default, releases+snapshots)", "org.apache.maven.its.dependency:test-parent:1.0-SNAPSHOT", "/list-repositories-location/parent/pom.xml") +assertDeclared(buildLog, "parent-plugin-repository (http://localhost:3457, default, releases+snapshots)", "org.apache.maven.its.dependency:test-parent:1.0-SNAPSHOT", "/list-repositories-location/parent/pom.xml") -if ( !mavenVersion.startsWith( '4.' ) ) -{ +if (!mavenVersion.startsWith('4.')) { // Maven 4 drops central from the super POM model List<String> lines = buildLog.readLines() - int central = lines.findIndexOf { it.contains( '* central (https://repo.maven.apache.org/maven2' ) } + int central = lines.findIndexOf { + it.contains('* central (https://repo.maven.apache.org/maven2') + } assert central >= 0 : 'central not listed' - assert lines[central + 1].endsWith( ' declared in the Maven super POM' ) : lines[central + 1] + assert lines[central + 1].endsWith(' declared in the Maven super POM') : lines[central + 1] } diff --git a/src/it/projects/list-repositories/verify.groovy b/src/it/projects/list-repositories/verify.groovy index dde475eb..12076c90 100644 --- a/src/it/projects/list-repositories/verify.groovy +++ b/src/it/projects/list-repositories/verify.groovy @@ -17,15 +17,15 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) -assert buildLog.contains( 'Project remote repositories used by this build:') -assert buildLog.contains( '* fake-remote-repository (http://localhost:2345, default, releases+snapshots)') -assert buildLog.contains( 'Plugin repositories used by this build:' ) -assert buildLog.contains( '* fake-plugin-repository (http://localhost:3456, default, releases+snapshots)' ) -assert buildLog.contains( '* sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots, default, snapshots) mirrored by mrm-maven-plugin') +String buildLog = file.getText("UTF-8") +assert buildLog.contains('Project remote repositories used by this build:') +assert buildLog.contains('* fake-remote-repository (http://localhost:2345, default, releases+snapshots)') +assert buildLog.contains('Plugin repositories used by this build:') +assert buildLog.contains('* fake-plugin-repository (http://localhost:3456, default, releases+snapshots)') +assert buildLog.contains('* sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots, default, snapshots) mirrored by mrm-maven-plugin') if (!mavenVersion.startsWith('4.')) { // Maven 4 drop central repo from default super pom - so model doesn't have it assert buildLog.contains('* central (https://repo.maven.apache.org/maven2, default, releases) mirrored by mrm-maven-plugin') diff --git a/src/it/projects/mdep-458-classifier-overwrite/verify.groovy b/src/it/projects/mdep-458-classifier-overwrite/verify.groovy index 230426fe..9b2ac1e6 100644 --- a/src/it/projects/mdep-458-classifier-overwrite/verify.groovy +++ b/src/it/projects/mdep-458-classifier-overwrite/verify.groovy @@ -17,12 +17,12 @@ * under the License. */ -assert new File( basedir, 'target/dependency/ResourceArtifact-1.0-client.jar' ).isFile() +assert new File(basedir, 'target/dependency/ResourceArtifact-1.0-client.jar').isFile() -String log = new File( basedir, 'build.log' ).text -assert log.contains( '(first)' ) && log.contains( '(second)' ) -String afterSecond = log.substring( log.indexOf( '(second)' ) ) -assert afterSecond.contains( 'already exists in destination' ) -assert !afterSecond.contains( 'Overwriting ' ) +String log = new File(basedir, 'build.log').text +assert log.contains('(first)') && log.contains('(second)') +String afterSecond = log.substring(log.indexOf('(second)')) +assert afterSecond.contains('already exists in destination') +assert !afterSecond.contains('Overwriting ') return true diff --git a/src/it/projects/mdep-480-unpack-overwrite-files/setup.groovy b/src/it/projects/mdep-480-unpack-overwrite-files/setup.groovy index 7ab33415..da328dcc 100644 --- a/src/it/projects/mdep-480-unpack-overwrite-files/setup.groovy +++ b/src/it/projects/mdep-480-unpack-overwrite-files/setup.groovy @@ -19,12 +19,11 @@ // resource1.txt exists before the plugin runs and is OLDER than the archive entry: it must be kept all the same; // the ITs run "clean" first, so the directories are outside of target -for ( dir in ["dependencies", "unpack"] ) -{ - File existing = new File( basedir, dir + "/resource1.txt" ) +for (dir in ["dependencies", "unpack"]) { + File existing = new File(basedir, dir + "/resource1.txt") existing.parentFile.mkdirs() existing.text = "existing" - existing.setLastModified( 1000000000000L ) + existing.setLastModified(1000000000000L) } return true diff --git a/src/it/projects/mdep-480-unpack-overwrite-files/verify.groovy b/src/it/projects/mdep-480-unpack-overwrite-files/verify.groovy index 6ec8d3cf..4af03c0b 100644 --- a/src/it/projects/mdep-480-unpack-overwrite-files/verify.groovy +++ b/src/it/projects/mdep-480-unpack-overwrite-files/verify.groovy @@ -18,10 +18,9 @@ */ // -Dmdep.unpack.overWriteFiles=false from cli.properties reaches both goals; resource2.txt did not exist -for ( dir in ["dependencies", "unpack"] ) -{ - assert new File( basedir, dir + "/resource1.txt" ).text == "existing" : dir + " should be kept" - assert new File( basedir, dir + "/resource2.txt" ).isFile() +for (dir in ["dependencies", "unpack"]) { + assert new File(basedir, dir + "/resource1.txt").text == "existing" : dir + " should be kept" + assert new File(basedir, dir + "/resource2.txt").isFile() } return true diff --git a/src/it/projects/mdep-571-resolve-java9/verify.groovy b/src/it/projects/mdep-571-resolve-java9/verify.groovy index 2fe1f641..b00dc0ef 100644 --- a/src/it/projects/mdep-571-resolve-java9/verify.groovy +++ b/src/it/projects/mdep-571-resolve-java9/verify.groovy @@ -17,10 +17,10 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) -assert buildLog.contains( 'org.slf4j:slf4j-api:jar:1.7.6:compile -- module' ) +String buildLog = file.getText("UTF-8") +assert buildLog.contains('org.slf4j:slf4j-api:jar:1.7.6:compile -- module') return true diff --git a/src/it/projects/mdep-572-unpack-tar-long-file/verify.groovy b/src/it/projects/mdep-572-unpack-tar-long-file/verify.groovy index 76b97d6e..d3272497 100644 --- a/src/it/projects/mdep-572-unpack-tar-long-file/verify.groovy +++ b/src/it/projects/mdep-572-unpack-tar-long-file/verify.groovy @@ -17,9 +17,9 @@ * under the License. */ -import java.io.File; +import java.io.File -File file = new File( basedir, "child2/target/dependency/this-is-an-empty-text-file-with-a-name-that-is-longer-than-100-characters-to-verify-that-the-name-is-fully-kept-when-unpacking-from-a-tar.txt" ); -assert file.isFile() : "Missing " + file; +File file = new File(basedir, "child2/target/dependency/this-is-an-empty-text-file-with-a-name-that-is-longer-than-100-characters-to-verify-that-the-name-is-fully-kept-when-unpacking-from-a-tar.txt") +assert file.isFile() : "Missing " + file -return true; +return true diff --git a/src/it/projects/mdep-578_display-reason-invalid-module/verify.groovy b/src/it/projects/mdep-578_display-reason-invalid-module/verify.groovy index c1e00cac..9c2a7976 100644 --- a/src/it/projects/mdep-578_display-reason-invalid-module/verify.groovy +++ b/src/it/projects/mdep-578_display-reason-invalid-module/verify.groovy @@ -17,20 +17,20 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) +String buildLog = file.getText("UTF-8") // Cause message is JDK specific and can change over time // JDOMAbout$Author.class found in top-level directory (unnamed package not allowed in module) -assert buildLog.contains( "Can't extract module name from jdom-1.0.jar: " ) +assert buildLog.contains("Can't extract module name from jdom-1.0.jar: ") // geronimo.servlet.2.4.spec: Invalid module name: '2' is not a Java identifier -assert buildLog.contains( "Can't extract module name from geronimo-servlet_2.4_spec-1.1.1.jar: " ) +assert buildLog.contains("Can't extract module name from geronimo-servlet_2.4_spec-1.1.1.jar: ") // geronimo.jta.1.1.spec: Invalid module name: '1' is not a Java identifier -assert buildLog.contains( "Can't extract module name from geronimo-jta_1.1_spec-1.1.jar: " ) +assert buildLog.contains("Can't extract module name from geronimo-jta_1.1_spec-1.1.jar: ") return true diff --git a/src/it/projects/mdep-580_display-manifest-automodules/verify.groovy b/src/it/projects/mdep-580_display-manifest-automodules/verify.groovy index 539131bf..24d658e8 100644 --- a/src/it/projects/mdep-580_display-manifest-automodules/verify.groovy +++ b/src/it/projects/mdep-580_display-manifest-automodules/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) +String buildLog = file.getText("UTF-8") -assert buildLog.contains( "org.apache.maven.resolver:maven-resolver-api:jar:1.1.0:compile -- module org.apache.maven.resolver [auto]" ) +assert buildLog.contains("org.apache.maven.resolver:maven-resolver-api:jar:1.1.0:compile -- module org.apache.maven.resolver [auto]") return true diff --git a/src/it/projects/mdep-586-unpacking-resources/verify.groovy b/src/it/projects/mdep-586-unpacking-resources/verify.groovy index 991b88b0..3facdfa4 100644 --- a/src/it/projects/mdep-586-unpacking-resources/verify.groovy +++ b/src/it/projects/mdep-586-unpacking-resources/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.isFile() -File file1 = new File( basedir, "resources1/resource1.txt" ) +File file1 = new File(basedir, "resources1/resource1.txt") assert file1.isFile() -File file2 = new File( basedir, "resources2/resource2.txt" ) +File file2 = new File(basedir, "resources2/resource2.txt") assert file2.isFile() \ No newline at end of file diff --git a/src/it/projects/mdep-587-artifact-type-classifier/verify.groovy b/src/it/projects/mdep-587-artifact-type-classifier/verify.groovy index 6c3b5814..aa94a8ca 100644 --- a/src/it/projects/mdep-587-artifact-type-classifier/verify.groovy +++ b/src/it/projects/mdep-587-artifact-type-classifier/verify.groovy @@ -17,14 +17,14 @@ * under the License. */ -[ 'test-jar': 'tests', 'ejb-client': 'client', 'explicit-classifier': 'client' ].each { directory, classifier -> - File output = new File( basedir, 'target/' + directory ) - assert new File( output, 'ResourceArtifact-1.0-' + classifier + '.jar' ).isFile() - assert new File( output, classifier + '.txt' ).isFile() - assert !new File( output, 'ResourceArtifact-1.0.jar' ).exists() - assert !new File( output, 'resource1.txt' ).exists() - if ( classifier == 'client' ) { - assert !new File( output, 'tests.txt' ).exists() +['test-jar': 'tests', 'ejb-client': 'client', 'explicit-classifier': 'client'].each { directory, classifier -> + File output = new File(basedir, 'target/' + directory) + assert new File(output, 'ResourceArtifact-1.0-' + classifier + '.jar').isFile() + assert new File(output, classifier + '.txt').isFile() + assert !new File(output, 'ResourceArtifact-1.0.jar').exists() + assert !new File(output, 'resource1.txt').exists() + if (classifier == 'client') { + assert !new File(output, 'tests.txt').exists() } } diff --git a/src/it/projects/mdep-589-exclude-reactor/verify.groovy b/src/it/projects/mdep-589-exclude-reactor/verify.groovy index c6ccb98d..9007f85d 100644 --- a/src/it/projects/mdep-589-exclude-reactor/verify.groovy +++ b/src/it/projects/mdep-589-exclude-reactor/verify.groovy @@ -17,12 +17,12 @@ * under the License. */ -File all = new File( basedir, 'child-b/target/default' ) -assert new File( all, 'child-a-1.0-SNAPSHOT.jar' ).isFile() -assert new File( all, 'ResourceArtifact-1.0.jar' ).isFile() +File all = new File(basedir, 'child-b/target/default') +assert new File(all, 'child-a-1.0-SNAPSHOT.jar').isFile() +assert new File(all, 'ResourceArtifact-1.0.jar').isFile() -File withoutReactor = new File( basedir, 'child-b/target/exclude-reactor' ) -assert !new File( withoutReactor, 'child-a-1.0-SNAPSHOT.jar' ).exists() -assert new File( withoutReactor, 'ResourceArtifact-1.0.jar' ).isFile() +File withoutReactor = new File(basedir, 'child-b/target/exclude-reactor') +assert !new File(withoutReactor, 'child-a-1.0-SNAPSHOT.jar').exists() +assert new File(withoutReactor, 'ResourceArtifact-1.0.jar').isFile() return true diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.groovy b/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.groovy index 177a8d81..de157b7c 100644 --- a/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.groovy +++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.groovy @@ -17,17 +17,13 @@ * under the License. */ -import java.io.*; +import java.io.* // Clean up test artifacts from local repository to ensure fresh test // This forces Maven to download artifacts from the fake-remote-repository // rather than using cached versions -String[] foldersToDelete = [ - "org/apache/maven/its/mdep592/test-parent", - "org/apache/maven/its/mdep592/test-child" -]; +String[] foldersToDelete = ["org/apache/maven/its/mdep592/test-parent", "org/apache/maven/its/mdep592/test-child"] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.groovy b/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.groovy index d9ab9588..7e0d17c7 100644 --- a/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.groovy +++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.groovy @@ -17,9 +17,9 @@ * under the License. */ -import java.io.*; +import java.io.* -File outputDir = new File( basedir, "target/dependencies" ); +File outputDir = new File(basedir, "target/dependencies") String[] expectedFiles = [ "org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.jar", @@ -28,12 +28,11 @@ String[] expectedFiles = [ // Without the fix, this file would be missing because the custom repository // would not be propagated to the ProjectBuildingRequest "org/apache/maven/its/mdep592/test-parent/1.0/test-parent-1.0.pom" -]; +] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( outputDir, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(outputDir, expectedFile) + assert file.isFile() : "Missing file " + file } -return true; +return true diff --git a/src/it/projects/mdep-593-copy-imported-boms/verify.groovy b/src/it/projects/mdep-593-copy-imported-boms/verify.groovy index dd320d92..643f3ffb 100644 --- a/src/it/projects/mdep-593-copy-imported-boms/verify.groovy +++ b/src/it/projects/mdep-593-copy-imported-boms/verify.groovy @@ -18,13 +18,29 @@ */ def base = 'org/apache/maven/its/mdep593' -def always = ["lib/1.0/lib-1.0.jar", "lib/1.0/lib-1.0.pom", "lib-parent/1.0/lib-parent-1.0.pom", "grandparent/1.0/grandparent-1.0.pom"] -def boms = ["bom-a/1.0/bom-a-1.0.pom", // imported by lib-parent, a parent of the dependency, through ${bom.version} - "bom-b/1.0/bom-b-1.0.pom", // imported by bom-a - "bom-parent/1.0/bom-parent-1.0.pom", // parent of bom-b - "bom-c/1.0/bom-c-1.0.pom"] // imported by the project itself +def always = [ + "lib/1.0/lib-1.0.jar", + "lib/1.0/lib-1.0.pom", + "lib-parent/1.0/lib-parent-1.0.pom", + "grandparent/1.0/grandparent-1.0.pom" +] +def boms = [ + "bom-a/1.0/bom-a-1.0.pom", + // imported by lib-parent, a parent of the dependency, through ${bom.version} + "bom-b/1.0/bom-b-1.0.pom", + // imported by bom-a + "bom-parent/1.0/bom-parent-1.0.pom", + // parent of bom-b + "bom-c/1.0/bom-c-1.0.pom" +] // imported by the project itself -always.each { assert new File(basedir, "target/parents-only/${base}/${it}").isFile() : "Missing ${it} in parents-only" } -boms.each { assert !new File(basedir, "target/parents-only/${base}/${it}").exists() : "Unexpected ${it} in parents-only" } -(always + boms).each { assert new File(basedir, "target/with-boms/${base}/${it}").isFile() : "Missing ${it} in with-boms" } +always.each { + assert new File(basedir, "target/parents-only/${base}/${it}").isFile() : "Missing ${it} in parents-only" +} +boms.each { + assert !new File(basedir, "target/parents-only/${base}/${it}").exists() : "Unexpected ${it} in parents-only" +} +(always + boms).each { + assert new File(basedir, "target/with-boms/${base}/${it}").isFile() : "Missing ${it} in with-boms" +} return true diff --git a/src/it/projects/mdep-650-copy-version-range-remote-repositories/setup.groovy b/src/it/projects/mdep-650-copy-version-range-remote-repositories/setup.groovy index 3fb9efb5..6b97dfd3 100644 --- a/src/it/projects/mdep-650-copy-version-range-remote-repositories/setup.groovy +++ b/src/it/projects/mdep-650-copy-version-range-remote-repositories/setup.groovy @@ -17,14 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -String[] foldersToDelete = [ - "org/apache/maven/its/dependency/remote-range" -]; +String[] foldersToDelete = ["org/apache/maven/its/dependency/remote-range"] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/mdep-650-copy-version-range-remote-repositories/verify.groovy b/src/it/projects/mdep-650-copy-version-range-remote-repositories/verify.groovy index 5f359610..5b2414a9 100644 --- a/src/it/projects/mdep-650-copy-version-range-remote-repositories/verify.groovy +++ b/src/it/projects/mdep-650-copy-version-range-remote-repositories/verify.groovy @@ -17,6 +17,6 @@ * under the License. */ -assert new File( basedir, 'target/dependency/remote-range-1.5.jar' ).isFile() -assert !new File( basedir, 'target/dependency/remote-range-2.0.jar' ).exists() -assert !new File( basedir, 'target/dependency/remote-range-1.0.jar' ).exists() +assert new File(basedir, 'target/dependency/remote-range-1.5.jar').isFile() +assert !new File(basedir, 'target/dependency/remote-range-2.0.jar').exists() +assert !new File(basedir, 'target/dependency/remote-range-1.0.jar').exists() diff --git a/src/it/projects/mdep-650-copy-version-range/verify.groovy b/src/it/projects/mdep-650-copy-version-range/verify.groovy index 46aae603..5f707d38 100644 --- a/src/it/projects/mdep-650-copy-version-range/verify.groovy +++ b/src/it/projects/mdep-650-copy-version-range/verify.groovy @@ -17,6 +17,6 @@ * under the License. */ -assert new File( basedir, 'target/dependency/version-range-1.5.jar' ).isFile() -assert !new File( basedir, 'target/dependency/version-range-2.0.jar' ).exists() -assert !new File( basedir, 'target/dependency/version-range-1.0.jar' ).exists() +assert new File(basedir, 'target/dependency/version-range-1.5.jar').isFile() +assert !new File(basedir, 'target/dependency/version-range-2.0.jar').exists() +assert !new File(basedir, 'target/dependency/version-range-1.0.jar').exists() diff --git a/src/it/projects/mdep-689-apply-filtering-go-offline-goal/verify.groovy b/src/it/projects/mdep-689-apply-filtering-go-offline-goal/verify.groovy index 1bc9464f..4b8697a3 100644 --- a/src/it/projects/mdep-689-apply-filtering-go-offline-goal/verify.groovy +++ b/src/it/projects/mdep-689-apply-filtering-go-offline-goal/verify.groovy @@ -17,33 +17,33 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) +String buildLog = file.getText("UTF-8") // Make sure non-exluded explicit dependencies are resolved -assert buildLog.contains( 'Resolved dependency: slf4j-simple-2.0.13.jar' ) -assert buildLog.contains( 'Resolved dependency: slf4j-api-2.0.13.jar' ) +assert buildLog.contains('Resolved dependency: slf4j-simple-2.0.13.jar') +assert buildLog.contains('Resolved dependency: slf4j-api-2.0.13.jar') // Did group excludes work? -assert !buildLog.contains( 'Resolving artifact skip.this.groupid' ) +assert !buildLog.contains('Resolving artifact skip.this.groupid') // Did artifact excludes work? -assert !buildLog.contains( 'Resolving artifact org.junit.jupiter:skip-this-artifact' ) +assert !buildLog.contains('Resolving artifact org.junit.jupiter:skip-this-artifact') // Did scope exludes work? -assert !buildLog.contains( 'Resolving artifact ch.qos.logback:logback-classic' ) +assert !buildLog.contains('Resolving artifact ch.qos.logback:logback-classic') // Did type excludes work? -assert !buildLog.contains( 'Resolving artifact ch.qos.logback:logback-examples' ) +assert !buildLog.contains('Resolving artifact ch.qos.logback:logback-examples') // Did classifier excludes work? -assert !buildLog.contains( 'Resolving artifact ch.qos.logback:logback-core:jar:skipThisClassifierToo' ) -assert !buildLog.contains( 'Resolving artifact ch.qos.logback:logback-core' ) +assert !buildLog.contains('Resolving artifact ch.qos.logback:logback-core:jar:skipThisClassifierToo') +assert !buildLog.contains('Resolving artifact ch.qos.logback:logback-core') -assert !buildLog.contains( 'Resolving artifact ch.qos.logback:logback-access:jar:skipThisClassifier' ) -assert !buildLog.contains( 'Resolving artifact ch.qos.logback:logback-access' ) +assert !buildLog.contains('Resolving artifact ch.qos.logback:logback-access:jar:skipThisClassifier') +assert !buildLog.contains('Resolving artifact ch.qos.logback:logback-access') diff --git a/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy b/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy index dded7be0..9f885a5f 100644 --- a/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy +++ b/src/it/projects/mdep-739-go-offline-respect-classifiers/verify.groovy @@ -17,10 +17,10 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) -assert buildLog.contains( 'Resolved dependency: spring-cloud-stream-3.1.2-test-binder.jar' ) +String buildLog = file.getText("UTF-8") +assert buildLog.contains('Resolved dependency: spring-cloud-stream-3.1.2-test-binder.jar') return true diff --git a/src/it/projects/mdep-744-copy-unbuilt-reactor-dependency/verify.groovy b/src/it/projects/mdep-744-copy-unbuilt-reactor-dependency/verify.groovy index a0eb16df..84d0cb87 100644 --- a/src/it/projects/mdep-744-copy-unbuilt-reactor-dependency/verify.groovy +++ b/src/it/projects/mdep-744-copy-unbuilt-reactor-dependency/verify.groovy @@ -18,11 +18,11 @@ */ // The goals ran without any lifecycle phase, so the sibling modules must still be unbuilt. -assert !new File( basedir, 'provided-module/target/provided-module-1.0-SNAPSHOT.jar' ).exists() -assert !new File( basedir, 'test-module/target/test-module-1.0-SNAPSHOT.jar' ).exists() +assert !new File(basedir, 'provided-module/target/provided-module-1.0-SNAPSHOT.jar').exists() +assert !new File(basedir, 'test-module/target/test-module-1.0-SNAPSHOT.jar').exists() // The selected runtime dependency is copied, the provided and test siblings are not. -File copied = new File( basedir, 'consumer/target/dependency/ResourceArtifact-1.0.jar' ) +File copied = new File(basedir, 'consumer/target/dependency/ResourceArtifact-1.0.jar') assert copied.isFile() : "Missing $copied" assert !new File( basedir, 'consumer/target/dependency/provided-module-1.0-SNAPSHOT.jar' ).exists() assert !new File( basedir, 'consumer/target/dependency/test-module-1.0-SNAPSHOT.jar' ).exists() diff --git a/src/it/projects/mdep-772-unpack-fail-on-duplicates/verify.groovy b/src/it/projects/mdep-772-unpack-fail-on-duplicates/verify.groovy index c88edcdf..b46c3451 100644 --- a/src/it/projects/mdep-772-unpack-fail-on-duplicates/verify.groovy +++ b/src/it/projects/mdep-772-unpack-fail-on-duplicates/verify.groovy @@ -18,11 +18,10 @@ */ // the first entry was written and the second was not; nothing is marked as unpacked, so a repeated run fails again -for ( dir in ["dependencies", "unpack"] ) -{ - assert new File( basedir, "target/" + dir + "/same.txt" ).isFile() : dir + " should hold the first entry" - assert !new File( basedir, "target/" + dir + "/resource1.txt" ).exists() : dir + " should hold the mapped name only" - File markers = new File( basedir, "target/markers-" + dir ) +for (dir in ["dependencies", "unpack"]) { + assert new File(basedir, "target/" + dir + "/same.txt").isFile() : dir + " should hold the first entry" + assert !new File(basedir, "target/" + dir + "/resource1.txt").exists() : dir + " should hold the mapped name only" + File markers = new File(basedir, "target/markers-" + dir) assert !markers.exists() || markers.list().length == 0 : dir + " should not be marked as unpacked" } diff --git a/src/it/projects/mdep-803-parent-poms-with-classifier/setup.groovy b/src/it/projects/mdep-803-parent-poms-with-classifier/setup.groovy index 29c78d17..a04e4c12 100644 --- a/src/it/projects/mdep-803-parent-poms-with-classifier/setup.groovy +++ b/src/it/projects/mdep-803-parent-poms-with-classifier/setup.groovy @@ -54,6 +54,6 @@ new JarOutputStream(new FileOutputStream(new File(artifactDir('library'), 'libra ['grandparent', 'classified'].each { artifactId -> new File(artifactDir(artifactId), "${artifactId}-1.0-sources.pom").text = new File(artifactDir(artifactId), "${artifactId}-1.0.pom").text.replace( - '</project>', '<description>sources attachment</description></project>') + '</project>', '<description>sources attachment</description></project>') } return true diff --git a/src/it/projects/mdep-803-parent-poms-with-classifier/verify.groovy b/src/it/projects/mdep-803-parent-poms-with-classifier/verify.groovy index 01c44878..cf1ec89c 100644 --- a/src/it/projects/mdep-803-parent-poms-with-classifier/verify.groovy +++ b/src/it/projects/mdep-803-parent-poms-with-classifier/verify.groovy @@ -24,7 +24,9 @@ def sources = ['library-1.0-sources.jar', 'grandparent-1.0-sources.pom', 'classi ['sources', 'sources-jar', 'excluded-parent'].each { name -> def expected = parents + dependencyPoms + sources if (name == 'sources-jar') { - expected = expected.collect { it.endsWith('-sources.pom') ? it.replace('-sources.pom', '-sources.jar') : it } + expected = expected.collect { + it.endsWith('-sources.pom') ? it.replace('-sources.pom', '-sources.jar') : it + } } if (name == 'excluded-parent') { expected = expected - 'dependency-parent-1.0.pom' diff --git a/src/it/projects/mdep-895-resolve-sources-unbuilt-reactor-dependency/verify.groovy b/src/it/projects/mdep-895-resolve-sources-unbuilt-reactor-dependency/verify.groovy index c8e6eabb..6229dbf2 100644 --- a/src/it/projects/mdep-895-resolve-sources-unbuilt-reactor-dependency/verify.groovy +++ b/src/it/projects/mdep-895-resolve-sources-unbuilt-reactor-dependency/verify.groovy @@ -17,12 +17,12 @@ * under the License. */ -assert !new File( basedir, 'provided-module/target/provided-module-1.0-SNAPSHOT.jar' ).exists() -assert !new File( basedir, 'test-module/target/test-module-1.0-SNAPSHOT.jar' ).exists() +assert !new File(basedir, 'provided-module/target/provided-module-1.0-SNAPSHOT.jar').exists() +assert !new File(basedir, 'test-module/target/test-module-1.0-SNAPSHOT.jar').exists() // With includeScope=runtime the sources of the runtime dependency are resolved and the siblings are not touched. -String runtime = new File( basedir, 'consumer/target/resolved-runtime.txt' ).text -assert runtime.contains( 'org.apache.maven.its.dependency:ResourceArtifact:jar:sources:1.0' ) : runtime +String runtime = new File(basedir, 'consumer/target/resolved-runtime.txt').text +assert runtime.contains('org.apache.maven.its.dependency:ResourceArtifact:jar:sources:1.0') : runtime assert !runtime.contains( 'provided-module' ) : runtime assert !runtime.contains( 'test-module' ) : runtime diff --git a/src/it/projects/mdep-952-unpack-fails-if-extension-of-artifact-is-used/verify.groovy b/src/it/projects/mdep-952-unpack-fails-if-extension-of-artifact-is-used/verify.groovy index e5eae39a..5a8f657c 100644 --- a/src/it/projects/mdep-952-unpack-fails-if-extension-of-artifact-is-used/verify.groovy +++ b/src/it/projects/mdep-952-unpack-fails-if-extension-of-artifact-is-used/verify.groovy @@ -17,11 +17,11 @@ * under the License. */ -File file = new File( basedir, "build.log" ) +File file = new File(basedir, "build.log") assert file.exists() -String buildLog = file.getText( "UTF-8" ) -assert buildLog.contains( 'BUILD SUCCESS' ) -assert !buildLog.contains( 'BUILD FAILURE' ) +String buildLog = file.getText("UTF-8") +assert buildLog.contains('BUILD SUCCESS') +assert !buildLog.contains('BUILD FAILURE') return true diff --git a/src/it/projects/purge-local-repository-bad-dep/verify.groovy b/src/it/projects/purge-local-repository-bad-dep/verify.groovy index 8c1590ee..31fb57d1 100644 --- a/src/it/projects/purge-local-repository-bad-dep/verify.groovy +++ b/src/it/projects/purge-local-repository-bad-dep/verify.groovy @@ -17,21 +17,20 @@ * under the License. */ -void checkFilePresence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) +void checkFilePresence(String path) { + File depJar = new File(localRepositoryPath, path) assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar } -checkFilePresence( "org/apache/maven/its/dependency/purge-local-repository-bad-dep-dep/1.0/purge-local-repository-bad-dep-dep-1.0.jar" ) -checkFilePresence( "org/apache/maven/its/dependency/purge-local-repository-bad-dep-dep/1.0/purge-local-repository-bad-dep-dep-1.0.pom" ) -checkFilePresence( "org/apache/maven/maven-model/2.0.9/maven-model-2.0.9-sources.jar" ) +checkFilePresence("org/apache/maven/its/dependency/purge-local-repository-bad-dep-dep/1.0/purge-local-repository-bad-dep-dep-1.0.jar") +checkFilePresence("org/apache/maven/its/dependency/purge-local-repository-bad-dep-dep/1.0/purge-local-repository-bad-dep-dep-1.0.pom") +checkFilePresence("org/apache/maven/maven-model/2.0.9/maven-model-2.0.9-sources.jar") -String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" ) -assert buildLog.contains( 'Unable to resolve artifact: org.apache.maven.its.dependency:i-do-not-exist:jar:1.0' ) -assert buildLog.contains( 'Purging artifact: org.apache.maven.its.dependency:purge-local-repository-bad-dep-dep:jar:1.0' ) -assert buildLog.contains( 'Resolving artifact: org.apache.maven.its.dependency:purge-local-repository-bad-dep-dep:jar:1.0' ) -assert buildLog.contains( 'Purging artifact: org.apache.maven:maven-model:jar:sources:2.0.9' ) -assert buildLog.contains( 'Resolving artifact: org.apache.maven:maven-model:jar:sources:2.0.9' ) +String buildLog = new File(basedir, "build.log").getText("UTF-8") +assert buildLog.contains('Unable to resolve artifact: org.apache.maven.its.dependency:i-do-not-exist:jar:1.0') +assert buildLog.contains('Purging artifact: org.apache.maven.its.dependency:purge-local-repository-bad-dep-dep:jar:1.0') +assert buildLog.contains('Resolving artifact: org.apache.maven.its.dependency:purge-local-repository-bad-dep-dep:jar:1.0') +assert buildLog.contains('Purging artifact: org.apache.maven:maven-model:jar:sources:2.0.9') +assert buildLog.contains('Resolving artifact: org.apache.maven:maven-model:jar:sources:2.0.9') return true diff --git a/src/it/projects/purge-local-repository-bad-pom/setup.groovy b/src/it/projects/purge-local-repository-bad-pom/setup.groovy index 792cc608..7b7c1f13 100644 --- a/src/it/projects/purge-local-repository-bad-pom/setup.groovy +++ b/src/it/projects/purge-local-repository-bad-pom/setup.groovy @@ -17,19 +17,18 @@ * under the License. */ -import java.io.*; +import java.io.* -File localRepoDir = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository/1.0/" ); -localRepoDir.mkdirs(); +File localRepoDir = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository/1.0/") +localRepoDir.mkdirs() -File badPomSrc = new File( basedir, "bad-pom.xml" ); -File badPomDest = new File( localRepoDir, "purge-local-repository-1.0.pom" ); +File badPomSrc = new File(basedir, "bad-pom.xml") +File badPomDest = new File(localRepoDir, "purge-local-repository-1.0.pom") -System.out.println( "Moving bad pom: " + badPomSrc ); -if ( ! badPomSrc.renameTo( badPomDest ) ) -{ - System.out.println( "Unable to move file: " + badPomSrc ); +System.out.println("Moving bad pom: " + badPomSrc) +if (! badPomSrc.renameTo(badPomDest)) { + System.out.println("Unable to move file: " + badPomSrc) } -System.out.println( "Moved to: " + badPomDest ); +System.out.println("Moved to: " + badPomDest) -return true; +return true diff --git a/src/it/projects/purge-local-repository-bad-pom/verify.groovy b/src/it/projects/purge-local-repository-bad-pom/verify.groovy index fa9ff2da..8fa0e765 100644 --- a/src/it/projects/purge-local-repository-bad-pom/verify.groovy +++ b/src/it/projects/purge-local-repository-bad-pom/verify.groovy @@ -17,22 +17,22 @@ * under the License. */ -import java.io.*; +import java.io.* -File depJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository/1.0/purge-local-repository-1.0.jar" ); +File depJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository/1.0/purge-local-repository-1.0.jar") -assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar; +assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar -File depPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository/1.0/purge-local-repository-1.0.pom" ); +File depPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository/1.0/purge-local-repository-1.0.pom" ) -assert depPom.exists() : "Direct dependency pom was not re-resolved: " + depPom; +assert depPom.exists() : "Direct dependency pom was not re-resolved: " + depPom -File transitiveDepJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-2/1.0/purge-local-repository-2-1.0.jar" ); +File transitiveDepJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-2/1.0/purge-local-repository-2-1.0.jar" ) -assert transitiveDepJar.exists() : "Transitive dep jar was not re-resolved: " + transitiveDepJar; +assert transitiveDepJar.exists() : "Transitive dep jar was not re-resolved: " + transitiveDepJar -File transitiveDepPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-2/1.0/purge-local-repository-2-1.0.pom" ); +File transitiveDepPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-2/1.0/purge-local-repository-2-1.0.pom" ) -assert transitiveDepPom.exists() : "Transitive dep pom was not re-resolved: " + transitiveDepPom; +assert transitiveDepPom.exists() : "Transitive dep pom was not re-resolved: " + transitiveDepPom -return true; +return true diff --git a/src/it/projects/purge-local-repository-include/verify.groovy b/src/it/projects/purge-local-repository-include/verify.groovy index a2059b55..004111d8 100644 --- a/src/it/projects/purge-local-repository-include/verify.groovy +++ b/src/it/projects/purge-local-repository-include/verify.groovy @@ -17,26 +17,24 @@ * under the License. */ -void checkFilePresence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) +void checkFilePresence(String path) { + File depJar = new File(localRepositoryPath, path) assert depJar.exists() : "Dependency jar was not re-resolved: " + depJar } -void checkFileAbsence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) +void checkFileAbsence(String path) { + File depJar = new File(localRepositoryPath, path) assert !depJar.exists() : "Dependency jar was not purged: " + depJar } -checkFilePresence( "org/apache/maven/its/dependency/purge-local-repository-include-dep/1.0/purge-local-repository-include-dep-1.0.jar" ) -checkFilePresence( "org/apache/maven/its/dependency/purge-local-repository-include-dep/1.0/purge-local-repository-include-dep-1.0.pom" ) +checkFilePresence("org/apache/maven/its/dependency/purge-local-repository-include-dep/1.0/purge-local-repository-include-dep-1.0.jar") +checkFilePresence("org/apache/maven/its/dependency/purge-local-repository-include-dep/1.0/purge-local-repository-include-dep-1.0.pom") -checkFileAbsence( "org/apache/maven/its/dependency/purge-local-repository-include-dep-2/1.0/purge-local-repository-include-dep-2-1.0.jar" ) -checkFileAbsence( "org/apache/maven/its/dependency/purge-local-repository-include-dep-2/1.0/purge-local-repository-include-dep-2-1.0.pom" ) +checkFileAbsence("org/apache/maven/its/dependency/purge-local-repository-include-dep-2/1.0/purge-local-repository-include-dep-2-1.0.jar") +checkFileAbsence("org/apache/maven/its/dependency/purge-local-repository-include-dep-2/1.0/purge-local-repository-include-dep-2-1.0.pom") -String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" ) -assert !buildLog.contains( 'Purging artifact: org.apache.maven.its.dependency:purge-local-repository-include-dep:jar:1.0' ) -assert buildLog.contains( 'Purging artifact: org.apache.maven.its.dependency:purge-local-repository-include-dep-2:jar:1.0' ) +String buildLog = new File(basedir, "build.log").getText("UTF-8") +assert !buildLog.contains('Purging artifact: org.apache.maven.its.dependency:purge-local-repository-include-dep:jar:1.0') +assert buildLog.contains('Purging artifact: org.apache.maven.its.dependency:purge-local-repository-include-dep-2:jar:1.0') return true diff --git a/src/it/projects/purge-local-repository-multi-module-execution/setup.groovy b/src/it/projects/purge-local-repository-multi-module-execution/setup.groovy index 301c55b1..3fc03836 100644 --- a/src/it/projects/purge-local-repository-multi-module-execution/setup.groovy +++ b/src/it/projects/purge-local-repository-multi-module-execution/setup.groovy @@ -17,17 +17,16 @@ * under the License. */ -import java.io.File; +import java.io.File -void createJar( String artifactId ) -{ - File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar" ); +void createJar(String artifactId) { + File purgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar") - purgedJar.getParentFile().mkdirs(); - purgedJar.createNewFile(); + purgedJar.getParentFile().mkdirs() + purgedJar.createNewFile() } -createJar( "purged-exec-a" ); -createJar( "purged-exec-b" ); +createJar("purged-exec-a") +createJar("purged-exec-b") -return true; +return true diff --git a/src/it/projects/purge-local-repository-multi-module-execution/verify.groovy b/src/it/projects/purge-local-repository-multi-module-execution/verify.groovy index 7e2f8698..01528fba 100644 --- a/src/it/projects/purge-local-repository-multi-module-execution/verify.groovy +++ b/src/it/projects/purge-local-repository-multi-module-execution/verify.groovy @@ -17,16 +17,15 @@ * under the License. */ -import java.io.File; +import java.io.File -void checkFilePurged( String artifactId ) -{ - File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar" ); - - assert !purgedJar.exists() : "JAR was not purged: " + purgedJar; +void checkFilePurged(String artifactId) { + File purgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar") + + assert !purgedJar.exists() : "JAR was not purged: " + purgedJar } -checkFilePurged( "purged-exec-a" ); -checkFilePurged( "purged-exec-b" ); +checkFilePurged("purged-exec-a") +checkFilePurged("purged-exec-b") -return true; +return true diff --git a/src/it/projects/purge-local-repository-multi-module/setup.groovy b/src/it/projects/purge-local-repository-multi-module/setup.groovy index f55d12dd..f0b9d3d4 100644 --- a/src/it/projects/purge-local-repository-multi-module/setup.groovy +++ b/src/it/projects/purge-local-repository-multi-module/setup.groovy @@ -17,17 +17,16 @@ * under the License. */ -import java.io.File; +import java.io.File -void createJar( String artifactId ) -{ - File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar" ); +void createJar(String artifactId) { + File purgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar") - purgedJar.getParentFile().mkdirs(); - purgedJar.createNewFile(); + purgedJar.getParentFile().mkdirs() + purgedJar.createNewFile() } -createJar( "purged-a" ); -createJar( "purged-b" ); +createJar("purged-a") +createJar("purged-b") -return true; +return true diff --git a/src/it/projects/purge-local-repository-multi-module/verify.groovy b/src/it/projects/purge-local-repository-multi-module/verify.groovy index d13c2ad4..4aaa8ffb 100644 --- a/src/it/projects/purge-local-repository-multi-module/verify.groovy +++ b/src/it/projects/purge-local-repository-multi-module/verify.groovy @@ -17,16 +17,15 @@ * under the License. */ -void checkFileAbsence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) - assert !depJar.exists() : "Dependency jar was not purged: " + depJar +void checkFileAbsence(String path) { + File depJar = new File(localRepositoryPath, path) + assert !depJar.exists() : "Dependency jar was not purged: " + depJar } -checkFileAbsence( "org/apache/maven/its/dependency/purged-a/1.0/purged-a-1.0.jar" ) -checkFileAbsence( "org/apache/maven/its/dependency/purged-b/1.0/purged-b-1.0.jar" ) +checkFileAbsence("org/apache/maven/its/dependency/purged-a/1.0/purged-a-1.0.jar") +checkFileAbsence("org/apache/maven/its/dependency/purged-b/1.0/purged-b-1.0.jar") -String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" ) -assert buildLog.contains( 'Deleting 1 transitive dependency for project child1 from ' ) -assert buildLog.contains( 'Deleting 1 transitive dependency for project child2 from ' ) -assert buildLog.contains( 'with artifact version resolution fuzziness' ) +String buildLog = new File(basedir, "build.log").getText("UTF-8") +assert buildLog.contains('Deleting 1 transitive dependency for project child1 from ') +assert buildLog.contains('Deleting 1 transitive dependency for project child2 from ') +assert buildLog.contains('with artifact version resolution fuzziness') diff --git a/src/it/projects/purge-local-repository-non-transitive/verify.groovy b/src/it/projects/purge-local-repository-non-transitive/verify.groovy index 4dd59067..88dbcdde 100644 --- a/src/it/projects/purge-local-repository-non-transitive/verify.groovy +++ b/src/it/projects/purge-local-repository-non-transitive/verify.groovy @@ -17,14 +17,14 @@ * under the License. */ -import java.io.*; +import java.io.* -File depDir = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-non-transitive-dep/1.0" ); +File depDir = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-non-transitive-dep/1.0") -assert !depDir.exists() : "Directory was not deleted: " + depDir; +assert !depDir.exists() : "Directory was not deleted: " + depDir -File transitiveDepDir = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-non-transitive-dep-2/1.0" ); +File transitiveDepDir = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-non-transitive-dep-2/1.0" ) -assert transitiveDepDir.exists() : "Transitive dep was purged: " + transitiveDepDir; +assert transitiveDepDir.exists() : "Transitive dep was purged: " + transitiveDepDir -return true; +return true diff --git a/src/it/projects/purge-local-repository-reresolve/verify.groovy b/src/it/projects/purge-local-repository-reresolve/verify.groovy index 21349305..293d7fb9 100644 --- a/src/it/projects/purge-local-repository-reresolve/verify.groovy +++ b/src/it/projects/purge-local-repository-reresolve/verify.groovy @@ -17,22 +17,22 @@ * under the License. */ -import java.io.*; +import java.io.* -File depJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep/1.0/purge-local-repository-reresolve-dep-1.0.jar" ); +File depJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep/1.0/purge-local-repository-reresolve-dep-1.0.jar") -assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar; +assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar -File depPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep/1.0/purge-local-repository-reresolve-dep-1.0.pom" ); +File depPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep/1.0/purge-local-repository-reresolve-dep-1.0.pom" ) -assert depPom.exists() : "Direct dependency pom was not re-resolved: " + depPom; +assert depPom.exists() : "Direct dependency pom was not re-resolved: " + depPom -File transitiveDepJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep-2/1.0/purge-local-repository-reresolve-dep-2-1.0.jar" ); +File transitiveDepJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep-2/1.0/purge-local-repository-reresolve-dep-2-1.0.jar" ) -assert transitiveDepJar.exists() : "Transitive dep jar was not re-resolved: " + transitiveDepJar; +assert transitiveDepJar.exists() : "Transitive dep jar was not re-resolved: " + transitiveDepJar -File transitiveDepPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep-2/1.0/purge-local-repository-reresolve-dep-2-1.0.pom" ); +File transitiveDepPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-reresolve-dep-2/1.0/purge-local-repository-reresolve-dep-2-1.0.pom" ) -assert transitiveDepPom.exists() : "Transitive dep pom was not re-resolved: " + transitiveDepPom; +assert transitiveDepPom.exists() : "Transitive dep pom was not re-resolved: " + transitiveDepPom -return true; +return true diff --git a/src/it/projects/purge-local-repository-snapshots-only/setup.groovy b/src/it/projects/purge-local-repository-snapshots-only/setup.groovy index 2f483641..e88e9c99 100644 --- a/src/it/projects/purge-local-repository-snapshots-only/setup.groovy +++ b/src/it/projects/purge-local-repository-snapshots-only/setup.groovy @@ -17,16 +17,16 @@ * under the License. */ -import java.io.*; +import java.io.* -File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/purged-snapshots-only/1.0/purged-snapshots-only-1.0.jar" ); +File purgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/purged-snapshots-only/1.0/purged-snapshots-only-1.0.jar") -purgedJar.getParentFile().mkdirs(); -purgedJar.createNewFile(); +purgedJar.getParentFile().mkdirs() +purgedJar.createNewFile() -purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/snap-purged/1.0-SNAPSHOT/snap-purged-1.0-SNAPSHOT.jar" ); +purgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/snap-purged/1.0-SNAPSHOT/snap-purged-1.0-SNAPSHOT.jar") -purgedJar.getParentFile().mkdirs(); -purgedJar.createNewFile(); +purgedJar.getParentFile().mkdirs() +purgedJar.createNewFile() -return true; +return true diff --git a/src/it/projects/purge-local-repository-snapshots-only/verify.groovy b/src/it/projects/purge-local-repository-snapshots-only/verify.groovy index c6bf5269..96e21c0f 100644 --- a/src/it/projects/purge-local-repository-snapshots-only/verify.groovy +++ b/src/it/projects/purge-local-repository-snapshots-only/verify.groovy @@ -17,15 +17,15 @@ * under the License. */ -import java.io.*; +import java.io.* -File nonPurgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/purged-snapshots-only/1.0/purged-snapshots-only-1.0.jar" ); +File nonPurgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/purged-snapshots-only/1.0/purged-snapshots-only-1.0.jar") -assert nonPurgedJar.exists() : "JAR was purged: " + nonPurgedJar; +assert nonPurgedJar.exists() : "JAR was purged: " + nonPurgedJar -File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/snap-purged/1.0-SNAPSHOT/snap-purged-1.0-SNAPSHOT.jar" ); +File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge/snapshots/snap-purged/1.0-SNAPSHOT/snap-purged-1.0-SNAPSHOT.jar" ) -assert !purgedJar.exists() : "JAR was not purged: " + purgedJar; +assert !purgedJar.exists() : "JAR was not purged: " + purgedJar -return true; +return true diff --git a/src/it/projects/purge-local-repository-version-range/verify.groovy b/src/it/projects/purge-local-repository-version-range/verify.groovy index ca5a2c8c..33727b66 100644 --- a/src/it/projects/purge-local-repository-version-range/verify.groovy +++ b/src/it/projects/purge-local-repository-version-range/verify.groovy @@ -17,22 +17,22 @@ * under the License. */ -import java.io.*; +import java.io.* -File depJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep/1.0/purge-local-repository-version-range-dep-1.0.jar" ); +File depJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep/1.0/purge-local-repository-version-range-dep-1.0.jar") -assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar; +assert depJar.exists() : "Direct dependency jar was not re-resolved: " + depJar -File depPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep/1.0/purge-local-repository-version-range-dep-1.0.pom" ); +File depPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep/1.0/purge-local-repository-version-range-dep-1.0.pom" ) -assert depPom.exists() : "Direct dependency pom was not re-resolved: " + depPom; +assert depPom.exists() : "Direct dependency pom was not re-resolved: " + depPom -File transitiveDepJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep-2/1.0/purge-local-repository-version-range-dep-2-1.0.jar" ); +File transitiveDepJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep-2/1.0/purge-local-repository-version-range-dep-2-1.0.jar" ) -assert transitiveDepJar.exists() : "Transitive dep jar was not re-resolved: " + transitiveDepJar; +assert transitiveDepJar.exists() : "Transitive dep jar was not re-resolved: " + transitiveDepJar -File transitiveDepPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep-2/1.0/purge-local-repository-version-range-dep-2-1.0.pom" ); +File transitiveDepPom = new File( localRepositoryPath, "org/apache/maven/its/dependency/purge-local-repository-version-range-dep-2/1.0/purge-local-repository-version-range-dep-2-1.0.pom" ) -assert transitiveDepPom.exists() : "Transitive dep pom was not re-resolved: " + transitiveDepPom; +assert transitiveDepPom.exists() : "Transitive dep pom was not re-resolved: " + transitiveDepPom -return true; +return true diff --git a/src/it/projects/purge-local-repository-without-pom/setup.groovy b/src/it/projects/purge-local-repository-without-pom/setup.groovy index dba9cfb3..192b36e4 100644 --- a/src/it/projects/purge-local-repository-without-pom/setup.groovy +++ b/src/it/projects/purge-local-repository-without-pom/setup.groovy @@ -17,11 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar" ); +File purgedJar = new File(localRepositoryPath, "org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar") -purgedJar.getParentFile().mkdirs(); -purgedJar.createNewFile(); +purgedJar.getParentFile().mkdirs() +purgedJar.createNewFile() -return true; +return true diff --git a/src/it/projects/purge-local-repository-without-pom/verify.groovy b/src/it/projects/purge-local-repository-without-pom/verify.groovy index 1d7c24ed..e001a8ee 100644 --- a/src/it/projects/purge-local-repository-without-pom/verify.groovy +++ b/src/it/projects/purge-local-repository-without-pom/verify.groovy @@ -17,13 +17,12 @@ * under the License. */ -void checkFileAbsence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) +void checkFileAbsence(String path) { + File depJar = new File(localRepositoryPath, path) assert !depJar.exists() : "Dependency jar was not purged: " + depJar } -checkFileAbsence( "org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar" ) +checkFileAbsence("org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar") -String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" ) -assert buildLog.contains( 'Deleting 1 manual dependency from ' ) +String buildLog = new File(basedir, "build.log").getText("UTF-8") +assert buildLog.contains('Deleting 1 manual dependency from ') diff --git a/src/it/projects/purge-local-repository/setup.groovy b/src/it/projects/purge-local-repository/setup.groovy index ba0a2b75..f962e191 100644 --- a/src/it/projects/purge-local-repository/setup.groovy +++ b/src/it/projects/purge-local-repository/setup.groovy @@ -17,38 +17,37 @@ * under the License. */ -import java.io.*; +import java.io.* -void createJar( String artifactId ) -{ - File jar = new File( localRepositoryPath, - "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar" ); - jar.getParentFile().mkdirs(); - jar.createNewFile(); +void createJar(String artifactId) { + File jar = new File(localRepositoryPath, + "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar") + jar.getParentFile().mkdirs() + jar.createNewFile() } -createJar( "purged" ); -createJar( "not-purged-test" ); -createJar( "not-purged-provided" ); -createJar( "not-purged-optional" ); +createJar("purged") +createJar("not-purged-test") +createJar("not-purged-provided") +createJar("not-purged-optional") -File purgedPom = new File( localRepositoryPath, - "org/apache/maven/its/dependency/purged/1.0/purged-1.0.pom" ); -purgedPom.withPrintWriter( "UTF-8" ) { writer -> - writer.println( "<project>" ); - writer.println( " <modelVersion>4.0.0</modelVersion>" ); - writer.println( " <groupId>org.apache.maven.its.dependency</groupId>" ); - writer.println( " <artifactId>purged</artifactId>" ); - writer.println( " <version>1.0</version>" ); - writer.println( " <dependencies>" ); - writer.println( " <dependency>" ); - writer.println( " <groupId>org.apache.maven.its.dependency</groupId>" ); - writer.println( " <artifactId>not-purged-optional</artifactId>" ); - writer.println( " <version>1.0</version>" ); - writer.println( " <optional>true</optional>" ); - writer.println( " </dependency>" ); - writer.println( " </dependencies>" ); - writer.println( "</project>" ); +File purgedPom = new File(localRepositoryPath, + "org/apache/maven/its/dependency/purged/1.0/purged-1.0.pom") +purgedPom.withPrintWriter("UTF-8") { writer -> + writer.println("<project>") + writer.println(" <modelVersion>4.0.0</modelVersion>") + writer.println(" <groupId>org.apache.maven.its.dependency</groupId>") + writer.println(" <artifactId>purged</artifactId>") + writer.println(" <version>1.0</version>") + writer.println(" <dependencies>") + writer.println(" <dependency>") + writer.println(" <groupId>org.apache.maven.its.dependency</groupId>") + writer.println(" <artifactId>not-purged-optional</artifactId>") + writer.println(" <version>1.0</version>") + writer.println(" <optional>true</optional>") + writer.println(" </dependency>") + writer.println(" </dependencies>") + writer.println("</project>") } -return true; +return true diff --git a/src/it/projects/purge-local-repository/verify.groovy b/src/it/projects/purge-local-repository/verify.groovy index 6895f8e2..2b2a0074 100644 --- a/src/it/projects/purge-local-repository/verify.groovy +++ b/src/it/projects/purge-local-repository/verify.groovy @@ -17,23 +17,21 @@ * under the License. */ -void checkFileAbsence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) - assert !depJar.exists() : "Dependency jar was not purged: " + depJar +void checkFileAbsence(String path) { + File depJar = new File(localRepositoryPath, path) + assert !depJar.exists() : "Dependency jar was not purged: " + depJar } -void checkFilePresence( String path ) -{ - File depJar = new File( localRepositoryPath, path ) - assert depJar.exists() : "Dependency jar was purged: " + depJar +void checkFilePresence(String path) { + File depJar = new File(localRepositoryPath, path) + assert depJar.exists() : "Dependency jar was purged: " + depJar } -checkFileAbsence( "org/apache/maven/its/dependency/purged/1.0/purged-1.0.jar" ) -checkFileAbsence( "org/apache/maven/its/dependency/not-purged-test/1.0/not-purged-test-1.0.jar" ) -checkFileAbsence( "org/apache/maven/its/dependency/not-purged-provided/1.0/not-purged-provided-1.0.jar" ) -checkFilePresence( "org/apache/maven/its/dependency/not-purged-optional/1.0/not-purged-optional-1.0.jar" ) +checkFileAbsence("org/apache/maven/its/dependency/purged/1.0/purged-1.0.jar") +checkFileAbsence("org/apache/maven/its/dependency/not-purged-test/1.0/not-purged-test-1.0.jar") +checkFileAbsence("org/apache/maven/its/dependency/not-purged-provided/1.0/not-purged-provided-1.0.jar") +checkFilePresence("org/apache/maven/its/dependency/not-purged-optional/1.0/not-purged-optional-1.0.jar") -String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" ) -assert buildLog.contains( 'Deleting 3 transitive dependencies for project test from ' ) -assert buildLog.contains( 'with artifact version resolution fuzziness' ) +String buildLog = new File(basedir, "build.log").getText("UTF-8") +assert buildLog.contains('Deleting 3 transitive dependencies for project test from ') +assert buildLog.contains('with artifact version resolution fuzziness') diff --git a/src/it/projects/require-explicit-dependencies-copy-pom/verify.groovy b/src/it/projects/require-explicit-dependencies-copy-pom/verify.groovy index a3e713b3..7b6dd095 100644 --- a/src/it/projects/require-explicit-dependencies-copy-pom/verify.groovy +++ b/src/it/projects/require-explicit-dependencies-copy-pom/verify.groovy @@ -17,7 +17,7 @@ * under the License. */ -File copied = new File( basedir, "child-b/target/dependency/child-a-1.0-SNAPSHOT.jar" ) +File copied = new File(basedir, "child-b/target/dependency/child-a-1.0-SNAPSHOT.jar") assert copied.isFile() : "Missing file " + copied -return true; +return true diff --git a/src/it/projects/require-explicit-dependencies-declared/verify.groovy b/src/it/projects/require-explicit-dependencies-declared/verify.groovy index 5a1ad70d..50cf14e6 100644 --- a/src/it/projects/require-explicit-dependencies-declared/verify.groovy +++ b/src/it/projects/require-explicit-dependencies-declared/verify.groovy @@ -17,7 +17,7 @@ * under the License. */ -File unpacked = new File( basedir, "child-b/target/dependency/DoNotDelete.xml" ) +File unpacked = new File(basedir, "child-b/target/dependency/DoNotDelete.xml") assert unpacked.isFile() : "Missing file " + unpacked -return true; +return true diff --git a/src/it/projects/require-explicit-dependencies-undeclared/verify.groovy b/src/it/projects/require-explicit-dependencies-undeclared/verify.groovy index f7d2b51a..a22ea9f5 100644 --- a/src/it/projects/require-explicit-dependencies-undeclared/verify.groovy +++ b/src/it/projects/require-explicit-dependencies-undeclared/verify.groovy @@ -17,9 +17,9 @@ * under the License. */ -String log = new File( basedir, "build.log" ).text -assert log.contains( "requireExplicitDependencies is set" ) : "Missing failure message" +String log = new File(basedir, "build.log").text +assert log.contains("requireExplicitDependencies is set") : "Missing failure message" assert log.contains( "org.apache.maven.its.dependency:child-a:1.0-SNAPSHOT:jar is not declared as a dependency" ) : "Missing offending item" assert !new File( basedir, "child-b/target/dependency/DoNotDelete.xml" ).exists() -return true; +return true diff --git a/src/it/projects/resolve-plugins-exclude-reactor/verify.groovy b/src/it/projects/resolve-plugins-exclude-reactor/verify.groovy index 6476a9ea..55f88e88 100644 --- a/src/it/projects/resolve-plugins-exclude-reactor/verify.groovy +++ b/src/it/projects/resolve-plugins-exclude-reactor/verify.groovy @@ -17,5 +17,5 @@ * under the License. */ -def resolved = new File( basedir, "target/resolved.txt" ).text -assert !( resolved =~ /child-a/ ) : "Reactor plugin 'child-a' should be excluded!" +def resolved = new File(basedir, "target/resolved.txt").text +assert !(resolved =~ /child-a/) : "Reactor plugin 'child-a' should be excluded!" diff --git a/src/it/projects/resolve-plugins-with-exclude/verify.groovy b/src/it/projects/resolve-plugins-with-exclude/verify.groovy index a62cf346..cab31d39 100644 --- a/src/it/projects/resolve-plugins-with-exclude/verify.groovy +++ b/src/it/projects/resolve-plugins-with-exclude/verify.groovy @@ -17,6 +17,6 @@ * under the License. */ -def resolved = new File( basedir, "target/resolved.txt" ).text -assert !( resolved =~ /maven-surefire-plugin/ ) : "Surefire plugin should be excluded!" +def resolved = new File(basedir, "target/resolved.txt").text +assert !(resolved =~ /maven-surefire-plugin/) : "Surefire plugin should be excluded!" assert !( resolved =~ /maven-dependency-plugin/ ) : "Dependency plugin should be excluded!" diff --git a/src/it/projects/resolve-sources-test-jar/verify.groovy b/src/it/projects/resolve-sources-test-jar/verify.groovy index fe442edf..6f72906b 100644 --- a/src/it/projects/resolve-sources-test-jar/verify.groovy +++ b/src/it/projects/resolve-sources-test-jar/verify.groovy @@ -19,8 +19,14 @@ def lines = new File(basedir, "target/resolved.txt").readLines()*.trim() -def notResolved = lines.findIndexOf { it.startsWith("The following files have NOT been resolved") } +def notResolved = lines.findIndexOf { + it.startsWith("The following files have NOT been resolved") +} def resolved = notResolved < 0 ? lines : lines.subList(0, notResolved) -assert resolved.any { it.startsWith("org.apache.maven.its.dependency:ResourceArtifact:jar:sources:1.0") } : "Expected main sources in " + lines -assert resolved.any { it.startsWith("org.apache.maven.its.dependency:ResourceArtifact:jar:test-sources:1.0") } : "Expected test-sources for the test-jar dependency in " + lines +assert resolved.any { + it.startsWith("org.apache.maven.its.dependency:ResourceArtifact:jar:sources:1.0") +} : "Expected main sources in " + lines +assert resolved.any { + it.startsWith("org.apache.maven.its.dependency:ResourceArtifact:jar:test-sources:1.0") +} : "Expected test-sources for the test-jar dependency in " + lines diff --git a/src/it/projects/resolve-sources/verify.groovy b/src/it/projects/resolve-sources/verify.groovy index 4a5e9296..4919be36 100644 --- a/src/it/projects/resolve-sources/verify.groovy +++ b/src/it/projects/resolve-sources/verify.groovy @@ -17,15 +17,25 @@ * under the License. */ def lines = new File(basedir, "target/resolved.txt").readLines()*.trim() -def notResolved = lines.findIndexOf { it.startsWith("The following files have NOT been resolved") } +def notResolved = lines.findIndexOf { + it.startsWith("The following files have NOT been resolved") +} def resolved = notResolved < 0 ? lines : lines.subList(0, notResolved) def missing = notResolved < 0 ? [] : lines.subList(notResolved, lines.size()) assert lines[0] == "The following files have been resolved:" : "Unexpected header in " + lines -assert resolved.any { it.startsWith("org.apache.maven:maven-project:jar:sources:2.0.8") } : "Expected the sources of the dependency in " + lines -assert resolved.any { it.startsWith("org.apache.maven:maven-model:jar:sources:2.0.8") } : "Expected the sources of a transitive dependency in " + lines +assert resolved.any { + it.startsWith("org.apache.maven:maven-project:jar:sources:2.0.8") +} : "Expected the sources of the dependency in " + lines +assert resolved.any { + it.startsWith("org.apache.maven:maven-model:jar:sources:2.0.8") +} : "Expected the sources of a transitive dependency in " + lines // some old dependencies have no sources on Central (which ones differs between Maven 3 and 4 and over time); they are // listed instead of failing the build, so only check that whatever is listed is a sources jar def missingSources = missing.drop(1).findAll { it } -assert missingSources.every { it.contains(":jar:sources:") } : "Expected only sources jars among the missing in " + lines -assert resolved.every { it.contains(":jar:sources:") || it.startsWith("The following") || !it } : "Expected only sources jars among the resolved in " + lines +assert missingSources.every { + it.contains(":jar:sources:") +} : "Expected only sources jars among the missing in " + lines +assert resolved.every { + it.contains(":jar:sources:") || it.startsWith("The following") || !it +} : "Expected only sources jars among the resolved in " + lines diff --git a/src/it/projects/resolve/verify.groovy b/src/it/projects/resolve/verify.groovy index 8f4033b0..e51cf923 100644 --- a/src/it/projects/resolve/verify.groovy +++ b/src/it/projects/resolve/verify.groovy @@ -19,7 +19,15 @@ def lines = new File(basedir, "target/resolved.txt").readLines()*.trim() assert lines[0] == "The following files have been resolved:" : "Unexpected header in " + lines -assert lines.any { it.startsWith("org.apache.maven:maven-project:jar:2.0.6:compile") } : "Expected the dependency in " + lines -assert lines.any { it.startsWith("org.apache.maven:maven-model:jar:2.0.6:compile") } : "Expected a transitive dependency in " + lines -assert lines.any { it.startsWith("junit:junit:jar:3.8.1:compile") } : "Expected a transitive dependency in " + lines -assert !lines.any { it.startsWith("The following files have NOT been resolved") } : "Nothing may be unresolved in " + lines +assert lines.any { + it.startsWith("org.apache.maven:maven-project:jar:2.0.6:compile") +} : "Expected the dependency in " + lines +assert lines.any { + it.startsWith("org.apache.maven:maven-model:jar:2.0.6:compile") +} : "Expected a transitive dependency in " + lines +assert lines.any { + it.startsWith("junit:junit:jar:3.8.1:compile") +} : "Expected a transitive dependency in " + lines +assert !lines.any { + it.startsWith("The following files have NOT been resolved") +} : "Nothing may be unresolved in " + lines diff --git a/src/it/projects/tree-dot-multimodule/verify.groovy b/src/it/projects/tree-dot-multimodule/verify.groovy index 90e1869b..949de3d2 100644 --- a/src/it/projects/tree-dot-multimodule/verify.groovy +++ b/src/it/projects/tree-dot-multimodule/verify.groovy @@ -19,7 +19,9 @@ import static org.assertj.core.api.Assertions.assertThat -def lines = new File(basedir, "target/tree.dot").readLines()*.trim().findAll { it } +def lines = new File(basedir, "target/tree.dot").readLines()*.trim().findAll { + it +} // one graph for the whole reactor, opened by the first module assertThat(lines.findAll { it.startsWith("digraph ") }).hasSize(1) diff --git a/src/it/projects/tree-multimodule/verify.groovy b/src/it/projects/tree-multimodule/verify.groovy index 03cfc779..4f52ec80 100644 --- a/src/it/projects/tree-multimodule/verify.groovy +++ b/src/it/projects/tree-multimodule/verify.groovy @@ -31,4 +31,4 @@ assertThat(new File(basedir, "module-a/target/tree.txt")) assertThat(new File(basedir, "module-b/target/tree.txt")) .hasSameTextualContentAs(new File(basedir, "module-b/" + expected)) -return true; +return true diff --git a/src/it/projects/tree-verbose-multimodule/verify.groovy b/src/it/projects/tree-verbose-multimodule/verify.groovy index 03cfc779..4f52ec80 100644 --- a/src/it/projects/tree-verbose-multimodule/verify.groovy +++ b/src/it/projects/tree-verbose-multimodule/verify.groovy @@ -31,4 +31,4 @@ assertThat(new File(basedir, "module-a/target/tree.txt")) assertThat(new File(basedir, "module-b/target/tree.txt")) .hasSameTextualContentAs(new File(basedir, "module-b/" + expected)) -return true; +return true diff --git a/src/it/projects/unpack-custom-ear/verify.groovy b/src/it/projects/unpack-custom-ear/verify.groovy index 9b92ae56..d2ca3dd9 100644 --- a/src/it/projects/unpack-custom-ear/verify.groovy +++ b/src/it/projects/unpack-custom-ear/verify.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -def buildLog = new File( basedir, 'build.log' ) +def buildLog = new File(basedir, 'build.log') assert buildLog.exists() assert buildLog.length() != 0 -assert buildLog.text.contains( "[DEBUG] Found unArchiver: org.apache.maven.archiver.LogUnArchiver by type: custom-ear" ) +assert buildLog.text.contains("[DEBUG] Found unArchiver: org.apache.maven.archiver.LogUnArchiver by type: custom-ear") diff --git a/src/it/projects/unpack-from-remote-repository/setup.groovy b/src/it/projects/unpack-from-remote-repository/setup.groovy index 5ad3cb98..a2cdb705 100644 --- a/src/it/projects/unpack-from-remote-repository/setup.groovy +++ b/src/it/projects/unpack-from-remote-repository/setup.groovy @@ -17,14 +17,11 @@ * under the License. */ -import java.io.*; +import java.io.* -String[] foldersToDelete = [ - "org/apache/maven/its/dependency/fake-remote-unpack" -]; +String[] foldersToDelete = ["org/apache/maven/its/dependency/fake-remote-unpack"] -for ( String folderToDelete : foldersToDelete ) -{ - assert new File( localRepositoryPath, folderToDelete ).deleteDir(); +for (String folderToDelete : foldersToDelete) { + assert new File(localRepositoryPath, folderToDelete).deleteDir() } diff --git a/src/it/projects/unpack-from-remote-repository/verify.groovy b/src/it/projects/unpack-from-remote-repository/verify.groovy index 5d8e2c62..5536bf63 100644 --- a/src/it/projects/unpack-from-remote-repository/verify.groovy +++ b/src/it/projects/unpack-from-remote-repository/verify.groovy @@ -17,19 +17,16 @@ * under the License. */ -import java.io.*; +import java.io.* -String[] expectedFiles = [ - "org/apache/maven/its/dependency/fake-remote-unpack/1.0/fake-remote-unpack-1.0.jar" -]; +String[] expectedFiles = ["org/apache/maven/its/dependency/fake-remote-unpack/1.0/fake-remote-unpack-1.0.jar"] -for ( String expectedFile : expectedFiles ) -{ - File file = new File( localRepositoryPath, expectedFile ); - assert file.isFile() : "Missing file " + file; +for (String expectedFile : expectedFiles) { + File file = new File(localRepositoryPath, expectedFile) + assert file.isFile() : "Missing file " + file } -File unpacked = new File( basedir, "target/dependency/META-INF/MANIFEST.MF" ); -assert unpacked.exists() : "Missing file " + unpacked; +File unpacked = new File(basedir, "target/dependency/META-INF/MANIFEST.MF") +assert unpacked.exists() : "Missing file " + unpacked -return true; +return true diff --git a/src/it/projects/unpack/verify.groovy b/src/it/projects/unpack/verify.groovy index 209b5950..7b8a782f 100644 --- a/src/it/projects/unpack/verify.groovy +++ b/src/it/projects/unpack/verify.groovy @@ -18,20 +18,19 @@ */ // the same archive unpacked by the execution (outputDirectory in the POM) and by the command line (-Dartifact) -for ( outputDirectory in ["output spaces directory", "cli output directory"] ) -{ - File file = new File( basedir, "target/" + outputDirectory ); - assert file.isDirectory() : "Missing " + file; +for (outputDirectory in ["output spaces directory", "cli output directory"]) { + File file = new File(basedir, "target/" + outputDirectory) + assert file.isDirectory() : "Missing " + file - file = new File( file, "qdox-1.5" ); - assert file.isDirectory() : "Missing " + file; + file = new File(file, "qdox-1.5") + assert file.isDirectory() : "Missing " + file - file = new File( file, "build.xml" ); - assert file.isFile() : "Missing " + file; + file = new File(file, "build.xml") + assert file.isFile() : "Missing " + file //until MDEP-242 is fixed, the next test will passed - file = new File( file.getParent(), "src" ); - assert file.isDirectory() : "Missing " + file; + file = new File(file.getParent(), "src") + assert file.isDirectory() : "Missing " + file } -return true; +return true
