You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2021/01/02 12:50:21 UTC
[maven-help-plugin] branch MPH-170 created (now 39c89f4)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch MPH-170
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git.
at 39c89f4 [MPH-170] Maven 3.1.1
This branch includes the following new commits:
new 2882c06 [MPH-164] - Effective-pom ignores artifact argument
new 39c89f4 [MPH-170] Maven 3.1.1
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-help-plugin] 01/02: [MPH-164] - Effective-pom ignores
artifact argument
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MPH-170
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git
commit 2882c062875ba403d6a0b5693a1e7ca3992a1bce
Author: Christian Lindblom <cr...@croister.se>
AuthorDate: Mon Mar 9 15:36:39 2020 +0100
[MPH-164] - Effective-pom ignores artifact argument
Set the projects argument to only contain the wanted artifact to
avoid processing the local pom when the artifact argument
has been provided.
Closes #5
---
.../invoker.properties | 18 ++++++++++
.../module/pom.xml | 23 ++++++++++++
src/it/effective-pom-multimodule-artifact/pom.xml | 41 ++++++++++++++++++++++
.../test.properties | 19 ++++++++++
.../verify.groovy | 30 ++++++++++++++++
.../maven/plugins/help/EffectivePomMojo.java | 2 ++
6 files changed, 133 insertions(+)
diff --git a/src/it/effective-pom-multimodule-artifact/invoker.properties b/src/it/effective-pom-multimodule-artifact/invoker.properties
new file mode 100644
index 0000000..adecbad
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/invoker.properties
@@ -0,0 +1,18 @@
+# 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 = ${project.groupId}:${project.artifactId}:${project.version}:effective-pom
diff --git a/src/it/effective-pom-multimodule-artifact/module/pom.xml b/src/it/effective-pom-multimodule-artifact/module/pom.xml
new file mode 100644
index 0000000..0a041ec
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/module/pom.xml
@@ -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. -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.its.help</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ </parent>
+ <packaging>pom</packaging>
+ <artifactId>module</artifactId>
+</project>
diff --git a/src/it/effective-pom-multimodule-artifact/pom.xml b/src/it/effective-pom-multimodule-artifact/pom.xml
new file mode 100644
index 0000000..bf048a5
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/pom.xml
@@ -0,0 +1,41 @@
+<?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.help</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+ <url>https://issues.apache.org/jira/browse/MPH-105</url>
+ <description>
+ Tests that the effective POM goal in a multi-module project prints the effective POM of all projects in the reactor
+ </description>
+ <modules>
+ <module>module</module>
+ </modules>
+
+ <build>
+ <plugins>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/effective-pom-multimodule-artifact/test.properties b/src/it/effective-pom-multimodule-artifact/test.properties
new file mode 100644
index 0000000..037f045
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/test.properties
@@ -0,0 +1,19 @@
+# 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.
+
+output = result.txt
+artifact = org.apache.maven.plugins:maven-help-plugin
diff --git a/src/it/effective-pom-multimodule-artifact/verify.groovy b/src/it/effective-pom-multimodule-artifact/verify.groovy
new file mode 100644
index 0000000..fae54ad
--- /dev/null
+++ b/src/it/effective-pom-multimodule-artifact/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * 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 content = new File( basedir, "build.log" ).text
+assert content.indexOf( "<projects>" ) == -1
+
+def result = new File(basedir, 'result.txt');
+assert result.exists()
+
+def LS = System.getProperty("line.separator")
+assert result.text.find('(?s)' +
+ ' <groupId>org.apache.maven.plugins</groupId>' + LS +
+ ' <artifactId>maven-help-plugin</artifactId>'
+) != null
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java b/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
index 144f247..eb94595 100644
--- a/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/EffectivePomMojo.java
@@ -24,6 +24,7 @@ import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Collections;
import java.util.List;
import java.util.Properties;
@@ -111,6 +112,7 @@ public class EffectivePomMojo
if ( StringUtils.isNotEmpty( artifact ) )
{
project = getMavenProject( artifact );
+ projects = Collections.singletonList( project );
}
StringWriter w = new StringWriter();
[maven-help-plugin] 02/02: [MPH-170] Maven 3.1.1
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MPH-170
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git
commit 39c89f4f1de0b6bb98543bfde98a96cad35a499f
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri Jan 1 23:47:14 2021 +0100
[MPH-170] Maven 3.1.1
---
pom.xml | 9 +---
.../maven/plugins/help/AbstractHelpMojo.java | 61 +++++++++++++++-------
.../apache/maven/plugins/help/DescribeMojo.java | 29 +++++-----
.../apache/maven/plugins/help/EvaluateMojo.java | 36 ++++++-------
4 files changed, 73 insertions(+), 62 deletions(-)
diff --git a/pom.xml b/pom.xml
index 57e53e8..86f3962 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,7 @@
<properties>
<javaVersion>7</javaVersion>
- <mavenVersion>3.0</mavenVersion>
+ <mavenVersion>3.1.1</mavenVersion>
<surefire.version>2.22.2</surefire.version>
<project.build.outputTimestamp>2020-04-07T21:04:00Z</project.build.outputTimestamp>
</properties>
@@ -143,11 +143,6 @@
<version>3.2.1</version>
</dependency>
<dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-artifact-transfer</artifactId>
- <version>0.10.0</version>
- </dependency>
- <dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.0</version>
@@ -212,7 +207,7 @@
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
- <version>2.1</version>
+ <version>3.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java b/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
index 4349428..22abe6e 100644
--- a/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.Writer;
import java.util.List;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.MavenSession;
@@ -36,12 +37,18 @@ import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
-import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate;
-import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.WriterFactory;
+import org.eclipse.aether.RepositoryException;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactDescriptorException;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+import org.eclipse.aether.resolution.ArtifactRequest;
/**
* Base class with some Help Mojo functionalities.
@@ -63,13 +70,13 @@ public abstract class AbstractHelpMojo
*/
@Component
protected ProjectBuilder projectBuilder;
-
+
/**
* Component used to resolve artifacts and download their files from remote repositories.
*/
@Component
- protected ArtifactResolver artifactResolver;
-
+ RepositorySystem repositorySystem;
+
/**
* Remote repositories used for the project.
*/
@@ -152,7 +159,7 @@ public abstract class AbstractHelpMojo
* @return the <code>Artifact</code> object for the <code>artifactString</code> parameter.
* @throws MojoExecutionException if the <code>artifactString</code> doesn't respect the format.
*/
- protected ArtifactCoordinate getArtifactCoordinate( String artifactString, String type )
+ protected org.eclipse.aether.artifact.Artifact getArtifact( String artifactString, String type )
throws MojoExecutionException
{
if ( StringUtils.isEmpty( artifactString ) )
@@ -181,17 +188,8 @@ public abstract class AbstractHelpMojo
throw new MojoExecutionException( "The artifact parameter '" + artifactString
+ "' should be conform to: " + "'groupId:artifactId[:version]'." );
}
- return getArtifactCoordinate( groupId, artifactId, version, type );
- }
- protected ArtifactCoordinate getArtifactCoordinate( String groupId, String artifactId, String version, String type )
- {
- DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate();
- coordinate.setGroupId( groupId );
- coordinate.setArtifactId( artifactId );
- coordinate.setVersion( version );
- coordinate.setExtension( type );
- return coordinate;
+ return new DefaultArtifact( groupId, artifactId, null, type, version );
}
/**
@@ -206,7 +204,6 @@ public abstract class AbstractHelpMojo
protected MavenProject getMavenProject( String artifactString )
throws MojoExecutionException
{
- ArtifactCoordinate coordinate = getArtifactCoordinate( artifactString, "pom" );
try
{
ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
@@ -214,7 +211,10 @@ public abstract class AbstractHelpMojo
pbr.setProject( null );
pbr.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
pbr.setResolveDependencies( true );
- Artifact artifact = artifactResolver.resolveArtifact( pbr, coordinate ).getArtifact();
+
+ org.eclipse.aether.artifact.Artifact artifact = resolveArtifact(
+ getArtifact( artifactString, "pom" ) ).getArtifact();
+
return projectBuilder.build( artifact.getFile(), pbr ).getProject();
}
catch ( Exception e )
@@ -224,4 +224,27 @@ public abstract class AbstractHelpMojo
}
}
+ protected org.eclipse.aether.resolution.ArtifactResult resolveArtifact(
+ org.eclipse.aether.artifact.Artifact aetherArtifact ) throws RepositoryException
+ {
+ try
+ {
+ List<RemoteRepository> remoteRepositories = RepositoryUtils.toRepos( this.remoteRepositories );
+ RepositorySystemSession repositorySession = session.getProjectBuildingRequest().getRepositorySession();
+
+ // use descriptor to respect relocation
+ ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest( aetherArtifact,
+ remoteRepositories, null );
+ ArtifactDescriptorResult descriptorResult = repositorySystem.readArtifactDescriptor( repositorySession,
+ descriptorRequest );
+ ArtifactRequest request = new ArtifactRequest( descriptorResult.getArtifact(), remoteRepositories, null );
+
+ return repositorySystem.resolveArtifact( repositorySession, request );
+ }
+ catch ( ArtifactDescriptorException e )
+ {
+ throw new RepositoryException( e.getMessage(), e );
+ }
+ }
+
}
diff --git a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
index da65624..b3ad4e1 100644
--- a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
@@ -32,7 +32,7 @@ import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.maven.artifact.Artifact;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.lifecycle.DefaultLifecycles;
import org.apache.maven.lifecycle.Lifecycle;
import org.apache.maven.lifecycle.internal.MojoDescriptorCreator;
@@ -56,11 +56,12 @@ import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.exec.MavenPluginManagerHelper;
-import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
import org.apache.maven.shared.utils.logging.MessageUtils;
import org.apache.maven.tools.plugin.generator.GeneratorUtils;
import org.apache.maven.tools.plugin.util.PluginUtils;
import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
/**
* Displays a list of the attributes for a Maven Plugin and/or goals (aka Mojo - Maven plain Old Java Object).
@@ -431,15 +432,15 @@ public class DescribeMojo
if ( name == null )
{
// Can be null because of MPLUGIN-137 (and descriptors generated with maven-plugin-tools-api <= 2.4.3)
- ArtifactCoordinate coordinate = toArtifactCoordinate( pd, "jar" );
+ org.eclipse.aether.artifact.Artifact coordinate = toArtifact( pd, "jar" );
ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
pbr.setRemoteRepositories( remoteRepositories );
pbr.setProject( null );
pbr.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
try
{
- Artifact artifact = artifactResolver.resolveArtifact( pbr, coordinate ).getArtifact();
- name = projectBuilder.build( artifact, pbr ).getProject().getName();
+ Artifact artifact = resolveArtifact( coordinate ).getArtifact();
+ name = projectBuilder.build( RepositoryUtils.toArtifact( artifact ), pbr ).getProject().getName();
}
catch ( Exception e )
{
@@ -692,11 +693,10 @@ public class DescribeMojo
*
* @param descriptionBuffer not null
* @return <code>true</code> if it implies to describe a plugin, <code>false</code> otherwise.
- * @throws MojoFailureException if any reflection exceptions occur or missing components.
* @throws MojoExecutionException if any
*/
private boolean describeCommand( StringBuilder descriptionBuffer )
- throws MojoFailureException, MojoExecutionException
+ throws MojoExecutionException
{
if ( cmd.indexOf( ':' ) == -1 )
{
@@ -819,8 +819,7 @@ public class DescribeMojo
try
{
Method m = HelpMojo.class.getDeclaredMethod( "toLines",
- new Class[]{ String.class, Integer.TYPE, Integer.TYPE,
- Integer.TYPE } );
+ String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE );
m.setAccessible( true );
@SuppressWarnings( "unchecked" )
List<String> output = (List<String>) m.invoke( HelpMojo.class, text, indent, indentSize, lineLength );
@@ -977,16 +976,15 @@ public class DescribeMojo
pbr.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
try
{
- Artifact jar = artifactResolver.resolveArtifact( pbr, toArtifactCoordinate( pd, "jar" ) ).getArtifact();
- Artifact pom = artifactResolver.resolveArtifact( pbr, toArtifactCoordinate( pd, "pom" ) ).getArtifact();
+ org.eclipse.aether.artifact.Artifact jar = resolveArtifact( toArtifact( pd, "jar" ) ).getArtifact();
+ org.eclipse.aether.artifact.Artifact pom = resolveArtifact( toArtifact( pd, "pom" ) ).getArtifact();
MavenProject project = projectBuilder.build( pom.getFile(), pbr ).getProject();
urls.add( jar.getFile().toURI().toURL() );
for ( Object artifact : project.getCompileClasspathElements() )
{
urls.add( new File( (String) artifact ).toURI().toURL() );
}
- ClassLoader classLoader =
- new URLClassLoader( urls.toArray( new URL[urls.size()] ), getClass().getClassLoader() );
+ ClassLoader classLoader = new URLClassLoader( urls.toArray( new URL[0] ), getClass().getClassLoader() );
return MavenReport.class.isAssignableFrom( Class.forName( md.getImplementation(), false, classLoader ) );
}
catch ( Exception e )
@@ -1004,9 +1002,10 @@ public class DescribeMojo
* @param type Extension for the coordinate.
* @return Coordinate of an artifact having the same GAV as the given plugin descriptor, with the given type.
*/
- private ArtifactCoordinate toArtifactCoordinate( PluginDescriptor pd, String type )
+ private org.eclipse.aether.artifact.Artifact toArtifact( PluginDescriptor pd, String type )
{
- return getArtifactCoordinate( pd.getGroupId(), pd.getArtifactId(), pd.getVersion(), type );
+ return new DefaultArtifact( pd.getGroupId(), pd.getArtifactId(), null, type, pd.getVersion() );
+// return getArtifactCoordinate( pd.getGroupId(), pd.getArtifactId(), pd.getVersion(), type );
}
/**
diff --git a/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java b/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
index 758973e..3b41b68 100644
--- a/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
@@ -51,8 +51,6 @@ import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
-import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
-import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.components.interactivity.InputHandler;
import org.codehaus.plexus.util.IOUtil;
@@ -62,6 +60,9 @@ import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.collections.PropertiesConverter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import org.eclipse.aether.RepositoryException;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
/**
* Evaluates Maven expressions given by the user in an interactive mode.
@@ -498,11 +499,11 @@ public class EvaluateMojo
getLog().debug( "MojoExecutionException: " + e.getMessage(), e );
}
}
- catch ( ArtifactResolverException e )
+ catch ( RepositoryException e )
{
if ( getLog().isDebugEnabled() )
{
- getLog().debug( "ArtifactResolverException: " + e.getMessage(), e );
+ getLog().debug( "RepositoryException: " + e.getMessage(), e );
}
}
catch ( ProjectBuildingException e )
@@ -577,10 +578,9 @@ public class EvaluateMojo
* @return the <code>org.apache.maven:maven-model</code> artifact jar file in the local repository.
* @throws MojoExecutionException if any
* @throws ProjectBuildingException if any
- * @throws ArtifactResolverException if any
+ * @throws RepositoryException if any
*/
- private File getMavenModelJarFile()
- throws MojoExecutionException, ProjectBuildingException, ArtifactResolverException
+ private File getMavenModelJarFile() throws MojoExecutionException, ProjectBuildingException, RepositoryException
{
return getArtifactFile( true );
}
@@ -589,10 +589,9 @@ public class EvaluateMojo
* @return the <code>org.apache.maven:maven-settings</code> artifact jar file in the local repository.
* @throws MojoExecutionException if any
* @throws ProjectBuildingException if any
- * @throws ArtifactResolverException if any
+ * @throws RepositoryException if any
*/
- private File getMavenSettingsJarFile()
- throws MojoExecutionException, ProjectBuildingException, ArtifactResolverException
+ private File getMavenSettingsJarFile() throws MojoExecutionException, ProjectBuildingException, RepositoryException
{
return getArtifactFile( false );
}
@@ -603,11 +602,8 @@ public class EvaluateMojo
* @return the <code>org.apache.maven:maven-model|maven-settings</code> artifact jar file for this current
* HelpPlugin pom.
* @throws MojoExecutionException if any
- * @throws ProjectBuildingException if any
- * @throws ArtifactResolverException if any
*/
- private File getArtifactFile( boolean isPom )
- throws MojoExecutionException, ProjectBuildingException, ArtifactResolverException
+ private File getArtifactFile( boolean isPom ) throws MojoExecutionException, RepositoryException
{
List<Dependency> dependencies = getHelpPluginPom().getDependencies();
for ( Dependency depependency : dependencies )
@@ -632,12 +628,12 @@ public class EvaluateMojo
}
}
- ArtifactCoordinate coordinate =
- getArtifactCoordinate( depependency.getGroupId(), depependency.getArtifactId(),
- depependency.getVersion(), "jar" );
+ Artifact artifact = new DefaultArtifact( depependency.getGroupId(), depependency.getArtifactId(), null,
+ "jar", depependency.getVersion() );
+
ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
pbr.setRemoteRepositories( remoteRepositories );
- return artifactResolver.resolveArtifact( pbr, coordinate ).getArtifact().getFile();
+ return resolveArtifact( artifact ).getArtifact().getFile();
}
throw new MojoExecutionException( "Unable to find the 'org.apache.maven:"
@@ -647,10 +643,8 @@ public class EvaluateMojo
/**
* @return the Maven POM for the current help plugin
* @throws MojoExecutionException if any
- * @throws ProjectBuildingException if any
*/
- private MavenProject getHelpPluginPom()
- throws MojoExecutionException, ProjectBuildingException
+ private MavenProject getHelpPluginPom() throws MojoExecutionException
{
String resource = "META-INF/maven/org.apache.maven.plugins/maven-help-plugin/pom.properties";