diff --git a/src/it/compare-pom/altered-pom.xml b/src/it/compare-pom/altered-pom.xml index 1dc5badc..0830255f 100644 --- a/src/it/compare-pom/altered-pom.xml +++ b/src/it/compare-pom/altered-pom.xml @@ -24,7 +24,7 @@ under the License. org.apache.maven.its.deploy.comparepom test - 1.0 + ${revision} pom @@ -32,6 +32,7 @@ under the License. + 1.0-SNAPSHOT true diff --git a/src/it/compare-pom/invoker.properties b/src/it/compare-pom/invoker.properties index 3f29adb2..a61a53fa 100644 --- a/src/it/compare-pom/invoker.properties +++ b/src/it/compare-pom/invoker.properties @@ -17,10 +17,15 @@ invoker.debug = false -invoker.goals = -Dclassifier=first clean deploy +invoker.goals.1 = -Dclassifier=first clean deploy -invoker.goals.2 = -Dclassifier=second clean deploy +invoker.project.2 = altered-pom.xml +invoker.goals.2 = -Dclassifier=second -Dm-deploy-p.version=${project.version} clean deploy -invoker.project.3 = altered-pom.xml -invoker.goals.3 = -Dclassifier=third -Dm-deploy-p.version=${project.version} clean deploy -invoker.buildResult.3 = failure +invoker.goals.3 = -Drevision=1.0 -Dclassifier=first clean deploy + +invoker.goals.4 = -Drevision=1.0 -Dclassifier=second clean deploy + +invoker.project.5 = altered-pom.xml +invoker.goals.5 = -Drevision=1.0 -Dclassifier=third -Dm-deploy-p.version=${project.version} clean deploy +invoker.buildResult.5 = failure diff --git a/src/it/compare-pom/pom.xml b/src/it/compare-pom/pom.xml index f7410fd7..80e5ef1a 100644 --- a/src/it/compare-pom/pom.xml +++ b/src/it/compare-pom/pom.xml @@ -24,7 +24,7 @@ under the License. org.apache.maven.its.deploy.comparepom test - 1.0 + ${revision} pom @@ -32,6 +32,7 @@ under the License. + 1.0-SNAPSHOT true diff --git a/src/it/compare-pom/verify.groovy b/src/it/compare-pom/verify.groovy index e2791c11..98c9a943 100644 --- a/src/it/compare-pom/verify.groovy +++ b/src/it/compare-pom/verify.groovy @@ -44,6 +44,12 @@ class LogInspector assert new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/maven-metadata.xml" ).exists() + +File snDir = new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/1.0-SNAPSHOT/" ) +assert snDir.list( {d, f -> f ==~ /test-1.0-.*-first.jar/} as FilenameFilter ).size() == 1 +assert snDir.list( {d, f -> f ==~ /test-1.0-.*-second.jar/} as FilenameFilter ).size() == 1 +assert snDir.list( {d, f -> f ==~ /test-1.0-.*.pom/} as FilenameFilter ).size() == 2 + assert new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0-first.jar" ).exists() assert new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0-second.jar").exists() @@ -62,18 +68,22 @@ assert buildLog.exists() LogInspector li = new LogInspector( buildLog ) String groupUrl = "file:///${basedir}/repo/org/apache/maven/its/deploy/comparepom" -// First run: The POM tried to be downloaded and uploaded: +// 1st and 2nd run: The POM tried to be downloaded and uploaded: +assert li.containsAfter( "[INFO] Downloading from it: ${groupUrl}/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom" ) +assert li.containsAfter( "[INFO] Downloading from it: ${groupUrl}/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom" ) + +// 3rd run: The POM tried to be downloaded and uploaded: assert li.containsAfter( "[INFO] Downloading from it: ${groupUrl}/test/1.0/test-1.0.pom" ) assert li.containsAfter( "[INFO] Uploaded to it: ${groupUrl}/test/1.0/test-1.0.pom" ) // After that, it is never tried to be uploaded: assert -1 == buildLog.text.indexOf( "[INFO] Uploading to it: ${groupUrl}/test/1.0/test-1.0.pom", li.index + 1 ) -// Second run: POM is downloaded and not uploaded: +// 4th run: POM is downloaded and not uploaded: assert li.containsAfter( "[INFO] Downloaded from it: ${groupUrl}/test/1.0/test-1.0.pom" ) assert li.containsAfter( "[INFO] Not deploying POM, since deployed POM is equal to current POM." ) -// Third run: POM is downloaded, nothing is tried to be uploaded after that, and the build fails with error: +// 5th run: POM is downloaded, nothing is tried to be uploaded after that, and the build fails with error: assert li.containsAfter( "[INFO] Downloaded from it: ${groupUrl}/test/1.0/test-1.0.pom" ) assert -1 == buildLog.text.indexOf( "[INFO] Uploading to", li.index + 1 ) assert li.containsAfter( "[ERROR] Project version org.apache.maven.its.deploy.comparepom:test:1.0 already deployed with a differing POM." )