You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2011/12/10 22:00:40 UTC
svn commit: r1212870 - in /maven/core-integration-testing/trunk:
core-it-suite/src/test/java/org/apache/maven/it/
core-it-suite/src/test/resources/mng-5214/
core-it-suite/src/test/resources/mng-5214/consumer/
core-it-suite/src/test/resources/mng-5214/d...
Author: bimargulies
Date: Sat Dec 10 21:00:40 2011
New Revision: 1212870
URL: http://svn.apache.org/viewvc?rev=1212870&view=rev
Log:
MNG-5214: Dependency resolution substitutes g:a:v:jar for j:a:v:something-else when something-else isn't in the reactor
o Add an integration test for the new behavior, conditioned for 3.0.5 and after.
o Add another mojo to maven-it-plugin-dependency-resolution to support the test. Note that I had to tweak dependencies
on the plugin to add this mojo; if anyone really wants to run against 2.0 with the trunk of the tests this will need
something, I'm not sure what.
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml (with props)
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java (with props)
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml
Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=1212870&r1=1212869&r2=1212870&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Sat Dec 10 21:00:40 2011
@@ -83,6 +83,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng5214DontMapWsdlToJar.class );
suite.addTestSuite( MavenITmng5137ReactorResolutionInForkedBuildTest.class );
suite.addTestSuite( MavenITmng5135AggregatorDepResolutionModuleExtensionTest.class );
suite.addTestSuite( MavenITmng5096ExclusionAtDependencyWithImpliedClassifierTest.class );
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java?rev=1212870&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java Sat Dec 10 21:00:40 2011
@@ -0,0 +1,76 @@
+package org.apache.maven.it;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+/*
+ * 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.
+ */
+
+
+public class MavenITmng5214DontMapWsdlToJar extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng5214DontMapWsdlToJar()
+ {
+ super( "[3.0-5,)" );
+ }
+
+ /**
+ * Test that the code that allows test-jar and ejb-client dependencies to resolve to the
+ * target/classes or target/test-class is *not* applies to other types, e.g. wsdl.
+ */
+ public void testitTestPhase()
+ throws Exception
+ {
+ File setupDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214/dependency" );
+
+ Verifier setupVerifier = newVerifier( setupDir.getAbsolutePath() );
+ setupVerifier.setAutoclean( false );
+ setupVerifier.setMavenDebug( true );
+ setupVerifier.deleteDirectory( "target" );
+ setupVerifier.deleteArtifacts( "org.apache.maven.its.mng5214" );
+ setupVerifier.setLogFileName( "log-setup.txt" );
+ setupVerifier.addCliOption( "-PcreateWsdl" );
+ setupVerifier.executeGoal( "generate-resources" );
+
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.setAutoclean( false );
+ verifier.deleteDirectory( "consumer/target" );
+ verifier.deleteDirectory( "dependency/target" );
+ verifier.setLogFileName( "log-test.txt" );
+ verifier.executeGoal( "test" );
+ verifier.verifyErrorFreeLog();
+ List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
+ Iterator lineIt = lines.iterator();
+ // RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT $ /tmp/it.repo/org/apache/maven/its/mng5214/dependency/1.0-SNAPSHOT/dependency-1.0-SNAPSHOT.wsdl
+ while ( lineIt.hasNext() )
+ {
+ String line = (String) lineIt.next();
+ if ( line.contains( "RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT" ) )
+ {
+ assertFalse( line.contains( "classes-main" ) );
+ assertTrue( line.endsWith( ".wsdl" ) );
+ }
+ }
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5214DontMapWsdlToJar.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml?rev=1212870&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml Sat Dec 10 21:00:40 2011
@@ -0,0 +1,73 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng5214</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>consumer</artifactId>
+
+ <name>Maven Integration Test :: MNG-5214 :: Consumer</name>
+ <description>
+ Test that a dependency on a type other than jar/test-jar/ejb is not mapped to target/classes.
+ </description>
+
+ <dependencies>
+ <!-- This module depends *only* on the test JAR -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>dependency</artifactId>
+ <version>${project.version}</version>
+ <type>wsdl</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>compile-classpath</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>resolve-one-dependency</goal>
+ </goals>
+ <configuration>
+ <scope>compile</scope>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>dependency</artifactId>
+ <version>${project.version}</version>
+ <type>wsdl</type>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/consumer/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl?rev=1212870&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl Sat Dec 10 21:00:40 2011
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<wsdl:definitions name="HelloWorld"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+</wsdl:definitions>
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/notmuch.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml?rev=1212870&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml Sat Dec 10 21:00:40 2011
@@ -0,0 +1,83 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng5214</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dependency</artifactId>
+
+ <name>Maven Integration Test :: MNG-5214 :: Dependency</name>
+ <description>A very dull project, which exists only so that its g:a:v is in the reactor.
+ </description>
+
+ <build>
+ <outputDirectory>classes-main</outputDirectory>
+ <testOutputDirectory>classes-test</testOutputDirectory>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>createWsdl</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-artifact</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>attach</goal>
+ </goals>
+ <configuration>
+ <attachedFile>notmuch.wsdl</attachedFile>
+ <artifactType>wsdl</artifactType>
+ </configuration>
+ </execution>
+ <execution>
+ <id>install</id>
+ <phase>generate-resources</phase>
+ <configuration>
+ <pomFile>pom.xml</pomFile>
+ <!-- borrow the POM as the main artifact -->
+ <mainFile>pom.xml</mainFile>
+ </configuration>
+ <goals>
+ <goal>set</goal>
+ <goal>attach-pom</goal>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/dependency/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml?rev=1212870&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml Sat Dec 10 21:00:40 2011
@@ -0,0 +1,69 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mng5214</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-5214</name>
+ <description>
+ Test that a dependency with a type other than jar, test-jar, or ejb-client
+ *not* get assigned a reactor path (target/classes, e.g.) just
+ because the corresponding 'jar'
+ artifact is in the reactor.
+ </description>
+
+ <modules>
+ <module>dependency</module>
+ <module>consumer</module>
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>0.1-stub-SNAPSHOT</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>0.1-stub-SNAPSHOT</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>0.1-stub-SNAPSHOT</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>0.1-stub-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5214/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml?rev=1212870&r1=1212869&r2=1212870&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/pom.xml Sat Dec 10 21:00:40 2011
@@ -51,7 +51,13 @@ under the License.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
- <version>2.0</version>
+ <version>2.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>2.1.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Added: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java?rev=1212870&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java (added)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java Sat Dec 10 21:00:40 2011
@@ -0,0 +1,199 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Attempts to resolve a single artifact from dependencies, and logs the results for the Verifier to look at.
+ *
+ * @goal resolve-one-dependency
+ * @requiresDependencyResolution runtime
+ * @author bimargulies
+ * @version $Id$
+ */
+public class ResolveOneDependencyMojo
+ extends AbstractDependencyMojo
+{
+
+ /**
+ * Group ID of the artifact to resolve.
+ *
+ * @parameter
+ * @required
+ */
+ private String groupId;
+ /**
+ * Artifact ID of the artifact to resolve.
+ *
+ * @parameter
+ * @required
+ */
+ private String artifactId;
+ /**
+ * Version of the artifact to resolve.
+ *
+ * @parameter
+ * @required
+ */
+ private String version;
+ /**
+ * Type of the artifact to resolve.
+ *
+ * @parameter
+ * @required
+ */
+ private String type;
+ /**
+ * Classifier of the artifact to resolve.
+ *
+ * @parameter
+ */
+ private String classifier;
+
+ /**
+ * The scope to resolve for.
+ *
+ * @parameter
+ * @required
+ */
+ private String scope;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ */
+ MavenProject project;
+
+ /**
+ * @component
+ */
+ private ArtifactResolver resolver;
+
+ /**
+ * @component
+ * @readonly
+ * @required
+ */
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * The Maven session.
+ *
+ * @parameter expression="${session}"
+ * @readonly
+ * @required
+ */
+ private MavenSession session;
+
+ /**
+ * Metadata source object.
+ *
+ * @component
+ */
+ private ArtifactMetadataSource metadataSource;
+
+ /**
+ * Runs this mojo.
+ *
+ * @throws MojoExecutionException If the output file could not be created or any dependency could not be resolved.
+ */
+ public void execute()
+ throws MojoExecutionException
+ {
+
+ Artifact projectArtifact = project.getArtifact();
+ if ( projectArtifact == null )
+ {
+ projectArtifact =
+ artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
+ project.getVersion() );
+ }
+
+ Set depArtifacts = new HashSet();
+ Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
+ depArtifacts.add( artifact );
+
+ ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter( scope );
+
+ ArtifactResolutionResult result;
+ try
+ {
+ result =
+ resolver.resolveTransitively( depArtifacts, projectArtifact, project.getManagedVersionMap(),
+ session.getLocalRepository(), project.getRemoteArtifactRepositories(),
+ metadataSource, scopeFilter );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException( "RESOLVE-ONE-DEPENDENCY ArtifactResolutionException exception ", e );
+ }
+ catch ( ArtifactNotFoundException e )
+ {
+ throw new MojoExecutionException( "RESOLVE-ONE-DEPENDENCY ArtifactNotFoundException exception ", e );
+ }
+
+ if ( result == null )
+ {
+ getLog().info( "RESOLVE-ONE-DEPENDENCY null result" );
+ }
+ else
+ {
+ Set resolvedArtifacts = result.getArtifacts();
+ Iterator it = resolvedArtifacts.iterator();
+ /*
+ * Assume that the user of this is not interested in transitive deps and such, just report the one.
+ */
+ while ( it.hasNext() )
+ {
+ Artifact a = (Artifact) it.next();
+ if ( a.equals( artifact ) )
+ {
+ File file = a.getFile();
+ if ( file == null )
+ {
+ getLog().info( " RESOLVE-ONE-DEPENDENCY " + a.toString() + " $ NO-FILE" );
+ }
+ else
+ {
+ getLog().info( " RESOLVE-ONE-DEPENDENCY " + a.toString() + " $ " + file.getAbsolutePath() );
+ }
+ return;
+ }
+ }
+ getLog().info(" RESOLVE-ONE-DEPENDENCY " + artifact.toString() + " $ NOT-RESOLVED" );
+ }
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/ResolveOneDependencyMojo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain