You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/07/04 15:28:34 UTC
svn commit: r1357251 [1/2] - in
/maven/plugins/trunk/maven-dependency-plugin: ./
src/main/java/org/apache/maven/plugin/dependency/
src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/
src/main/java/org/apache/maven/plugin/dependency/reso...
Author: olamy
Date: Wed Jul 4 13:28:33 2012
New Revision: 1357251
URL: http://svn.apache.org/viewvc?rev=1357251&view=rev
Log:
[MDEP-357] use plugins annotations.
Modified:
maven/plugins/trunk/maven-dependency-plugin/pom.xml
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDuplicateMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeOnlyMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeReportMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/GetMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/ListMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/PropertiesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/PurgeLocalRepositoryMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/TreeMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/UnpackDependenciesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/CopyMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/fromConfiguration/UnpackMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/GoOfflineMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ListRepositoriesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolveDependenciesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolveDependencySourcesMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolvePluginsMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/utils/markers/UnpackFileMarkerHandler.java
maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestIncludeExcludeUnpackMojo.java
Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Wed Jul 4 13:28:33 2012
@@ -82,6 +82,7 @@ under the License.
<mavenVersion>2.0.9</mavenVersion>
<doxiaVersion>1.0</doxiaVersion>
<pluginTestingVersion>1.2</pluginTestingVersion>
+ <mavenPluginPluginVersion>3.1</mavenPluginPluginVersion>
</properties>
<dependencies>
@@ -213,6 +214,14 @@ under the License.
<version>1.1</version>
</dependency>
+ <!-- dependencies to annotations -->
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
<!-- test -->
<dependency>
<groupId>junit</groupId>
@@ -242,11 +251,38 @@ under the License.
</dependencies>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ <configuration>
+ <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+ </configuration>
+ <executions>
+ <execution>
+ <id>mojo-descriptor</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.12</version>
+ <version>2.13-SNAPSHOT</version>
<configuration>
<!-- Need of more head space in order to run the unit tests !-->
<argLine>-Xmx256m</argLine>
@@ -258,6 +294,16 @@ under the License.
</plugins>
</build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
<profiles>
<profile>
<id>run-its</id>
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java Wed Jul 4 13:28:33 2012
@@ -19,17 +19,13 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.io.File;
-import java.io.StringWriter;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
import org.apache.commons.lang.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
@@ -41,6 +37,12 @@ import org.codehaus.plexus.context.Conte
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import java.io.File;
+import java.io.StringWriter;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
/**
* Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused
* and declared.
@@ -63,82 +65,74 @@ public abstract class AbstractAnalyzeMoj
/**
* The Maven project to analyze.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
*/
+ @Component
private MavenProject project;
/**
* Project dependency analyzer to use (plexus component role-hint).
*
- * @parameter expression="${analyzer}" default-value="default"
* @since 2.2
*/
+ @Parameter( property = "analyzer", defaultValue = "default" )
private String analyzer;
/**
* Whether to fail the build if a dependency warning is found.
- *
- * @parameter expression="${failOnWarning}" default-value="false"
*/
+ @Parameter( property = "failOnWarning", defaultValue = "false" )
private boolean failOnWarning;
/**
* Output used dependencies
- *
- * @parameter expression="${verbose}" default-value="false"
*/
+ @Parameter( property = "verbose", defaultValue = "false" )
private boolean verbose;
/**
* Ignore Runtime,Provide,Test,System scopes for unused dependency analysis
- *
- * @parameter expression="${ignoreNonCompile}" default-value="false"
*/
+ @Parameter( property = "ignoreNonCompile", defaultValue = "false" )
private boolean ignoreNonCompile;
/**
* Output the xml for the missing dependencies
*
- * @parameter expression="${outputXML}" default-value="false"
* @since 2.0-alpha-5
*/
+ @Parameter( property = "outputXML", defaultValue = "false" )
private boolean outputXML;
/**
* Output scriptable values
*
- * @parameter expression="${scriptableOutput}" default-value="false"
* @since 2.0-alpha-5
*/
+ @Parameter( property = "scriptableOutput", defaultValue = "false" )
private boolean scriptableOutput;
/**
* Flag to use for scriptable output
*
- * @parameter expression="${scriptableFlag}" default-value="$$$%%%"
* @since 2.0-alpha-5
*/
+ @Parameter( property = "scriptableFlag", defaultValue = "$$$%%%" )
private String scriptableFlag;
/**
* Flag to use for scriptable output
*
- * @parameter default-value="${basedir}"
- * @readonly
* @since 2.0-alpha-5
*/
+ @Parameter( defaultValue = "${basedir}", readonly = true )
private File baseDir;
/**
* Target folder
*
- * @parameter default-value="${project.build.directory}"
- * @readonly
* @since 2.0-alpha-5
*/
+ @Parameter( defaultValue = "${project.build.directory}", readonly = true )
private File outputDirectory;
// Mojo methods -----------------------------------------------------------
@@ -184,8 +178,9 @@ public abstract class AbstractAnalyzeMoj
}
catch ( Exception exception )
{
- throw new MojoExecutionException( "Failed to instantiate ProjectDependencyAnalyser with role " + role
- + " / role-hint " + roleHint,exception );
+ throw new MojoExecutionException(
+ "Failed to instantiate ProjectDependencyAnalyser with role " + role + " / role-hint " + roleHint,
+ exception );
}
}
@@ -210,12 +205,9 @@ public abstract class AbstractAnalyzeMoj
throw new MojoExecutionException( "Cannot analyze dependencies", exception );
}
- @SuppressWarnings( "unchecked" )
- Set<Artifact> usedDeclared = analysis.getUsedDeclaredArtifacts();
- @SuppressWarnings( "unchecked" )
- Set<Artifact> usedUndeclared = analysis.getUsedUndeclaredArtifacts();
- @SuppressWarnings( "unchecked" )
- Set<Artifact> unusedDeclared = analysis.getUnusedDeclaredArtifacts();
+ @SuppressWarnings( "unchecked" ) Set<Artifact> usedDeclared = analysis.getUsedDeclaredArtifacts();
+ @SuppressWarnings( "unchecked" ) Set<Artifact> usedUndeclared = analysis.getUsedUndeclaredArtifacts();
+ @SuppressWarnings( "unchecked" ) Set<Artifact> unusedDeclared = analysis.getUnusedDeclaredArtifacts();
if ( ignoreNonCompile )
{
@@ -356,8 +348,8 @@ public abstract class AbstractAnalyzeMoj
artifact.isSnapshot();
buf.append( scriptableFlag + ":" + pomFile + ":" + artifact.getDependencyConflictId() + ":"
- + artifact.getClassifier() + ":" + artifact.getBaseVersion() + ":"
- + artifact.getScope() + "\n" );
+ + artifact.getClassifier() + ":" + artifact.getBaseVersion() + ":" + artifact.getScope()
+ + "\n" );
}
getLog().info( "\n" + buf );
}
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java Wed Jul 4 13:28:33 2012
@@ -15,10 +15,6 @@ package org.apache.maven.plugin.dependen
* the License.
*/
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.dependency.utils.DependencyStatusSets;
@@ -27,6 +23,7 @@ import org.apache.maven.plugin.dependenc
import org.apache.maven.plugin.dependency.utils.resolvers.DefaultArtifactsResolver;
import org.apache.maven.plugin.dependency.utils.translators.ArtifactTranslator;
import org.apache.maven.plugin.dependency.utils.translators.ClassifierTypeTranslator;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter;
import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
@@ -38,6 +35,10 @@ import org.apache.maven.shared.artifact.
import org.apache.maven.shared.artifact.filter.collection.TypeFilter;
import org.codehaus.plexus.util.StringUtils;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* Class that encapsulates the plugin parameters, and contains methods that
* handle dependency filtering
@@ -53,9 +54,8 @@ public abstract class AbstractDependency
* If we should exclude transitive dependencies
*
* @since 2.0
- * @optional
- * @parameter expression="${excludeTransitive}" default-value="false"
*/
+ @Parameter( property = "excludeTransitive", defaultValue = "false" )
protected boolean excludeTransitive;
/**
@@ -63,9 +63,8 @@ public abstract class AbstractDependency
* everything (default).
*
* @since 2.0
- * @parameter expression="${includeTypes}" default-value=""
- * @optional
*/
+ @Parameter( property = "includeTypes", defaultValue = "" )
protected String includeTypes;
/**
@@ -73,27 +72,24 @@ public abstract class AbstractDependency
* exclude anything (default).
*
* @since 2.0
- * @parameter expression="${excludeTypes}" default-value=""
- * @optional
*/
+ @Parameter( property = "excludeTypes", defaultValue = "" )
protected String excludeTypes;
/**
* Scope to include. An Empty string indicates all scopes (default).
*
* @since 2.0
- * @parameter expression="${includeScope}" default-value=""
- * @optional
*/
+ @Parameter( property = "includeScope", defaultValue = "" )
protected String includeScope;
/**
* Scope to exclude. An Empty string indicates no scopes (default).
*
* @since 2.0
- * @parameter expression="${excludeScope}" default-value=""
- * @optional
*/
+ @Parameter( property = "excludeScope", defaultValue = "" )
protected String excludeScope;
/**
@@ -101,9 +97,8 @@ public abstract class AbstractDependency
* include everything (default).
*
* @since 2.0
- * @parameter expression="${includeClassifiers}" default-value=""
- * @optional
*/
+ @Parameter( property = "includeClassifiers", defaultValue = "" )
protected String includeClassifiers;
/**
@@ -111,111 +106,98 @@ public abstract class AbstractDependency
* don't exclude anything (default).
*
* @since 2.0
- * @parameter expression="${excludeClassifiers}" default-value=""
- * @optional
*/
+ @Parameter( property = "excludeClassifiers", defaultValue = "" )
protected String excludeClassifiers;
/**
* Specify classifier to look for. Example: sources
*
- * @optional
* @since 2.0
- * @parameter expression="${classifier}" default-value=""
*/
+ @Parameter( property = "classifier", defaultValue = "" )
protected String classifier;
/**
* Specify type to look for when constructing artifact based on classifier.
* Example: java-source,jar,war
*
- * @optional
* @since 2.0
- * @parameter expression="${type}" default-value="java-source"
*/
+ @Parameter( property = "type", defaultValue = "java-source" )
protected String type;
/**
* Comma separated list of Artifact names too exclude.
*
* @since 2.0
- * @optional
- * @parameter expression="${excludeArtifactIds}" default-value=""
*/
+ @Parameter( property = "excludeArtifactIds", defaultValue = "" )
protected String excludeArtifactIds;
/**
* Comma separated list of Artifact names to include.
*
* @since 2.0
- * @optional
- * @parameter expression="${includeArtifactIds}" default-value=""
*/
+ @Parameter( property = "includeArtifactIds", defaultValue = "" )
protected String includeArtifactIds;
/**
* Comma separated list of GroupId Names to exclude.
*
* @since 2.0
- * @optional
- * @parameter expression="${excludeGroupIds}" default-value=""
*/
+ @Parameter( property = "excludeGroupIds", defaultValue = "" )
protected String excludeGroupIds;
/**
* Comma separated list of GroupIds to include.
*
* @since 2.0
- * @optional
- * @parameter expression="${includeGroupIds}" default-value=""
*/
+ @Parameter( property = "includeGroupIds", defaultValue = "" )
protected String includeGroupIds;
/**
* Directory to store flag files
*
- * @parameter expression="${markersDirectory}"
- * default-value="${project.build.directory}/dependency-maven-plugin-markers"
- * @optional
* @since 2.0
*/
+ @Parameter( property = "markersDirectory",
+ defaultValue = "${project.build.directory}/dependency-maven-plugin-markers" )
protected File markersDirectory;
/**
* Overwrite release artifacts
*
- * @optional
* @since 1.0
- * @parameter expression="${overWriteReleases}" default-value="false"
*/
+ @Parameter( property = "overWriteReleases", defaultValue = "false" )
protected boolean overWriteReleases;
/**
* Overwrite snapshot artifacts
*
- * @optional
* @since 1.0
- * @parameter expression="${overWriteSnapshots}" default-value="false"
*/
+ @Parameter( property = "overWriteSnapshots", defaultValue = "false" )
protected boolean overWriteSnapshots;
/**
* Overwrite artifacts that don't exist or are older than the source.
*
- * @optional
* @since 2.0
- * @parameter expression="${overWriteIfNewer}" default-value="true"
*/
+ @Parameter( property = "overWriteIfNewer", defaultValue = "true" )
protected boolean overWriteIfNewer;
-
+
/**
* Prepend the groupId during copy.
- *
- * @optional
+ *
* @since 2.2
- * @parameter expression="${mdep.prependGroupId}" default-value="false"
- * @parameter
*/
+ @Parameter( property = "mdep.prependGroupId", defaultValue = "false" )
protected boolean prependGroupId = false;
protected abstract ArtifactsFilter getMarkedArtifactFilter();
@@ -236,7 +218,6 @@ public abstract class AbstractDependency
}
/**
- *
* Method creates filters and filters the projects dependencies. This method
* also transforms the dependencies if classifier is set. The dependencies
* are filtered in least specific to most specific order
@@ -270,8 +251,7 @@ public abstract class AbstractDependency
DependencyUtil.cleanToBeTokenizedString( this.excludeArtifactIds ) ) );
// start with all artifacts.
- @SuppressWarnings( "unchecked" )
- Set<Artifact> artifacts = project.getArtifacts();
+ @SuppressWarnings( "unchecked" ) Set<Artifact> artifacts = project.getArtifacts();
// perform filtering
try
@@ -298,7 +278,6 @@ public abstract class AbstractDependency
}
/**
- *
* Transform artifacts
*
* @param artifacts
@@ -328,8 +307,8 @@ public abstract class AbstractDependency
artifacts = status.getResolvedDependencies();
// resolve the rest of the artifacts
- ArtifactsResolver artifactsResolver = new DefaultArtifactsResolver( this.resolver, this.getLocal(),
- this.remoteRepos, stopOnFailure );
+ ArtifactsResolver artifactsResolver =
+ new DefaultArtifactsResolver( this.resolver, this.getLocal(), this.remoteRepos, stopOnFailure );
resolvedArtifacts = artifactsResolver.resolve( artifacts, getLog() );
// calculate the artifacts not resolved.
@@ -386,8 +365,7 @@ public abstract class AbstractDependency
}
/**
- * @param theMarkersDirectory
- * The markersDirectory to set.
+ * @param theMarkersDirectory The markersDirectory to set.
*/
public void setMarkersDirectory( File theMarkersDirectory )
{
@@ -397,7 +375,7 @@ public abstract class AbstractDependency
// TODO: Set marker files.
/**
- * @return true, if the groupId should be prepended to the filename.
+ * @return true, if the groupId should be prepended to the filename.
*/
public boolean isPrependGroupId()
{
@@ -405,8 +383,8 @@ public abstract class AbstractDependency
}
/**
- * @param prependGroupId -
- * true if the groupId must be prepended during the copy.
+ * @param prependGroupId -
+ * true if the groupId must be prepended during the copy.
*/
public void setPrependGroupId( boolean prependGroupId )
{
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyMojo.java Wed Jul 4 13:28:33 2012
@@ -19,10 +19,6 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.List;
-
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -32,6 +28,8 @@ import org.apache.maven.plugin.AbstractM
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.dependency.utils.DependencySilentLog;
import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.UnArchiver;
@@ -42,6 +40,10 @@ import org.codehaus.plexus.util.FileUtil
import org.codehaus.plexus.util.ReflectionUtils;
import org.codehaus.plexus.util.StringUtils;
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.List;
+
/**
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: AbstractDependencyMojo.java 552528
@@ -52,96 +54,72 @@ public abstract class AbstractDependency
{
/**
* Used to look up Artifacts in the remote repository.
- *
- * @component
*/
+ @Component
protected ArtifactFactory factory;
/**
* Used to look up Artifacts in the remote repository.
- *
- * @component
*/
+ @Component
protected ArtifactResolver resolver;
/**
* Artifact collector, needed to resolve dependencies.
- *
- * @component role="org.apache.maven.artifact.resolver.ArtifactCollector"
- * @required
- * @readonly
*/
+ @Component( role = ArtifactCollector.class )
protected ArtifactCollector artifactCollector;
/**
- * @component role="org.apache.maven.artifact.metadata.ArtifactMetadataSource"
- * hint="maven"
- * @required
- * @readonly
+ *
*/
+ @Component( role = ArtifactMetadataSource.class, hint = "maven" )
protected ArtifactMetadataSource artifactMetadataSource;
/**
* Location of the local repository.
- *
- * @parameter default-value="${localRepository}"
- * @readonly
- * @required
*/
+ @Parameter( defaultValue = "${localRepository}", readonly = true, required = true )
private ArtifactRepository local;
/**
* List of Remote Repositories used by the resolver
- *
- * @parameter default-value="${project.remoteArtifactRepositories}"
- * @readonly
- * @required
*/
+ @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true )
protected List<ArtifactRepository> remoteRepos;
/**
* To look up Archiver/UnArchiver implementations
- *
- * @component
*/
+ @Component
protected ArchiverManager archiverManager;
/**
* POM
- *
- * @parameter default-value="${project}"
- * @readonly
- * @required
*/
+ @Component
protected MavenProject project;
/**
* Contains the full list of projects in the reactor.
- *
- * @parameter default-value="${reactorProjects}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${reactorProjects}" )
protected List<MavenProject> reactorProjects;
/**
* If the plugin should be silent.
*
- * @optional
* @since 2.0
- * @parameter expression="${silent}"
- * default-value="false"
*/
+ @Parameter( property = "silent", defaultValue = "false" )
public boolean silent;
/**
* Output absolute filename for resolved artifacts
*
- * @optional
* @since 2.0
- * @parameter expression="${outputAbsoluteArtifactFilename}"
- * default-value="false"
*/
+ @Parameter( property = "outputAbsoluteArtifactFilename", defaultValue = "false" )
protected boolean outputAbsoluteArtifactFilename;
private Log log;
@@ -176,9 +154,8 @@ public abstract class AbstractDependency
*
* @param artifact represents the file to copy.
* @param destFile file name of destination file.
- *
* @throws MojoExecutionException with a message if an
- * error occurs.
+ * error occurs.
*/
protected void copyFile( File artifact, File destFile )
throws MojoExecutionException
@@ -186,9 +163,9 @@ public abstract class AbstractDependency
Log theLog = this.getLog();
try
{
- theLog.info( "Copying "
- + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() ) + " to "
- + destFile );
+ theLog.info(
+ "Copying " + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() )
+ + " to " + destFile );
FileUtils.copyFile( artifact, destFile );
}
@@ -207,12 +184,12 @@ public abstract class AbstractDependency
/**
* Unpacks the archive file.
*
- * @param file File to be unpacked.
+ * @param file File to be unpacked.
* @param location Location where to put the unpacked files.
* @param includes Comma separated list of file patterns to include i.e. <code>**/.xml,
- * **/*.properties</code>
+ * **/*.properties</code>
* @param excludes Comma separated list of file patterns to exclude i.e. <code>**/*.xml,
- * **/*.properties</code>
+ * **/*.properties</code>
*/
protected void unpack( File file, File location, String includes, String excludes )
throws MojoExecutionException
@@ -236,7 +213,8 @@ public abstract class AbstractDependency
// Create the selectors that will filter
// based on include/exclude parameters
// MDEP-47
- IncludeExcludeFileSelector[] selectors = new IncludeExcludeFileSelector[] { new IncludeExcludeFileSelector() };
+ IncludeExcludeFileSelector[] selectors =
+ new IncludeExcludeFileSelector[]{ new IncludeExcludeFileSelector() };
if ( StringUtils.isNotEmpty( excludes ) )
{
@@ -264,8 +242,8 @@ public abstract class AbstractDependency
catch ( ArchiverException e )
{
e.printStackTrace();
- throw new MojoExecutionException( "Error unpacking file: " + file + " to: " + location + "\r\n"
- + e.toString(), e );
+ throw new MojoExecutionException(
+ "Error unpacking file: " + file + " to: " + location + "\r\n" + e.toString(), e );
}
}
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractFromDependenciesMojo.java Wed Jul 4 13:28:33 2012
@@ -19,6 +19,8 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
+import org.apache.maven.plugins.annotations.Parameter;
+
import java.io.File;
/**
@@ -34,50 +36,42 @@ public abstract class AbstractFromDepend
/**
* Strip artifact version during copy
- *
- * @optional
- * @parameter expression="${mdep.stripVersion}" default-value="false"
- * @parameter
*/
+ @Parameter( property = "mdep.stripVersion", defaultValue = "false" )
protected boolean stripVersion = false;
-
+
/**
* Default location used for mojo unless overridden in ArtifactItem
*
- * @parameter expression="${outputDirectory}"
- * default-value="${project.build.directory}/dependency"
- * @optional
* @since 1.0
*/
+ @Parameter( property = "outputDirectory", defaultValue = "${project.build.directory}/dependency" )
protected File outputDirectory;
/**
* Place each artifact in the same directory layout as a default repository.
* <br/>example: /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
+ *
* @since 2.0-alpha-2
- * @parameter expression="${mdep.useRepositoryLayout}" default-value="false"
- * @optional
*/
+ @Parameter( property = "mdep.useRepositoryLayout", defaultValue = "false" )
protected boolean useRepositoryLayout;
/**
* Also copy the pom of each artifact.
*
* @since 2.0
- * @parameter expression="${mdep.copyPom}"
- * default-value="false"
- * @optional
*/
+ @Parameter( property = "mdep.copyPom", defaultValue = "false" )
protected boolean copyPom = true;
/**
* Place each type of file in a separate subdirectory. (example
* /outputDirectory/runtime /outputDirectory/provided etc)
*
- * @parameter expression="${mdep.useSubDirectoryPerScope}" default-value="false"
- * @optional
* @since 2.2
*/
+ @Parameter( property = "mdep.useSubDirectoryPerScope", defaultValue = "false" )
protected boolean useSubDirectoryPerScope;
/**
@@ -85,9 +79,8 @@ public abstract class AbstractFromDepend
* /outputDirectory/jars /outputDirectory/wars etc)
*
* @since 2.0-alpha-1
- * @parameter expression="${mdep.useSubDirectoryPerType}" default-value="false"
- * @optional
*/
+ @Parameter( property = "mdep.useSubDirectoryPerType", defaultValue = "false" )
protected boolean useSubDirectoryPerType;
/**
@@ -95,20 +88,16 @@ public abstract class AbstractFromDepend
* <code>/outputDirectory/junit-3.8.1-jar</code>)
*
* @since 2.0-alpha-1
- * @parameter expression="${mdep.useSubDirectoryPerArtifact}"
- * default-value="false"
- * @optional
*/
+ @Parameter( property = "mdep.useSubDirectoryPerArtifact", defaultValue = "false" )
protected boolean useSubDirectoryPerArtifact;
/**
* This only applies if the classifier parameter is used.
*
* @since 2.0-alpha-2
- * @parameter expression="${mdep.failOnMissingClassifierArtifact}"
- * default-value="true"
- * @optional
*/
+ @Parameter( property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false" )
protected boolean failOnMissingClassifierArtifact = true;
/**
@@ -120,8 +109,7 @@ public abstract class AbstractFromDepend
}
/**
- * @param theOutputDirectory
- * The outputDirectory to set.
+ * @param theOutputDirectory The outputDirectory to set.
*/
public void setOutputDirectory( File theOutputDirectory )
{
@@ -137,8 +125,7 @@ public abstract class AbstractFromDepend
}
/**
- * @param theUseSubDirectoryPerArtifact
- * The useSubDirectoryPerArtifact to set.
+ * @param theUseSubDirectoryPerArtifact The useSubDirectoryPerArtifact to set.
*/
public void setUseSubDirectoryPerArtifact( boolean theUseSubDirectoryPerArtifact )
{
@@ -152,10 +139,9 @@ public abstract class AbstractFromDepend
{
return this.useSubDirectoryPerScope;
}
-
+
/**
- * @param theUseSubDirectoryPerScope
- * The useSubDirectoryPerScope to set.
+ * @param theUseSubDirectoryPerScope The useSubDirectoryPerScope to set.
*/
public void setUseSubDirectoryPerScope( boolean theUseSubDirectoryPerScope )
{
@@ -171,8 +157,7 @@ public abstract class AbstractFromDepend
}
/**
- * @param theUseSubDirectoryPerType
- * The useSubDirectoryPerType to set.
+ * @param theUseSubDirectoryPerType The useSubDirectoryPerType to set.
*/
public void setUseSubDirectoryPerType( boolean theUseSubDirectoryPerType )
{
@@ -200,7 +185,6 @@ public abstract class AbstractFromDepend
}
/**
- *
* @return true, if dependencies must be planted in a repository layout
*/
public boolean isUseRepositoryLayout()
@@ -209,9 +193,8 @@ public abstract class AbstractFromDepend
}
/**
- *
* @param useRepositoryLayout -
- * true if dependencies must be planted in a repository layout
+ * true if dependencies must be planted in a repository layout
*/
public void setUseRepositoryLayout( boolean useRepositoryLayout )
{
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java Wed Jul 4 13:28:33 2012
@@ -19,42 +19,40 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.io.File;
-import java.util.Set;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import java.io.File;
+import java.util.Set;
+
/**
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
- *
*/
public abstract class AbstractResolveMojo
extends AbstractDependencyFilterMojo
{
/**
* Project builder -- builds a model from a pom.xml
- *
- * @component role="org.apache.maven.project.MavenProjectBuilder"
- * @required
- * @readonly
*/
+ @Component
protected MavenProjectBuilder mavenProjectBuilder;
/**
* If specified, this parameter will cause the dependencies to be written to the path specified, instead of writing
* to the console.
*
- * @parameter expression="${outputFile}"
* @since 2.0
*/
+ @Parameter( property = "outputFile" )
protected File outputFile;
/**
@@ -68,21 +66,20 @@ public abstract class AbstractResolveMoj
* @throws ArtifactNotFoundException
* @throws InvalidDependencyVersionException
*/
-
- /**
- * Whether to append outputs into the output file or overwrite it.
- *
- * @parameter expression="${appendOutput}" default-value="false"
- * @since 2.2
- */
- protected boolean appendOutput;
-
+
+ /**
+ * Whether to append outputs into the output file or overwrite it.
+ *
+ * @since 2.2
+ */
+ @Parameter( property = "appendOutput", defaultValue = "false" )
+ protected boolean appendOutput;
+
protected Set<Artifact> resolveDependencyArtifacts( MavenProject theProject )
throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException
{
- Set<Artifact> artifacts =
- theProject.createArtifacts( this.factory, Artifact.SCOPE_TEST,
- new ScopeArtifactFilter( Artifact.SCOPE_TEST ) );
+ Set<Artifact> artifacts = theProject.createArtifacts( this.factory, Artifact.SCOPE_TEST,
+ new ScopeArtifactFilter( Artifact.SCOPE_TEST ) );
for ( Artifact artifact : artifacts )
{
@@ -95,15 +92,13 @@ public abstract class AbstractResolveMoj
/**
* This method resolves all transitive dependencies of an artifact.
*
- * @param artifact
- * the artifact used to retrieve dependencies
- *
+ * @param artifact the artifact used to retrieve dependencies
* @return resolved set of dependencies
- *
* @throws ArtifactResolutionException
* @throws ArtifactNotFoundException
* @throws ProjectBuildingException
* @throws InvalidDependencyVersionException
+ *
*/
protected Set<Artifact> resolveArtifactDependencies( Artifact artifact )
throws ArtifactResolutionException, ArtifactNotFoundException, ProjectBuildingException,
@@ -113,7 +108,8 @@ public abstract class AbstractResolveMoj
this.factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "",
"pom" );
- MavenProject pomProject = mavenProjectBuilder.buildFromRepository( pomArtifact, this.remoteRepos, this.getLocal() );
+ MavenProject pomProject =
+ mavenProjectBuilder.buildFromRepository( pomArtifact, this.remoteRepos, this.getLocal() );
return resolveDependencyArtifacts( pomProject );
}
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java Wed Jul 4 13:28:33 2012
@@ -19,13 +19,6 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
@@ -33,9 +26,20 @@ import org.apache.maven.model.Exclusion;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* This mojo looks at the dependencies after final resolution and looks for
* mismatches in your dependencyManagement section. In versions of maven prior
@@ -48,10 +52,9 @@ import org.codehaus.plexus.util.StringUt
*
* @author <a href="mailto:brianefox@gmail.com">Brian Fox</a>
* @version $Id$
- * @goal analyze-dep-mgt
- * @requiresDependencyResolution test
* @since 2.0-alpha-3
*/
+@Mojo( name = "analyze-dep-mgt", requiresDependencyResolution = ResolutionScope.TEST )
public class AnalyzeDepMgt
extends AbstractMojo
{
@@ -59,25 +62,20 @@ public class AnalyzeDepMgt
/**
*
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
*/
+ @Component
private MavenProject project;
/**
* Fail the build if a problem is detected.
- *
- * @parameter expression="${mdep.analyze.failBuild}" default-value="false"
*/
+ @Parameter( property = "mdep.analyze.failBuild", defaultValue = "false" )
private boolean failBuild = false;
/**
* Ignore Direct Dependency Overrides of dependencyManagement section.
- *
- * @parameter expression="${mdep.analyze.ignore.direct}" default-value="true"
*/
+ @Parameter( property = "mdep.analyze.ignore.direct", defaultValue = "true" )
private boolean ignoreDirect = true;
// Mojo methods -----------------------------------------------------------
@@ -105,6 +103,7 @@ public class AnalyzeDepMgt
/**
* Does the work of checking the DependencyManagement Section.
+ *
* @return true if errors are found.
* @throws MojoExecutionException
*/
@@ -137,16 +136,15 @@ public class AnalyzeDepMgt
}
// get dependencies for the project (including transitive)
- @SuppressWarnings( "unchecked" )
- Set<Artifact> allDependencyArtifacts = new HashSet<Artifact>( project.getArtifacts() );
+ @SuppressWarnings( "unchecked" ) Set<Artifact> allDependencyArtifacts =
+ new HashSet<Artifact>( project.getArtifacts() );
// don't warn if a dependency that is directly listed overrides
// depMgt. That's ok.
if ( this.ignoreDirect )
{
getLog().info( "\tIgnoring Direct Dependencies." );
- @SuppressWarnings( "unchecked" )
- Set<Artifact> directDependencies = project.getDependencyArtifacts();
+ @SuppressWarnings( "unchecked" ) Set<Artifact> directDependencies = project.getDependencyArtifacts();
allDependencyArtifacts.removeAll( directDependencies );
}
@@ -154,8 +152,7 @@ public class AnalyzeDepMgt
List<Artifact> exclusionErrors = getExclusionErrors( exclusions, allDependencyArtifacts );
for ( Artifact exclusion : exclusionErrors )
{
- getLog().info(
- StringUtils.stripEnd( getArtifactManagementKey( exclusion ), ":" )
+ getLog().info( StringUtils.stripEnd( getArtifactManagementKey( exclusion ), ":" )
+ " was excluded in DepMgt, but version " + exclusion.getVersion()
+ " has been found in the dependency tree." );
foundError = true;
@@ -178,8 +175,6 @@ public class AnalyzeDepMgt
getLog().info( " Nothing in DepMgt." );
}
-
-
return foundError;
}
@@ -187,8 +182,7 @@ public class AnalyzeDepMgt
* Returns a map of the exclusions using the Dependency ManagementKey as the
* keyset.
*
- * @param exclusionList
- * to be added to the map.
+ * @param exclusionList to be added to the map.
* @return a map of the exclusions using the Dependency ManagementKey as the
* keyset.
*/
@@ -209,11 +203,9 @@ public class AnalyzeDepMgt
* Returns a List of the artifacts that should have been excluded, but were
* found in the dependency tree.
*
- * @param exclusions
- * a map of the DependencyManagement exclusions, with the
- * ManagementKey as the key and Dependency as the value.
- * @param allDependencyArtifacts
- * resolved artifacts to be compared.
+ * @param exclusions a map of the DependencyManagement exclusions, with the
+ * ManagementKey as the key and Dependency as the value.
+ * @param allDependencyArtifacts resolved artifacts to be compared.
* @return list of artifacts that should have been excluded.
*/
public List<Artifact> getExclusionErrors( Map<String, Exclusion> exclusions, Set<Artifact> allDependencyArtifacts )
@@ -245,11 +237,9 @@ public class AnalyzeDepMgt
* Calculate the mismatches between the DependencyManagement and resolved
* artifacts
*
- * @param depMgtMap
- * contains the Dependency.GetManagementKey as the keyset for
- * quick lookup.
- * @param allDependencyArtifacts
- * contains the set of all artifacts to compare.
+ * @param depMgtMap contains the Dependency.GetManagementKey as the keyset for
+ * quick lookup.
+ * @param allDependencyArtifacts contains the set of all artifacts to compare.
* @return a map containing the resolved artifact as the key and the listed
* dependency as the value.
*/
@@ -266,7 +256,7 @@ public class AnalyzeDepMgt
//workaround for MNG-2961
dependencyArtifact.isSnapshot();
- if (!depFromDepMgt.getVersion().equals( dependencyArtifact.getBaseVersion()) )
+ if ( !depFromDepMgt.getVersion().equals( dependencyArtifact.getBaseVersion() ) )
{
mismatchMap.put( dependencyArtifact, depFromDepMgt );
}
@@ -279,10 +269,8 @@ public class AnalyzeDepMgt
* This function displays the log to the screen showing the versions and
* information about the artifacts that don't match.
*
- * @param dependencyArtifact
- * the artifact that was resolved.
- * @param dependencyFromDepMgt
- * the dependency listed in the DependencyManagement section.
+ * @param dependencyArtifact the artifact that was resolved.
+ * @param dependencyFromDepMgt the dependency listed in the DependencyManagement section.
* @throws MojoExecutionException
*/
public void logMismatch( Artifact dependencyArtifact, Dependency dependencyFromDepMgt )
@@ -290,8 +278,8 @@ public class AnalyzeDepMgt
{
if ( dependencyArtifact == null || dependencyFromDepMgt == null )
{
- throw new MojoExecutionException( "Invalid params: Artifact:" + dependencyArtifact + " Dependency:"
- + dependencyFromDepMgt );
+ throw new MojoExecutionException(
+ "Invalid params: Artifact:" + dependencyArtifact + " Dependency:" + dependencyFromDepMgt );
}
getLog().info( "\tDependency: " + StringUtils.stripEnd( dependencyFromDepMgt.getManagementKey(), ":" ) );
@@ -302,14 +290,13 @@ public class AnalyzeDepMgt
/**
* This function returns a string comparable with Dependency.GetManagementKey.
*
- * @param artifact
- * to gen the key for
+ * @param artifact to gen the key for
* @return a string in the form: groupId:ArtifactId:Type[:Classifier]
*/
public String getArtifactManagementKey( Artifact artifact )
{
- return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getType()
- + ( ( artifact.getClassifier() != null ) ? ":" + artifact.getClassifier() : "" );
+ return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getType() + ( (
+ artifact.getClassifier() != null ) ? ":" + artifact.getClassifier() : "" );
}
/**
@@ -321,8 +308,7 @@ public class AnalyzeDepMgt
}
/**
- * @param theFailBuild
- * the failBuild to set
+ * @param theFailBuild the failBuild to set
*/
public void setFailBuild( boolean theFailBuild )
{
@@ -338,8 +324,7 @@ public class AnalyzeDepMgt
}
/**
- * @param theProject
- * the project to set
+ * @param theProject the project to set
*/
public void setProject( MavenProject theProject )
{
@@ -355,8 +340,7 @@ public class AnalyzeDepMgt
}
/**
- * @param theIgnoreDirect
- * the ignoreDirect to set
+ * @param theIgnoreDirect the ignoreDirect to set
*/
public void setIgnoreDirect( boolean theIgnoreDirect )
{
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDuplicateMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDuplicateMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDuplicateMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDuplicateMojo.java Wed Jul 4 13:28:33 2012
@@ -19,13 +19,6 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
@@ -33,32 +26,39 @@ import org.apache.maven.model.io.xpp3.Ma
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
/**
* Analyzes the <code><dependencies/></code> and <code><dependencyManagement/></code> tags in the
* <code>pom.xml</code> and determines the duplicate declared dependencies.
*
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id$
- * @goal analyze-duplicate
- * @aggregator false
*/
+@Mojo( name = "analyze-duplicate", aggregator = false )
public class AnalyzeDuplicateMojo
extends AbstractMojo
{
/**
* The Maven project to analyze.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
*/
+ @Component
private MavenProject project;
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void execute()
throws MojoExecutionException, MojoFailureException
{
@@ -117,8 +117,8 @@ public class AnalyzeDuplicateMojo
{
sb.append( "\n" );
}
- sb.append( "List of duplicate dependencies defined in <dependencyManagement/> in "
- + "your pom.xml:\n" );
+ sb.append(
+ "List of duplicate dependencies defined in <dependencyManagement/> in " + "your pom.xml:\n" );
for ( Iterator<String> it = duplicateDependenciesManagement.iterator(); it.hasNext(); )
{
String dup = it.next();
@@ -150,7 +150,7 @@ public class AnalyzeDuplicateMojo
modelDependencies2.add( dep.getManagementKey() );
}
- return new HashSet<String>( CollectionUtils.disjunction( modelDependencies2,
- new HashSet<String>( modelDependencies2 ) ) );
+ return new HashSet<String>(
+ CollectionUtils.disjunction( modelDependencies2, new HashSet<String>( modelDependencies2 ) ) );
}
}
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java Wed Jul 4 13:28:33 2012
@@ -19,22 +19,25 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
/**
* Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused
* and declared. This goal is intended to be used standalone, thus it always executes the <code>test-compile</code>
* phase - use the <code>dependency:analyze-only</code> goal instead when participating in the build lifecycle.
- *
+ *
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id$
- * @since 2.0-alpha-3
* @see AnalyzeOnlyMojo
- *
- * @goal analyze
- * @requiresDependencyResolution test
- * @execute phase="test-compile"
+ * @since 2.0-alpha-3
*/
+@Mojo( name = "analyze", requiresDependencyResolution = ResolutionScope.TEST )
+@Execute( phase = LifecyclePhase.TEST_COMPILE )
public class AnalyzeMojo
extends AbstractAnalyzeMojo
{
- // subclassed to provide plexus annotations
+ // subclassed to provide annotations
}
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeOnlyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeOnlyMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeOnlyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeOnlyMojo.java Wed Jul 4 13:28:33 2012
@@ -19,23 +19,25 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
/**
* Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused
* and declared. This goal is intended to be used in the build lifecycle, thus it assumes that the
* <code>test-compile</code> phase has been executed - use the <code>dependency:analyze</code> goal instead when
* running standalone.
- *
+ *
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id$
- * @since 2.0
* @see AnalyzeMojo
- *
- * @goal analyze-only
- * @requiresDependencyResolution test
- * @phase verify
+ * @since 2.0
*/
+@Mojo( name = "analyze-only", requiresDependencyResolution = ResolutionScope.TEST,
+ defaultPhase = LifecyclePhase.VERIFY )
public class AnalyzeOnlyMojo
extends AbstractAnalyzeMojo
{
- // subclassed to provide plexus annotations
+ // subclassed to provide annotations
}
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeReportMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeReportMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeReportMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeReportMojo.java Wed Jul 4 13:28:33 2012
@@ -19,16 +19,15 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.io.File;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Set;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
@@ -36,16 +35,22 @@ import org.apache.maven.shared.dependenc
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
/**
* Analyzes the dependencies of this project and produces a report that summarizes which are: used and declared; used
* and undeclared; unused and declared.
- *
+ *
* @version $Id$
* @since 2.0-alpha-5
- * @goal analyze-report
- * @requiresDependencyResolution test
- * @execute phase="test-compile"
*/
+@Mojo( name = "analyze-report", requiresDependencyResolution = ResolutionScope.TEST )
+@Execute( phase = LifecyclePhase.TEST_COMPILE )
public class AnalyzeReportMojo
extends AbstractMavenReport
{
@@ -53,43 +58,34 @@ public class AnalyzeReportMojo
/**
* The Maven project to analyze.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
*/
+ @Parameter
private MavenProject project;
/**
* The Maven project dependency analyzer to use.
- *
- * @component
- * @required
- * @readonly
*/
+ @Component
private ProjectDependencyAnalyzer analyzer;
/**
- * @component
- * @required
- * @readonly
+ *
*/
+ @Component
private Renderer siteRenderer;
/**
* Target folder
- *
- * @parameter default-value="${project.build.directory}"
- * @readonly
+ *
* @since 2.0-alpha-5
*/
+ @Parameter( defaultValue = "${project.build.directory}", readonly = true )
private File outputDirectory;
/**
* Ignore Runtime,Provide,Test,System scopes for unused dependency analysis
- *
- * @parameter expression="${ignoreNonCompile}" default-value="false"
*/
+ @Parameter( property = "ignoreNonCompile", defaultValue = "false" )
private boolean ignoreNonCompile;
// Mojo methods -----------------------------------------------------------
@@ -124,12 +120,11 @@ public class AnalyzeReportMojo
throw new MavenReportException( "Cannot analyze dependencies", exception );
}
-
//remove everything that's not in the compile scope
if ( ignoreNonCompile )
{
- @SuppressWarnings( "unchecked" )
- Set<Artifact> filteredUnusedDeclared = new HashSet<Artifact>( analysis.getUnusedDeclaredArtifacts() );
+ @SuppressWarnings( "unchecked" ) Set<Artifact> filteredUnusedDeclared =
+ new HashSet<Artifact>( analysis.getUnusedDeclaredArtifacts() );
Iterator<Artifact> iter = filteredUnusedDeclared.iterator();
while ( iter.hasNext() )
{
@@ -139,14 +134,13 @@ public class AnalyzeReportMojo
iter.remove();
}
}
-
- ProjectDependencyAnalysis analysisTemp =
- new ProjectDependencyAnalysis( analysis.getUsedDeclaredArtifacts(),
- analysis.getUsedUndeclaredArtifacts(), filteredUnusedDeclared );
+
+ ProjectDependencyAnalysis analysisTemp = new ProjectDependencyAnalysis( analysis.getUsedDeclaredArtifacts(),
+ analysis.getUsedUndeclaredArtifacts(),
+ filteredUnusedDeclared );
analysis = analysisTemp;
}
-
-
+
// Step 2: Create sink and bundle
Sink sink = getSink();
ResourceBundle bundle = getBundle( locale );
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/BuildClasspathMojo.java Wed Jul 4 13:28:33 2012
@@ -19,6 +19,19 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.dependency.utils.DependencyUtil;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -34,24 +47,15 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.dependency.utils.DependencyUtil;
-import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.StringUtils;
-
/**
* This goal will output a classpath string of dependencies from the local repository to a file or log.
*
- * @goal build-classpath
- * @requiresDependencyResolution test
- * @phase generate-sources
* @author ankostis
* @version $Id$
* @since 2.0-alpha-2
*/
+@Mojo( name = "build-classpath", requiresDependencyResolution = ResolutionScope.TEST,
+ defaultPhase = LifecyclePhase.GENERATE_SOURCES )
public class BuildClasspathMojo
extends AbstractDependencyFilterMojo
implements Comparator<Artifact>
@@ -59,41 +63,37 @@ public class BuildClasspathMojo
/**
* Strip artifact version during copy (only works if prefix is set)
- *
- * @parameter expression="${mdep.stripVersion}" default-value="false"
- * @parameter
*/
+ @Parameter( property = "mdep.stripVersion", defaultValue = "false" )
private boolean stripVersion = false;
/**
* The prefix to prepend on each dependent artifact. If undefined, the paths refer to the actual files store in the
* local repository (the stipVersion parameter does nothing then).
- *
- * @parameter expression="${mdep.prefix}"
*/
+ @Parameter( property = "mdep.prefix" )
private String prefix;
/**
* The file to write the classpath string. If undefined, it just prints the classpath as [INFO].
* This parameter is deprecated. Use outputFile instead.
*
- * @parameter expression="${mdep.cpFile}"
- * @deprecated use outputFile instead
* @since 2.0
+ * @deprecated use outputFile instead
*/
+ @Parameter( property = "mdep.cpFile" )
private File cpFile;
/**
* The file to write the classpath string. If undefined, it just prints the classpath as [INFO].
- * @parameter expression="${mdep.outputFile}"
*/
+ @Parameter( property = "mdep.outputFile" )
private File outputFile;
/**
* If 'true', it skips the up-to-date-check, and always regenerates the classpath file.
- *
- * @parameter default-value="false" expression="${mdep.regenerateFile}"
*/
+ @Parameter( property = "mdep.regenerateFile", defaultValue = "false" )
private boolean regenerateFile;
/**
@@ -102,8 +102,8 @@ public class BuildClasspathMojo
* systems it is '\'. The default is File.separator
*
* @since 2.0
- * @parameter default-value="" expression="${mdep.fileSeparator}"
*/
+ @Parameter( property = "mdep.fileSeparator", defaultValue = "" )
private String fileSeparator;
/**
@@ -113,8 +113,8 @@ public class BuildClasspathMojo
* on Microsoft Windows systems it is ';'.
*
* @since 2.0
- * @parameter default-value="" expression="${mdep.pathSeparator}"
*/
+ @Parameter( property = "mdep.pathSeparator", defaultValue = "" )
private String pathSeparator;
/**
@@ -122,32 +122,30 @@ public class BuildClasspathMojo
* value will be forced to "${M2_REPO}" if no value is provided AND the attach flag is true.
*
* @since 2.0
- * @parameter default-value="" expression="${mdep.localRepoProperty}"
*/
+ @Parameter( property = "mdep.localRepoProperty", defaultValue = "" )
private String localRepoProperty;
/**
* Attach the classpath file to the main artifact so it can be installed and deployed.
*
* @since 2.0
- * @parameter default-value=false
*/
+ @Parameter( defaultValue = "false" )
boolean attach;
/**
* Write out the classpath in a format compatible with filtering (classpath=xxxxx)
*
* @since 2.0
- * @parameter default-value=false expression="${mdep.outputFilterFile}"
*/
+ @Parameter( property = "mdep.outputFilterFile", defaultValue = "false" )
boolean outputFilterFile;
/**
* Maven ProjectHelper
- *
- * @component
- * @readonly
*/
+ @Component
private MavenProjectHelper projectHelper;
boolean isFileSepSet = true;
@@ -295,7 +293,8 @@ public class BuildClasspathMojo
}
catch ( Exception ex )
{
- this.getLog().warn( "Error while reading old classpath file '" + outputFile + "' for up-to-date check: " + ex );
+ this.getLog().warn(
+ "Error while reading old classpath file '" + outputFile + "' for up-to-date check: " + ex );
return false;
}
@@ -322,8 +321,8 @@ public class BuildClasspathMojo
}
catch ( IOException ex )
{
- throw new MojoExecutionException( "Error while writting to classpath file '" + out + "': "
- + ex.toString(), ex );
+ throw new MojoExecutionException( "Error while writting to classpath file '" + out + "': " + ex.toString(),
+ ex );
}
finally
{
@@ -344,7 +343,7 @@ public class BuildClasspathMojo
if ( outputFile == null )
{
throw new IllegalArgumentException(
- "The outputFile parameter cannot be null if the file is intended to be read." );
+ "The outputFile parameter cannot be null if the file is intended to be read." );
}
if ( !outputFile.isFile() )
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java?rev=1357251&r1=1357250&r2=1357251&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/CopyDependenciesMojo.java Wed Jul 4 13:28:33 2012
@@ -19,11 +19,6 @@ package org.apache.maven.plugin.dependen
* under the License.
*/
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.installer.ArtifactInstallationException;
import org.apache.maven.artifact.installer.ArtifactInstaller;
@@ -34,45 +29,54 @@ import org.apache.maven.plugin.MojoExecu
import org.apache.maven.plugin.dependency.utils.DependencyStatusSets;
import org.apache.maven.plugin.dependency.utils.DependencyUtil;
import org.apache.maven.plugin.dependency.utils.filters.DestFileFilter;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.Map;
+import java.util.Set;
+
/**
* Goal that copies the project dependencies from the repository to a defined
* location.
*
- * @goal copy-dependencies
- * @requiresDependencyResolution test
- * @phase process-sources
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
* @since 1.0
*/
+@Mojo( name = "copy-dependencies", requiresDependencyResolution = ResolutionScope.TEST,
+ defaultPhase = LifecyclePhase.PROCESS_SOURCES )
public class CopyDependenciesMojo
extends AbstractFromDependenciesMojo
{
/**
- * @component
+ *
*/
+ @Component
protected ArtifactInstaller installer;
/**
- * @component
+ *
*/
+ @Component
protected ArtifactRepositoryFactory repositoryFactory;
/**
- * @component role="org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout"
+ *
*/
+ @Component( role = ArtifactRepositoryLayout.class )
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
/**
* Main entry into mojo. Gets the list of dependencies and iterates through
* calling copyArtifact.
*
- * @throws MojoExecutionException
- * with a message if an error occurs.
- *
+ * @throws MojoExecutionException with a message if an error occurs.
* @see #getDependencies
* @see #copyArtifact(Artifact, boolean)
*/
@@ -86,18 +90,19 @@ public class CopyDependenciesMojo
{
for ( Artifact artifact : artifacts )
{
- copyArtifact( artifact, this.stripVersion, this.prependGroupId );
+ copyArtifact( artifact, this.stripVersion, this.prependGroupId );
}
}
else
{
try
{
- ArtifactRepository targetRepository = repositoryFactory.createDeploymentArtifactRepository(
- "local",
- outputDirectory.toURL().toExternalForm(),
- (ArtifactRepositoryLayout) repositoryLayouts.get( "default" ),
- false /*uniqueVersion*/ );
+ ArtifactRepository targetRepository = repositoryFactory.createDeploymentArtifactRepository( "local",
+ outputDirectory.toURL().toExternalForm(),
+ (ArtifactRepositoryLayout) repositoryLayouts.get(
+ "default" ),
+ false
+ /*uniqueVersion*/ );
for ( Artifact artifact : artifacts )
{
installArtifact( artifact, targetRepository );
@@ -118,7 +123,8 @@ public class CopyDependenciesMojo
if ( isCopyPom() )
{
copyPoms( getOutputDirectory(), artifacts, this.stripVersion );
- copyPoms( getOutputDirectory(), skippedArtifacts, this.stripVersion ); // Artifacts that already exist may not already have poms.
+ copyPoms( getOutputDirectory(), skippedArtifacts,
+ this.stripVersion ); // Artifacts that already exist may not already have poms.
}
}
@@ -154,12 +160,13 @@ public class CopyDependenciesMojo
}
private void installBaseSnapshot( Artifact artifact, ArtifactRepository targetRepository )
- throws ArtifactInstallationException
+ throws ArtifactInstallationException
{
if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
{
- Artifact baseArtifact = this.factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getBaseVersion(), artifact.getScope(), artifact.getType() );
+ Artifact baseArtifact =
+ this.factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(),
+ artifact.getScope(), artifact.getType() );
installer.install( artifact.getFile(), baseArtifact, targetRepository );
}
}
@@ -169,16 +176,11 @@ public class CopyDependenciesMojo
* overridden. This method also checks if the classifier is set and adds it
* to the destination file name if needed.
*
- * @param artifact
- * representing the object to be copied.
- * @param removeVersion
- * specifies if the version should be removed from the file name
- * when copying.
- * @param prependGroupId
- * specifies if the groupId should be prepend to the file while copying.
- * @throws MojoExecutionException
- * with a message if an error occurs.
- *
+ * @param artifact representing the object to be copied.
+ * @param removeVersion specifies if the version should be removed from the file name
+ * when copying.
+ * @param prependGroupId specifies if the groupId should be prepend to the file while copying.
+ * @throws MojoExecutionException with a message if an error occurs.
* @see DependencyUtil#copyFile(File, File, Log)
* @see DependencyUtil#getFormattedFileName(Artifact, boolean)
*/
@@ -186,12 +188,12 @@ public class CopyDependenciesMojo
throws MojoExecutionException
{
- String destFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId);
+ String destFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId );
File destDir;
- destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerScope, useSubDirectoryPerType, useSubDirectoryPerArtifact,
- useRepositoryLayout, stripVersion, outputDirectory,
- artifact );
+ destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerScope, useSubDirectoryPerType,
+ useSubDirectoryPerArtifact, useRepositoryLayout,
+ stripVersion, outputDirectory, artifact );
File destFile = new File( destDir, destFileName );
copyFile( artifact.getFile(), destFile );
@@ -212,8 +214,8 @@ public class CopyDependenciesMojo
if ( pomArtifact.getFile() != null && pomArtifact.getFile().exists() )
{
File pomDestFile = new File( destDir, DependencyUtil.getFormattedFileName( pomArtifact, removeVersion,
- prependGroupId) );
- if ( ! pomDestFile.exists() )
+ prependGroupId ) );
+ if ( !pomDestFile.exists() )
{
copyFile( pomArtifact.getFile(), pomDestFile );
}
@@ -223,8 +225,9 @@ public class CopyDependenciesMojo
protected Artifact getResolvedPomArtifact( Artifact artifact )
{
- Artifact pomArtifact = this.factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getVersion(), "", "pom" );
+ Artifact pomArtifact =
+ this.factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "",
+ "pom" );
// Resolve the pom artifact using repos
try
{
@@ -240,7 +243,8 @@ public class CopyDependenciesMojo
protected ArtifactsFilter getMarkedArtifactFilter()
{
return new DestFileFilter( this.overWriteReleases, this.overWriteSnapshots, this.overWriteIfNewer,
- this.useSubDirectoryPerArtifact, this.useSubDirectoryPerType, this.useSubDirectoryPerScope,
- this.useRepositoryLayout, this.stripVersion, this.outputDirectory );
+ this.useSubDirectoryPerArtifact, this.useSubDirectoryPerType,
+ this.useSubDirectoryPerScope, this.useRepositoryLayout, this.stripVersion,
+ this.outputDirectory );
}
}