This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch MDEPLOY-319 in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
commit d50e75f0acaf3953a1c946aad7c776b5205ac470 Author: Slawomir Jaranowski <[email protected]> AuthorDate: Fri Jun 14 00:08:03 2024 +0200 [MDEPLOY-319] Cleanup of test code --- src/it/3rd-party-jar-with-extras/pom.xml | 2 +- src/it/3rd-party-jar-with-extras/setup.bsh | 33 ----------- .../setup.groovy} | 11 +--- src/it/3rd-party-jar-with-extras/test.properties | 2 +- src/it/3rd-party-jar-with-extras/verify.bsh | 12 ++-- src/it/3rd-party-jar-without-pom/pom.xml | 2 +- .../setup.groovy} | 15 +---- src/it/3rd-party-jar-without-pom/test.properties | 2 +- src/it/3rd-party-jar-without-pom/verify.bsh | 6 +- .../invoker.properties} | 8 +-- .../pom.xml | 37 ++++++++++++- .../setup.bsh | 33 ----------- .../setup.groovy} | 8 +-- src/it/alt-deploy-repo-with-dist-mgmt/setup.bsh | 33 ----------- .../setup.groovy} | 8 +-- src/it/alt-deploy-repo-without-dist-mgmt/setup.bsh | 33 ----------- .../setup.groovy} | 8 +-- src/it/attach-release-jar/setup.bsh | 33 ----------- .../setup.bsh => attach-release-jar/setup.groovy} | 8 +-- .../invoker.properties} | 8 +-- .../pom.xml | 29 +++++++++- .../setup.bsh => deploy-bom/setup.groovy} | 6 +- .../setup.bsh => deploy-bom/verify.groovy} | 18 +++--- src/it/external-release-jar/setup.bsh | 33 ----------- .../setup.groovy} | 7 +-- src/it/gav-validation/setup.bsh | 33 ----------- .../setup.bsh => gav-validation/setup.groovy} | 8 +-- .../setup.bsh => mdeploy-45-test/setup.groovy} | 8 +-- src/it/no-main-artifact-1/setup.bsh | 33 ----------- .../setup.bsh => no-main-artifact-1/setup.groovy} | 8 +-- src/it/no-main-artifact-2/setup.bsh | 33 ----------- .../setup.bsh => no-main-artifact-2/setup.groovy} | 8 +-- src/it/non-default-pom/setup.bsh | 33 ----------- .../setup.bsh => non-default-pom/setup.groovy} | 8 +-- src/it/offline/setup.bsh | 33 ----------- .../setup.bsh => offline/setup.groovy} | 8 +-- src/it/release-jar/setup.bsh | 33 ----------- .../setup.bsh => release-jar/setup.groovy} | 8 +-- src/it/release-pom/setup.bsh | 33 ----------- .../setup.bsh => release-pom/setup.groovy} | 8 +-- src/it/skip-release-jar/setup.bsh | 33 ----------- .../setup.bsh => skip-release-jar/setup.groovy} | 8 +-- src/it/skip-snapshot-jar/setup.bsh | 33 ----------- .../setup.bsh => skip-snapshot-jar/setup.groovy} | 8 +-- .../setup.bsh => skip/setup.groovy} | 8 +-- src/it/snapshot-jar/setup.bsh | 33 ----------- .../setup.bsh => snapshot-jar/setup.groovy} | 8 +-- src/it/snapshot-pom/setup.bsh | 33 ----------- .../setup.bsh => snapshot-pom/setup.groovy} | 8 +-- .../maven/plugins/deploy/DeployFileMojoTest.java | 30 +++++----- .../maven/plugins/deploy/DeployMojoTest.java | 64 ++++++++-------------- 51 files changed, 141 insertions(+), 815 deletions(-) diff --git a/src/it/3rd-party-jar-with-extras/pom.xml b/src/it/3rd-party-jar-with-extras/pom.xml index ad91bea..6b79b51 100644 --- a/src/it/3rd-party-jar-with-extras/pom.xml +++ b/src/it/3rd-party-jar-with-extras/pom.xml @@ -22,7 +22,7 @@ under the License. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.its.deploy.tpjwop</groupId> + <groupId>org.apache.maven.its.deploy.tpjwop1</groupId> <artifactId>test</artifactId> <version>1.0</version> <packaging>jar</packaging> diff --git a/src/it/3rd-party-jar-with-extras/setup.bsh b/src/it/3rd-party-jar-with-extras/setup.bsh deleted file mode 100644 index abd2b2c..0000000 --- a/src/it/3rd-party-jar-with-extras/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/tpjwop" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/skip/setup.bsh b/src/it/3rd-party-jar-with-extras/setup.groovy similarity index 76% rename from src/it/skip/setup.bsh rename to src/it/3rd-party-jar-with-extras/setup.groovy index 6456ca5..b9468e5 100644 --- a/src/it/skip/setup.bsh +++ b/src/it/3rd-party-jar-with-extras/setup.groovy @@ -17,13 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/skip" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/tpjwop1').deleteDir() diff --git a/src/it/3rd-party-jar-with-extras/test.properties b/src/it/3rd-party-jar-with-extras/test.properties index 6fd2093..09d5870 100644 --- a/src/it/3rd-party-jar-with-extras/test.properties +++ b/src/it/3rd-party-jar-with-extras/test.properties @@ -17,7 +17,7 @@ file = test-0.1.jar url = file:target/repo -groupId = org.apache.maven.its.deploy.tpjwop +groupId = org.apache.maven.its.deploy.tpjwop1 artifactId = test version = 1.0 packaging = jar diff --git a/src/it/3rd-party-jar-with-extras/verify.bsh b/src/it/3rd-party-jar-with-extras/verify.bsh index 6c5f4c5..348e5f3 100644 --- a/src/it/3rd-party-jar-with-extras/verify.bsh +++ b/src/it/3rd-party-jar-with-extras/verify.bsh @@ -22,11 +22,11 @@ import java.util.*; String[] paths = { - "org/apache/maven/its/deploy/tpjwop/test/maven-metadata.xml", - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0.jar", - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0.zip", - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0-src.tar.gz", - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0.tar.gz", + "org/apache/maven/its/deploy/tpjwop1/test/maven-metadata.xml", + "org/apache/maven/its/deploy/tpjwop1/test/1.0/test-1.0.jar", + "org/apache/maven/its/deploy/tpjwop1/test/1.0/test-1.0.zip", + "org/apache/maven/its/deploy/tpjwop1/test/1.0/test-1.0-src.tar.gz", + "org/apache/maven/its/deploy/tpjwop1/test/1.0/test-1.0.tar.gz", }; for ( String path : paths ) @@ -41,7 +41,7 @@ for ( String path : paths ) String[] missing = { - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0.pom", + "org/apache/maven/its/deploy/tpjwop1/test/1.0/test-1.0.pom", }; for ( String path : missing ) diff --git a/src/it/3rd-party-jar-without-pom/pom.xml b/src/it/3rd-party-jar-without-pom/pom.xml index ad91bea..da4e8ab 100644 --- a/src/it/3rd-party-jar-without-pom/pom.xml +++ b/src/it/3rd-party-jar-without-pom/pom.xml @@ -22,7 +22,7 @@ under the License. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.its.deploy.tpjwop</groupId> + <groupId>org.apache.maven.its.deploy.tpjwop2</groupId> <artifactId>test</artifactId> <version>1.0</version> <packaging>jar</packaging> diff --git a/src/it/mdeploy-45-test/setup.bsh b/src/it/3rd-party-jar-without-pom/setup.groovy similarity index 68% rename from src/it/mdeploy-45-test/setup.bsh rename to src/it/3rd-party-jar-without-pom/setup.groovy index 08a516a..36a8f77 100644 --- a/src/it/mdeploy-45-test/setup.bsh +++ b/src/it/3rd-party-jar-without-pom/setup.groovy @@ -17,17 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/45" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/tpjwop2').deleteDir() diff --git a/src/it/3rd-party-jar-without-pom/test.properties b/src/it/3rd-party-jar-without-pom/test.properties index 269719d..e0bfbe2 100644 --- a/src/it/3rd-party-jar-without-pom/test.properties +++ b/src/it/3rd-party-jar-without-pom/test.properties @@ -17,7 +17,7 @@ file = test-0.1.jar url = file:target/repo -groupId = org.apache.maven.its.deploy.tpjwop +groupId = org.apache.maven.its.deploy.tpjwop2 artifactId = test version = 1.0 packaging = jar diff --git a/src/it/3rd-party-jar-without-pom/verify.bsh b/src/it/3rd-party-jar-without-pom/verify.bsh index 2e74222..36ec696 100644 --- a/src/it/3rd-party-jar-without-pom/verify.bsh +++ b/src/it/3rd-party-jar-without-pom/verify.bsh @@ -22,8 +22,8 @@ import java.util.*; String[] paths = { - "org/apache/maven/its/deploy/tpjwop/test/maven-metadata.xml", - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0.jar", + "org/apache/maven/its/deploy/tpjwop2/test/maven-metadata.xml", + "org/apache/maven/its/deploy/tpjwop2/test/1.0/test-1.0.jar", }; for ( String path : paths ) @@ -38,7 +38,7 @@ for ( String path : paths ) String[] missing = { - "org/apache/maven/its/deploy/tpjwop/test/1.0/test-1.0.pom", + "org/apache/maven/its/deploy/tpjwop2/test/1.0/test-1.0.pom", }; for ( String path : missing ) diff --git a/src/it/3rd-party-jar-without-pom/test.properties b/src/it/MDEPLOY-318-invalid-pom/invoker.properties similarity index 83% copy from src/it/3rd-party-jar-without-pom/test.properties copy to src/it/MDEPLOY-318-invalid-pom/invoker.properties index 269719d..c32d7bb 100644 --- a/src/it/3rd-party-jar-without-pom/test.properties +++ b/src/it/MDEPLOY-318-invalid-pom/invoker.properties @@ -15,10 +15,4 @@ # specific language governing permissions and limitations # under the License. -file = test-0.1.jar -url = file:target/repo -groupId = org.apache.maven.its.deploy.tpjwop -artifactId = test -version = 1.0 -packaging = jar -generatePom = false +invoker.goals = clean jar:jar deploy:deploy diff --git a/src/it/3rd-party-jar-with-extras/pom.xml b/src/it/MDEPLOY-318-invalid-pom/pom.xml similarity index 54% copy from src/it/3rd-party-jar-with-extras/pom.xml copy to src/it/MDEPLOY-318-invalid-pom/pom.xml index ad91bea..2ac4f83 100644 --- a/src/it/3rd-party-jar-with-extras/pom.xml +++ b/src/it/MDEPLOY-318-invalid-pom/pom.xml @@ -22,22 +22,53 @@ under the License. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.its.deploy.tpjwop</groupId> + <groupId>org.apache.maven.its.deploy.invalid-pom</groupId> <artifactId>test</artifactId> <version>1.0</version> - <packaging>jar</packaging> + <packaging>pom</packaging> <description> - Tests the manual deployment of a simple release JAR without a corresponding POM (cf. MDEPLOY-113). + Tests the deployment of a simple release POM. </description> + <properties> + <maven.test.skip>true</maven.test.skip> + </properties> + + <distributionManagement> + <repository> + <id>it</id> + <url>file:///${basedir}/target/repo</url> + </repository> + </distributionManagement> + <build> <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>@mavenCompilerPluginVersion@</version> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>@project.version@</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <version>@mavenInstallPluginVersion@</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>@mavenResourcesPluginVersion@</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>@mavenSurefirePluginVersion@</version> + </plugin> </plugins> </build> diff --git a/src/it/alt-deploy-repo-with-dist-mgmt-snapshot/setup.bsh b/src/it/alt-deploy-repo-with-dist-mgmt-snapshot/setup.bsh deleted file mode 100644 index 60ba9eb..0000000 --- a/src/it/alt-deploy-repo-with-dist-mgmt-snapshot/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/adrwdms" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/alt-deploy-repo-with-dist-mgmt-snapshot/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/alt-deploy-repo-with-dist-mgmt-snapshot/setup.groovy index c2a9d19..c27a858 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/alt-deploy-repo-with-dist-mgmt-snapshot/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/adrwdms').deleteDir() diff --git a/src/it/alt-deploy-repo-with-dist-mgmt/setup.bsh b/src/it/alt-deploy-repo-with-dist-mgmt/setup.bsh deleted file mode 100644 index eb93de9..0000000 --- a/src/it/alt-deploy-repo-with-dist-mgmt/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/adrwdm" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/alt-deploy-repo-with-dist-mgmt/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/alt-deploy-repo-with-dist-mgmt/setup.groovy index c2a9d19..8f00f5c 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/alt-deploy-repo-with-dist-mgmt/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/adrwdm').deleteDir() diff --git a/src/it/alt-deploy-repo-without-dist-mgmt/setup.bsh b/src/it/alt-deploy-repo-without-dist-mgmt/setup.bsh deleted file mode 100644 index 0948163..0000000 --- a/src/it/alt-deploy-repo-without-dist-mgmt/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/adrwodm" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/alt-deploy-repo-without-dist-mgmt/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/alt-deploy-repo-without-dist-mgmt/setup.groovy index c2a9d19..f3b5b94 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/alt-deploy-repo-without-dist-mgmt/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/adrwodm').deleteDir() diff --git a/src/it/attach-release-jar/setup.bsh b/src/it/attach-release-jar/setup.bsh deleted file mode 100644 index b538241..0000000 --- a/src/it/attach-release-jar/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/arj" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/attach-release-jar/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/attach-release-jar/setup.groovy index c2a9d19..385b11c 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/attach-release-jar/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/arj').deleteDir() diff --git a/src/it/3rd-party-jar-without-pom/test.properties b/src/it/deploy-bom/invoker.properties similarity index 83% copy from src/it/3rd-party-jar-without-pom/test.properties copy to src/it/deploy-bom/invoker.properties index 269719d..dd6ac48 100644 --- a/src/it/3rd-party-jar-without-pom/test.properties +++ b/src/it/deploy-bom/invoker.properties @@ -15,10 +15,4 @@ # specific language governing permissions and limitations # under the License. -file = test-0.1.jar -url = file:target/repo -groupId = org.apache.maven.its.deploy.tpjwop -artifactId = test -version = 1.0 -packaging = jar -generatePom = false +invoker.maven.version=4+ \ No newline at end of file diff --git a/src/it/3rd-party-jar-with-extras/pom.xml b/src/it/deploy-bom/pom.xml similarity index 64% copy from src/it/3rd-party-jar-with-extras/pom.xml copy to src/it/deploy-bom/pom.xml index ad91bea..c0aee9b 100644 --- a/src/it/3rd-party-jar-with-extras/pom.xml +++ b/src/it/deploy-bom/pom.xml @@ -22,17 +22,40 @@ under the License. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.maven.its.deploy.tpjwop</groupId> + <groupId>org.apache.maven.its.deploy.bom</groupId> <artifactId>test</artifactId> <version>1.0</version> - <packaging>jar</packaging> + <packaging>bom</packaging> <description> - Tests the manual deployment of a simple release JAR without a corresponding POM (cf. MDEPLOY-113). + Tests the deployment of bom packaging. </description> + <distributionManagement> + <repository> + <id>it</id> + <url>file:///${basedir}/target/repo</url> + </repository> + </distributionManagement> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>5.10.2</version> + <scope>test</scope> + </dependency> + </dependencies> + </dependencyManagement> + <build> <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <version>@version.maven-install-plugin@</version> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/deploy-bom/setup.groovy similarity index 88% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/deploy-bom/setup.groovy index c2a9d19..ca56db9 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/deploy-bom/setup.groovy @@ -17,10 +17,6 @@ * under the License. */ -import java.io.*; -import java.util.*; -file = new File( basedir, "target/repo" ); -file.mkdirs(); +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/bom').deleteDir() -return true; diff --git a/src/it/3rd-party-jar-without-pom/setup.bsh b/src/it/deploy-bom/verify.groovy similarity index 67% rename from src/it/3rd-party-jar-without-pom/setup.bsh rename to src/it/deploy-bom/verify.groovy index abd2b2c..2b314e9 100644 --- a/src/it/3rd-party-jar-without-pom/setup.bsh +++ b/src/it/deploy-bom/verify.groovy @@ -17,17 +17,15 @@ * under the License. */ -import java.io.*; -import java.util.*; +def expectedDeploys = [ + 'org/apache/maven/its/deploy/bom/test/1.0/test-1.0-build.pom', + 'org/apache/maven/its/deploy/bom/test/1.0/test-1.0.pom', + 'org/apache/maven/its/deploy/bom/test/maven-metadata.xml', +] -import org.codehaus.plexus.util.*; +def repoDir = new File ( basedir, 'target/repo') -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/tpjwop" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); +def missingDeploys = expectedDeploys.findAll { ! new File(repoDir, it).isFile() } -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); +assert missingDeploys.size() == 0 -return true; diff --git a/src/it/external-release-jar/setup.bsh b/src/it/external-release-jar/setup.bsh deleted file mode 100644 index 5f69d96..0000000 --- a/src/it/external-release-jar/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/erj" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-default-packaging/setup.bsh b/src/it/external-release-jar/setup.groovy similarity index 88% rename from src/it/deploy-default-packaging/setup.bsh rename to src/it/external-release-jar/setup.groovy index c2a9d19..cb31bfe 100644 --- a/src/it/deploy-default-packaging/setup.bsh +++ b/src/it/external-release-jar/setup.groovy @@ -17,10 +17,5 @@ * under the License. */ -import java.io.*; -import java.util.*; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/erj').deleteDir() -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; diff --git a/src/it/gav-validation/setup.bsh b/src/it/gav-validation/setup.bsh deleted file mode 100644 index 90152f0..0000000 --- a/src/it/gav-validation/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/gv" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/gav-validation/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/gav-validation/setup.groovy index c2a9d19..2f2cab7 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/gav-validation/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/gv').deleteDir() diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/mdeploy-45-test/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/mdeploy-45-test/setup.groovy index c2a9d19..71d4f68 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/mdeploy-45-test/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/45').deleteDir() diff --git a/src/it/no-main-artifact-1/setup.bsh b/src/it/no-main-artifact-1/setup.bsh deleted file mode 100644 index dcdb7b4..0000000 --- a/src/it/no-main-artifact-1/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/nma1" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/no-main-artifact-1/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/no-main-artifact-1/setup.groovy index c2a9d19..1380370 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/no-main-artifact-1/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/nma1').deleteDir() diff --git a/src/it/no-main-artifact-2/setup.bsh b/src/it/no-main-artifact-2/setup.bsh deleted file mode 100644 index 34b9183..0000000 --- a/src/it/no-main-artifact-2/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/nma2" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/no-main-artifact-2/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/no-main-artifact-2/setup.groovy index c2a9d19..0da4972 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/no-main-artifact-2/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/nma2').deleteDir() diff --git a/src/it/non-default-pom/setup.bsh b/src/it/non-default-pom/setup.bsh deleted file mode 100644 index 3e47a74..0000000 --- a/src/it/non-default-pom/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/ndp" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/non-default-pom/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/non-default-pom/setup.groovy index c2a9d19..5cae918 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/non-default-pom/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/ndp').deleteDir() diff --git a/src/it/offline/setup.bsh b/src/it/offline/setup.bsh deleted file mode 100644 index 979af0e..0000000 --- a/src/it/offline/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/om" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/offline/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/offline/setup.groovy index c2a9d19..3297c59 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/offline/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/om').deleteDir() diff --git a/src/it/release-jar/setup.bsh b/src/it/release-jar/setup.bsh deleted file mode 100644 index d3bb122..0000000 --- a/src/it/release-jar/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/rj" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/release-jar/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/release-jar/setup.groovy index c2a9d19..ace45dd 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/release-jar/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/rj').deleteDir() diff --git a/src/it/release-pom/setup.bsh b/src/it/release-pom/setup.bsh deleted file mode 100644 index e8e3dfb..0000000 --- a/src/it/release-pom/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/rp" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/release-pom/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/release-pom/setup.groovy index c2a9d19..36c5d49 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/release-pom/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/rp').deleteDir() diff --git a/src/it/skip-release-jar/setup.bsh b/src/it/skip-release-jar/setup.bsh deleted file mode 100644 index bb1b4e8..0000000 --- a/src/it/skip-release-jar/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/srj" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/skip-release-jar/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/skip-release-jar/setup.groovy index c2a9d19..c038f5c 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/skip-release-jar/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/srj').deleteDir() diff --git a/src/it/skip-snapshot-jar/setup.bsh b/src/it/skip-snapshot-jar/setup.bsh deleted file mode 100644 index f35751b..0000000 --- a/src/it/skip-snapshot-jar/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/ssj" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/skip-snapshot-jar/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/skip-snapshot-jar/setup.groovy index c2a9d19..bdd26cf 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/skip-snapshot-jar/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/ssj').deleteDir() diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/skip/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/skip/setup.groovy index c2a9d19..21ab3a3 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/skip/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/skip').deleteDir() diff --git a/src/it/snapshot-jar/setup.bsh b/src/it/snapshot-jar/setup.bsh deleted file mode 100644 index fae73ff..0000000 --- a/src/it/snapshot-jar/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/sj" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/snapshot-jar/setup.groovy similarity index 87% copy from src/it/deploy-attached-sources/setup.bsh copy to src/it/snapshot-jar/setup.groovy index c2a9d19..54c8061 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/snapshot-jar/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/sj').deleteDir() diff --git a/src/it/snapshot-pom/setup.bsh b/src/it/snapshot-pom/setup.bsh deleted file mode 100644 index 37c17e7..0000000 --- a/src/it/snapshot-pom/setup.bsh +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.util.*; - -import org.codehaus.plexus.util.*; - -File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/sp" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -file = new File( basedir, "target/repo" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/deploy-attached-sources/setup.bsh b/src/it/snapshot-pom/setup.groovy similarity index 87% rename from src/it/deploy-attached-sources/setup.bsh rename to src/it/snapshot-pom/setup.groovy index c2a9d19..0a996d5 100644 --- a/src/it/deploy-attached-sources/setup.bsh +++ b/src/it/snapshot-pom/setup.groovy @@ -17,10 +17,4 @@ * under the License. */ -import java.io.*; -import java.util.*; - -file = new File( basedir, "target/repo" ); -file.mkdirs(); - -return true; +assert new File(localRepositoryPath, 'org/apache/maven/its/deploy/sp').deleteDir() diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java index 572d8e4..b1083cb 100644 --- a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java @@ -26,7 +26,6 @@ import java.util.Objects; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Model; import org.apache.maven.plugin.testing.AbstractMojoTestCase; -import org.apache.maven.project.ProjectBuildingRequest; import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.internal.impl.DefaultLocalPathComposer; import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; @@ -35,7 +34,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** @@ -50,6 +48,8 @@ public class DeployFileMojoTest extends AbstractMojoTestCase { private File remoteRepo; + private AutoCloseable openMocks; + @Mock private MavenSession session; @@ -66,6 +66,14 @@ public class DeployFileMojoTest extends AbstractMojoTestCase { } } + @Override + public void tearDown() throws Exception { + super.tearDown(); + if (openMocks != null) { + openMocks.close(); + } + } + public void testDeployTestEnvironment() throws Exception { File testPom = new File(getBasedir(), "target/test-classes/unit/deploy-file-test/plugin-config.xml"); @@ -79,18 +87,14 @@ public class DeployFileMojoTest extends AbstractMojoTestCase { mojo = (DeployFileMojo) lookupMojo("deploy-file", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(buildingRequest.getRepositoryMerging()).thenReturn(ProjectBuildingRequest.RepositoryMerging.POM_DOMINANT); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); String groupId = (String) getVariableValueFromObject(mojo, "groupId"); @@ -188,18 +192,14 @@ public class DeployFileMojoTest extends AbstractMojoTestCase { mojo = (DeployFileMojo) lookupMojo("deploy-file", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(buildingRequest.getRepositoryMerging()).thenReturn(ProjectBuildingRequest.RepositoryMerging.POM_DOMINANT); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); String classifier = (String) getVariableValueFromObject(mojo, "classifier"); @@ -243,18 +243,14 @@ public class DeployFileMojoTest extends AbstractMojoTestCase { mojo = (DeployFileMojo) lookupMojo("deploy-file", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(buildingRequest.getRepositoryMerging()).thenReturn(ProjectBuildingRequest.RepositoryMerging.POM_DOMINANT); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); String groupId = (String) getVariableValueFromObject(mojo, "groupId"); diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java index 5884ae1..52964cc 100644 --- a/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java @@ -34,7 +34,6 @@ import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.plugins.deploy.stubs.ArtifactRepositoryStub; import org.apache.maven.plugins.deploy.stubs.DeployArtifactStub; import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuildingRequest; import org.codehaus.plexus.util.FileUtils; import org.eclipse.aether.DefaultRepositorySystemSession; import org.eclipse.aether.RepositorySystem; @@ -66,6 +65,8 @@ public class DeployMojoTest extends AbstractMojoTestCase { final MavenProjectStub project = new MavenProjectStub(); + private AutoCloseable openMocks; + private MavenSession session; @InjectMocks @@ -104,12 +105,16 @@ public class DeployMojoTest extends AbstractMojoTestCase { if (remoteRepo.exists()) { // FileUtils.deleteDirectory( remoteRepo ); } + + if (openMocks != null) { + openMocks.close(); + } } public void testDeployTestEnvironment() throws Exception { File testPom = new File(getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml"); - DeployMojo mojo = (DeployMojo) lookupMojo("deploy", testPom); + mojo = (DeployMojo) lookupMojo("deploy", testPom); assertNotNull(mojo); } @@ -119,17 +124,14 @@ public class DeployMojoTest extends AbstractMojoTestCase { mojo = (DeployMojo) lookupMojo("deploy", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); File file = new File( @@ -238,7 +240,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { public void testSkippingDeploy() throws Exception { File testPom = new File(getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml"); - DeployMojo mojo = (DeployMojo) lookupMojo("deploy", testPom); + mojo = (DeployMojo) lookupMojo("deploy", testPom); assertNotNull(mojo); @@ -296,17 +298,14 @@ public class DeployMojoTest extends AbstractMojoTestCase { mojo = (DeployMojo) lookupMojo("deploy", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); File pomFile = new File( @@ -372,17 +371,14 @@ public class DeployMojoTest extends AbstractMojoTestCase { mojo = (DeployMojo) lookupMojo("deploy", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); File pomFile = new File( @@ -446,12 +442,9 @@ public class DeployMojoTest extends AbstractMojoTestCase { public void testDeployIfArtifactFileIsNull() throws Exception { File testPom = new File(getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml"); - DeployMojo mojo = (DeployMojo) lookupMojo("deploy", testPom); - - MockitoAnnotations.initMocks(this); + mojo = (DeployMojo) lookupMojo("deploy", testPom); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); + openMocks = MockitoAnnotations.openMocks(this); setVariableValueToObject(mojo, "session", session); @@ -485,12 +478,9 @@ public class DeployMojoTest extends AbstractMojoTestCase { public void testDeployIfProjectFileIsNull() throws Exception { File testPom = new File(getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml"); - DeployMojo mojo = (DeployMojo) lookupMojo("deploy", testPom); - - MockitoAnnotations.initMocks(this); + mojo = (DeployMojo) lookupMojo("deploy", testPom); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); + openMocks = MockitoAnnotations.openMocks(this); setVariableValueToObject(mojo, "session", session); @@ -522,17 +512,14 @@ public class DeployMojoTest extends AbstractMojoTestCase { mojo = (DeployMojo) lookupMojo("deploy", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory(new DefaultLocalPathComposer()) .newInstance(repositorySession, new LocalRepository(LOCAL_REPO))); - when(buildingRequest.getRepositorySession()).thenReturn(repositorySession); when(session.getRepositorySession()).thenReturn(repositorySession); MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project"); @@ -613,13 +600,10 @@ public class DeployMojoTest extends AbstractMojoTestCase { mojo = (DeployMojo) lookupMojo("deploy", testPom); - MockitoAnnotations.initMocks(this); + openMocks = MockitoAnnotations.openMocks(this); assertNotNull(mojo); - ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class); - when(session.getProjectBuildingRequest()).thenReturn(buildingRequest); - MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project"); project.setGroupId("org.apache.maven.test"); project.setArtifactId("maven-deploy-test"); @@ -708,7 +692,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testLegacyAltDeploymentRepositoryWithDefaultLayout() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session); @@ -723,7 +707,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testLegacyAltDeploymentRepositoryWithLegacyLayout() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session); @@ -742,7 +726,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testInsaneAltDeploymentRepository() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session); @@ -763,7 +747,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testDefaultScmSvnAltDeploymentRepository() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session); @@ -779,7 +763,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testLegacyScmSvnAltDeploymentRepository() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject( @@ -799,7 +783,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testAltSnapshotDeploymentRepository() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session); @@ -814,7 +798,7 @@ public class DeployMojoTest extends AbstractMojoTestCase { } public void testAltReleaseDeploymentRepository() throws Exception { - DeployMojo mojo = new DeployMojo(); + mojo = new DeployMojo(); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session);
