Skip to content

Commit 74de493

Browse files
[MINVOKER-313] Get rid of maven-artifact-transfer - InstallMojo refactor
- refactor InstallMojo to use Resolver API - add possibility to configure scope for installing artifacts - remove maven-artifact-transfer and maven-common-artifact-filters from dependencies
1 parent c06ec6c commit 74de493

File tree

11 files changed

+413
-546
lines changed

11 files changed

+413
-546
lines changed

pom.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,6 @@ under the License.
183183
<version>1.4</version>
184184
</dependency>
185185

186-
<dependency>
187-
<groupId>org.apache.maven.shared</groupId>
188-
<artifactId>maven-artifact-transfer</artifactId>
189-
<version>0.13.1</version>
190-
</dependency>
191-
<dependency>
192-
<groupId>org.apache.maven.shared</groupId>
193-
<artifactId>maven-common-artifact-filters</artifactId>
194-
<version>3.2.0</version>
195-
<scope>compile</scope>
196-
</dependency>
197-
198186
<dependency>
199187
<groupId>${beanshell-groupId}</groupId>
200188
<artifactId>${beanshell-artifactId}</artifactId>
@@ -411,7 +399,6 @@ under the License.
411399
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
412400
<settingsFile>src/it/settings.xml</settingsFile>
413401
<mavenOpts>-Djava.io.tmpdir=${project.build.directory}</mavenOpts>
414-
<streamLogsOnFailures>true</streamLogsOnFailures>
415402
<properties>
416403
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
417404
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = verify
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<groupId>test</groupId>
26+
<artifactId>staging-dependencies-test-scope</artifactId>
27+
<version>1.0-SNAPSHOT</version>
28+
29+
<description>
30+
Test to check for staging of test scope dependencies.
31+
</description>
32+
33+
<dependencies>
34+
<!-- compile scope -->
35+
<dependency>
36+
<groupId>org.slf4j</groupId>
37+
<artifactId>slf4j-api</artifactId>
38+
<version>1.7.36</version>
39+
</dependency>
40+
41+
<!-- test scope dependency -->
42+
<dependency>
43+
<groupId>org.slf4j</groupId>
44+
<artifactId>slf4j-simple</artifactId>
45+
<version>1.7.36</version>
46+
<scope>test</scope>
47+
</dependency>
48+
</dependencies>
49+
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-invoker-plugin</artifactId>
55+
<version>@pom.version@</version>
56+
<configuration>
57+
<localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
58+
<scope>test</scope>
59+
</configuration>
60+
<executions>
61+
<execution>
62+
<id>integration-test</id>
63+
<goals>
64+
<goal>install</goal>
65+
</goals>
66+
</execution>
67+
</executions>
68+
</plugin>
69+
</plugins>
70+
</build>
71+
</project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.io.*;
21+
import java.util.*;
22+
import java.util.regex.*;
23+
24+
import org.codehaus.plexus.util.*;
25+
import org.codehaus.plexus.util.xml.*;
26+
27+
try
28+
{
29+
File itRepoDir = new File( basedir, "target/it-repo" );
30+
System.out.println( "Checking for existence of: " + itRepoDir );
31+
if ( !itRepoDir.isDirectory() )
32+
{
33+
System.out.println( "FAILED!" );
34+
return false;
35+
}
36+
37+
String[] files = {
38+
"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar",
39+
"org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom",
40+
"org/slf4j/slf4j-api/maven-metadata-local.xml",
41+
"org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom",
42+
"org/slf4j/slf4j-parent/maven-metadata-local.xml",
43+
"org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.jar",
44+
"org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.pom",
45+
"org/slf4j/slf4j-simple/maven-metadata-local.xml",
46+
"test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.pom",
47+
"test/staging-dependencies-test-scope/1.0-SNAPSHOT/staging-dependencies-test-scope-1.0-SNAPSHOT.jar"
48+
};
49+
for ( String file : files )
50+
{
51+
File stagedFile = new File( itRepoDir, file );
52+
System.out.println( "Checking for existence of: " + stagedFile );
53+
if ( !stagedFile.isFile() )
54+
{
55+
throw new IllegalStateException( "Missing: " + stagedFile );
56+
}
57+
}
58+
}
59+
catch( Throwable t )
60+
{
61+
t.printStackTrace();
62+
return false;
63+
}
64+
65+
return true;

src/it/staging-dependencies/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ under the License.
6262
<artifactId>dep</artifactId>
6363
<version>2.0</version>
6464
</dependency>
65+
<dependency>
66+
<groupId>org.slf4j</groupId>
67+
<artifactId>slf4j-simple</artifactId>
68+
<version>1.7.36</version>
69+
<scope>test</scope>
70+
</dependency>
6571
</dependencies>
6672

6773
<repositories>

src/it/staging-dependencies/verify.bsh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ try
5656
"org/apache/maven/its/dep/2.0/dep-2.0.pom",
5757
"org/apache/maven/its/dep/2.0/dep-2.0.jar",
5858
"org/apache/maven/its/dep/maven-metadata-local.xml",
59+
"test/staging-dependencies/1.0-SNAPSHOT/staging-dependencies-1.0-SNAPSHOT.jar",
60+
"test/staging-dependencies/1.0-SNAPSHOT/staging-dependencies-1.0-SNAPSHOT.pom"
5961
};
6062
for ( String file : files )
6163
{
@@ -67,6 +69,12 @@ try
6769
}
6870
}
6971

72+
File stagedTestScope = new File(itRepoDir, "org/slf4j/slf4j-simple");
73+
if ( stagedTestScope.exists() )
74+
{
75+
throw new IllegalStateException( "Test scope dependencies should not exists" );
76+
}
77+
7078
Reader reader = ReaderFactory.newXmlReader( new File( itRepoDir, "org/apache/maven/its/dep/maven-metadata-local.xml" ) );
7179
Xpp3Dom dom = Xpp3DomBuilder.build( reader );
7280
IOUtil.close( reader );

src/it/staging-pom/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ under the License.
2222
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2323
<modelVersion>4.0.0</modelVersion>
2424

25+
<parent>
26+
<groupId>org.apache.maven.plugins</groupId>
27+
<artifactId>maven-plugins</artifactId>
28+
<version>39</version>
29+
<relativePath />
30+
</parent>
31+
2532
<groupId>test</groupId>
2633
<artifactId>pom-packaging</artifactId>
2734
<version>1.0-SNAPSHOT</version>
@@ -31,6 +38,10 @@ under the License.
3138
Test to check for MINVOKER-51, i.e. NPE when packaging is pom.
3239
</description>
3340

41+
<properties>
42+
<spotless.check.skip>true</spotless.check.skip>
43+
</properties>
44+
3445
<build>
3546
<plugins>
3647
<plugin>

src/it/staging-pom/verify.bsh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ try
3333

3434
String[] files = {
3535
"test/pom-packaging/1.0-SNAPSHOT/pom-packaging-1.0-SNAPSHOT.pom",
36+
"org/apache/maven/plugins/maven-plugins/39/maven-plugins-39.pom",
37+
"org/apache/maven/maven-parent/39/maven-parent-39.pom",
38+
"org/apache/apache/29/apache-29.pom"
3639
};
3740
for ( String file : files )
3841
{

src/it/staging-reactor/verify.bsh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ try
4444
"test/mod2/1.0-SNAPSHOT/maven-metadata-local.xml",
4545
"test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.pom",
4646
"test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.jar",
47-
"test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT-sources.jar",
4847
"test/mod2-parent/maven-metadata-local.xml",
4948
"test/mod2-parent/1.0-SNAPSHOT/maven-metadata-local.xml",
5049
"test/mod2-parent/1.0-SNAPSHOT/mod2-parent-1.0-SNAPSHOT.pom",

0 commit comments

Comments
 (0)