This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch maven-install-plugin-4.x in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
commit 1ace7302abdad3a7f0965f166ed2d839eea837cc Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Sat Nov 21 13:54:07 2026 +0100 Move deterministic ITs to JUnit 5 unit tests and rename remaining ITs (4.x) Part of #497 --- src/it/attach-jar-checksum/pom.xml | 80 -------- src/it/attach-jar-checksum/setup.groovy | 29 --- src/it/attach-jar-checksum/verify.groovy | 66 ------ src/it/gav-validation/invoker.properties | 22 -- src/it/gav-validation/pom.xml | 46 ----- src/it/gav-validation/setup.groovy | 29 --- src/it/gav-validation/test-invalid.properties | 24 --- src/it/gav-validation/test-missing.properties | 22 -- src/it/gav-validation/test.jar | Bin 345 -> 0 bytes src/it/gav-validation/verify.groovy | 35 ---- src/it/generate-pom-auto-1/pom.xml | 40 ---- src/it/generate-pom-auto-1/setup.groovy | 29 --- src/it/generate-pom-auto-1/test.jar | Bin 345 -> 0 bytes src/it/generate-pom-auto-1/test.properties | 22 -- src/it/generate-pom-auto-1/verify.groovy | 45 ----- src/it/generate-pom-auto-2/invoker.properties | 18 -- src/it/generate-pom-auto-2/pom.xml | 40 ---- src/it/generate-pom-auto-2/setup.groovy | 34 ---- src/it/generate-pom-auto-2/test.jar | Bin 345 -> 0 bytes src/it/generate-pom-auto-2/test.properties | 22 -- src/it/generate-pom-auto-2/verify.groovy | 48 ----- .../invoker.properties | 0 .../module1/pom.xml | 0 .../pom.xml | 0 .../test.properties | 0 .../verify.groovy | 0 .../invoker.properties | 0 .../module-phase-none/pom.xml | 0 .../module-skip-true/pom.xml | 0 .../pom.xml | 0 .../verify.groovy | 0 .../invoker.properties | 0 .../pom.xml | 0 .../test.properties | 0 .../verify.groovy | 0 .../invoker.properties | 0 .../pom.xml | 0 .../setup.groovy | 4 +- .../test-0.1.jar | Bin .../test-0.1.pom | 0 .../test.properties | 0 .../verify.groovy | 0 .../invoker.properties | 0 .../invoker.properties | 0 .../module1/external-module1-1.0.jar | Bin .../module1/pom.xml | 0 .../module2/external-module2-1.0.jar | Bin .../module2/pom.xml | 0 .../pom.xml | 0 .../setup.groovy | 0 .../verify.groovy | 0 .../invoker.properties | 18 -- .../pom.xml | 41 ---- .../setup.groovy | 29 --- .../test.jar | Bin 345 -> 0 bytes .../test.properties | 24 --- .../verify.groovy | 58 ------ .../invoker.properties | 18 -- src/it/local-repo-override-with-checksum/pom.xml | 41 ---- .../local-repo-override-with-checksum/setup.groovy | 29 --- src/it/local-repo-override-with-checksum/test.jar | Bin 345 -> 0 bytes .../test.properties | 23 --- .../verify.groovy | 55 ----- src/it/minstall-55/invoker.properties | 18 -- src/it/no-main-artifact-1/invoker.properties | 17 -- src/it/no-main-artifact-1/pom.xml | 96 --------- src/it/no-main-artifact-1/setup.groovy | 29 --- src/it/no-main-artifact-1/verify.groovy | 23 --- src/it/no-main-artifact-2/invoker.properties | 17 -- src/it/no-main-artifact-2/pom.xml | 95 --------- src/it/no-main-artifact-2/setup.groovy | 29 --- src/it/no-main-artifact-2/verify.groovy | 23 --- .../invoker.properties | 0 .../module1/pom.xml | 0 .../module2/pom.xml | 0 .../pom.xml | 0 .../verify.groovy | 0 .../module1/pom.xml | 0 .../module2/pom.xml | 0 src/it/{MINSTALL-99 => per-project-config}/pom.xml | 0 .../verify.groovy | 0 src/it/pom-checksum/pom.xml | 59 ------ src/it/pom-checksum/setup.groovy | 29 --- src/it/pom-checksum/verify.groovy | 57 ------ src/it/skip-install/pom.xml | 67 ------ src/it/skip-install/setup.groovy | 29 --- src/it/skip-install/verify.groovy | 40 ---- .../maven/plugins/install/InstallFileMojoTest.java | 225 +++++++++++++++++++++ .../install/InstallMojoPomPackagingTest.java | 38 ++++ .../maven/plugins/install/InstallMojoTest.java | 100 +++++++++ 90 files changed, 364 insertions(+), 1618 deletions(-) diff --git a/src/it/attach-jar-checksum/pom.xml b/src/it/attach-jar-checksum/pom.xml deleted file mode 100644 index d11deeb..0000000 --- a/src/it/attach-jar-checksum/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.ajc</groupId> - <artifactId>test</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>jar</packaging> - - <description>Tests the installation of a simple snapshot JAR with an attached artifact and checksums</description> - - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>@version.maven-compiler-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>@version.maven-jar-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>@version.maven-resources-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <version>@version.maven-source-plugin@</version> - <configuration> - <forceCreation>true</forceCreation> - </configuration> - <executions> - <execution> - <id>attach-sources</id> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>@version.maven-surefire@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/attach-jar-checksum/setup.groovy b/src/it/attach-jar-checksum/setup.groovy deleted file mode 100644 index 9c52da8..0000000 --- a/src/it/attach-jar-checksum/setup.groovy +++ /dev/null @@ -1,29 +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/install/ajc" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/attach-jar-checksum/verify.groovy b/src/it/attach-jar-checksum/verify.groovy deleted file mode 100644 index 66b7d95..0000000 --- a/src/it/attach-jar-checksum/verify.groovy +++ /dev/null @@ -1,66 +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.*; - -String[] paths = -[ - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/maven-metadata-local.xml", - "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml", -]; - -String[] pathsWhichShouldNotExist = -[ - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.md5", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.sha1", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar.md5", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar.sha1", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar.md5", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar.sha1", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/maven-metadata-local.xml.md5", - "org/apache/maven/its/install/ajc/test/1.0-SNAPSHOT/maven-metadata-local.xml.sha1", - "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml.md5", - "org/apache/maven/its/install/ajc/test/maven-metadata-local.xml.sha1", -]; - -for ( String path : paths ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for existence of " + file ); - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() ); - } -} - -for ( String path : pathsWhichShouldNotExist ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for existence of " + file ); - if ( file.isFile() ) - { - throw new IOException( "Existing: " + file.getAbsolutePath() ); - } -} - -return true; diff --git a/src/it/gav-validation/invoker.properties b/src/it/gav-validation/invoker.properties deleted file mode 100644 index 70d43e4..0000000 --- a/src/it/gav-validation/invoker.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file -invoker.buildResult = failure - -invoker.userPropertiesFile.1 = test-invalid.properties -invoker.userPropertiesFile.2 = test-missing.properties diff --git a/src/it/gav-validation/pom.xml b/src/it/gav-validation/pom.xml deleted file mode 100644 index 3bd9b07..0000000 --- a/src/it/gav-validation/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.gv</groupId> - <artifactId>test</artifactId> - <version>1.0</version> - <packaging>jar</packaging> - - <description>Tests the manual installation validates the coordinates of the artifact just like the model validator would - (MINSTALL-59).</description> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-invoker-plugin</artifactId> - <version>@version.maven-invoker-plugin@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/gav-validation/setup.groovy b/src/it/gav-validation/setup.groovy deleted file mode 100644 index e9f32a3..0000000 --- a/src/it/gav-validation/setup.groovy +++ /dev/null @@ -1,29 +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/install/gv" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/gav-validation/test-invalid.properties b/src/it/gav-validation/test-invalid.properties deleted file mode 100644 index 679878f..0000000 --- a/src/it/gav-validation/test-invalid.properties +++ /dev/null @@ -1,24 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -file = test.jar -packaging = jar - -# using invalid coordinates should have install-file bail out -groupId = invalid~group -artifactId = invalid/artifactId -version = 1+ diff --git a/src/it/gav-validation/test-missing.properties b/src/it/gav-validation/test-missing.properties deleted file mode 100644 index 6efaf08..0000000 --- a/src/it/gav-validation/test-missing.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -file = test.jar -packaging = jar - -# missing coordinates should have install-file bail out -groupId = groupId diff --git a/src/it/gav-validation/test.jar b/src/it/gav-validation/test.jar deleted file mode 100644 index 226277c..0000000 Binary files a/src/it/gav-validation/test.jar and /dev/null differ diff --git a/src/it/gav-validation/verify.groovy b/src/it/gav-validation/verify.groovy deleted file mode 100644 index f006b22..0000000 --- a/src/it/gav-validation/verify.groovy +++ /dev/null @@ -1,35 +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. - */ - -String[] paths = -[ - "org/apache/maven/its/install/gv", -]; - -for ( String path : paths ) -{ - assert !new File( localRepositoryPath, path ).exists(); -} - -File buildLog = new File( basedir, 'build.log' ) -assert buildLog.exists() -assert buildLog.text.contains( "The artifact information is incomplete" ) -assert buildLog.text.contains( "The artifact information is not valid" ) - -return true; diff --git a/src/it/generate-pom-auto-1/pom.xml b/src/it/generate-pom-auto-1/pom.xml deleted file mode 100644 index b3904c2..0000000 --- a/src/it/generate-pom-auto-1/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.gpa1</groupId> - <artifactId>test</artifactId> - <version>1.0</version> - <packaging>jar</packaging> - - <description>Tests that by default a POM is generated for the installed file if no POM exists already in the local repo.</description> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/generate-pom-auto-1/setup.groovy b/src/it/generate-pom-auto-1/setup.groovy deleted file mode 100644 index 2337e4f..0000000 --- a/src/it/generate-pom-auto-1/setup.groovy +++ /dev/null @@ -1,29 +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/install/gpa1" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/generate-pom-auto-1/test.jar b/src/it/generate-pom-auto-1/test.jar deleted file mode 100644 index 226277c..0000000 Binary files a/src/it/generate-pom-auto-1/test.jar and /dev/null differ diff --git a/src/it/generate-pom-auto-1/test.properties b/src/it/generate-pom-auto-1/test.properties deleted file mode 100644 index bfe720e..0000000 --- a/src/it/generate-pom-auto-1/test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -file = test.jar -groupId = org.apache.maven.its.install.gpa1 -artifactId = test -version = 0.1 -packaging = jar diff --git a/src/it/generate-pom-auto-1/verify.groovy b/src/it/generate-pom-auto-1/verify.groovy deleted file mode 100644 index 5fe13bb..0000000 --- a/src/it/generate-pom-auto-1/verify.groovy +++ /dev/null @@ -1,45 +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.*; - -String[] paths = -[ - "org/apache/maven/its/install/gpa1/test/maven-metadata-local.xml", - "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.jar", - "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.pom", -]; - -Set cksumToCheckPaths = new HashSet( Arrays.asList( [ - "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.jar", - "org/apache/maven/its/install/gpa1/test/0.1/test-0.1.pom", -] as String[] ) ); - -for ( String path : paths ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for existence of " + file ); - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() ); - } -} - -return true; diff --git a/src/it/generate-pom-auto-2/invoker.properties b/src/it/generate-pom-auto-2/invoker.properties deleted file mode 100644 index 0413238..0000000 --- a/src/it/generate-pom-auto-2/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file diff --git a/src/it/generate-pom-auto-2/pom.xml b/src/it/generate-pom-auto-2/pom.xml deleted file mode 100644 index 9512c9a..0000000 --- a/src/it/generate-pom-auto-2/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.gpa2</groupId> - <artifactId>test</artifactId> - <version>1.0</version> - <packaging>jar</packaging> - - <description>Tests that by default no POM is generated for the installed file if already a POM exists in the local repo.</description> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/generate-pom-auto-2/setup.groovy b/src/it/generate-pom-auto-2/setup.groovy deleted file mode 100644 index 635aae6..0000000 --- a/src/it/generate-pom-auto-2/setup.groovy +++ /dev/null @@ -1,34 +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 groupDir = new File( localRepositoryPath, "org/apache/maven/its/install/gpa2" ); -System.out.println( "Deleting " + groupDir ); -FileUtils.deleteDirectory( groupDir ); - -File pomFile = new File( localRepositoryPath, "org/apache/maven/its/install/gpa2/test/0.1/test-0.1.pom" ); -System.out.println( "Writing " + pomFile ); -pomFile.getParentFile().mkdirs(); -FileUtils.fileWrite( pomFile.getPath(), "UTF-8", "test" ); - -return true; diff --git a/src/it/generate-pom-auto-2/test.jar b/src/it/generate-pom-auto-2/test.jar deleted file mode 100644 index 226277c..0000000 Binary files a/src/it/generate-pom-auto-2/test.jar and /dev/null differ diff --git a/src/it/generate-pom-auto-2/test.properties b/src/it/generate-pom-auto-2/test.properties deleted file mode 100644 index d96c4f3..0000000 --- a/src/it/generate-pom-auto-2/test.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -file = test.jar -groupId = org.apache.maven.its.install.gpa2 -artifactId = test -version = 0.1 -packaging = jar diff --git a/src/it/generate-pom-auto-2/verify.groovy b/src/it/generate-pom-auto-2/verify.groovy deleted file mode 100644 index 39f2b4b..0000000 --- a/src/it/generate-pom-auto-2/verify.groovy +++ /dev/null @@ -1,48 +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.*; - -String[] paths = -[ - "org/apache/maven/its/install/gpa2/test/maven-metadata-local.xml", - "org/apache/maven/its/install/gpa2/test/0.1/test-0.1.jar", - "org/apache/maven/its/install/gpa2/test/0.1/test-0.1.pom", -]; - -for ( String path : paths ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for existence of " + file ); - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() ); - } - if ( path.endsWith( ".pom" ) ) - { - System.out.println( "Checking for original state of " + file ); - if ( file.length() != "test".length() ) - { - throw new Exception( "Overwritten: " + file.getAbsolutePath() ); - } - } -} - -return true; diff --git a/src/it/MINSTALL-108/invoker.properties b/src/it/install-at-end-default/invoker.properties similarity index 100% rename from src/it/MINSTALL-108/invoker.properties rename to src/it/install-at-end-default/invoker.properties diff --git a/src/it/MINSTALL-108/module1/pom.xml b/src/it/install-at-end-default/module1/pom.xml similarity index 100% rename from src/it/MINSTALL-108/module1/pom.xml rename to src/it/install-at-end-default/module1/pom.xml diff --git a/src/it/MINSTALL-108/pom.xml b/src/it/install-at-end-default/pom.xml similarity index 100% rename from src/it/MINSTALL-108/pom.xml rename to src/it/install-at-end-default/pom.xml diff --git a/src/it/MINSTALL-108/test.properties b/src/it/install-at-end-default/test.properties similarity index 100% rename from src/it/MINSTALL-108/test.properties rename to src/it/install-at-end-default/test.properties diff --git a/src/it/MINSTALL-108/verify.groovy b/src/it/install-at-end-default/verify.groovy similarity index 100% rename from src/it/MINSTALL-108/verify.groovy rename to src/it/install-at-end-default/verify.groovy diff --git a/src/it/MINSTALL-206/invoker.properties b/src/it/install-at-end-phase-and-skip/invoker.properties similarity index 100% rename from src/it/MINSTALL-206/invoker.properties rename to src/it/install-at-end-phase-and-skip/invoker.properties diff --git a/src/it/MINSTALL-206/module-phase-none/pom.xml b/src/it/install-at-end-phase-and-skip/module-phase-none/pom.xml similarity index 100% rename from src/it/MINSTALL-206/module-phase-none/pom.xml rename to src/it/install-at-end-phase-and-skip/module-phase-none/pom.xml diff --git a/src/it/MINSTALL-206/module-skip-true/pom.xml b/src/it/install-at-end-phase-and-skip/module-skip-true/pom.xml similarity index 100% rename from src/it/MINSTALL-206/module-skip-true/pom.xml rename to src/it/install-at-end-phase-and-skip/module-skip-true/pom.xml diff --git a/src/it/MINSTALL-206/pom.xml b/src/it/install-at-end-phase-and-skip/pom.xml similarity index 100% rename from src/it/MINSTALL-206/pom.xml rename to src/it/install-at-end-phase-and-skip/pom.xml diff --git a/src/it/MINSTALL-206/verify.groovy b/src/it/install-at-end-phase-and-skip/verify.groovy similarity index 100% rename from src/it/MINSTALL-206/verify.groovy rename to src/it/install-at-end-phase-and-skip/verify.groovy diff --git a/src/it/MINSTALL-52/invoker.properties b/src/it/install-file-embedded-pom/invoker.properties similarity index 100% rename from src/it/MINSTALL-52/invoker.properties rename to src/it/install-file-embedded-pom/invoker.properties diff --git a/src/it/MINSTALL-52/pom.xml b/src/it/install-file-embedded-pom/pom.xml similarity index 100% rename from src/it/MINSTALL-52/pom.xml rename to src/it/install-file-embedded-pom/pom.xml diff --git a/src/it/MINSTALL-52/test.properties b/src/it/install-file-embedded-pom/test.properties similarity index 100% rename from src/it/MINSTALL-52/test.properties rename to src/it/install-file-embedded-pom/test.properties diff --git a/src/it/MINSTALL-52/verify.groovy b/src/it/install-file-embedded-pom/verify.groovy similarity index 100% rename from src/it/MINSTALL-52/verify.groovy rename to src/it/install-file-embedded-pom/verify.groovy diff --git a/src/it/generate-pom-auto-1/invoker.properties b/src/it/install-file-generated-pom/invoker.properties similarity index 100% rename from src/it/generate-pom-auto-1/invoker.properties rename to src/it/install-file-generated-pom/invoker.properties diff --git a/src/it/minstall-55/pom.xml b/src/it/install-file-generated-pom/pom.xml similarity index 100% rename from src/it/minstall-55/pom.xml rename to src/it/install-file-generated-pom/pom.xml diff --git a/src/it/minstall-55/setup.groovy b/src/it/install-file-generated-pom/setup.groovy similarity index 93% rename from src/it/minstall-55/setup.groovy rename to src/it/install-file-generated-pom/setup.groovy index 149dbca..e04174d 100644 --- a/src/it/minstall-55/setup.groovy +++ b/src/it/install-file-generated-pom/setup.groovy @@ -20,10 +20,8 @@ import java.io.*; import java.util.*; -import org.codehaus.plexus.util.*; - File file = new File( localRepositoryPath, "org/apache/maven/its/install/55" ); System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); +file.deleteDir(); return true; diff --git a/src/it/minstall-55/test-0.1.jar b/src/it/install-file-generated-pom/test-0.1.jar similarity index 100% rename from src/it/minstall-55/test-0.1.jar rename to src/it/install-file-generated-pom/test-0.1.jar diff --git a/src/it/minstall-55/test-0.1.pom b/src/it/install-file-generated-pom/test-0.1.pom similarity index 100% rename from src/it/minstall-55/test-0.1.pom rename to src/it/install-file-generated-pom/test-0.1.pom diff --git a/src/it/minstall-55/test.properties b/src/it/install-file-generated-pom/test.properties similarity index 100% rename from src/it/minstall-55/test.properties rename to src/it/install-file-generated-pom/test.properties diff --git a/src/it/minstall-55/verify.groovy b/src/it/install-file-generated-pom/verify.groovy similarity index 100% rename from src/it/minstall-55/verify.groovy rename to src/it/install-file-generated-pom/verify.groovy diff --git a/src/it/MINSTALL-87/invoker.properties b/src/it/install-file-missing-file/invoker.properties similarity index 100% rename from src/it/MINSTALL-87/invoker.properties rename to src/it/install-file-missing-file/invoker.properties diff --git a/src/it/MINSTALL-205/invoker.properties b/src/it/install-file-parallel/invoker.properties similarity index 100% rename from src/it/MINSTALL-205/invoker.properties rename to src/it/install-file-parallel/invoker.properties diff --git a/src/it/MINSTALL-205/module1/external-module1-1.0.jar b/src/it/install-file-parallel/module1/external-module1-1.0.jar similarity index 100% rename from src/it/MINSTALL-205/module1/external-module1-1.0.jar rename to src/it/install-file-parallel/module1/external-module1-1.0.jar diff --git a/src/it/MINSTALL-205/module1/pom.xml b/src/it/install-file-parallel/module1/pom.xml similarity index 100% rename from src/it/MINSTALL-205/module1/pom.xml rename to src/it/install-file-parallel/module1/pom.xml diff --git a/src/it/MINSTALL-205/module2/external-module2-1.0.jar b/src/it/install-file-parallel/module2/external-module2-1.0.jar similarity index 100% rename from src/it/MINSTALL-205/module2/external-module2-1.0.jar rename to src/it/install-file-parallel/module2/external-module2-1.0.jar diff --git a/src/it/MINSTALL-205/module2/pom.xml b/src/it/install-file-parallel/module2/pom.xml similarity index 100% rename from src/it/MINSTALL-205/module2/pom.xml rename to src/it/install-file-parallel/module2/pom.xml diff --git a/src/it/MINSTALL-205/pom.xml b/src/it/install-file-parallel/pom.xml similarity index 100% rename from src/it/MINSTALL-205/pom.xml rename to src/it/install-file-parallel/pom.xml diff --git a/src/it/MINSTALL-205/setup.groovy b/src/it/install-file-parallel/setup.groovy similarity index 100% rename from src/it/MINSTALL-205/setup.groovy rename to src/it/install-file-parallel/setup.groovy diff --git a/src/it/MINSTALL-205/verify.groovy b/src/it/install-file-parallel/verify.groovy similarity index 100% rename from src/it/MINSTALL-205/verify.groovy rename to src/it/install-file-parallel/verify.groovy diff --git a/src/it/local-repo-override-with-checksum-generatePom/invoker.properties b/src/it/local-repo-override-with-checksum-generatePom/invoker.properties deleted file mode 100644 index 0413238..0000000 --- a/src/it/local-repo-override-with-checksum-generatePom/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file diff --git a/src/it/local-repo-override-with-checksum-generatePom/pom.xml b/src/it/local-repo-override-with-checksum-generatePom/pom.xml deleted file mode 100644 index 5ff1695..0000000 --- a/src/it/local-repo-override-with-checksum-generatePom/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.lro</groupId> - <artifactId>test</artifactId> - <version>1.0</version> - <packaging>jar</packaging> - - <description>Tests the manual installation into a different local repo than the one configured in the settings - (MINSTALL-35), also installing checksums.</description> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/local-repo-override-with-checksum-generatePom/setup.groovy b/src/it/local-repo-override-with-checksum-generatePom/setup.groovy deleted file mode 100644 index d37913a..0000000 --- a/src/it/local-repo-override-with-checksum-generatePom/setup.groovy +++ /dev/null @@ -1,29 +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( basedir, "target" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/local-repo-override-with-checksum-generatePom/test.jar b/src/it/local-repo-override-with-checksum-generatePom/test.jar deleted file mode 100644 index 226277c..0000000 Binary files a/src/it/local-repo-override-with-checksum-generatePom/test.jar and /dev/null differ diff --git a/src/it/local-repo-override-with-checksum-generatePom/test.properties b/src/it/local-repo-override-with-checksum-generatePom/test.properties deleted file mode 100644 index d796040..0000000 --- a/src/it/local-repo-override-with-checksum-generatePom/test.properties +++ /dev/null @@ -1,24 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -file = test.jar -groupId = gid -artifactId = test -version = 0.1 -packaging = jar -generatePom = true -localRepositoryPath = target/local-repo diff --git a/src/it/local-repo-override-with-checksum-generatePom/verify.groovy b/src/it/local-repo-override-with-checksum-generatePom/verify.groovy deleted file mode 100644 index 6e913c6..0000000 --- a/src/it/local-repo-override-with-checksum-generatePom/verify.groovy +++ /dev/null @@ -1,58 +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 java.lang.*; - -String[] paths = -[ - "gid/test/0.1/test-0.1.jar", - "gid/test/0.1/test-0.1.pom", -]; - -String[] pathsWhichShouldNotExist = -[ - "gid/test/0.1/test-0.1.jar.md5", - "gid/test/0.1/test-0.1.jar.sha1", - "gid/test/0.1/test-0.1.pom.md5", - "gid/test/0.1/test-0.1.pom.sha1", -]; - -for ( String path : paths ) -{ - File file = new File( new File( basedir, "target/local-repo" ), path ); - System.out.println( "Checking for existence of " + file ); - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Existing: " + file.getAbsolutePath() ); - } -} - -for ( String path : pathsWhichShouldNotExist ) -{ - File file = new File( new File( basedir, "target/local-repo" ), path ); - System.out.println( "Checking for non existence of " + file ); - if ( file.isFile() ) - { - throw new IOException( "Existing: " + file.getAbsolutePath() ); - } -} - -return true; diff --git a/src/it/local-repo-override-with-checksum/invoker.properties b/src/it/local-repo-override-with-checksum/invoker.properties deleted file mode 100644 index 0413238..0000000 --- a/src/it/local-repo-override-with-checksum/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file diff --git a/src/it/local-repo-override-with-checksum/pom.xml b/src/it/local-repo-override-with-checksum/pom.xml deleted file mode 100644 index 5ff1695..0000000 --- a/src/it/local-repo-override-with-checksum/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.lro</groupId> - <artifactId>test</artifactId> - <version>1.0</version> - <packaging>jar</packaging> - - <description>Tests the manual installation into a different local repo than the one configured in the settings - (MINSTALL-35), also installing checksums.</description> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/local-repo-override-with-checksum/setup.groovy b/src/it/local-repo-override-with-checksum/setup.groovy deleted file mode 100644 index d37913a..0000000 --- a/src/it/local-repo-override-with-checksum/setup.groovy +++ /dev/null @@ -1,29 +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( basedir, "target" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/local-repo-override-with-checksum/test.jar b/src/it/local-repo-override-with-checksum/test.jar deleted file mode 100644 index 226277c..0000000 Binary files a/src/it/local-repo-override-with-checksum/test.jar and /dev/null differ diff --git a/src/it/local-repo-override-with-checksum/test.properties b/src/it/local-repo-override-with-checksum/test.properties deleted file mode 100644 index cd619e3..0000000 --- a/src/it/local-repo-override-with-checksum/test.properties +++ /dev/null @@ -1,23 +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. - -file = test.jar -groupId = gid -artifactId = test -version = 0.1 -packaging = jar -localRepositoryPath = target/local-repo diff --git a/src/it/local-repo-override-with-checksum/verify.groovy b/src/it/local-repo-override-with-checksum/verify.groovy deleted file mode 100644 index 75a5001..0000000 --- a/src/it/local-repo-override-with-checksum/verify.groovy +++ /dev/null @@ -1,55 +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 java.lang.*; - -String[] paths = -[ - "gid/test/0.1/test-0.1.jar", -]; - -String[] pathsWhichAreNotAllowedToBeThere = -[ - "gid/test/0.1/test-0.1.jar.md5", - "gid/test/0.1/test-0.1.jar.sha1", -]; - -for ( String path : pathsWhichAreNotAllowedToBeThere ) -{ - File file = new File( new File( basedir, "target/local-repo" ), path ); - System.out.println( "Checking for existence of " + file ); - if ( file.isFile() ) - { - throw new IOException( "Existing file which should not be there: " + file.getAbsolutePath() ); - } -} - -for ( String path : paths ) -{ - File file = new File( new File( basedir, "target/local-repo" ), path ); - System.out.println( "Checking for non existence of " + file ); - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Existing: " + file.getAbsolutePath() ); - } -} - -return true; diff --git a/src/it/minstall-55/invoker.properties b/src/it/minstall-55/invoker.properties deleted file mode 100644 index 0413238..0000000 --- a/src/it/minstall-55/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file diff --git a/src/it/no-main-artifact-1/invoker.properties b/src/it/no-main-artifact-1/invoker.properties deleted file mode 100644 index e497ae4..0000000 --- a/src/it/no-main-artifact-1/invoker.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -invoker.buildResult=failure \ No newline at end of file diff --git a/src/it/no-main-artifact-1/pom.xml b/src/it/no-main-artifact-1/pom.xml deleted file mode 100644 index ebe37f4..0000000 --- a/src/it/no-main-artifact-1/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.nma1</groupId> - <artifactId>test</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>jar</packaging> - - <description>Tests the installation of a non-POM project that has no main artifact file but only attached artifacts (see - MINSTALL-18, MINSTALL-40, MINSTALL-41). This variant of the test checks the build when target/classes is - non-existent.</description> - - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>@version.maven-antrun-plugin@</version> - <configuration> - <target> - <!-- - NOTE: The Compiler Plugin sets this as the main artifact file, should be non-existent for this test. - --> - <delete dir="target/classes" /> - </target> - </configuration> - <executions> - <execution> - <id>delete-output-dir</id> - <goals> - <goal>run</goal> - </goals> - <phase>verify</phase> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>@version.maven-compiler-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>@version.maven-jar-plugin@</version> - <configuration> - <classifier>it</classifier> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>@version.maven-resources-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>@version.maven-surefire@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-invoker-plugin</artifactId> - <version>@version.maven-invoker-plugin@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/no-main-artifact-1/setup.groovy b/src/it/no-main-artifact-1/setup.groovy deleted file mode 100644 index 8715832..0000000 --- a/src/it/no-main-artifact-1/setup.groovy +++ /dev/null @@ -1,29 +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/install/nma1" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/no-main-artifact-1/verify.groovy b/src/it/no-main-artifact-1/verify.groovy deleted file mode 100644 index 9442aa7..0000000 --- a/src/it/no-main-artifact-1/verify.groovy +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -def buildLog = new File ( basedir, "build.log") - -assert buildLog.text.contains( "The packaging plugin for this project did not assign " - + "a main file to the project but it has attachments. Change packaging to 'pom'." ) \ No newline at end of file diff --git a/src/it/no-main-artifact-2/invoker.properties b/src/it/no-main-artifact-2/invoker.properties deleted file mode 100644 index e497ae4..0000000 --- a/src/it/no-main-artifact-2/invoker.properties +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -invoker.buildResult=failure \ No newline at end of file diff --git a/src/it/no-main-artifact-2/pom.xml b/src/it/no-main-artifact-2/pom.xml deleted file mode 100644 index 203dc2a..0000000 --- a/src/it/no-main-artifact-2/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.nma2</groupId> - <artifactId>test</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>jar</packaging> - - <description>Tests the installation of a non-POM project that has no main artifact file but only attached artifacts (see - MINSTALL-18, MINSTALL-40, MINSTALL-41). This variant of the test checks the build when target/classes is existent.</description> - - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>@version.maven-antrun-plugin@</version> - <configuration> - <target> - <!-- - NOTE: The Compiler Plugin sets this as the main artifact file, should be existent for this test. - --> - <mkdir dir="target/classes" /> - </target> - </configuration> - <executions> - <execution> - <id>make-output-dir</id> - <goals> - <goal>run</goal> - </goals> - <phase>verify</phase> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>@version.maven-compiler-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>@version.maven-jar-plugin@</version> - <configuration> - <classifier>it</classifier> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>@version.maven-resources-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>@version.maven-surefire@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-invoker-plugin</artifactId> - <version>@version.maven-invoker-plugin@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/no-main-artifact-2/setup.groovy b/src/it/no-main-artifact-2/setup.groovy deleted file mode 100644 index 03c64c1..0000000 --- a/src/it/no-main-artifact-2/setup.groovy +++ /dev/null @@ -1,29 +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/install/nma2" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/no-main-artifact-2/verify.groovy b/src/it/no-main-artifact-2/verify.groovy deleted file mode 100644 index 9442aa7..0000000 --- a/src/it/no-main-artifact-2/verify.groovy +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -def buildLog = new File ( basedir, "build.log") - -assert buildLog.text.contains( "The packaging plugin for this project did not assign " - + "a main file to the project but it has attachments. Change packaging to 'pom'." ) \ No newline at end of file diff --git a/src/it/MINSTALL-98/invoker.properties b/src/it/parallel-reactor-install/invoker.properties similarity index 100% rename from src/it/MINSTALL-98/invoker.properties rename to src/it/parallel-reactor-install/invoker.properties diff --git a/src/it/MINSTALL-98/module1/pom.xml b/src/it/parallel-reactor-install/module1/pom.xml similarity index 100% rename from src/it/MINSTALL-98/module1/pom.xml rename to src/it/parallel-reactor-install/module1/pom.xml diff --git a/src/it/MINSTALL-98/module2/pom.xml b/src/it/parallel-reactor-install/module2/pom.xml similarity index 100% rename from src/it/MINSTALL-98/module2/pom.xml rename to src/it/parallel-reactor-install/module2/pom.xml diff --git a/src/it/MINSTALL-98/pom.xml b/src/it/parallel-reactor-install/pom.xml similarity index 100% rename from src/it/MINSTALL-98/pom.xml rename to src/it/parallel-reactor-install/pom.xml diff --git a/src/it/MINSTALL-98/verify.groovy b/src/it/parallel-reactor-install/verify.groovy similarity index 100% rename from src/it/MINSTALL-98/verify.groovy rename to src/it/parallel-reactor-install/verify.groovy diff --git a/src/it/MINSTALL-99/module1/pom.xml b/src/it/per-project-config/module1/pom.xml similarity index 100% rename from src/it/MINSTALL-99/module1/pom.xml rename to src/it/per-project-config/module1/pom.xml diff --git a/src/it/MINSTALL-99/module2/pom.xml b/src/it/per-project-config/module2/pom.xml similarity index 100% rename from src/it/MINSTALL-99/module2/pom.xml rename to src/it/per-project-config/module2/pom.xml diff --git a/src/it/MINSTALL-99/pom.xml b/src/it/per-project-config/pom.xml similarity index 100% rename from src/it/MINSTALL-99/pom.xml rename to src/it/per-project-config/pom.xml diff --git a/src/it/MINSTALL-99/verify.groovy b/src/it/per-project-config/verify.groovy similarity index 100% rename from src/it/MINSTALL-99/verify.groovy rename to src/it/per-project-config/verify.groovy diff --git a/src/it/pom-checksum/pom.xml b/src/it/pom-checksum/pom.xml deleted file mode 100644 index 563503b..0000000 --- a/src/it/pom-checksum/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.pc</groupId> - <artifactId>test</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <description>Tests the installation of a simple snapshot POM with checksums</description> - - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>@version.maven-compiler-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>@version.maven-resources-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>@version.maven-surefire@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/pom-checksum/setup.groovy b/src/it/pom-checksum/setup.groovy deleted file mode 100644 index 0aead3d..0000000 --- a/src/it/pom-checksum/setup.groovy +++ /dev/null @@ -1,29 +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/install/pc" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/pom-checksum/verify.groovy b/src/it/pom-checksum/verify.groovy deleted file mode 100644 index 7a642f6..0000000 --- a/src/it/pom-checksum/verify.groovy +++ /dev/null @@ -1,57 +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 java.lang.*; - -String[] paths = -[ - "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom", - "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/maven-metadata-local.xml", - "org/apache/maven/its/install/pc/test/maven-metadata-local.xml", -]; - -String[] pathsWhichShouldNotExist = -[ - "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.md5", - "org/apache/maven/its/install/pc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.sha1", -]; - -for ( String path : paths ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for existence of " + file ); - if ( !file.isFile() ) - { - throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() ); - } -} - -for ( String path : pathsWhichShouldNotExist ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for none existence of " + file ); - if ( file.isFile() ) - { - throw new IOException( "Found: " + file.getAbsolutePath() ); - } -} - -return true; diff --git a/src/it/skip-install/pom.xml b/src/it/skip-install/pom.xml deleted file mode 100644 index a8094e0..0000000 --- a/src/it/skip-install/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.its.install.skip</groupId> - <artifactId>test</artifactId> - <version>1.0</version> - <packaging>jar</packaging> - - <description>Tests the skip installation of a simple release JAR.</description> - - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>@version.maven-compiler-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-install-plugin</artifactId> - <version>@project.version@</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>@version.maven-jar-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>@version.maven-resources-plugin@</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>@version.maven-surefire@</version> - </plugin> - </plugins> - </build> - -</project> diff --git a/src/it/skip-install/setup.groovy b/src/it/skip-install/setup.groovy deleted file mode 100644 index be3fa1e..0000000 --- a/src/it/skip-install/setup.groovy +++ /dev/null @@ -1,29 +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/install/skip" ); -System.out.println( "Deleting " + file ); -FileUtils.deleteDirectory( file ); - -return true; diff --git a/src/it/skip-install/verify.groovy b/src/it/skip-install/verify.groovy deleted file mode 100644 index 4f44422..0000000 --- a/src/it/skip-install/verify.groovy +++ /dev/null @@ -1,40 +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.*; - -String[] paths = -[ - "org/apache/maven/its/install/skip/test/maven-metadata-local.xml", - "org/apache/maven/its/install/skip/test/1.0/test-1.0.pom", - "org/apache/maven/its/install/skip/test/1.0/test-1.0.jar", -]; - -for ( String path : paths ) -{ - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for non existence of " + file ); - if ( file.isFile() ) - { - throw new Exception( "Existence of file: " + file.getAbsolutePath() ); - } -} - -return true; diff --git a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java index f92cfb1..03c1a2b 100644 --- a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; +import java.util.stream.Stream; import org.apache.maven.api.Artifact; import org.apache.maven.api.LocalRepository; @@ -62,10 +63,12 @@ import static org.apache.maven.api.plugin.testing.MojoExtension.setVariableValue import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** @@ -74,6 +77,7 @@ import static org.mockito.Mockito.when; @MojoTest class InstallFileMojoTest { private static final String LOCAL_REPO = "target/local-repo"; + private static final String OVERRIDE_REPO = "target/local-repo-override"; private String groupId; private String artifactId; @@ -619,6 +623,220 @@ class InstallFileMojoTest { assertTrue(e.getMessage().contains("not valid"), e.getMessage()); } + // ------------------------------------------------------------------------------------------------------- + // Conversions of the src/it integration tests that only exercised install:install-file mojo behaviour. + // The real ArtifactInstaller is mocked by the harness, so "installed" is asserted as the set of + // artifacts handed to it (plus the generated POM model captured while the install call is in flight). + // Checksum files are produced by Maven's ArtifactInstaller, never by this mojo; at this level we + // assert that no checksum artifact is handed to the installer and that none is left in the repo. + // ------------------------------------------------------------------------------------------------------- + + /** Converted from {@code src/it/gav-validation} (invalid coordinates, test-invalid.properties). */ + @Test + @InjectMojo(goal = "install-file") + @MojoParameter(name = "groupId", value = "invalid~group") + @MojoParameter(name = "artifactId", value = "invalid/artifactId") + @MojoParameter(name = "version", value = "1+") + @MojoParameter(name = "packaging", value = "jar") + @MojoParameter( + name = "file", + value = "${project.basedir}/target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar") + void invalidGavRejectedAndNothingInstalled(InstallFileMojo mojo) { + assertNotNull(mojo); + + MojoException e = executeExpectingFailure(mojo); + + assertTrue(e.getMessage().contains("The artifact information is not valid"), e.getMessage()); + } + + /** Converted from {@code src/it/gav-validation} (missing coordinates, test-missing.properties). */ + @Test + @InjectMojo(goal = "install-file") + @MojoParameter(name = "groupId", value = "groupId") + @MojoParameter(name = "packaging", value = "jar") + @MojoParameter( + name = "file", + value = "${project.basedir}/target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar") + void missingCoordinatesRejectedAndNothingInstalled(InstallFileMojo mojo) throws Exception { + assertNotNull(mojo); + // A jar with no embedded POM keeps the coordinates genuinely incomplete. + Path plainJar = createJarWithEntryBytes( + "Manifest-Version: 1.0\n".getBytes(StandardCharsets.UTF_8), "META-INF/MANIFEST.MF"); + setVariableValueToObject(mojo, "file", plainJar); + + MojoException e = executeExpectingFailure(mojo); + + assertTrue(e.getMessage().contains("The artifact information is incomplete"), e.getMessage()); + } + + /** Converted from {@code src/it/generate-pom-auto-1}: with the default generatePom, a jar and a POM are installed. */ + @Test + @InjectMojo(goal = "install-file") + @MojoParameter(name = "groupId", value = "org.apache.maven.its.install.gpa1") + @MojoParameter(name = "artifactId", value = "test") + @MojoParameter(name = "version", value = "0.1") + @MojoParameter(name = "packaging", value = "jar") + @MojoParameter( + name = "file", + value = "${project.basedir}/target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar") + void generatePomAutoInstallsJarAndPom(InstallFileMojo mojo) throws Exception { + assertNotNull(mojo); + assignValuesForParameter(mojo); + + AtomicReference<Model> model = new AtomicReference<>(); + ArtifactInstallerRequest request = + execute(mojo, air -> model.set(readModelFrom(air, getArtifact(null, "pom")))); + + assertNotNull(request); + Artifact pom = getArtifact(null, "pom"); + Artifact jar = getArtifact(null, "jar"); + assertEquals(new HashSet<>(Arrays.asList(pom, jar)), new HashSet<>(request.getArtifacts())); + assertFileExists(artifactManager.getPath(jar).orElse(null)); + assertEquals("4.0.0", model.get().getModelVersion()); + assertEquals(groupId, model.get().getGroupId()); + assertEquals(artifactId, model.get().getArtifactId()); + assertEquals(version, model.get().getVersion()); + assertNoChecksumFiles(Paths.get(getBasedir(), LOCAL_REPO)); + } + + /** Converted from {@code src/it/generate-pom-auto-2}: a POM already in the repo is never overwritten. */ + @Test + @InjectMojo(goal = "install-file") + @MojoParameter(name = "groupId", value = "org.apache.maven.its.install.gpa2") + @MojoParameter(name = "artifactId", value = "test") + @MojoParameter(name = "version", value = "0.1") + @MojoParameter(name = "packaging", value = "jar") + @MojoParameter( + name = "file", + value = "${project.basedir}/target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar") + void existingPomNotOverwrittenWhenGeneratePomAuto(InstallFileMojo mojo) throws Exception { + assertNotNull(mojo); + assignValuesForParameter(mojo); + + Path existingPom = + Paths.get(getBasedir(), LOCAL_REPO, "org/apache/maven/its/install/gpa2/test/0.1/test-0.1.pom"); + Files.createDirectories(existingPom.getParent()); + Files.writeString(existingPom, "test"); + + ArtifactInstallerRequest request = execute(mojo); + + assertNotNull(request); + Artifact jar = getArtifact(null, "jar"); + assertEquals(Collections.singleton(jar), new HashSet<>(request.getArtifacts())); + assertFileExists(artifactManager.getPath(jar).orElse(null)); + assertEquals("test", Files.readString(existingPom), "existing POM must keep its original 4-byte content"); + assertNoChecksumFiles(Paths.get(getBasedir(), LOCAL_REPO)); + } + + /** Converted from {@code src/it/local-repo-override-with-checksum}: install into a custom local repository. */ + @Test + @InjectMojo(goal = "install-file") + @MojoParameter(name = "groupId", value = "gid") + @MojoParameter(name = "artifactId", value = "test") + @MojoParameter(name = "version", value = "0.1") + @MojoParameter(name = "packaging", value = "jar") + @MojoParameter( + name = "file", + value = "${project.basedir}/target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar") + @MojoParameter(name = "localRepositoryPath", value = "target/local-repo-override") + void installFileIntoOverriddenLocalRepositoryNoChecksums(InstallFileMojo mojo) throws Exception { + assertNotNull(mojo); + assignValuesForParameter(mojo); + + ArtifactInstallerRequest request = execute(mojo); + + assertNotNull(request); + Artifact jar = getArtifact(null, "jar"); + assertTrue(request.getArtifacts().contains(jar), "the jar must be installed into the overridden repository"); + assertTrue(request.getArtifacts().stream() + .noneMatch(a -> "md5".equals(a.getExtension()) || "sha1".equals(a.getExtension()))); + assertFileExistsInRequest(request, jar); + assertEquals( + Paths.get(getBasedir(), OVERRIDE_REPO).toString().replace(File.separator, "/"), + request.getSession().getLocalRepository().getPath().toString().replace(File.separator, "/")); + assertNoChecksumFiles(Paths.get(getBasedir(), OVERRIDE_REPO)); + } + + /** + * Converted from {@code src/it/local-repo-override-with-checksum-generatePom}: the generated POM is installed + * into the custom local repository too, and neither jar nor POM gets a checksum file. + */ + @Test + @InjectMojo(goal = "install-file") + @MojoParameter(name = "groupId", value = "gid") + @MojoParameter(name = "artifactId", value = "test") + @MojoParameter(name = "version", value = "0.1") + @MojoParameter(name = "packaging", value = "jar") + @MojoParameter( + name = "file", + value = "${project.basedir}/target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar") + @MojoParameter(name = "generatePom", value = "true") + @MojoParameter(name = "localRepositoryPath", value = "target/local-repo-override") + void installFileIntoOverriddenLocalRepositoryWithGeneratedPomNoChecksums(InstallFileMojo mojo) throws Exception { + assertNotNull(mojo); + assignValuesForParameter(mojo); + + AtomicReference<Model> model = new AtomicReference<>(); + ArtifactInstallerRequest request = + execute(mojo, air -> model.set(readModelFrom(air, getArtifact(null, "pom")))); + + assertNotNull(request); + Artifact pom = getArtifact(null, "pom"); + Artifact jar = getArtifact(null, "jar"); + assertEquals(new HashSet<>(Arrays.asList(pom, jar)), new HashSet<>(request.getArtifacts())); + assertFileExistsInRequest(request, jar); + assertEquals( + Paths.get(getBasedir(), OVERRIDE_REPO).toString().replace(File.separator, "/"), + request.getSession().getLocalRepository().getPath().toString().replace(File.separator, "/")); + assertEquals(groupId, model.get().getGroupId()); + assertEquals(artifactId, model.get().getArtifactId()); + assertEquals(version, model.get().getVersion()); + assertNoChecksumFiles(Paths.get(getBasedir(), OVERRIDE_REPO)); + } + + private void assertFileExistsInRequest(ArtifactInstallerRequest request, Artifact artifact) { + ArtifactManager requestArtifactManager = request.getSession().getService(ArtifactManager.class); + assertFileExists(requestArtifactManager.getPath(artifact).orElse(null)); + } + + private Model readModelFrom(ArtifactInstallerRequest request, Artifact pom) { + try { + ArtifactManager requestArtifactManager = request.getSession().getService(ArtifactManager.class); + Path pomPath = requestArtifactManager.getPath(pom).orElse(null); + assertNotNull(pomPath); + return session.getService(ModelXmlFactory.class).read(pomPath); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + private MojoException executeExpectingFailure(InstallFileMojo mojo) { + AtomicReference<ArtifactInstallerRequest> request = new AtomicReference<>(); + doAnswer(iom -> { + request.set(iom.getArgument(0, ArtifactInstallerRequest.class)); + return null; + }) + .when(artifactInstaller) + .install(any(ArtifactInstallerRequest.class)); + MojoException e = assertThrows(MojoException.class, mojo::execute); + assertNull(request.get(), "nothing should be installed on validation failure"); + return e; + } + + private static void assertNoChecksumFiles(Path repositoryRoot) throws Exception { + if (!Files.exists(repositoryRoot)) { + return; + } + try (Stream<Path> paths = Files.walk(repositoryRoot)) { + assertTrue( + paths.noneMatch(p -> { + String name = p.getFileName().toString(); + return name.endsWith(".md5") || name.endsWith(".sha1"); + }), + "no .md5/.sha1 checksum files should be created"); + } + } + private static Path createJarWithEntries(String pomContent, String... entryNames) throws Exception { Path jar = Files.createTempFile("maven-install-file-test", ".jar"); try (JarOutputStream jos = new JarOutputStream(Files.newOutputStream(jar))) { @@ -697,6 +915,13 @@ class InstallFileMojoTest { @SuppressWarnings("unused") private static Session createMavenSession() { Session session = SessionMock.getMockSession(LOCAL_REPO); + when(session.createLocalRepository(any(Path.class))).thenAnswer(iom -> { + Path path = iom.getArgument(0, Path.class); + LocalRepository localRepository = mock(LocalRepository.class); + when(localRepository.getPath()).thenReturn(path); + when(localRepository.getId()).thenReturn("local"); + return localRepository; + }); when(session.withLocalRepository(any())).thenAnswer(iom -> { LocalRepository localRepository = iom.getArgument(0, LocalRepository.class); Session mockSession = SessionMock.getMockSession(localRepository); diff --git a/src/test/java/org/apache/maven/plugins/install/InstallMojoPomPackagingTest.java b/src/test/java/org/apache/maven/plugins/install/InstallMojoPomPackagingTest.java index 9ebf2e0..a2a5555 100644 --- a/src/test/java/org/apache/maven/plugins/install/InstallMojoPomPackagingTest.java +++ b/src/test/java/org/apache/maven/plugins/install/InstallMojoPomPackagingTest.java @@ -19,11 +19,14 @@ package org.apache.maven.plugins.install; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collection; import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; +import java.util.stream.Stream; import org.apache.maven.api.Artifact; import org.apache.maven.api.MojoExecution; @@ -55,6 +58,7 @@ import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; import static org.apache.maven.api.plugin.testing.MojoExtension.getVariableValueFromObject; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.when; @@ -103,6 +107,40 @@ class InstallMojoPomPackagingTest { artifacts.stream().map(Artifact::key).toList()); } + /** Converted from {@code src/it/pom-checksum}: the POM is installed and no checksum files are created. */ + @Test + @InjectMojo(goal = "install") + @MojoParameter(name = "installAtEnd", value = "false") + void pomPackagingInstalledWithoutChecksums(InstallMojo mojo) throws Exception { + assertNotNull(mojo); + Project project = (Project) getVariableValueFromObject(mojo, "project"); + artifactManager.setPath(project.getPomArtifact(), project.getPomPath()); + + ArtifactInstallerRequest request = execute(mojo); + + assertNotNull(request); + assertEquals( + List.of("org.apache.maven.test:maven-install-test:pom:1.0-SNAPSHOT"), + request.getArtifacts().stream().map(Artifact::key).toList()); + assertTrue(request.getArtifacts().stream() + .noneMatch(a -> "md5".equals(a.getExtension()) || "sha1".equals(a.getExtension()))); + assertNoChecksumFiles(Paths.get(getBasedir(), LOCAL_REPO)); + } + + private static void assertNoChecksumFiles(Path repositoryRoot) throws Exception { + if (!Files.exists(repositoryRoot)) { + return; + } + try (Stream<Path> paths = Files.walk(repositoryRoot)) { + assertTrue( + paths.noneMatch(p -> { + String name = p.getFileName().toString(); + return name.endsWith(".md5") || name.endsWith(".sha1"); + }), + "no .md5/.sha1 checksum files should be created"); + } + } + @Provides @Singleton @Priority(10) diff --git a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java index 231ff6e..dfe6b4e 100644 --- a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java @@ -20,6 +20,8 @@ package org.apache.maven.plugins.install; import java.io.File; import java.lang.reflect.Method; +import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; @@ -29,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Stream; import org.apache.maven.api.Artifact; import org.apache.maven.api.MojoExecution; @@ -269,6 +272,103 @@ class InstallMojoTest { verify(artifactInstaller, times(2)).install(any(ArtifactInstallerRequest.class)); } + // ------------------------------------------------------------------------------------------------------- + // Conversions of the src/it integration tests that exercised the install mojo's project processing. + // ------------------------------------------------------------------------------------------------------- + + private static final String MAIN_ARTIFACT_WITHOUT_ATTACHMENTS_MESSAGE = + "The packaging plugin for this project did not assign a main file to the project but it has attachments." + + " Change packaging to 'pom'."; + + private static final Path ATTACHED_ARTIFACT_JAR = + Paths.get("target/test-classes/unit/attached-artifact-test-1.0-SNAPSHOT.jar"); + + /** Converted from {@code src/it/no-main-artifact-1}: target/classes is absent. */ + @Test + @InjectMojo(goal = "install") + @MojoParameter(name = "installAtEnd", value = "false") + void noMainArtifactWithAttachmentsFailsWhenOutputDirMissing(InstallMojo mojo) throws Exception { + assertNotNull(mojo); + Project project = (Project) getVariableValueFromObject(mojo, "project"); + assertFalse(artifactManager.getPath(project.getMainArtifact().get()).isPresent()); + attachClassifiedJar(project, "it"); + + MojoException e = assertThrows(MojoException.class, mojo::execute); + + assertTrue(e.getMessage().contains(MAIN_ARTIFACT_WITHOUT_ATTACHMENTS_MESSAGE), e.getMessage()); + } + + /** Converted from {@code src/it/no-main-artifact-2}: target/classes exists (as a directory, not a file). */ + @Test + @InjectMojo(goal = "install") + @MojoParameter(name = "installAtEnd", value = "false") + void noMainArtifactWithAttachmentsFailsWhenOutputDirPresent(InstallMojo mojo) throws Exception { + assertNotNull(mojo); + Project project = (Project) getVariableValueFromObject(mojo, "project"); + Path outputDir = Paths.get(getBasedir(), "target/no-main-artifact-output-dir"); + Files.createDirectories(outputDir); + artifactManager.setPath(project.getMainArtifact().get(), outputDir); + assertFalse(Files.isRegularFile( + artifactManager.getPath(project.getMainArtifact().get()).get())); + attachClassifiedJar(project, "it"); + + MojoException e = assertThrows(MojoException.class, mojo::execute); + + assertTrue(e.getMessage().contains(MAIN_ARTIFACT_WITHOUT_ATTACHMENTS_MESSAGE), e.getMessage()); + } + + /** Converted from {@code src/it/attach-jar-checksum}: pom, jar and attached sources are installed, no checksums. */ + @Test + @InjectMojo(goal = "install") + @MojoParameter(name = "installAtEnd", value = "false") + void attachedJarInstalledWithoutChecksums(InstallMojo mojo) throws Exception { + assertNotNull(mojo); + Project project = (Project) getVariableValueFromObject(mojo, "project"); + artifactManager.setPath( + project.getMainArtifact().get(), + Paths.get(getBasedir(), "target/test-classes/unit/maven-install-test-1.0-SNAPSHOT.jar")); + projectManager.attachArtifact( + project, + new ProducedArtifactStub( + "org.apache.maven.test", "maven-install-test", "sources", "1.0-SNAPSHOT", "jar"), + Paths.get(getBasedir()).resolve(ATTACHED_ARTIFACT_JAR)); + + ArtifactInstallerRequest request = execute(mojo); + + assertNotNull(request); + assertEquals( + Arrays.asList( + "org.apache.maven.test:maven-install-test:pom:1.0-SNAPSHOT", + "org.apache.maven.test:maven-install-test:jar:1.0-SNAPSHOT", + "org.apache.maven.test:maven-install-test:jar:sources:1.0-SNAPSHOT"), + request.getArtifacts().stream().map(Artifact::key).toList()); + assertTrue(request.getArtifacts().stream() + .noneMatch(a -> "md5".equals(a.getExtension()) || "sha1".equals(a.getExtension()))); + assertNoChecksumFiles(Paths.get(getBasedir(), LOCAL_REPO)); + } + + private void attachClassifiedJar(Project project, String classifier) { + projectManager.attachArtifact( + project, + new ProducedArtifactStub( + "org.apache.maven.test", "attached-artifact-test", classifier, "1.0-SNAPSHOT", "jar"), + Paths.get(getBasedir()).resolve(ATTACHED_ARTIFACT_JAR)); + } + + private static void assertNoChecksumFiles(Path repositoryRoot) throws Exception { + if (!Files.exists(repositoryRoot)) { + return; + } + try (Stream<Path> paths = Files.walk(repositoryRoot)) { + assertTrue( + paths.noneMatch(p -> { + String name = p.getFileName().toString(); + return name.endsWith(".md5") || name.endsWith(".sha1"); + }), + "no .md5/.sha1 checksum files should be created"); + } + } + private Project reactorProject(String artifactId) { Project project = mock(Project.class); when(project.getBuild()).thenReturn(installPluginBuild("default-install", "install"));
