[MDEP-583] Failed to create release on JDK 8 based on JavaDoc issues
o Fixed JavaDoc issues with JDK 8.
o Fixed some checkstyle reported issues as well.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1807877 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java b/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java
index 0ee1247..dc89a6b 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/AbstractDependencyMojo.java
@@ -48,8 +48,7 @@
/**
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @version $Id: AbstractDependencyMojo.java 552528
- * 2007-07-02 16:12:47Z markh $
+ * @version $Id$
*/
public abstract class AbstractDependencyMojo
extends AbstractMojo
@@ -65,6 +64,7 @@
* will use the jvm chmod, this is available for user and all level group level will be ignored
* </p>
* <b>since 2.6 is on by default</b>
+ *
* @since 2.5.1
*/
@Parameter( property = "dependency.useJvmChmod", defaultValue = "true" )
@@ -72,6 +72,7 @@
/**
* ignore to set file permissions when unpacking a dependency
+ *
* @since 2.7
*/
@Parameter( property = "dependency.ignorePermissions", defaultValue = "false" )
@@ -82,7 +83,7 @@
*/
@Parameter( defaultValue = "${project}", readonly = true, required = true )
private MavenProject project;
-
+
/**
* Remote repositories which will be searched for artifacts.
*/
@@ -100,7 +101,7 @@
*/
@Parameter( defaultValue = "${session}", readonly = true, required = true )
protected MavenSession session;
-
+
/**
* If the plugin should be silent.
*
@@ -144,7 +145,7 @@
}
protected abstract void doExecute()
- throws MojoExecutionException, MojoFailureException;
+ throws MojoExecutionException, MojoFailureException;
/**
* @return Returns the archiverManager.
@@ -159,8 +160,7 @@
*
* @param artifact represents the file to copy.
* @param destFile file name of destination file.
- * @throws MojoExecutionException with a message if an
- * error occurs.
+ * @throws MojoExecutionException with a message if an error occurs.
*/
protected void copyFile( File artifact, File destFile )
throws MojoExecutionException
@@ -168,8 +168,8 @@
try
{
getLog().info( "Copying "
- + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath()
- : artifact.getName() ) + " to " + destFile );
+ + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() ) + " to "
+ + destFile );
if ( artifact.isDirectory() )
{
@@ -202,6 +202,7 @@
* @param excludes Comma separated list of file patterns to exclude i.e. <code>**/*.xml,
* **/*.properties</code>
* @param encoding Encoding of artifact. Set {@code null} for default encoding.
+ * @throws MojoExecutionException In case of errors.
*/
protected void unpack( Artifact artifact, File location, String includes, String excludes, String encoding )
throws MojoExecutionException
@@ -213,7 +214,7 @@
String encoding )
throws MojoExecutionException
{
- File file = artifact.getFile();
+ File file = artifact.getFile();
try
{
logUnpack( file, location, includes, excludes );
@@ -221,8 +222,8 @@
location.mkdirs();
if ( !location.exists() )
{
- throw new MojoExecutionException(
- "Location to write unpacked files to could not be created: " + location );
+ throw new MojoExecutionException( "Location to write unpacked files to could not be created: "
+ + location );
}
if ( file.isDirectory() )
@@ -265,7 +266,7 @@
// based on include/exclude parameters
// MDEP-47
IncludeExcludeFileSelector[] selectors =
- new IncludeExcludeFileSelector[]{ new IncludeExcludeFileSelector() };
+ new IncludeExcludeFileSelector[] { new IncludeExcludeFileSelector() };
if ( StringUtils.isNotEmpty( excludes ) )
{
@@ -292,8 +293,8 @@
}
catch ( ArchiverException e )
{
- 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 );
}
}
@@ -363,18 +364,18 @@
{
this.skip = skip;
}
-
+
protected final boolean isSilent()
{
return silent;
}
-
+
public void setSilent( boolean silent )
{
this.silent = silent;
if ( silent )
{
- setLog( new DependencySilentLog() );
+ setLog( new DependencySilentLog() );
}
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/DisplayAncestorsMojo.java b/src/main/java/org/apache/maven/plugins/dependency/DisplayAncestorsMojo.java
index 70878dc..9c94bb9 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/DisplayAncestorsMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/DisplayAncestorsMojo.java
@@ -33,8 +33,8 @@
import java.util.Locale;
/**
- * Displays all ancestor POMs of the project. This may be useful in a continuous integration system
- * where you want to know all parent poms of the project.
+ * Displays all ancestor POMs of the project. This may be useful in a continuous integration system where you want to
+ * know all parent poms of the project.
*
* @author Mirko Friedenhagen
* @since 2.9
@@ -74,8 +74,8 @@
MavenProject currentAncestor = project.getParent();
while ( currentAncestor != null )
{
- final String gav = String.format( Locale.US, "%s:%s:%s",
- currentAncestor.getGroupId(), currentAncestor.getArtifactId(), currentAncestor.getVersion() );
+ final String gav = String.format( Locale.US, "%s:%s:%s", currentAncestor.getGroupId(),
+ currentAncestor.getArtifactId(), currentAncestor.getVersion() );
ancestors.add( gav );
diff --git a/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java b/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
index 099fc4f..0dda115 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/GetMojo.java
@@ -52,19 +52,18 @@
import org.codehaus.plexus.util.StringUtils;
/**
- * Resolves a single artifact, eventually transitively, from the specified remote repositories.
- * Caveat: will always check the central repository defined in the super pom. You could use a mirror entry in your
- * <code>settings.xml</code>
+ * Resolves a single artifact, eventually transitively, from the specified remote repositories. Caveat: will always
+ * check the central repository defined in the super pom. You could use a mirror entry in your <code>settings.xml</code>
*/
@Mojo( name = "get", requiresProject = false, threadSafe = true )
public class GetMojo
extends AbstractMojo
{
private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.*)::(.+)" );
-
+
@Parameter( defaultValue = "${session}", required = true, readonly = true )
private MavenSession session;
-
+
/**
*
*/
@@ -74,11 +73,11 @@
/**
*
*/
- @Component
- private DependencyResolver dependencyResolver;
+ @Component
+ private DependencyResolver dependencyResolver;
- @Component
- private ArtifactHandlerManager artifactHandlerManager;
+ @Component
+ private ArtifactHandlerManager artifactHandlerManager;
/**
* Map that contains the layouts.
@@ -87,7 +86,7 @@
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
private DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate();
-
+
/**
* The groupId of the artifact to download. Ignored if {@link #artifact} is used.
*/
@@ -121,8 +120,8 @@
private String packaging = "jar";
/**
- * Repositories in the format id::[layout]::url or just url, separated by comma.
- * ie. central::default::http://repo1.maven.apache.org/maven2,myrepo::::http://repo.acme.com,http://repo.acme2.com
+ * Repositories in the format id::[layout]::url or just url, separated by comma. ie.
+ * central::default::http://repo1.maven.apache.org/maven2,myrepo::::http://repo.acme.com,http://repo.acme2.com
*/
@Parameter( property = "remoteRepositories" )
private String remoteRepositories;
@@ -173,9 +172,8 @@
String[] tokens = StringUtils.split( artifact, ":" );
if ( tokens.length < 3 || tokens.length > 5 )
{
- throw new MojoFailureException(
- "Invalid artifact, you must specify groupId:artifactId:version[:packaging[:classifier]] "
- + artifact );
+ throw new MojoFailureException( "Invalid artifact, you must specify "
+ + "groupId:artifactId:version[:packaging[:classifier]] " + artifact );
}
coordinate.setGroupId( tokens[0] );
coordinate.setArtifactId( tokens[1] );
@@ -215,7 +213,7 @@
{
ProjectBuildingRequest buildingRequest =
new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
-
+
buildingRequest.setRemoteRepositories( repoList );
if ( transitive )
@@ -300,31 +298,31 @@
// @Parameter( alias = "groupId" )
public void setGroupId( String groupId )
{
- this.coordinate.setGroupId( groupId );
+ this.coordinate.setGroupId( groupId );
}
-
+
// @Parameter( alias = "artifactId" )
public void setArtifactId( String artifactId )
{
- this.coordinate.setArtifactId( artifactId );
+ this.coordinate.setArtifactId( artifactId );
}
-
+
// @Parameter( alias = "version" )
public void setVersion( String version )
{
- this.coordinate.setVersion( version );
+ this.coordinate.setVersion( version );
}
-
+
// @Parameter( alias = "classifier" )
public void setClassifier( String classifier )
{
- this.coordinate.setClassifier( classifier );
+ this.coordinate.setClassifier( classifier );
}
-
+
// @Parameter( alias = "packaging" )
public void setPackaging( String type )
{
- this.coordinate.setType( type );
+ this.coordinate.setType( type );
}
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/PropertiesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/PropertiesMojo.java
index 7f43d6c..7c28a81 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/PropertiesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/PropertiesMojo.java
@@ -31,16 +31,17 @@
import org.apache.maven.project.MavenProject;
/**
- * Goal that sets a property pointing to the artifact file for each project dependency.
- * For each dependency (direct and transitive) a project property will be set which follows the
- * <code>groupId:artifactId:type:[classifier]</code> form and contains the path to the resolved artifact.
+ * Goal that sets a property pointing to the artifact file for each project dependency. For each dependency (direct and
+ * transitive) a project property will be set which follows the <code>groupId:artifactId:type:[classifier]</code> form
+ * and contains the path to the resolved artifact.
*
* @author Paul Gier
* @version $Id$
* @since 2.2
*/
-@Mojo( name = "properties", requiresDependencyResolution = ResolutionScope.TEST,
- defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true )
+//CHECKSTYLE_OFF: LineLength
+@Mojo( name = "properties", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true )
+//CHECKSTYLE_ON: LineLength
public class PropertiesMojo
extends AbstractMojo
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
index a68cc3a..8895234 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
@@ -296,7 +296,8 @@
/**
* Includes only snapshot artifacts
*/
- private class SnapshotsFilter extends AbstractFilter
+ private class SnapshotsFilter
+ extends AbstractFilter
{
@Override
public boolean accept( Node node, List<Node> parents )
@@ -371,8 +372,7 @@
{
List<Dependency> dependencies = project.getDependencies();
- TransformableFilter dependencyFilter =
- createPurgeArtifactsFilter( project, dependencies, purgedArtifacts );
+ TransformableFilter dependencyFilter = createPurgeArtifactsFilter( project, dependencies, purgedArtifacts );
Set<Artifact> resolvedArtifactsToPurge =
getFilteredResolvedArtifacts( project, dependencies, dependencyFilter );
@@ -524,7 +524,7 @@
}
List<String> exclusions = new ArrayList<String>( reactorProjects.size() );
- // It doesn't make sense to include projects from the reactor here since they're likely not able to be resolved
+ // It doesn't make sense to include projects from the reactor here since they're likely not able to be resolved
for ( MavenProject reactorProject : reactorProjects )
{
exclusions.add( toPatternExcludes( reactorProject.getArtifact() ) );
@@ -576,8 +576,8 @@
try
{
Iterable<ArtifactResult> results =
- dependencyResolver.resolveDependencies( session.getProjectBuildingRequest(),
- project.getModel(), filter );
+ dependencyResolver.resolveDependencies( session.getProjectBuildingRequest(), project.getModel(),
+ filter );
Set<Artifact> resolvedArtifacts = new LinkedHashSet<Artifact>();
@@ -591,8 +591,8 @@
catch ( DependencyResolverException e )
{
getLog().info( "Unable to resolve all dependencies for: " + project.getGroupId() + ":"
- + project.getArtifactId() + ":" + project.getVersion()
- + ". Falling back to non-transitive mode for initial artifact resolution." );
+ + project.getArtifactId() + ":" + project.getVersion()
+ + ". Falling back to non-transitive mode for initial artifact resolution." );
}
Set<Artifact> resolvedArtifacts = new LinkedHashSet<Artifact>();
@@ -667,8 +667,10 @@
{
try
{
+ //CHECKSTYLE_OFF: LineLength
artifactResolver.resolveArtifact( session.getProjectBuildingRequest(),
- org.apache.maven.shared.artifact.TransferUtils.toArtifactCoordinate( artifact ) );
+ org.apache.maven.shared.artifact.TransferUtils.toArtifactCoordinate( artifact ) );
+ //CHECKSTYLE_ON: LineLength
}
catch ( ArtifactResolverException e )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java
index 487598c..e2ce7cf 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java
@@ -74,12 +74,10 @@
private MavenProject project;
/**
- * Specify the project dependency analyzer to use (plexus component role-hint).
- * By default, <a href="/shared/maven-dependency-analyzer/">maven-dependency-analyzer</a> is used.
- *
- * To use this, you must declare a dependency for this plugin that contains the code for the
- * analyzer. The analyzer must have a declared Plexus role name, and you specify the role name
- * here.
+ * Specify the project dependency analyzer to use (plexus component role-hint). By default,
+ * <a href="/shared/maven-dependency-analyzer/">maven-dependency-analyzer</a> is used. To use this, you must declare
+ * a dependency for this plugin that contains the code for the analyzer. The analyzer must have a declared Plexus
+ * role name, and you specify the role name here.
*
* @since 2.2
*/
@@ -145,8 +143,8 @@
private File outputDirectory;
/**
- * Force dependencies as used, to override incomplete result caused by bytecode-level analysis.
- * Dependency format is <code>groupId:artifactId</code>.
+ * Force dependencies as used, to override incomplete result caused by bytecode-level analysis. Dependency format is
+ * <code>groupId:artifactId</code>.
*
* @since 2.6
*/
@@ -162,70 +160,65 @@
private boolean skip;
/**
- * List of dependencies that will be ignored.
- *
- * Any dependency on this list will be excluded from the "declared but unused" and the "used but undeclared" list.
- *
- * The filter syntax is:
+ * List of dependencies that will be ignored. Any dependency on this list will be excluded from the "declared but
+ * unused" and the "used but undeclared" list. The filter syntax is:
*
* <pre>
* [groupId]:[artifactId]:[type]:[version]
* </pre>
*
* where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
- * segment is treated as an implicit wildcard.
- * *
- * <p>For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
- * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.</p>
+ * segment is treated as an implicit wildcard. *
+ * <p>
+ * For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
+ * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.
+ * </p>
*
* @since 2.10
* @see StrictPatternIncludesArtifactFilter
*/
@Parameter
- private String [] ignoredDependencies = new String[0];
+ private String[] ignoredDependencies = new String[0];
/**
- * List of dependencies that will be ignored if they are used but undeclared.
- *
- * The filter syntax is:
+ * List of dependencies that will be ignored if they are used but undeclared. The filter syntax is:
*
* <pre>
* [groupId]:[artifactId]:[type]:[version]
* </pre>
*
* where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
- * segment is treated as an implicit wildcard.
- * *
- * <p>For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
- * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.</p>
+ * segment is treated as an implicit wildcard. *
+ * <p>
+ * For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
+ * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.
+ * </p>
*
* @since 2.10
* @see StrictPatternIncludesArtifactFilter
*/
@Parameter
- private String [] ignoredUsedUndeclaredDependencies = new String[0];
+ private String[] ignoredUsedUndeclaredDependencies = new String[0];
/**
- * List of dependencies that will be ignored if they are declared but unused.
- *
- * The filter syntax is:
+ * List of dependencies that will be ignored if they are declared but unused. The filter syntax is:
*
* <pre>
* [groupId]:[artifactId]:[type]:[version]
* </pre>
*
* where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
- * segment is treated as an implicit wildcard.
- * *
- * <p>For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
- * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.</p>
+ * segment is treated as an implicit wildcard. *
+ * <p>
+ * For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
+ * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.
+ * </p>
*
* @since 2.10
* @see StrictPatternIncludesArtifactFilter
*/
@Parameter
- private String [] ignoredUnusedDeclaredDependencies = new String[0];
-
+ private String[] ignoredUnusedDeclaredDependencies = new String[0];
// Mojo methods -----------------------------------------------------------
@@ -277,9 +270,8 @@
}
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 );
}
}
@@ -336,7 +328,6 @@
boolean reported = false;
boolean warning = false;
-
if ( verbose && !usedDeclared.isEmpty() )
{
getLog().info( "Used declared dependencies found:" );
@@ -480,10 +471,20 @@
// called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
artifact.isSnapshot();
- buf.append( scriptableFlag ).append( ":" ).append( pomFile ).append( ":" )
- .append( artifact.getDependencyConflictId() ).append( ":" ).append( artifact.getClassifier() )
- .append( ":" ).append( artifact.getBaseVersion() ).append( ":" ).append( artifact.getScope() )
+ //CHECKSTYLE_OFF: LineLength
+ buf.append( scriptableFlag )
+ .append( ":" )
+ .append( pomFile )
+ .append( ":" )
+ .append( artifact.getDependencyConflictId() )
+ .append( ":" )
+ .append( artifact.getClassifier() )
+ .append( ":" )
+ .append( artifact.getBaseVersion() )
+ .append( ":" )
+ .append( artifact.getScope() )
.append( "\n" );
+ //CHECKSTYLE_ON: LineLength
}
getLog().info( "\n" + buf );
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java
index 45fadb5..dc8bb61 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDepMgt.java
@@ -40,14 +40,11 @@
import org.codehaus.plexus.util.StringUtils;
/**
- * This mojo looks at the dependencies after final resolution and looks for
- * mismatches in your dependencyManagement section. In versions of maven prior
- * to 2.0.6, it was possible to inherit versions that didn't match your
- * dependencyManagement. See <a
- * href="https://issues.apache.org/jira/browse/MNG-1577">MNG-1577</a> for more info.
- * This mojo is also useful for just detecting projects that override the
- * dependencyManagement directly. Set ignoreDirect to false to detect these
- * otherwise normal conditions.
+ * This mojo looks at the dependencies after final resolution and looks for mismatches in your dependencyManagement
+ * section. In versions of maven prior to 2.0.6, it was possible to inherit versions that didn't match your
+ * dependencyManagement. See <a href="https://issues.apache.org/jira/browse/MNG-1577">MNG-1577</a> for more info. This
+ * mojo is also useful for just detecting projects that override the dependencyManagement directly. Set ignoreDirect to
+ * false to detect these otherwise normal conditions.
*
* @author <a href="mailto:brianefox@gmail.com">Brian Fox</a>
* @version $Id$
@@ -150,8 +147,7 @@
}
// get dependencies for the project (including transitive)
- Set<Artifact> allDependencyArtifacts =
- new LinkedHashSet<Artifact>( project.getArtifacts() );
+ Set<Artifact> allDependencyArtifacts = new LinkedHashSet<Artifact>( project.getArtifacts() );
// don't warn if a dependency that is directly listed overrides
// depMgt. That's ok.
@@ -167,8 +163,8 @@
for ( Artifact exclusion : exclusionErrors )
{
getLog().info( StringUtils.stripEnd( getArtifactManagementKey( exclusion ), ":" )
- + " was excluded in DepMgt, but version " + exclusion.getVersion()
- + " has been found in the dependency tree." );
+ + " was excluded in DepMgt, but version " + exclusion.getVersion()
+ + " has been found in the dependency tree." );
foundError = true;
}
@@ -193,12 +189,10 @@
}
/**
- * Returns a map of the exclusions using the Dependency ManagementKey as the
- * keyset.
+ * Returns a map of the exclusions using the Dependency ManagementKey as the keyset.
*
* @param exclusionList to be added to the map.
- * @return a map of the exclusions using the Dependency ManagementKey as the
- * keyset.
+ * @return a map of the exclusions using the Dependency ManagementKey as the keyset.
*/
public Map<String, Exclusion> addExclusions( List<Exclusion> exclusionList )
{
@@ -214,11 +208,10 @@
}
/**
- * Returns a List of the artifacts that should have been excluded, but were
- * found in the dependency tree.
+ * 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 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.
*/
@@ -248,14 +241,11 @@
}
/**
- * Calculate the mismatches between the DependencyManagement and resolved
- * artifacts
+ * Calculate the mismatches between the DependencyManagement and resolved artifacts
*
- * @param depMgtMap contains the Dependency.GetManagementKey as the keyset for
- * quick lookup.
+ * @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.
+ * @return a map containing the resolved artifact as the key and the listed dependency as the value.
*/
public Map<Artifact, Dependency> getMismatch( Map<String, Dependency> depMgtMap,
Set<Artifact> allDependencyArtifacts )
@@ -267,11 +257,11 @@
Dependency depFromDepMgt = depMgtMap.get( getArtifactManagementKey( dependencyArtifact ) );
if ( depFromDepMgt != null )
{
- //workaround for MNG-2961
+ // workaround for MNG-2961
dependencyArtifact.isSnapshot();
if ( depFromDepMgt.getVersion() != null
- && !depFromDepMgt.getVersion().equals( dependencyArtifact.getBaseVersion() ) )
+ && !depFromDepMgt.getVersion().equals( dependencyArtifact.getBaseVersion() ) )
{
mismatchMap.put( dependencyArtifact, depFromDepMgt );
}
@@ -281,20 +271,20 @@
}
/**
- * This function displays the log to the screen showing the versions and
- * information about the artifacts that don't match.
+ * 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 dependencyArtifact the artifact that was resolved.
* @param dependencyFromDepMgt the dependency listed in the DependencyManagement section.
- * @throws MojoExecutionException
+ * @throws MojoExecutionException in case of errors.
*/
public void logMismatch( Artifact dependencyArtifact, Dependency dependencyFromDepMgt )
throws MojoExecutionException
{
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(), ":" ) );
@@ -310,8 +300,8 @@
*/
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() : "" );
}
/**
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java
index c2509dd..59a16ce 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java
@@ -168,7 +168,10 @@
modelDependencies2.add( dep.getManagementKey() );
}
- return new LinkedHashSet<String>(
- CollectionUtils.disjunction( modelDependencies2, new LinkedHashSet<String>( modelDependencies2 ) ) );
+ //@formatter:off
+ return new LinkedHashSet<String>(
+ CollectionUtils.disjunction( modelDependencies2, new LinkedHashSet<String>( modelDependencies2 ) )
+ );
+ //@formatter:on
}
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeMojo.java
index de6d7ce..ef8e04a 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeMojo.java
@@ -28,10 +28,11 @@
* 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.
- *
- * <p>By default, <a href="http://maven.apache.org/shared/maven-dependency-analyzer/">maven-dependency-analyzer</a> is
- * used to perform the analysis, with limitations due to the fact that it works at bytecode level, but any
- * analyzer can be plugged in through <code>analyzer</code> parameter.</p>
+ * <p>
+ * By default, <a href="http://maven.apache.org/shared/maven-dependency-analyzer/">maven-dependency-analyzer</a> is used
+ * to perform the analysis, with limitations due to the fact that it works at bytecode level, but any analyzer can be
+ * plugged in through <code>analyzer</code> parameter.
+ * </p>
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id$
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeOnlyMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeOnlyMojo.java
index 89f60be..f095ef5 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeOnlyMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeOnlyMojo.java
@@ -26,20 +26,27 @@
/**
* 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.
- *
- * <p>By default, <a href="http://maven.apache.org/shared/maven-dependency-analyzer/">maven-dependency-analyzer</a> is
- * used to perform the analysis, with limitations due to the fact that it works at bytecode level, but any
- * analyzer can be plugged in through <code>analyzer</code> parameter.</p>
+ * <code>test-compile</code> phase has been executed - use the <code>dependency:analyze</code> goal instead when running
+ * standalone.
+ * <p>
+ * By default, <a href="http://maven.apache.org/shared/maven-dependency-analyzer/">maven-dependency-analyzer</a> is used
+ * to perform the analysis, with limitations due to the fact that it works at bytecode level, but any analyzer can be
+ * plugged in through <code>analyzer</code> parameter.
+ * </p>
*
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id$
* @see AnalyzeMojo
* @since 2.0
*/
-@Mojo( name = "analyze-only", requiresDependencyResolution = ResolutionScope.TEST,
- defaultPhase = LifecyclePhase.VERIFY, threadSafe = true )
+//@formatter:off
+@Mojo(
+ name = "analyze-only",
+ requiresDependencyResolution = ResolutionScope.TEST,
+ defaultPhase = LifecyclePhase.VERIFY,
+ threadSafe = true
+)
+//@formatter:on
public class AnalyzeOnlyMojo
extends AbstractAnalyzeMojo
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java
index c28e41a..5e5fe56 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java
@@ -80,14 +80,15 @@
/**
* Ignore Runtime/Provided/Test/System scopes for unused dependency analysis
+ *
* @since 2.2
*/
@Parameter( property = "ignoreNonCompile", defaultValue = "false" )
private boolean ignoreNonCompile;
/**
- * Force dependencies as used, to override incomplete result caused by bytecode-level analysis.
- * Dependency format is <code>groupId:artifactId</code>.
+ * Force dependencies as used, to override incomplete result caused by bytecode-level analysis. Dependency format is
+ * <code>groupId:artifactId</code>.
*
* @since 2.6
*/
@@ -146,7 +147,7 @@
throw new MavenReportException( "Cannot analyze dependencies", exception );
}
- //remove everything that's not in the compile scope
+ // remove everything that's not in the compile scope
if ( ignoreNonCompile )
{
analysis = analysis.ignoreNonCompile();
@@ -225,6 +226,7 @@
/**
* @param locale the current locale
+ * @return The resource bundle {@link ResourceBundle}
*/
protected ResourceBundle getBundle( Locale locale )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportView.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportView.java
index fd48160..c537da0 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportView.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportView.java
@@ -34,6 +34,10 @@
{
/**
* Generates the HTML report.
+ *
+ * @param analysis {@link ProjectDependencyAnalysis}
+ * @param sink {@link Sink}
+ * @param bundle {@link ResourceBundle}
*/
public void generateReport( ProjectDependencyAnalysis analysis, Sink sink, ResourceBundle bundle )
{
@@ -114,6 +118,9 @@
/**
* Generate a table for the given dependencies iterator.
+ *
+ * @param sink {@link Sink}
+ * @param iter {@link Artifact}
*/
public void generateDependenciesTable( Sink sink, Iterator<Artifact> iter )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
index 06605e2..18236ca 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/AbstractFromConfigurationMojo.java
@@ -116,7 +116,8 @@
abstract ArtifactItemFilter getMarkedArtifactFilter( ArtifactItem item );
// artifactItems is filled by either field injection or by setArtifact()
- protected void verifyRequirements() throws MojoFailureException
+ protected void verifyRequirements()
+ throws MojoFailureException
{
if ( artifactItems == null || artifactItems.isEmpty() )
{
@@ -133,13 +134,13 @@
* @throws MojoExecutionException with a message if an error occurs.
* @see ArtifactItem
*/
- protected List<ArtifactItem> getProcessedArtifactItems( ProcessArtifactItemsRequest processArtifactItemsRequest )
+ protected List<ArtifactItem> getProcessedArtifactItems( ProcessArtifactItemsRequest processArtifactItemsRequest )
throws MojoExecutionException
{
- boolean removeVersion = processArtifactItemsRequest.isRemoveVersion(), prependGroupId =
- processArtifactItemsRequest.isPrependGroupId(), useBaseVersion =
- processArtifactItemsRequest.isUseBaseVersion();
+ boolean removeVersion = processArtifactItemsRequest.isRemoveVersion(),
+ prependGroupId = processArtifactItemsRequest.isPrependGroupId(),
+ useBaseVersion = processArtifactItemsRequest.isUseBaseVersion();
boolean removeClassifier = processArtifactItemsRequest.isRemoveClassifier();
@@ -267,18 +268,16 @@
{
MavenProject project = getProject();
List<Dependency> deps = project.getDependencies();
- List<Dependency> depMngt = project.getDependencyManagement() == null
- ? Collections.<Dependency>emptyList()
- : project.getDependencyManagement().getDependencies();
+ List<Dependency> depMngt = project.getDependencyManagement() == null ? Collections.<Dependency>emptyList()
+ : project.getDependencyManagement().getDependencies();
if ( !findDependencyVersion( artifact, deps, false )
&& ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, depMngt, false ) )
&& !findDependencyVersion( artifact, deps, true )
&& ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, depMngt, true ) ) )
{
- throw new MojoExecutionException(
- "Unable to find artifact version of " + artifact.getGroupId() + ":" + artifact.getArtifactId()
- + " in either dependency list or in project's dependency management." );
+ throw new MojoExecutionException( "Unable to find artifact version of " + artifact.getGroupId() + ":"
+ + artifact.getArtifactId() + " in either dependency list or in project's dependency management." );
}
}
@@ -286,9 +285,9 @@
* Tries to find missing version from a list of dependencies. If found, the artifact is updated with the correct
* version.
*
- * @param artifact representing configured file.
+ * @param artifact representing configured file.
* @param dependencies list of dependencies to search.
- * @param looseMatch only look at artifactId and groupId
+ * @param looseMatch only look at artifactId and groupId
* @return the found dependency
*/
private boolean findDependencyVersion( ArtifactItem artifact, List<Dependency> dependencies, boolean looseMatch )
@@ -404,9 +403,8 @@
String[] tokens = StringUtils.split( artifact, ":" );
if ( tokens.length < 3 || tokens.length > 5 )
{
- throw new MojoFailureException(
- "Invalid artifact, you must specify groupId:artifactId:version[:packaging[:classifier]] "
- + artifact );
+ throw new MojoFailureException( "Invalid artifact, "
+ + "you must specify groupId:artifactId:version[:packaging[:classifier]] " + artifact );
}
String groupId = tokens[0];
String artifactId = tokens[1];
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ArtifactItem.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ArtifactItem.java
index 5c30b08..89a96c4 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ArtifactItem.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ArtifactItem.java
@@ -28,14 +28,14 @@
import org.codehaus.plexus.util.StringUtils;
/**
- * ArtifactItem represents information specified in the plugin configuration
- * section for each artifact.
+ * ArtifactItem represents information specified in the plugin configuration section for each artifact.
*
* @since 1.0
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
*/
-public class ArtifactItem implements DependableCoordinate
+public class ArtifactItem
+ implements DependableCoordinate
{
/**
* Group Id of Artifact
@@ -112,14 +112,12 @@
private Artifact artifact;
/**
- * A comma separated list of file patterns to include when unpacking the
- * artifact.
+ * A comma separated list of file patterns to include when unpacking the artifact.
*/
private String includes;
/**
- * A comma separated list of file patterns to exclude when unpacking the
- * artifact.
+ * A comma separated list of file patterns to exclude when unpacking the artifact.
*/
private String excludes;
@@ -156,8 +154,7 @@
}
/**
- * @param artifact
- * The artifactId to set.
+ * @param artifact The artifactId to set.
*/
public void setArtifactId( String artifact )
{
@@ -173,8 +170,7 @@
}
/**
- * @param groupId
- * The groupId to set.
+ * @param groupId The groupId to set.
*/
public void setGroupId( String groupId )
{
@@ -190,8 +186,7 @@
}
/**
- * @param type
- * The type to set.
+ * @param type The type to set.
*/
public void setType( String type )
{
@@ -207,8 +202,7 @@
}
/**
- * @param version
- * The version to set.
+ * @param version The version to set.
*/
public void setVersion( String version )
{
@@ -232,8 +226,7 @@
}
/**
- * @param classifier
- * Classifier.
+ * @param classifier Classifier.
*/
public void setClassifier( String classifier )
{
@@ -249,8 +242,8 @@
}
else
{
- return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString( version, "?" )
- + ":" + type;
+ return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString( version, "?" ) + ":"
+ + type;
}
}
@@ -263,8 +256,7 @@
}
/**
- * @param outputDirectory
- * The outputDirectory to set.
+ * @param outputDirectory The outputDirectory to set.
*/
public void setOutputDirectory( File outputDirectory )
{
@@ -280,8 +272,7 @@
}
/**
- * @param destFileName
- * The destFileName to set.
+ * @param destFileName The destFileName to set.
*/
public void setDestFileName( String destFileName )
{
@@ -297,8 +288,7 @@
}
/**
- * @param needsProcessing
- * The needsProcessing to set.
+ * @param needsProcessing The needsProcessing to set.
*/
public void setNeedsProcessing( boolean needsProcessing )
{
@@ -314,8 +304,7 @@
}
/**
- * @param overWrite
- * The overWrite to set.
+ * @param overWrite The overWrite to set.
*/
public void setOverWrite( String overWrite )
{
@@ -349,8 +338,7 @@
}
/**
- * @param artifact
- * The artifact to set.
+ * @param artifact The artifact to set.
*/
public void setArtifact( Artifact artifact )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java
index a8f6110..b8120a1 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/CopyMojo.java
@@ -37,7 +37,7 @@
* @version $Id$
* @since 1.0
*/
-@Mojo( name = "copy", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresProject = false, threadSafe = true )
+@Mojo( name = "copy", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresProject = false, threadSafe = true )
public class CopyMojo
extends AbstractFromConfigurationMojo
{
@@ -56,6 +56,7 @@
/**
* Prepend artifact groupId during copy
+ *
* @since 2.7
*/
@Parameter( property = "mdep.prependGroupId", defaultValue = "false" )
@@ -63,17 +64,17 @@
/**
* Use artifact baseVersion during copy
+ *
* @since 2.7
*/
@Parameter( property = "mdep.useBaseVersion", defaultValue = "false" )
private boolean useBaseVersion = false;
/**
- * The artifact to copy from command line. A string of the form
- * groupId:artifactId:version[:packaging[:classifier]]. Use {@link #artifactItems} within the
- * POM configuration.
+ * The artifact to copy from command line. A string of the form groupId:artifactId:version[:packaging[:classifier]].
+ * Use {@link #artifactItems} within the POM configuration.
*/
- @SuppressWarnings( "unused" ) //marker-field, setArtifact(String) does the magic
+ @SuppressWarnings( "unused" ) // marker-field, setArtifact(String) does the magic
@Parameter( property = "artifact" )
private String artifact;
@@ -105,8 +106,8 @@
verifyRequirements();
List<ArtifactItem> theArtifactItems =
- getProcessedArtifactItems( new ProcessArtifactItemsRequest( stripVersion, prependGroupId,
- useBaseVersion, stripClassifier ) );
+ getProcessedArtifactItems( new ProcessArtifactItemsRequest( stripVersion, prependGroupId, useBaseVersion,
+ stripClassifier ) );
for ( ArtifactItem artifactItem : theArtifactItems )
{
if ( artifactItem.isNeedsProcessing() )
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ProcessArtifactItemsRequest.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ProcessArtifactItemsRequest.java
index d6fbc94..6129348 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ProcessArtifactItemsRequest.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/ProcessArtifactItemsRequest.java
@@ -30,11 +30,11 @@
*/
private boolean removeVersion;
- /**
+ /**
* remove the classifier from the filename.
*/
private boolean removeClassifier;
-
+
/**
* prepend the groupId to the filename.
*/
@@ -79,7 +79,6 @@
this.removeClassifier = removeClassifier;
}
-
public ProcessArtifactItemsRequest removeVersion( boolean removeVersion )
{
this.removeVersion = removeVersion;
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
index e796284..8a62cfb 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromConfiguration/UnpackMojo.java
@@ -53,9 +53,8 @@
/**
* A comma separated list of file patterns to include when unpacking the artifact. i.e.
- * <code>**/*.xml,**/*.properties</code>
- * NOTE: Excludes patterns override the includes.
- * (component code = <code>return isIncluded( name ) AND !isExcluded( name );</code>)
+ * <code>**/*.xml,**/*.properties</code> NOTE: Excludes patterns override the includes. (component code =
+ * <code>return isIncluded( name ) AND !isExcluded( name );</code>)
*
* @since 2.0-alpha-5
*/
@@ -64,9 +63,8 @@
/**
* A comma separated list of file patterns to exclude when unpacking the artifact. i.e. **\/*.xml,**\/*.properties
- * <code>**/*.xml,**/*.properties</code>
- * NOTE: Excludes patterns override the includes.
- * (component code = <code>return isIncluded( name ) AND !isExcluded( name );</code>)
+ * <code>**/*.xml,**/*.properties</code> NOTE: Excludes patterns override the includes. (component code =
+ * <code>return isIncluded( name ) AND !isExcluded( name );</code>)
*
* @since 2.0-alpha-5
*/
@@ -75,10 +73,10 @@
/**
* The artifact to unpack from command line. A string of the form
- * <code>groupId:artifactId:version[:packaging[:classifier]]</code>. Use {@link #artifactItems} within the
- * POM configuration.
+ * <code>groupId:artifactId:version[:packaging[:classifier]]</code>. Use {@link #artifactItems} within the POM
+ * configuration.
*/
- @SuppressWarnings( "unused" ) //marker-field, setArtifact(String) does the magic
+ @SuppressWarnings( "unused" ) // marker-field, setArtifact(String) does the magic
@Parameter( property = "artifact" )
private String artifact;
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java
index 7fd1505..4efd105 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java
@@ -56,8 +56,7 @@
import org.codehaus.plexus.util.StringUtils;
/**
- * Class that encapsulates the plugin parameters, and contains methods that
- * handle dependency filtering
+ * Class that encapsulates the plugin parameters, and contains methods that handle dependency filtering
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
@@ -108,8 +107,7 @@
protected boolean excludeTransitive;
/**
- * Comma Separated list of Types to include. Empty String indicates include
- * everything (default).
+ * Comma Separated list of Types to include. Empty String indicates include everything (default).
*
* @since 2.0
*/
@@ -117,8 +115,7 @@
protected String includeTypes;
/**
- * Comma Separated list of Types to exclude. Empty String indicates don't
- * exclude anything (default).
+ * Comma Separated list of Types to exclude. Empty String indicates don't exclude anything (default).
*
* @since 2.0
*/
@@ -150,8 +147,7 @@
protected String excludeScope;
/**
- * Comma Separated list of Classifiers to include. Empty String indicates
- * include everything (default).
+ * Comma Separated list of Classifiers to include. Empty String indicates include everything (default).
*
* @since 2.0
*/
@@ -159,8 +155,7 @@
protected String includeClassifiers;
/**
- * Comma Separated list of Classifiers to exclude. Empty String indicates
- * don't exclude anything (default).
+ * Comma Separated list of Classifiers to exclude. Empty String indicates don't exclude anything (default).
*
* @since 2.0
*/
@@ -176,8 +171,7 @@
protected String classifier;
/**
- * Specify type to look for when constructing artifact based on classifier.
- * Example: java-source,jar,war
+ * Specify type to look for when constructing artifact based on classifier. Example: java-source,jar,war
*
* @since 2.0
*/
@@ -193,9 +187,7 @@
protected String excludeArtifactIds;
/**
- * Comma separated list of Artifact names to include.
- * Empty String indicates include
- * everything (default).
+ * Comma separated list of Artifact names to include. Empty String indicates include everything (default).
*
* @since 2.0
*/
@@ -211,9 +203,7 @@
protected String excludeGroupIds;
/**
- * Comma separated list of GroupIds to include.
- * Empty String indicates include
- * everything (default).
+ * Comma separated list of GroupIds to include. Empty String indicates include everything (default).
*
* @since 2.0
*/
@@ -225,8 +215,9 @@
*
* @since 2.0
*/
- @Parameter( property = "markersDirectory",
- defaultValue = "${project.build.directory}/dependency-maven-plugin-markers" )
+ //CHECKSTYLE_OFF: LineLength
+ @Parameter( property = "markersDirectory", defaultValue = "${project.build.directory}/dependency-maven-plugin-markers" )
+ //CHECKSTYLE_ON: LineLength
protected File markersDirectory;
/**
@@ -253,8 +244,9 @@
/**
* Retrieves dependencies, either direct only or all including transitive.
*
+ * @param stopOnFailure true to fail if resolution does not work or false not to fail.
* @return A set of artifacts
- * @throws MojoExecutionException
+ * @throws MojoExecutionException in case of errors.
*/
protected Set<Artifact> getResolvedDependencies( boolean stopOnFailure )
throws MojoExecutionException
@@ -265,6 +257,11 @@
return status.getResolvedDependencies();
}
+ /**
+ * @param stopOnFailure true/false.
+ * @return {@link DependencyStatusSets}
+ * @throws MojoExecutionException in case of an error.
+ */
protected DependencyStatusSets getDependencySets( boolean stopOnFailure )
throws MojoExecutionException
{
@@ -272,14 +269,13 @@
}
/**
- * 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
+ * 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
*
- * @param stopOnFailure
- * @return DependencyStatusSets - Bean of TreeSets that contains information
- * on the projects dependencies
- * @throws MojoExecutionException
+ * @param stopOnFailure true to fail if artifacts can't be resolved false otherwise.
+ * @param includeParents <code>true</code> if parents should be included or not <code>false</code>.
+ * @return DependencyStatusSets - Bean of TreeSets that contains information on the projects dependencies
+ * @throws MojoExecutionException in case of errors.
*/
protected DependencyStatusSets getDependencySets( boolean stopOnFailure, boolean includeParents )
throws MojoExecutionException
@@ -384,14 +380,14 @@
}
}
}
+
/**
* Transform artifacts
*
- * @param artifacts
- * @param stopOnFailure
- * @return DependencyStatusSets - Bean of TreeSets that contains information
- * on the projects dependencies
- * @throws MojoExecutionException
+ * @param artifacts set of artifacts {@link Artifact}.
+ * @param stopOnFailure true/false.
+ * @return DependencyStatusSets - Bean of TreeSets that contains information on the projects dependencies
+ * @throws MojoExecutionException in case of an error.
*/
protected DependencyStatusSets getClassifierTranslatedDependencies( Set<Artifact> artifacts, boolean stopOnFailure )
throws MojoExecutionException
@@ -432,9 +428,9 @@
/**
* Filter the marked dependencies
*
- * @param artifacts
- * @return status set
- * @throws MojoExecutionException
+ * @param artifacts The artifacts set {@link Artifact}.
+ * @return status set {@link DependencyStatusSets}.
+ * @throws MojoExecutionException in case of an error.
*/
protected DependencyStatusSets filterMarkedDependencies( Set<Artifact> artifacts )
throws MojoExecutionException
@@ -462,9 +458,15 @@
return new DependencyStatusSets( unMarkedArtifacts, null, skippedArtifacts );
}
-
+ /**
+ * @param coordinates The set of artifact coordinates{@link ArtifactCoordinate}.
+ * @param stopOnFailure <code>true</code> if we should fail with exception if an artifact couldn't be resolved
+ * <code>false</code> otherwise.
+ * @return the resolved artifacts. {@link Artifact}.
+ * @throws MojoExecutionException in case of error.
+ */
protected Set<Artifact> resolve( Set<ArtifactCoordinate> coordinates, boolean stopOnFailure )
- throws MojoExecutionException
+ throws MojoExecutionException
{
ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest();
@@ -489,6 +491,7 @@
}
return resolvedArtifacts;
}
+
/**
* @return Returns the markersDirectory.
*/
@@ -516,8 +519,7 @@
}
/**
- * @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 )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java
index b3ae95a..bbd9508 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java
@@ -24,8 +24,7 @@
import java.io.File;
/**
- * Abstract Parent class used by mojos that get Artifact information from the
- * project dependencies.
+ * Abstract Parent class used by mojos that get Artifact information from the project dependencies.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
@@ -46,7 +45,7 @@
*/
@Parameter( property = "mdep.stripVersion", defaultValue = "false" )
protected boolean stripVersion = false;
-
+
/**
* Strip artifact classifier during copy
*/
@@ -54,8 +53,16 @@
protected boolean stripClassifier = false;
/**
+ * <p>
* 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
+ * </p>
+ * <p>
+ * example:
+ * </p>
+ *
+ * <pre>
+ * /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
+ * </pre>
*
* @since 2.0-alpha-2
*/
@@ -63,8 +70,8 @@
protected boolean useRepositoryLayout;
/**
- * Place each type of file in a separate subdirectory. (example
- * /outputDirectory/runtime /outputDirectory/provided etc)
+ * Place each type of file in a separate subdirectory. (example /outputDirectory/runtime /outputDirectory/provided
+ * etc)
*
* @since 2.2
*/
@@ -72,8 +79,7 @@
protected boolean useSubDirectoryPerScope;
/**
- * Place each type of file in a separate subdirectory. (example
- * /outputDirectory/jars /outputDirectory/wars etc)
+ * Place each type of file in a separate subdirectory. (example /outputDirectory/jars /outputDirectory/wars etc)
*
* @since 2.0-alpha-1
*/
@@ -81,8 +87,7 @@
protected boolean useSubDirectoryPerType;
/**
- * Place each file in a separate subdirectory. (example
- * <code>/outputDirectory/junit-3.8.1-jar</code>)
+ * Place each file in a separate subdirectory. (example <code>/outputDirectory/junit-3.8.1-jar</code>)
*
* @since 2.0-alpha-1
*/
@@ -190,8 +195,7 @@
}
/**
- * @param useRepositoryLayout -
- * true if dependencies must be planted in a repository layout
+ * @param useRepositoryLayout - true if dependencies must be planted in a repository layout
*/
public void setUseRepositoryLayout( boolean useRepositoryLayout )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java
index a441007..3f356e1 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java
@@ -55,8 +55,9 @@
* @version $Id$
* @since 2.0-alpha-2
*/
-@Mojo( name = "build-classpath", requiresDependencyResolution = ResolutionScope.TEST,
- defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
+// CHECKSTYLE_OFF: LineLength
+@Mojo( name = "build-classpath", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
+// CHECKSTYLE_ON: LineLength
public class BuildClasspathMojo
extends AbstractDependencyFilterMojo
implements Comparator<Artifact>
@@ -73,7 +74,7 @@
*/
@Parameter( property = "mdep.stripClassifier", defaultValue = "false" )
private boolean stripClassifier = false;
-
+
/**
* The prefix to prepend on each dependent artifact. If undefined, the paths refer to the actual files store in the
* local repository (the stripVersion parameter does nothing then).
@@ -86,7 +87,7 @@
*/
@Parameter( property = "mdep.outputProperty" )
private String outputProperty;
-
+
/**
* The file to write the classpath string. If undefined, it just prints the classpath as [INFO].
*/
@@ -146,8 +147,9 @@
private boolean outputFilterFile;
/**
- * Either append the artifact's baseVersion or uniqueVersion to the filename.
- * Will only be used if {@link #isStripVersion()} is {@code false}.
+ * Either append the artifact's baseVersion or uniqueVersion to the filename. Will only be used if
+ * {@link #isStripVersion()} is {@code false}.
+ *
* @since 2.6
*/
@Parameter( property = "mdep.useBaseVersion", defaultValue = "true" )
@@ -158,9 +160,9 @@
*/
@Component
private MavenProjectHelper projectHelper;
-
+
@Component
- private RepositoryManager repositoryManager;
+ private RepositoryManager repositoryManager;
/**
* Main entry into mojo. Gets the list of dependencies and iterates to create a classpath.
@@ -176,7 +178,7 @@
boolean isFileSepSet = StringUtils.isNotEmpty( fileSeparator );
boolean isPathSepSet = StringUtils.isNotEmpty( pathSeparator );
- //don't allow them to have absolute paths when they attach.
+ // don't allow them to have absolute paths when they attach.
if ( attach && StringUtils.isEmpty( localRepoProperty ) )
{
localRepoProperty = "${M2_REPO}";
@@ -217,7 +219,7 @@
cpString = cpString.replaceAll( pattern, replacement );
}
- //make the string valid for filtering
+ // make the string valid for filtering
if ( outputFilterFile )
{
cpString = "classpath=" + cpString;
@@ -265,8 +267,8 @@
/**
* Appends the artifact path into the specified StringBuilder.
*
- * @param art
- * @param sb
+ * @param art {@link Artifact}
+ * @param sb {@link StringBuilder}
*/
protected void appendArtifactPath( Artifact art, StringBuilder sb )
{
@@ -277,7 +279,7 @@
if ( StringUtils.isNotEmpty( localRepoProperty ) )
{
File localBasedir = repositoryManager.getLocalRepositoryBasedir( session.getProjectBuildingRequest() );
-
+
file = StringUtils.replace( file, localBasedir.getAbsolutePath(), localRepoProperty );
}
sb.append( file );
@@ -308,8 +310,8 @@
}
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;
}
@@ -324,7 +326,7 @@
private void storeClasspathFile( String cpString, File out )
throws MojoExecutionException
{
- //make sure the parent path exists.
+ // make sure the parent path exists.
out.getParentFile().mkdirs();
Writer w = null;
@@ -352,15 +354,15 @@
* 'outputFile' is not null.
*
* @return the string contained in the classpathFile, if exists, or null otherwise.
- * @throws MojoExecutionException
+ * @throws IOException in case of an error.
*/
protected String readClasspathFile()
throws IOException
{
if ( outputFile == null )
{
- throw new IllegalArgumentException(
- "The outputFile parameter cannot be null if the file is intended to be read." );
+ throw new IllegalArgumentException( "The outputFile parameter "
+ + "cannot be null if the file is intended to be read." );
}
if ( !outputFile.isFile() )
@@ -395,9 +397,9 @@
*
* @param art1 first object
* @param art2 second object
- * @return the value <code>0</code> if the argument string is equal to this string; a value less than
- * <code>0</code> if this string is lexicographically less than the string argument; and a value greater
- * than <code>0</code> if this string is lexicographically greater than the string argument.
+ * @return the value <code>0</code> if the argument string is equal to this string; a value less than <code>0</code>
+ * if this string is lexicographically less than the string argument; and a value greater than
+ * <code>0</code> if this string is lexicographically greater than the string argument.
*/
@Override
public int compare( Artifact art1, Artifact art2 )
@@ -434,7 +436,7 @@
{
this.outputFile = outputFile;
}
-
+
/**
* @param theOutputProperty the outputProperty to set
*/
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
index 563dc8f..f9ad5c6 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
@@ -43,15 +43,15 @@
import java.util.Set;
/**
- * Goal that copies the project dependencies from the repository to a defined
- * location.
+ * Goal that copies the project dependencies from the repository to a defined location.
*
* @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, threadSafe = true )
+//CHECKSTYLE_OFF: LineLength
+@Mojo( name = "copy-dependencies", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true )
+//CHECKSTYLE_ON: LineLength
public class CopyDependenciesMojo
extends AbstractFromDependenciesMojo
{
@@ -75,10 +75,10 @@
@Component( role = ArtifactRepositoryLayout.class )
private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
-
/**
- * Either append the artifact's baseVersion or uniqueVersion to the filename.
- * Will only be used if {@link #isStripVersion()} is {@code false}.
+ * Either append the artifact's baseVersion or uniqueVersion to the filename. Will only be used if
+ * {@link #isStripVersion()} is {@code false}.
+ *
* @since 2.6
*/
@Parameter( property = "mdep.useBaseVersion", defaultValue = "true" )
@@ -86,6 +86,7 @@
/**
* Add parent poms to the list of copied dependencies (both current project pom parents and dependencies parents).
+ *
* @since 2.8
*/
@Parameter( property = "mdep.addParentPoms", defaultValue = "false" )
@@ -104,8 +105,7 @@
protected boolean ignorePermissions;
/**
- * Main entry into mojo. Gets the list of dependencies and iterates through
- * calling copyArtifact.
+ * Main entry into mojo. Gets the list of dependencies and iterates through calling copyArtifact.
*
* @throws MojoExecutionException with a message if an error occurs.
* @see #getDependencySets(boolean, boolean)
@@ -141,14 +141,17 @@
Set<Artifact> skippedArtifacts = dss.getSkippedDependencies();
for ( Artifact artifact : skippedArtifacts )
{
- getLog().info( artifact.getId() + " already exists in destination." ) ;
+ getLog().info( artifact.getId() + " already exists in destination." );
}
if ( isCopyPom() && !useRepositoryLayout )
{
copyPoms( getOutputDirectory(), artifacts, this.stripVersion );
- copyPoms( getOutputDirectory(), skippedArtifacts,
- this.stripVersion, this.stripClassifier ); // Artifacts that already exist may not yet have poms
+ copyPoms( getOutputDirectory(), skippedArtifacts, this.stripVersion, this.stripClassifier ); // Artifacts
+ // that already
+ // exist may
+ // not yet have
+ // poms
}
}
@@ -187,12 +190,12 @@
if ( artifact.isSnapshot() && !artifact.getBaseVersion().equals( artifact.getVersion() ) )
{
String version = artifact.getVersion();
- try
+ try
{
artifact.setVersion( artifact.getBaseVersion() );
installer.install( buildingRequest, Collections.singletonList( artifact ) );
}
- finally
+ finally
{
artifact.setVersion( version );
}
@@ -200,13 +203,11 @@
}
/**
- * Copies the Artifact after building the destination file name if
- * overridden. This method also checks if the classifier is set and adds it
- * to the destination file name if needed.
+ * Copies the Artifact after building the destination file name if 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 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.
* @param useBaseVersion specifies if the baseVersion of the artifact should be used instead of the version.
* @throws MojoExecutionException with a message if an error occurs.
@@ -220,13 +221,11 @@
}
/**
- * Copies the Artifact after building the destination file name if
- * overridden. This method also checks if the classifier is set and adds it
- * to the destination file name if needed.
+ * Copies the Artifact after building the destination file name if 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 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.
* @param useBaseVersion specifies if the baseVersion of the artifact should be used instead of the version.
* @param removeClassifier specifies if the classifier should be removed from the file name when copying.
@@ -239,8 +238,8 @@
throws MojoExecutionException
{
- String destFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId,
- useBaseVersion, removeClassifier );
+ String destFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId,
+ useBaseVersion, removeClassifier );
File destDir;
destDir = DependencyUtil.getFormattedOutputDirectory( useSubDirectoryPerScope, useSubDirectoryPerType,
@@ -250,9 +249,14 @@
copyFile( artifact.getFile(), destFile );
}
-
+
/**
* Copy the pom files associated with the artifacts.
+ *
+ * @param destDir The destination directory {@link File}.
+ * @param artifacts The artifacts {@link Artifact}.
+ * @param removeVersion remove version or not.
+ * @throws MojoExecutionException in case of errors.
*/
public void copyPoms( File destDir, Set<Artifact> artifacts, boolean removeVersion )
throws MojoExecutionException
@@ -260,9 +264,15 @@
{
copyPoms( destDir, artifacts, removeVersion, false );
}
-
+
/**
* Copy the pom files associated with the artifacts.
+ *
+ * @param destDir The destination directory {@link File}.
+ * @param artifacts The artifacts {@link Artifact}.
+ * @param removeVersion remove version or not.
+ * @param removeClassifier remove the classifier or not.
+ * @throws MojoExecutionException in case of errors.
*/
public void copyPoms( File destDir, Set<Artifact> artifacts, boolean removeVersion, boolean removeClassifier )
throws MojoExecutionException
@@ -293,7 +303,7 @@
coordinate.setArtifactId( artifact.getArtifactId() );
coordinate.setVersion( artifact.getVersion() );
coordinate.setExtension( "pom" );
-
+
Artifact pomArtifact = null;
// Resolve the pom artifact using repos
try
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
index 32f59b1..0e40a98 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/UnpackDependenciesMojo.java
@@ -34,23 +34,22 @@
import java.io.File;
/**
- * Goal that unpacks the project dependencies from the repository to a defined
- * location.
+ * Goal that unpacks the project dependencies from the repository to a defined location.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
* @since 1.0
*/
-@Mojo( name = "unpack-dependencies", requiresDependencyResolution = ResolutionScope.TEST,
- defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true )
+//CHECKSTYLE_OFF: LineLength
+@Mojo( name = "unpack-dependencies", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true )
+//CHECKSTYLE_ON: LineLength
public class UnpackDependenciesMojo
extends AbstractFromDependenciesMojo
{
/**
- * A comma separated list of file patterns to include when unpacking the
- * artifact. i.e. <code>**/*.xml,**/*.properties</code>
- * NOTE: Excludes patterns override the includes.
- * (component code = <code>return isIncluded( name ) AND !isExcluded( name );</code>)
+ * A comma separated list of file patterns to include when unpacking the artifact. i.e.
+ * <code>**/*.xml,**/*.properties</code> NOTE: Excludes patterns override the includes. (component code =
+ * <code>return isIncluded( name ) AND !isExcluded( name );</code>)
*
* @since 2.0
*/
@@ -58,10 +57,9 @@
private String includes;
/**
- * A comma separated list of file patterns to exclude when unpacking the
- * artifact. i.e. <code>**/*.xml,**/*.properties</code>
- * NOTE: Excludes patterns override the includes.
- * (component code = <code>return isIncluded( name ) AND !isExcluded( name );</code>)
+ * A comma separated list of file patterns to exclude when unpacking the artifact. i.e.
+ * <code>**/*.xml,**/*.properties</code> NOTE: Excludes patterns override the includes. (component code =
+ * <code>return isIncluded( name ) AND !isExcluded( name );</code>)
*
* @since 2.0
*/
@@ -70,14 +68,15 @@
/**
* Encoding of artifacts.
+ *
* @since 3.0
*/
@Parameter( property = "mdep.unpack.encoding" )
private String encoding;
/**
- * Main entry into mojo. This method gets the dependencies and iterates
- * through each one passing it to DependencyUtil.unpackFile().
+ * Main entry into mojo. This method gets the dependencies and iterates through each one passing it to
+ * DependencyUtil.unpackFile().
*
* @throws MojoExecutionException with a message if an error occurs.
* @see #getDependencySets(boolean)
@@ -122,8 +121,7 @@
}
/**
- * @param excludes A comma separated list of items to exclude
- * i.e. <code>**\/*.xml, **\/*.properties</code>
+ * @param excludes A comma separated list of items to exclude i.e. <code>**\/*.xml, **\/*.properties</code>
*/
public void setExcludes( String excludes )
{
@@ -139,8 +137,7 @@
}
/**
- * @param includes A comma separated list of items to include
- * i.e. <code>**\/*.xml, **\/*.properties</code>
+ * @param includes A comma separated list of items to include i.e. <code>**\/*.xml, **\/*.properties</code>
*/
public void setIncludes( String includes )
{
@@ -154,7 +151,7 @@
public void setEncoding( String encoding )
{
this.encoding = encoding;
- }
+ }
/**
* @return Returns the encoding.
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/AbstractResolveMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/AbstractResolveMojo.java
index 6ff6559..160336e 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/AbstractResolveMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/AbstractResolveMojo.java
@@ -57,10 +57,8 @@
/**
* This method resolves the dependency artifacts from the project.
*
- * @param theProject
- * The POM.
+ * @param theProject The POM.
* @return resolved set of dependency artifacts.
- *
* @throws ArtifactResolutionException
* @throws ArtifactNotFoundException
* @throws InvalidDependencyVersionException
@@ -75,8 +73,7 @@
protected boolean appendOutput;
/**
- * Don't resolve plugins that are in the current reactor.
- * Only works for plugins at the moment.
+ * Don't resolve plugins that are in the current reactor. Only works for plugins at the moment.
*
* @since 2.7
*/
@@ -125,9 +122,10 @@
final FilterArtifacts filter = new FilterArtifacts();
- filter.addFilter( new org.apache.maven.shared.artifact.filter.collection.ScopeFilter(
- DependencyUtil.cleanToBeTokenizedString( this.includeScope ),
- DependencyUtil.cleanToBeTokenizedString( this.excludeScope ) ) );
+ //CHECKSTYLE_OFF: LineLength
+ filter.addFilter( new org.apache.maven.shared.artifact.filter.collection.ScopeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeScope ),
+ DependencyUtil.cleanToBeTokenizedString( this.excludeScope ) ) );
+ //CHECKSTYLE_ON: LineLength
filter.addFilter( new TypeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeTypes ),
DependencyUtil.cleanToBeTokenizedString( this.excludeTypes ) ) );
@@ -149,7 +147,7 @@
*
* @param artifact the artifact used to retrieve dependencies
* @return resolved set of dependencies
- * @throws DependencyResolverException
+ * @throws DependencyResolverException in case of error while resolving artifacts.
*/
protected Set<Artifact> resolveArtifactDependencies( final DependableCoordinate artifact )
throws DependencyResolverException
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/CollectDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/CollectDependenciesMojo.java
index 550fa3e..123347f 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/CollectDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/CollectDependenciesMojo.java
@@ -24,22 +24,28 @@
import org.apache.maven.plugins.annotations.ResolutionScope;
/**
- * Goal that collects the project dependencies from the repository.
- * This goal requires Maven 3.0 or higher to function because it uses "requiresDependencyCollection".
- * This means that it lists the groupId:artifactId:version information by downloading the pom files
- * without downloading the actual artifacts such as jar files.
+ * <p>
+ * Goal that collects the project dependencies from the repository. This goal requires Maven 3.0 or higher to function
+ * because it uses "requiresDependencyCollection". This means that it lists the groupId:artifactId:version information
+ * by downloading the pom files without downloading the actual artifacts such as jar files.
+ * </p>
+ * <p>
* This is very useful when full dependency resolution might fail due to projects which haven't been built yet.
- * <p/>
+ * </p>
+ * <p>
* It is identical to {@link ResolveDependenciesMojo} except for using the requiresDependencyCollection annotation
* attribute instead of requiresDependencyResolution.
+ * </p>
*
* @author <a href="mailto:epabst@gmail.com">Eric Pabst</a>
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
* @since 3.0
*/
-@Mojo( name = "collect", requiresDependencyCollection = ResolutionScope.TEST,
- defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
-public class CollectDependenciesMojo extends ResolveDependenciesMojo
+//CHECKSTYLE_OFF: LineLength
+@Mojo( name = "collect", requiresDependencyCollection = ResolutionScope.TEST, defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
+//CHECKSTYLE_ON: LineLength
+public class CollectDependenciesMojo
+ extends ResolveDependenciesMojo
{
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
index 754d552..ab67b22 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/GoOfflineMojo.java
@@ -30,8 +30,7 @@
import java.util.Set;
/**
- * Goal that resolves all project dependencies, including plugins and reports
- * and their dependencies.
+ * Goal that resolves all project dependencies, including plugins and reports and their dependencies.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
@@ -44,8 +43,7 @@
{
/**
- * Main entry into mojo. Gets the list of dependencies and iterates through
- * displaying the resolved version.
+ * Main entry into mojo. Gets the list of dependencies and iterates through displaying the resolved version.
*
* @throws MojoExecutionException with a message if an error occurs.
*/
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListRepositoriesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListRepositoriesMojo.java
index 422849d..149a5f1 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListRepositoriesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ListRepositoriesMojo.java
@@ -30,8 +30,8 @@
import org.apache.maven.shared.dependencies.collect.DependencyCollectorException;
/**
- * Goal that resolves all project dependencies and then lists the repositories
- * used by the build and by the transitive dependencies
+ * Goal that resolves all project dependencies and then lists the repositories used by the build and by the transitive
+ * dependencies
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id: GoOfflineMojo.java 728546 2008-12-21 22:56:51Z bentmann $
@@ -59,8 +59,7 @@
try
{
CollectorResult collectResult =
- dependencyCollector.collectDependencies( session.getProjectBuildingRequest(),
- getProject().getModel() );
+ dependencyCollector.collectDependencies( session.getProjectBuildingRequest(), getProject().getModel() );
this.getLog().info( "Repositories used by this build:" );
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java
index c8b1e73..7514e09 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java
@@ -47,15 +47,16 @@
import java.util.jar.Manifest;
/**
- * Goal that resolves the project dependencies from the repository.
- * When using this goal while running on Java 9 the module names will be visible as well.
+ * Goal that resolves the project dependencies from the repository. When using this goal while running on Java 9 the
+ * module names will be visible as well.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
* @since 2.0
*/
-@Mojo( name = "resolve", requiresDependencyResolution = ResolutionScope.TEST,
- defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
+//CHECKSTYLE_OFF: LineLength
+@Mojo( name = "resolve", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
+//CHECKSTYLE_ON: LineLength
public class ResolveDependenciesMojo
extends AbstractResolveMojo
{
@@ -74,8 +75,7 @@
DependencyStatusSets results;
/**
- * Sort the output list of resolved artifacts alphabetically.
- * The default ordering matches the classpath order.
+ * Sort the output list of resolved artifacts alphabetically. The default ordering matches the classpath order.
*
* @since 2.8
*/
@@ -133,7 +133,7 @@
{
return new ResolveFileFilter( new SourcesFileMarkerHandler( this.markersDirectory ) );
}
-
+
public String getOutput( boolean outputAbsoluteArtifactFilename, boolean outputScope, boolean sort )
{
StringBuilder sb = new StringBuilder();
@@ -155,8 +155,8 @@
sb.append( "The following files were skipped:\n" );
Set<Artifact> skippedDependencies = new LinkedHashSet<Artifact>();
skippedDependencies.addAll( results.getSkippedDependencies() );
- sb.append( buildArtifactListOutput( skippedDependencies, outputAbsoluteArtifactFilename,
- outputScope, sort ) );
+ sb.append( buildArtifactListOutput( skippedDependencies, outputAbsoluteArtifactFilename, outputScope,
+ sort ) );
}
if ( results.getUnResolvedDependencies() != null && !results.getUnResolvedDependencies().isEmpty() )
@@ -165,14 +165,14 @@
sb.append( "The following files have NOT been resolved:\n" );
Set<Artifact> unResolvedDependencies = new LinkedHashSet<Artifact>();
unResolvedDependencies.addAll( results.getUnResolvedDependencies() );
- sb.append( buildArtifactListOutput( unResolvedDependencies, outputAbsoluteArtifactFilename,
- outputScope, sort ) );
+ sb.append( buildArtifactListOutput( unResolvedDependencies, outputAbsoluteArtifactFilename, outputScope,
+ sort ) );
}
sb.append( "\n" );
return sb.toString();
}
-
+
private StringBuilder buildArtifactListOutput( Set<Artifact> artifacts, boolean outputAbsoluteArtifactFilename,
boolean outputScope, boolean sort )
{
@@ -181,9 +181,9 @@
for ( Artifact artifact : artifacts )
{
MessageBuilder messageBuilder = MessageUtils.buffer();
-
+
messageBuilder.a( " " );
-
+
if ( outputScope )
{
messageBuilder.a( artifact.toString() );
@@ -192,14 +192,14 @@
{
messageBuilder.a( artifact.getId() );
}
-
+
if ( outputAbsoluteArtifactFilename )
{
try
{
// we want to print the absolute file name here
String artifactFilename = artifact.getFile().getAbsoluteFile().getPath();
-
+
messageBuilder.a( ':' ).a( artifactFilename );
}
catch ( NullPointerException e )
@@ -246,7 +246,7 @@
}
return sb;
}
-
+
private ModuleDescriptor getModuleDescriptor( File artifactFile )
{
ModuleDescriptor moduleDescriptor = null;
@@ -256,30 +256,30 @@
Class<?> moduleFinderClass = Class.forName( "java.lang.module.ModuleFinder" );
java.nio.file.Path path = artifactFile.toPath();
-
+
Method ofMethod = moduleFinderClass.getMethod( "of", java.nio.file.Path[].class );
Object moduleFinderInstance = ofMethod.invoke( null, new Object[] { new java.nio.file.Path[] { path } } );
-
+
Method findAllMethod = moduleFinderClass.getMethod( "findAll" );
@SuppressWarnings( "unchecked" )
Set<Object> moduleReferences = (Set<Object>) findAllMethod.invoke( moduleFinderInstance );
-
+
// moduleReferences can be empty when referring to target/classes without module-info.class
if ( !moduleReferences.isEmpty() )
{
Object moduleReference = moduleReferences.iterator().next();
Method descriptorMethod = moduleReference.getClass().getMethod( "descriptor" );
Object moduleDescriptorInstance = descriptorMethod.invoke( moduleReference );
-
+
Method nameMethod = moduleDescriptorInstance.getClass().getMethod( "name" );
String name = (String) nameMethod.invoke( moduleDescriptorInstance );
-
+
moduleDescriptor = new ModuleDescriptor();
moduleDescriptor.name = name;
-
+
Method isAutomaticMethod = moduleDescriptorInstance.getClass().getMethod( "isAutomatic" );
moduleDescriptor.automatic = (Boolean) isAutomaticMethod.invoke( moduleDescriptorInstance );
-
+
if ( moduleDescriptor.automatic )
{
if ( artifactFile.isFile() )
@@ -288,9 +288,9 @@
try
{
jarFile = new JarFile( artifactFile );
-
+
Manifest manifest = jarFile.getManifest();
-
+
if ( manifest != null
&& manifest.getMainAttributes().getValue( "Automatic-Module-Name" ) != null )
{
@@ -305,7 +305,7 @@
{
// noop
}
- finally
+ finally
{
if ( jarFile != null )
{
@@ -315,7 +315,7 @@
}
catch ( IOException e )
{
- // noop
+ // noop
}
}
}
@@ -354,11 +354,11 @@
}
return moduleDescriptor;
}
-
+
private class ModuleDescriptor
{
String name;
-
+
boolean automatic = true;
String moduleNameSource;
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java
index 7360a7f..d1d5af5 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java
@@ -32,8 +32,9 @@
* @version $Id$
* @since 2.0-alpha2
*/
-@Mojo( name = "sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES,
- requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true )
+//CHECKSTYLE_OFF: LineLength
+@Mojo( name = "sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true )
+//CHECKSTYLE_ON: LineLength
public class ResolveDependencySourcesMojo
extends ResolveDependenciesMojo
{
@@ -41,8 +42,7 @@
private static final String SOURCE_CLASSIFIER = "sources";
/**
- * Main entry into mojo. Gets the list of dependencies and iterates through
- * resolving the source jars.
+ * Main entry into mojo. Gets the list of dependencies and iterates through resolving the source jars.
*
* @throws MojoExecutionException with a message if an error occurs.
*/
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolvePluginsMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolvePluginsMojo.java
index 0c2478d..239c165 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolvePluginsMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolvePluginsMojo.java
@@ -59,8 +59,7 @@
private List<ArtifactRepository> remotePluginRepositories;
/**
- * Main entry into mojo. Gets the list of dependencies and iterates through
- * displaying the resolved version.
+ * Main entry into mojo. Gets the list of dependencies and iterates through displaying the resolved version.
*
* @throws MojoExecutionException with a message if an error occurs.
*/
@@ -128,7 +127,7 @@
id = artifact.toString();
sb.append( " " + id + ( outputAbsoluteArtifactFilename ? ":" + artifactFilename : "" )
- + "\n" );
+ + "\n" );
}
}
}
@@ -167,8 +166,8 @@
* This method resolves the plugin artifacts from the project.
*
* @return set of resolved plugin artifacts.
- * @throws ArtifactFilterException
- * @throws ArtifactResolverException
+ * @throws ArtifactFilterException in case of an error.
+ * @throws ArtifactResolverException in case of an error.
*/
protected Set<Artifact> resolvePluginArtifacts()
throws ArtifactFilterException, ArtifactResolverException
@@ -184,21 +183,21 @@
artifacts = filter.filter( artifacts );
Set<Artifact> resolvedArtifacts = new LinkedHashSet<Artifact>( artifacts.size() );
- // final ArtifactFilter filter = getPluginFilter();
+ // final ArtifactFilter filter = getPluginFilter();
for ( final Artifact artifact : new LinkedHashSet<Artifact>( artifacts ) )
{
// if ( !filter.include( artifact ) )
// {
- // final String logStr =
- // String.format( " Plugin SKIPPED: %s", DependencyUtil.getFormattedFileName( artifact, false ) );
+ // final String logStr =
+ // String.format( " Plugin SKIPPED: %s", DependencyUtil.getFormattedFileName( artifact, false ) );
//
- // if ( !silent )
- // {
- // this.getLog().info( logStr );
- // }
+ // if ( !silent )
+ // {
+ // this.getLog().info( logStr );
+ // }
//
- // artifacts.remove( artifact );
- // continue;
+ // artifacts.remove( artifact );
+ // continue;
// }
ProjectBuildingRequest buildingRequest =
@@ -207,7 +206,7 @@
buildingRequest.setRemoteRepositories( this.remotePluginRepositories );
// resolve the new artifact
- resolvedArtifacts.add( getArtifactResolver().resolveArtifact( buildingRequest, artifact ) .getArtifact() );
+ resolvedArtifacts.add( getArtifactResolver().resolveArtifact( buildingRequest, artifact ).getArtifact() );
}
return artifacts;
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/tree/AbstractSerializingVisitor.java b/src/main/java/org/apache/maven/plugins/dependency/tree/AbstractSerializingVisitor.java
index f2397fd..d71f70e 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/tree/AbstractSerializingVisitor.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/tree/AbstractSerializingVisitor.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugins.dependency.tree ;
+package org.apache.maven.plugins.dependency.tree;
/*
* Licensed to the Apache Software Foundation (ASF) under one
diff --git a/src/main/java/org/apache/maven/plugins/dependency/tree/DOTDependencyNodeVisitor.java b/src/main/java/org/apache/maven/plugins/dependency/tree/DOTDependencyNodeVisitor.java
index 2d1796c..d585e55 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/tree/DOTDependencyNodeVisitor.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/tree/DOTDependencyNodeVisitor.java
@@ -26,8 +26,7 @@
import java.util.List;
/**
- * A dependency node visitor that serializes visited nodes to DOT format
- * http://en.wikipedia.org/wiki/DOT_language
+ * A dependency node visitor that serializes visited nodes to DOT format http://en.wikipedia.org/wiki/DOT_language
*
* @author <a href="mailto:pi.songs@gmail.com">Pi Song</a>
* @since 2.1
@@ -47,7 +46,6 @@
super( writer );
}
-
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/org/apache/maven/plugins/dependency/tree/GraphmlDependencyNodeVisitor.java b/src/main/java/org/apache/maven/plugins/dependency/tree/GraphmlDependencyNodeVisitor.java
index da90d0a..1ec783a 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/tree/GraphmlDependencyNodeVisitor.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/tree/GraphmlDependencyNodeVisitor.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugins.dependency.tree ;
+package org.apache.maven.plugins.dependency.tree;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -39,16 +39,14 @@
/**
* Graphml xml file header. Define Schema and root element. We also define 2 key as meta data.
*/
- private static final String GRAPHML_HEADER =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
- + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" "
- + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
- + "xmlns:y=\"http://www.yworks.com/xml/graphml\" "
- + "xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
- + "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n"
- + " <key for=\"node\" id=\"d0\" yfiles.type=\"nodegraphics\"/> \n"
- + " <key for=\"edge\" id=\"d1\" yfiles.type=\"edgegraphics\"/> \n"
- + "<graph id=\"dependencies\" edgedefault=\"directed\">\n";
+ private static final String GRAPHML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
+ + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" "
+ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xmlns:y=\"http://www.yworks.com/xml/graphml\" "
+ + "xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns "
+ + "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n"
+ + " <key for=\"node\" id=\"d0\" yfiles.type=\"nodegraphics\"/> \n"
+ + " <key for=\"edge\" id=\"d1\" yfiles.type=\"edgegraphics\"/> \n"
+ + "<graph id=\"dependencies\" edgedefault=\"directed\">\n";
/**
* Graphml xml file footer.
diff --git a/src/main/java/org/apache/maven/plugins/dependency/tree/TGFDependencyNodeVisitor.java b/src/main/java/org/apache/maven/plugins/dependency/tree/TGFDependencyNodeVisitor.java
index 90ebe85..f25b56d 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/tree/TGFDependencyNodeVisitor.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/tree/TGFDependencyNodeVisitor.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugins.dependency.tree ;
+package org.apache.maven.plugins.dependency.tree;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -28,7 +28,6 @@
/**
* A dependency node visitor that serializes visited nodes to a writer using the TGF format.
- *
* http://en.wikipedia.org/wiki/Trivial_Graph_Format
*
* @author <a href="mailto:jerome.creignou@gmail.com">Jerome Creignou</a>
diff --git a/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
index a83c08d..7ece33e 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
@@ -107,8 +107,8 @@
* If specified, this parameter will cause the dependency tree to be written using the specified format. Currently
* supported format are: <code>text</code>, <code>dot</code>, <code>graphml</code> and <code>tgf</code>.
* <p/>
- * These formats can be plotted to image files. An example of how to plot a dot file using
- * pygraphviz can be found <a href="http://networkx.lanl.gov/pygraphviz/tutorial.html#layout-and-drawing">here</a>.
+ * These formats can be plotted to image files. An example of how to plot a dot file using pygraphviz can be found
+ * <a href="http://networkx.lanl.gov/pygraphviz/tutorial.html#layout-and-drawing">here</a>.
*
* @since 2.2
*/
@@ -116,8 +116,8 @@
private String outputType;
/**
- * The scope to filter by when resolving the dependency tree, or <code>null</code> to include dependencies from
- * all scopes. Note that this feature does not currently work due to MSHARED-4
+ * The scope to filter by when resolving the dependency tree, or <code>null</code> to include dependencies from all
+ * scopes. Note that this feature does not currently work due to MSHARED-4
*
* @see <a href="https://issues.apache.org/jira/browse/MSHARED-4">MSHARED-4</a>
* @since 2.0-alpha-5
@@ -137,8 +137,8 @@
/**
* The token set name to use when outputting the dependency tree. Possible values are <code>whitespace</code>,
- * <code>standard</code> or <code>extended</code>, which use whitespace, standard (ie ASCII) or extended
- * character sets respectively.
+ * <code>standard</code> or <code>extended</code>, which use whitespace, standard (ie ASCII) or extended character
+ * sets respectively.
*
* @since 2.0-alpha-6
*/
@@ -155,8 +155,10 @@
*
* where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
* segment is treated as an implicit wildcard.
- * <p>For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
- * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.</p>
+ * <p>
+ * For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
+ * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.
+ * </p>
*
* @see StrictPatternIncludesArtifactFilter
* @since 2.0-alpha-6
@@ -174,8 +176,10 @@
*
* where each pattern segment is optional and supports full and partial <code>*</code> wildcards. An empty pattern
* segment is treated as an implicit wildcard.
- * <p>For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
- * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.</p>
+ * <p>
+ * For example, <code>org.apache.*</code> will match all artifacts whose group id starts with
+ * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all snapshot artifacts.
+ * </p>
*
* @see StrictPatternExcludesArtifactFilter
* @since 2.0-alpha-6
@@ -232,12 +236,12 @@
// have already been resolved.
getLog().info( "Verbose not supported since maven-dependency-plugin 3.0" );
}
-
+
ProjectBuildingRequest buildingRequest =
new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
-
+
buildingRequest.setProject( project );
-
+
// non-verbose mode use dependency graph component, which gives consistent results with Maven version
// running
rootNode = dependencyGraphBuilder.buildDependencyGraph( buildingRequest, artifactFilter, reactorProjects );
@@ -440,9 +444,8 @@
return filters.isEmpty() ? null : new AndDependencyNodeFilter( filters );
}
- //following is required because the version handling in maven code
- //doesn't work properly. I ripped it out of the enforcer rules.
-
+ // following is required because the version handling in maven code
+ // doesn't work properly. I ripped it out of the enforcer rules.
/**
* Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default
@@ -450,7 +453,7 @@
* "[2.0.4,)"
*
* @param allowedRange range of allowed versions.
- * @param theVersion the version to be checked.
+ * @param theVersion the version to be checked.
* @return true if the version is contained by the range.
*/
public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java
index 953b478..186feec 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencySilentLog.java
@@ -353,7 +353,7 @@
{
// nop
}
-
+
/**
* @return <code>null</code>
* @see org.codehaus.plexus.logging.Logger#getName()
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyStatusSets.java b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyStatusSets.java
index 1ff9835..2647f3e 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyStatusSets.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyStatusSets.java
@@ -66,8 +66,7 @@
}
/**
- * @param resolvedDependencies
- * The resolvedDependencies to set.
+ * @param resolvedDependencies The resolvedDependencies to set.
*/
public void setResolvedDependencies( Set<Artifact> resolvedDependencies )
{
@@ -90,8 +89,7 @@
}
/**
- * @param skippedDependencies
- * The skippedDependencies to set.
+ * @param skippedDependencies The skippedDependencies to set.
*/
public void setSkippedDependencies( Set<Artifact> skippedDependencies )
{
@@ -114,8 +112,7 @@
}
/**
- * @param unResolvedDependencies
- * The unResolvedDependencies to set.
+ * @param unResolvedDependencies The unResolvedDependencies to set.
*/
public void setUnResolvedDependencies( Set<Artifact> unResolvedDependencies )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java
index 3feec7c..884a932 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java
@@ -55,41 +55,30 @@
}
/**
- * Builds the file name. If removeVersion is set, then the file name must be
- * reconstructed from the groupId (if <b>prependGroupId</b> is true) artifactId,
- * Classifier (if used) and Type.
- * Otherwise, this method returns the artifact file name.
+ * Builds the file name. If removeVersion is set, then the file name must be reconstructed from the groupId (if
+ * <b>prependGroupId</b> is true) artifactId, Classifier (if used) and Type. Otherwise, this method returns the
+ * artifact file name.
*
- * @param artifact
- * File to be formatted.
- * @param removeVersion
- * Specifies if the version should be removed from the file name.
- * @param prependGroupId
- * Specifies if the groupId should be prepended to the file name.
- * @return Formatted file name in the format
- * [groupId].artifactId-[version]-[classifier].[type]
+ * @param artifact File to be formatted.
+ * @param removeVersion Specifies if the version should be removed from the file name.
+ * @param prependGroupId Specifies if the groupId should be prepended to the file name.
+ * @return Formatted file name in the format [groupId].artifactId-[version]-[classifier].[type]
*/
public static String getFormattedFileName( Artifact artifact, boolean removeVersion, boolean prependGroupId )
- {
+ {
return getFormattedFileName( artifact, removeVersion, prependGroupId, false );
}
/**
- * Builds the file name. If removeVersion is set, then the file name must be
- * reconstructed from the groupId (if <b>prependGroupId</b> is true) artifactId,
- * Classifier (if used) and Type.
- * Otherwise, this method returns the artifact file name.
+ * Builds the file name. If removeVersion is set, then the file name must be reconstructed from the groupId (if
+ * <b>prependGroupId</b> is true) artifactId, Classifier (if used) and Type. Otherwise, this method returns the
+ * artifact file name.
*
- * @param artifact
- * File to be formatted.
- * @param removeVersion
- * Specifies if the version should be removed from the file name.
- * @param prependGroupId
- * Specifies if the groupId should be prepended to the file name.
- * @param useBaseVersion
- * Specifies if the baseVersion of the artifact should be used instead of the version.
- * @return Formatted file name in the format
- * [groupId].artifactId-[version]-[classifier].[type]
+ * @param artifact File to be formatted.
+ * @param removeVersion Specifies if the version should be removed from the file name.
+ * @param prependGroupId Specifies if the groupId should be prepended to the file name.
+ * @param useBaseVersion Specifies if the baseVersion of the artifact should be used instead of the version.
+ * @return Formatted file name in the format [groupId].artifactId-[version]-[classifier].[type]
*/
public static String getFormattedFileName( Artifact artifact, boolean removeVersion, boolean prependGroupId,
boolean useBaseVersion )
@@ -98,34 +87,27 @@
}
/**
- * Builds the file name. If removeVersion is set, then the file name must be
- * reconstructed from the groupId (if <b>prependGroupId</b> is true) artifactId,
- * Classifier (if used) and Type.
- * Otherwise, this method returns the artifact file name.
+ * Builds the file name. If removeVersion is set, then the file name must be reconstructed from the groupId (if
+ * <b>prependGroupId</b> is true) artifactId, Classifier (if used) and Type. Otherwise, this method returns the
+ * artifact file name.
*
- * @param artifact
- * File to be formatted.
- * @param removeVersion
- * Specifies if the version should be removed from the file name.
- * @param prependGroupId
- * Specifies if the groupId should be prepended to the file name.
- * @param useBaseVersion
- * Specifies if the baseVersion of the artifact should be used instead of the version.
- * @param removeClassifier
- * Specifies if the classifier of the artifact should be remved from the file name.
- * @return Formatted file name in the format
- * [groupId].artifactId-[version]-[classifier].[type]
+ * @param artifact File to be formatted.
+ * @param removeVersion Specifies if the version should be removed from the file name.
+ * @param prependGroupId Specifies if the groupId should be prepended to the file name.
+ * @param useBaseVersion Specifies if the baseVersion of the artifact should be used instead of the version.
+ * @param removeClassifier Specifies if the classifier of the artifact should be remved from the file name.
+ * @return Formatted file name in the format [groupId].artifactId-[version]-[classifier].[type]
*/
- public static String getFormattedFileName( Artifact artifact, boolean removeVersion, boolean prependGroupId,
- boolean useBaseVersion, boolean removeClassifier )
+ public static String getFormattedFileName( Artifact artifact, boolean removeVersion, boolean prependGroupId,
+ boolean useBaseVersion, boolean removeClassifier )
{
StringBuilder destFileName = new StringBuilder();
-
+
if ( prependGroupId )
{
destFileName.append( artifact.getGroupId() ).append( "." );
}
-
+
String versionString;
if ( !removeVersion )
{
@@ -152,13 +134,14 @@
destFileName.append( artifact.getArtifactId() ).append( versionString );
destFileName.append( classifierString ).append( "." );
destFileName.append( artifact.getArtifactHandler().getExtension() );
-
+
return destFileName.toString();
}
-
+
/**
* Formats the outputDirectory based on type.
*
+ * @param useSubdirsPerScope if a new sub directory should be used for each scope.
* @param useSubdirsPerType if a new sub directory should be used for each type.
* @param useSubdirPerArtifact if a new sub directory should be used for each artifact.
* @param useRepositoryLayout if dependencies must be moved into a Maven repository layout, if set, other settings
@@ -236,6 +219,8 @@
*
* @param string the string to write
* @param file the file to write to
+ * @param append append to existing file or not.
+ * @param log where to send the logging output.
* @throws IOException if an I/O error occurs
*/
public static synchronized void write( String string, File file, boolean append, Log log )
@@ -264,6 +249,7 @@
* Writes the specified string to the log at info level.
*
* @param string the string to write
+ * @param log where to log information.
* @throws IOException if an I/O error occurs
*/
public static synchronized void log( String string, Log log )
@@ -297,7 +283,7 @@
String ret = "";
if ( !StringUtils.isEmpty( str ) )
{
- // remove initial and ending spaces, plus all spaces next to commas
+ // remove initial and ending spaces, plus all spaces next to commas
ret = str.trim().replaceAll( "[\\s]*,[\\s]*", "," );
}
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/filters/DestFileFilter.java b/src/main/java/org/apache/maven/plugins/dependency/utils/filters/DestFileFilter.java
index d8812cd..f7a198b 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/filters/DestFileFilter.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/filters/DestFileFilter.java
@@ -87,9 +87,8 @@
/*
* (non-Javadoc)
- *
* @see org.apache.mojo.dependency.utils.filters.ArtifactsFilter#filter(java.util.Set,
- * org.apache.maven.plugin.logging.Log)
+ * org.apache.maven.plugin.logging.Log)
*/
@Override
public Set<Artifact> filter( Set<Artifact> artifacts )
@@ -116,8 +115,7 @@
}
/**
- * @param overWriteReleases
- * The overWriteReleases to set.
+ * @param overWriteReleases The overWriteReleases to set.
*/
public void setOverWriteReleases( boolean overWriteReleases )
{
@@ -133,8 +131,7 @@
}
/**
- * @param overWriteSnapshots
- * The overWriteSnapshots to set.
+ * @param overWriteSnapshots The overWriteSnapshots to set.
*/
public void setOverWriteSnapshots( boolean overWriteSnapshots )
{
@@ -150,8 +147,7 @@
}
/**
- * @param overWriteIfNewer
- * The overWriteIfNewer to set.
+ * @param overWriteIfNewer The overWriteIfNewer to set.
*/
public void setOverWriteIfNewer( boolean overWriteIfNewer )
{
@@ -167,8 +163,7 @@
}
/**
- * @param outputFileDirectory
- * The outputFileDirectory to set.
+ * @param outputFileDirectory The outputFileDirectory to set.
*/
public void setOutputFileDirectory( File outputFileDirectory )
{
@@ -184,8 +179,7 @@
}
/**
- * @param removeVersion
- * The removeVersion to set.
+ * @param removeVersion The removeVersion to set.
*/
public void setRemoveVersion( boolean removeVersion )
{
@@ -201,8 +195,7 @@
}
/**
- * @param removeClassifier
- * The removeClassifier to set.
+ * @param removeClassifier The removeClassifier to set.
*/
public void setRemoveClassifier( boolean removeClassifier )
{
@@ -218,8 +211,7 @@
}
/**
- * @param useSubDirectoryPerArtifact
- * The useSubDirectoryPerArtifact to set.
+ * @param useSubDirectoryPerArtifact The useSubDirectoryPerArtifact to set.
*/
public void setUseSubDirectoryPerArtifact( boolean useSubDirectoryPerArtifact )
{
@@ -235,8 +227,7 @@
}
/**
- * @param useSubDirectoryPerType
- * The useSubDirectoryPerType to set.
+ * @param useSubDirectoryPerType The useSubDirectoryPerType to set.
*/
public void setUseSubDirectoryPerType( boolean useSubDirectoryPerType )
{
@@ -244,7 +235,6 @@
}
/**
- *
* @return Returns the useRepositoryLayout
*/
public boolean isUseRepositoryLayout()
@@ -253,9 +243,7 @@
}
/**
- *
- * @param useRepositoryLayout
- * the useRepositoryLayout to set
+ * @param useRepositoryLayout the useRepositoryLayout to set
*/
public void setUseRepositoryLayout( boolean useRepositoryLayout )
{
@@ -267,8 +255,7 @@
{
Artifact artifact = item.getArtifact();
- boolean overWrite =
- ( artifact.isSnapshot() && this.overWriteSnapshots )
+ boolean overWrite = ( artifact.isSnapshot() && this.overWriteSnapshots )
|| ( !artifact.isSnapshot() && this.overWriteReleases );
File destFolder = item.getOutputDirectory();
@@ -283,9 +270,8 @@
File destFile;
if ( StringUtils.isEmpty( item.getDestFileName() ) )
{
- String formattedFileName =
- DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId,
- useBaseVersion, removeClassifier );
+ String formattedFileName = DependencyUtil.getFormattedFileName( artifact, removeVersion, prependGroupId,
+ useBaseVersion, removeClassifier );
destFile = new File( destFolder, formattedFileName );
}
else
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/filters/MarkerFileFilter.java b/src/main/java/org/apache/maven/plugins/dependency/utils/filters/MarkerFileFilter.java
index 29293b2..9fb3e09 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/filters/MarkerFileFilter.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/filters/MarkerFileFilter.java
@@ -47,7 +47,7 @@
protected final MarkerHandler handler;
public MarkerFileFilter( boolean overWriteReleases, boolean overWriteSnapshots, boolean overWriteIfNewer,
- MarkerHandler handler )
+ MarkerHandler handler )
{
this.overWriteReleases = overWriteReleases;
this.overWriteSnapshots = overWriteSnapshots;
@@ -57,9 +57,8 @@
/*
* (non-Javadoc)
- *
* @see org.apache.mojo.dependency.utils.filters.ArtifactsFilter#filter(java.util.Set,
- * org.apache.maven.plugin.logging.Log)
+ * org.apache.maven.plugin.logging.Log)
*/
@Override
public Set<Artifact> filter( Set<Artifact> artifacts )
@@ -79,7 +78,7 @@
@Override
public boolean isArtifactIncluded( ArtifactItem item )
- throws ArtifactFilterException
+ throws ArtifactFilterException
{
Artifact artifact = item.getArtifact();
@@ -107,8 +106,7 @@
}
/**
- * @param overWriteReleases
- * The overWriteReleases to set.
+ * @param overWriteReleases The overWriteReleases to set.
*/
public void setOverWriteReleases( boolean overWriteReleases )
{
@@ -124,8 +122,7 @@
}
/**
- * @param overWriteSnapshots
- * The overWriteSnapshots to set.
+ * @param overWriteSnapshots The overWriteSnapshots to set.
*/
public void setOverWriteSnapshots( boolean overWriteSnapshots )
{
@@ -141,8 +138,7 @@
}
/**
- * @param overWriteIfNewer
- * The overWriteIfNewer to set.
+ * @param overWriteIfNewer The overWriteIfNewer to set.
*/
public void setOverWriteIfNewer( boolean overWriteIfNewer )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/markers/DefaultFileMarkerHandler.java b/src/main/java/org/apache/maven/plugins/dependency/utils/markers/DefaultFileMarkerHandler.java
index e1f9f83..6c792b8 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/markers/DefaultFileMarkerHandler.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/markers/DefaultFileMarkerHandler.java
@@ -58,16 +58,13 @@
}
/**
- * Tests whether the file or directory denoted by this abstract pathname
- * exists.
+ * Tests whether the file or directory denoted by this abstract pathname exists.
*
- * @return <code>true</code> if and only if the file or directory denoted
- * by this abstract pathname exists; <code>false</code> otherwise
- *
- * @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
- * method denies read access to the file or directory
+ * @return <code>true</code> if and only if the file or directory denoted by this abstract pathname exists;
+ * <code>false</code> otherwise
+ * @throws SecurityException If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code> method denies read access to the file or
+ * directory
*/
@Override
public boolean isMarkerSet()
@@ -132,7 +129,7 @@
if ( !marker.setLastModified( ts ) )
{
throw new MojoExecutionException( "Unable to update last modified timestamp on marker file "
- + marker.getAbsolutePath() );
+ + marker.getAbsolutePath() );
}
}
@@ -143,17 +140,13 @@
}
/**
- * Deletes the file or directory denoted by this abstract pathname. If this
- * pathname denotes a directory, then the directory must be empty in order
- * to be deleted.
+ * Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the
+ * directory must be empty in order to be deleted.
*
- * @return <code>true</code> if and only if the file or directory is
- * successfully deleted; <code>false</code> otherwise
- *
- * @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkDelete}</code>
- * method denies delete access to the file
+ * @return <code>true</code> if and only if the file or directory is successfully deleted; <code>false</code>
+ * otherwise
+ * @throws SecurityException If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkDelete}</code> method denies delete access to the file
*/
@Override
public boolean clearMarker()
@@ -172,8 +165,7 @@
}
/**
- * @param artifact
- * The artifact to set.
+ * @param artifact The artifact to set.
*/
@Override
public void setArtifact( Artifact artifact )
@@ -190,8 +182,7 @@
}
/**
- * @param markerFilesDirectory
- * The markerFilesDirectory to set.
+ * @param markerFilesDirectory The markerFilesDirectory to set.
*/
public void setMarkerFilesDirectory( File markerFilesDirectory )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/markers/SourcesFileMarkerHandler.java b/src/main/java/org/apache/maven/plugins/dependency/utils/markers/SourcesFileMarkerHandler.java
index ec1966b..2c7da39 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/markers/SourcesFileMarkerHandler.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/markers/SourcesFileMarkerHandler.java
@@ -60,8 +60,7 @@
/**
* Get MarkerFile, exposed for unit testing purposes
*
- * @param res
- * resolved or not.
+ * @param res resolved or not.
* @return marker file for this artifact.
*/
protected File getMarkerFile( boolean res )
@@ -80,16 +79,13 @@
}
/**
- * Tests whether the file or directory denoted by this abstract pathname
- * exists.
+ * Tests whether the file or directory denoted by this abstract pathname exists.
*
- * @return <code>true</code> if and only if the file or directory denoted
- * by this abstract pathname exists; <code>false</code> otherwise
- *
- * @throws MojoExecutionException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
- * method denies read access to the file or directory
+ * @return <code>true</code> if and only if the file or directory denoted by this abstract pathname exists;
+ * <code>false</code> otherwise
+ * @throws MojoExecutionException If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}</code> method denies read access to the file or
+ * directory
*/
@Override
public boolean isMarkerSet()
@@ -164,17 +160,13 @@
}
/**
- * Deletes the file or directory denoted by this abstract pathname. If this
- * pathname denotes a directory, then the directory must be empty in order
- * to be deleted.
+ * Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the
+ * directory must be empty in order to be deleted.
*
- * @return <code>true</code> if and only if the file or directory is
- * successfully deleted; <code>false</code> otherwise
- *
- * @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkDelete}</code>
- * method denies delete access to the file
+ * @return <code>true</code> if and only if the file or directory is successfully deleted; <code>false</code>
+ * otherwise
+ * @throws SecurityException If a security manager exists and its <code>{@link
+ * java.lang.SecurityManager#checkDelete}</code> method denies delete access to the file
*/
@Override
public boolean clearMarker()
@@ -196,8 +188,7 @@
}
/**
- * @param isResolved
- * The resolved to set.
+ * @param isResolved The resolved to set.
*/
public void setResolved( boolean isResolved )
{
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/markers/UnpackFileMarkerHandler.java b/src/main/java/org/apache/maven/plugins/dependency/utils/markers/UnpackFileMarkerHandler.java
index ac169df..343f5a3 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/markers/UnpackFileMarkerHandler.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/markers/UnpackFileMarkerHandler.java
@@ -48,10 +48,9 @@
protected File getMarkerFile()
{
/**
- * Build a hash of all include/exclude strings, to determine
- * if an artifactItem has been unpacked using the include/exclude
- * parameters, this will allow an artifact to be included multiple
- * times with different include/exclude parameters
+ * Build a hash of all include/exclude strings, to determine if an artifactItem has been unpacked using the
+ * include/exclude parameters, this will allow an artifact to be included multiple times with different
+ * include/exclude parameters
*/
File markerFile;
if ( this.artifactItem == null || ( StringUtils.isEmpty( this.artifactItem.getIncludes() )
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/translators/ClassifierTypeTranslator.java b/src/main/java/org/apache/maven/plugins/dependency/utils/translators/ClassifierTypeTranslator.java
index 7cc43af..27c6353 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/translators/ClassifierTypeTranslator.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/translators/ClassifierTypeTranslator.java
@@ -38,15 +38,15 @@
implements ArtifactTranslator
{
private ArtifactHandlerManager artifactHandlerManager;
+
private String classifier;
private String type;
/**
- *
- * @param artifactHanderManager TODO
- * @param theClassifier
- * @param theType
+ * @param artifactHanderManager {@link ArtifactHandlerManager}.
+ * @param theClassifier The classifier to use.
+ * @param theType The type.
*/
public ClassifierTypeTranslator( ArtifactHandlerManager artifactHanderManager, String theClassifier,
String theType )
@@ -58,9 +58,8 @@
/*
* (non-Javadoc)
- *
* @see org.apache.mojo.dependency.utils.translators.ArtifactTranslator#translate(java.util.Set,
- * org.apache.maven.plugin.logging.Log)
+ * org.apache.maven.plugin.logging.Log)
*/
@Override
public Set<ArtifactCoordinate> translate( Set<Artifact> artifacts, Log log )
@@ -113,21 +112,21 @@
coordinate.setClassifier( useClassifier );
coordinate.setExtension( extension );
-// // Create a new artifact
-// Artifact newArtifact = factory.createArtifactWithClassifier( artifact.getGroupId(), artifact
-// .getArtifactId(), artifact.getVersion(), useType, useClassifier );
-//
-// // note the new artifacts will always have the scope set to null. We
-// // should
-// // reset it here so that it will pass other filters if needed
-// newArtifact.setScope( artifact.getScope() );
-//
-// if ( Artifact.SCOPE_SYSTEM.equals( newArtifact.getScope() ) )
-// {
-// File baseDir = repositoryManager.getLocalRepositoryBasedir( buildingRequest );
-// String path = repositoryManager.getPathForLocalArtifact( buildingRequest, newArtifact );
-// newArtifact.setFile( new File( baseDir, path ) );
-// }
+ // // Create a new artifact
+ // Artifact newArtifact = factory.createArtifactWithClassifier( artifact.getGroupId(), artifact
+ // .getArtifactId(), artifact.getVersion(), useType, useClassifier );
+ //
+ // // note the new artifacts will always have the scope set to null. We
+ // // should
+ // // reset it here so that it will pass other filters if needed
+ // newArtifact.setScope( artifact.getScope() );
+ //
+ // if ( Artifact.SCOPE_SYSTEM.equals( newArtifact.getScope() ) )
+ // {
+ // File baseDir = repositoryManager.getLocalRepositoryBasedir( buildingRequest );
+ // String path = repositoryManager.getPathForLocalArtifact( buildingRequest, newArtifact );
+ // newArtifact.setFile( new File( baseDir, path ) );
+ // }
results.add( coordinate );
}
@@ -144,8 +143,7 @@
}
/**
- * @param theType
- * The type to set.
+ * @param theType The type to set.
*/
public void setType( String theType )
{
@@ -161,8 +159,7 @@
}
/**
- * @param theClassifier
- * The classifier to set.
+ * @param theClassifier The classifier to set.
*/
public void setClassifier( String theClassifier )
{
diff --git a/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java b/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
index f1a5650..071bcb5 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/AbstractDependencyMojoTestCase.java
@@ -39,7 +39,7 @@
{
super();
}
-
+
protected void setUp( String testDirStr, boolean createFiles )
throws Exception
{
@@ -51,9 +51,8 @@
{
// required for mojo lookups to work
super.setUp();
- testDir =
- new File( getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar + testDirStr
- + File.separatorChar );
+ testDir = new File( getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar + testDirStr
+ + File.separatorChar );
DependencyTestUtils.removeDirectory( testDir );
assertFalse( testDir.exists() );
@@ -75,10 +74,10 @@
fail( "Trying to remove directory:" + testDir + "\r\n" + e.toString() );
}
assertFalse( testDir.exists() );
-
+
testDir = null;
}
-
+
stubFactory = null;
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
index bfc94bd..cb2715c 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestCollectMojo.java
@@ -54,7 +54,7 @@
assertNotNull( mojo.getProject() );
MavenProject project = mojo.getProject();
- mojo.setSilent(true);
+ mojo.setSilent( true );
Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
artifacts.addAll( directArtifacts );
@@ -64,8 +64,8 @@
mojo.execute();
DependencyStatusSets results = mojo.getResults();
- assertNotNull(results);
- assertEquals(artifacts.size(), results.getResolvedDependencies().size());
+ assertNotNull( results );
+ assertEquals( artifacts.size(), results.getResolvedDependencies().size() );
}
/**
@@ -83,13 +83,13 @@
assertNotNull( mojo.getProject() );
MavenProject project = mojo.getProject();
- mojo.setSilent(true);
+ mojo.setSilent( true );
Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
artifacts.addAll( directArtifacts );
- project.setArtifacts(artifacts);
- project.setDependencyArtifacts(directArtifacts);
+ project.setArtifacts( artifacts );
+ project.setDependencyArtifacts( directArtifacts );
setVariableValueToObject( mojo, "excludeTransitive", Boolean.TRUE );
@@ -104,7 +104,7 @@
{
File testPom = new File( getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml" );
CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo( "collect", testPom );
- mojo.setSilent(false);
+ mojo.setSilent( false );
assertFalse( mojo.getLog() instanceof SilentLog );
} // TODO: Test skipping artifacts.
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java
index 42e5fcb..bd56c6d 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestGetMojo.java
@@ -44,29 +44,30 @@
File testPom = new File( getBasedir(), "target/test-classes/unit/get-test/plugin-config.xml" );
assert testPom.exists();
mojo = (GetMojo) lookupMojo( "get", testPom );
-
+
assertNotNull( mojo );
-
+
LegacySupport legacySupport = lookup( LegacySupport.class );
legacySupport.setSession( newMavenSession( new MavenProjectStub() ) );
DefaultRepositorySystemSession repoSession =
(DefaultRepositorySystemSession) legacySupport.getRepositorySession();
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( testDir.getAbsolutePath() ) );
-
+
setVariableValueToObject( mojo, "session", legacySupport.getSession() );
}
/**
* Test transitive parameter
*
- * @throws Exception
+ * @throws Exception in case of errors
*/
public void testTransitive()
throws Exception
{
// Set properties, transitive = default value = true
setVariableValueToObject( mojo, "transitive", Boolean.FALSE );
- setVariableValueToObject( mojo, "remoteRepositories", "central::default::http://repo1.maven.apache.org/maven2" );
+ setVariableValueToObject( mojo, "remoteRepositories",
+ "central::default::http://repo1.maven.apache.org/maven2" );
mojo.setGroupId( "org.apache.maven" );
mojo.setArtifactId( "maven-model" );
mojo.setVersion( "2.0.9" );
@@ -77,11 +78,11 @@
setVariableValueToObject( mojo, "transitive", Boolean.FALSE );
mojo.execute();
}
-
+
/**
* Test remote repositories parameter
*
- * @throws Exception
+ * @throws Exception in case of errors
*/
public void testRemoteRepositories()
throws Exception
@@ -98,7 +99,7 @@
/**
* Test parsing of the remote repositories parameter
*
- * @throws Exception
+ * @throws Exception in case of errors
*/
public void testParseRepository()
throws Exception
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestPropertiesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/TestPropertiesMojo.java
index 561a98c..cd9f37a 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestPropertiesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestPropertiesMojo.java
@@ -38,7 +38,7 @@
/**
* tests the proper discovery and configuration of the mojo
*
- * @throws Exception
+ * @throws Exception in case of errors
*/
public void testSetProperties()
throws Exception
diff --git a/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java b/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
index 73cbf65..a627185 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/TestSkip.java
@@ -158,15 +158,14 @@
private void doConfigTest( String mojoName, String configFile )
throws Exception
{
- File testPom =
- new File( getBasedir(), "target/test-classes/unit/skip-test/" + configFile );
+ File testPom = new File( getBasedir(), "target/test-classes/unit/skip-test/" + configFile );
Mojo mojo = lookupMojo( mojoName, testPom );
assertNotNull( mojo );
CapturingLog log = new CapturingLog();
mojo.setLog( log );
mojo.execute();
- assertTrue(log.getContent().contains("Skipping plugin execution"));
+ assertTrue( log.getContent().contains( "Skipping plugin execution" ) );
}
class CapturingLog
@@ -293,7 +292,7 @@
private void print( String prefix, CharSequence content )
{
- sb.append("[").append(prefix).append("] ").append(content.toString()).append( "\n" );
+ sb.append( "[" ).append( prefix ).append( "] " ).append( content.toString() ).append( "\n" );
}
private void print( String prefix, Throwable error )
@@ -303,7 +302,7 @@
error.printStackTrace( pWriter );
- sb.append("[").append(prefix).append("] ").append(sWriter.toString()).append( "\n" );
+ sb.append( "[" ).append( prefix ).append( "] " ).append( sWriter.toString() ).append( "\n" );
}
private void print( String prefix, CharSequence content, Throwable error )
@@ -313,8 +312,7 @@
error.printStackTrace( pWriter );
- sb.append("[").append(prefix).append("] ").append(content.toString()).append( "\n\n" )
- .append( sWriter.toString() ).append( "\n" );
+ sb.append( "[" ).append( prefix ).append( "] " ).append( content.toString() ).append( "\n\n" ).append( sWriter.toString() ).append( "\n" );
}
protected String getContent()
diff --git a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java
index 77eae9d..21c6e69 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDepMgt.java
@@ -53,7 +53,9 @@
Artifact exclusionArtifact;
DependencyManagement depMgt;
+
DependencyManagement depMgtNoExclusions;
+
protected void setUp()
throws Exception
{
@@ -66,7 +68,6 @@
Set<Artifact> allArtifacts = stubFactory.getMixedArtifacts();
Set<Artifact> directArtifacts = stubFactory.getClassifiedArtifacts();
-
exclusionArtifact = stubFactory.getReleaseArtifact();
directArtifacts.add( exclusionArtifact );
ex = new Exclusion();
@@ -87,7 +88,6 @@
depMgt = new DependencyManagement();
depMgt.setDependencies( list );
-
project.setArtifacts( allArtifacts );
project.setDependencyArtifacts( directArtifacts );
@@ -107,8 +107,8 @@
// version isn't used in the key, it can be different
dep.setVersion( "1.1" );
- Artifact artifact = stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type",
- "class" );
+ Artifact artifact =
+ stubFactory.createArtifact( "group", "artifact", "1.0", Artifact.SCOPE_COMPILE, "type", "class" );
// basic case ok
assertEquals( dep.getManagementKey(), mojo.getArtifactManagementKey( artifact ) );
@@ -156,7 +156,7 @@
list.add( ex );
Map<String, Exclusion> map = mojo.addExclusions( list );
- assertEquals( 1,map.size() );
+ assertEquals( 1, map.size() );
assertTrue( map.containsKey( mojo.getExclusionKey( ex ) ) );
assertSame( ex, map.get( mojo.getExclusionKey( ex ) ) );
}
@@ -173,7 +173,7 @@
assertEquals( 1, l.size() );
- assertEquals( mojo.getExclusionKey( ex ), mojo.getExclusionKey(l.get( 0 )) );
+ assertEquals( mojo.getExclusionKey( ex ), mojo.getExclusionKey( l.get( 0 ) ) );
}
public void testGetMismatch()
@@ -191,7 +191,8 @@
assertSame( exclusion, results.get( stubFactory.getReleaseArtifact() ) );
}
- public void testMojo() throws IOException
+ public void testMojo()
+ throws IOException
{
mojo.setIgnoreDirect( false );
try
diff --git a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
index 400b080..dbcc0a9 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
@@ -37,8 +37,7 @@
public void testDuplicate()
throws Exception
{
- File testPom =
- new File( getBasedir(), "target/test-classes/unit/duplicate-dependencies/plugin-config.xml" );
+ File testPom = new File( getBasedir(), "target/test-classes/unit/duplicate-dependencies/plugin-config.xml" );
AnalyzeDuplicateMojo mojo = (AnalyzeDuplicateMojo) lookupMojo( "analyze-duplicate", testPom );
assertNotNull( mojo );
DuplicateLog log = new DuplicateLog();
@@ -53,8 +52,7 @@
public void testDuplicate2()
throws Exception
{
- File testPom =
- new File( getBasedir(), "target/test-classes/unit/duplicate-dependencies/plugin-config2.xml" );
+ File testPom = new File( getBasedir(), "target/test-classes/unit/duplicate-dependencies/plugin-config2.xml" );
AnalyzeDuplicateMojo mojo = (AnalyzeDuplicateMojo) lookupMojo( "analyze-duplicate", testPom );
assertNotNull( mojo );
DuplicateLog log = new DuplicateLog();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
index 5a1a0e4..7cc11e2 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
@@ -60,12 +60,12 @@
assertNotNull( mojo.getProject() );
// MavenProject project = mojo.getProject();
// init classifier things
-
+
MavenSession session = newMavenSession( mojo.getProject() );
setVariableValueToObject( mojo, "session", session );
-
+
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
-
+
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
}
@@ -172,7 +172,7 @@
assertFilesExist( list, true );
}
-
+
public void testCopyFileWithBaseVersion()
throws Exception
{
@@ -182,16 +182,16 @@
item.setArtifactId( "artifact" );
item.setGroupId( "groupId" );
item.setVersion( "1.0-20130210.213424-191" );
- list.add(item);
+ list.add( item );
mojo.setArtifactItems( createArtifactItemArtifacts( list ) );
- mojo.setUseBaseVersion(true);
+ mojo.setUseBaseVersion( true );
mojo.execute();
assertFilesExist( list, true );
}
-
+
public void testSkip()
throws Exception
{
@@ -203,7 +203,7 @@
mojo.execute();
for ( ArtifactItem item : list )
{
- //these will be null because no processing has occured only when everything is skipped
+ // these will be null because no processing has occured only when everything is skipped
assertEquals( null, item.getOutputDirectory() );
assertEquals( null, item.getDestFileName() );
}
@@ -245,7 +245,7 @@
throws Exception
{
List<ArtifactItem> list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
-
+
ArtifactItem item = list.get( 0 );
item.setOutputDirectory( new File( mojo.getOutputDirectory(), "testOverride" ) );
mojo.setStripVersion( true );
@@ -382,11 +382,11 @@
MavenProject project = mojo.getProject();
project.setDependencies( createDependencyArtifacts( getDependencyList( item ) ) );
-
+
// ensure dependency exists
item.setClassifier( "sources" );
item.setType( "jar" );
-
+
// pre-create item
item.setVersion( "2.1" );
createArtifact( item );
@@ -751,31 +751,31 @@
assertTrue( time < copiedFile.lastModified() );
}
-
+
public void testCopyFileWithOverideLocalRepo()
throws Exception
{
final File localRepo = stubFactory.getWorkingDir();
-
+
List<ArtifactItem> list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
mojo.setArtifactItems( list );
-
- File execLocalRepo = new File( this.testDir.getAbsolutePath(), "executionLocalRepo" );
+
+ File execLocalRepo = new File( this.testDir.getAbsolutePath(), "executionLocalRepo" );
assertFalse( execLocalRepo.exists() );
-
+
stubFactory.setWorkingDir( execLocalRepo );
createArtifactItemArtifacts( list );
-
+
assertFalse( "default local repo should not exist", localRepo.exists() );
-
+
mojo.setLocalRepositoryDirectory( execLocalRepo );
-
+
mojo.execute();
assertFilesExist( list, true );
-
- }
+
+ }
private List<Dependency> createDependencyArtifacts( List<Dependency> items )
throws IOException
@@ -785,12 +785,12 @@
{
String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(),
- VersionRange.createFromVersion( item.getVersion() ), null,
- item.getType(), classifier, item.isOptional() );
+ VersionRange.createFromVersion( item.getVersion() ), null, item.getType(),
+ classifier, item.isOptional() );
}
return items;
}
-
+
private List<ArtifactItem> createArtifactItemArtifacts( List<ArtifactItem> items )
throws IOException
{
@@ -805,12 +805,11 @@
throws IOException
{
stubFactory.setCreateFiles( true );
-
- String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
+
+ String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
String version = item.getVersion() != null ? item.getVersion() : item.getBaseVersion();
- stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(),
- version, null,
- item.getType(), classifier );
+ stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(), version, null, item.getType(),
+ classifier );
return item;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java
index 1f27f27..227b43b 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestIncludeExcludeUnpackMojo.java
@@ -58,7 +58,7 @@
// mojo.silent = true;
// it needs to get the archivermanager
- //stubFactory.setUnpackableFile( mojo.getArchiverManager() );
+ // stubFactory.setUnpackableFile( mojo.getArchiverManager() );
// i'm using one file repeatedly to archive so I can test the name
// programmatically.
stubFactory.setSrcFile( new File( getBasedir() + File.separatorChar + PACKED_FILE_PATH ) );
@@ -73,12 +73,12 @@
mojo.setMarkersDirectory( new File( this.testDir, "markers" ) );
mojo.setArtifactItems( list );
-
+
MavenSession session = newMavenSession( mojo.getProject() );
setVariableValueToObject( mojo, "session", session );
-
+
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
-
+
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
}
@@ -120,7 +120,7 @@
/**
* This test will validate that only the 1 and 11 files get unpacked
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testUnpackIncludesManyFiles()
throws Exception
@@ -136,7 +136,7 @@
/**
* This test will verify only the 2 file gets unpacked
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testUnpackIncludesSingleFile()
throws Exception
@@ -152,7 +152,7 @@
/**
* This test will verify all files get unpacked
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testUnpackIncludesAllFiles()
throws Exception
@@ -168,7 +168,7 @@
/**
* This test will validate that only the 2 and 3 files get unpacked
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testUnpackExcludesManyFiles()
throws Exception
@@ -182,9 +182,9 @@
}
/**
- * This test will verify only the 1, 11 & 3 files get unpacked
+ * This test will verify only the 1, 11 & 3 files get unpacked
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testUnpackExcludesSingleFile()
throws Exception
@@ -200,7 +200,7 @@
/**
* This test will verify no files get unpacked
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testUnpackExcludesAllFiles()
throws Exception
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
index 0058fcc..5a27484 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestUnpackMojo.java
@@ -73,10 +73,10 @@
+ "target/test-classes/unit/unpack-dependencies-test/test.txt" ) );
mojo.setUseJvmChmod( true );
-
+
MavenSession session = newMavenSession( mojo.getProject() );
setVariableValueToObject( mojo, "session", session );
-
+
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
@@ -145,7 +145,7 @@
assertMarkerFiles( list, true );
}
-
+
public void testSkip()
throws Exception
{
@@ -186,17 +186,18 @@
// pretend that the output directory cannot be found event after mkdirs has been called by the mojo
// ifor instance in the case when the outputDirectory cannot be created because of permissions on the
// parent of the output directory
- mojo.setOutputDirectory( new File( currentFile.getAbsolutePath() ) {
+ mojo.setOutputDirectory( new File( currentFile.getAbsolutePath() )
+ {
private static final long serialVersionUID = -8559876942040177020L;
@Override
public boolean exists()
{
- //this file will always report that it does not exist
+ // this file will always report that it does not exist
return false;
}
- });
+ } );
try
{
mojo.execute();
@@ -364,7 +365,7 @@
item.setClassifier( "classifier" );
item.setGroupId( "groupId" );
item.setType( "jar" );
-
+
MavenProject project = mojo.getProject();
project.setDependencies( createArtifacts( getDependencyList( item ) ) );
@@ -375,8 +376,10 @@
item.setGroupId( "groupId" );
item.setType( "jar" );
- stubFactory.createArtifact( "groupId", "artifactId-2", VersionRange.createFromVersion( "3.0-SNAPSHOT" ), null, "jar", "classifier", false );
- stubFactory.createArtifact( "groupId", "artifactId-2", VersionRange.createFromVersion( "3.1" ), null, "jar", "classifier", false );
+ stubFactory.createArtifact( "groupId", "artifactId-2", VersionRange.createFromVersion( "3.0-SNAPSHOT" ), null,
+ "jar", "classifier", false );
+ stubFactory.createArtifact( "groupId", "artifactId-2", VersionRange.createFromVersion( "3.1" ), null, "jar",
+ "classifier", false );
List<ArtifactItem> list = new ArrayList<ArtifactItem>();
list.add( item );
@@ -470,7 +473,7 @@
Artifact artifact = stubFactory.getSnapshotArtifact();
assertTrue( artifact.getFile().setLastModified( System.currentTimeMillis() - 2000 ) );
- ArtifactItem item = new ArtifactItem( createArtifact( artifact ) );
+ ArtifactItem item = new ArtifactItem( createArtifact( artifact ) );
List<ArtifactItem> list = new ArrayList<ArtifactItem>( 1 );
list.add( item );
@@ -528,7 +531,7 @@
throws Exception
{
final long now = System.currentTimeMillis();
-
+
mojo.setSilent( false );
stubFactory.setCreateFiles( true );
Artifact artifact = stubFactory.getSnapshotArtifact();
@@ -566,8 +569,8 @@
displayFile( "marker ", marker );
System.out.println( "marker.lastModified() = " + marker.lastModified() );
System.out.println( "unpackedFile.lastModified() = " + unpackedFile.lastModified() );
- assertTrue( "unpackedFile '" + unpackedFile + "' lastModified() == " + marker.lastModified() + ": should be different",
- marker.lastModified() != unpackedFile.lastModified() );
+ assertTrue( "unpackedFile '" + unpackedFile + "' lastModified() == " + marker.lastModified()
+ + ": should be different", marker.lastModified() != unpackedFile.lastModified() );
}
private void displayFile( String description, File file )
@@ -575,7 +578,7 @@
System.out.println( description + ' ' + DateFormatUtils.ISO_DATETIME_FORMAT.format( file.lastModified() ) + ' '
+ file.getPath().substring( getBasedir().length() ) );
}
-
+
public void assertUnpacked( ArtifactItem item, boolean overWrite )
throws Exception
{
@@ -603,42 +606,44 @@
public File getUnpackedFile( ArtifactItem item )
{
- File unpackedFile =
- new File( item.getOutputDirectory(),
- DependencyArtifactStubFactory.getUnpackableFileName( item.getArtifact() ) );
+ File unpackedFile = new File( item.getOutputDirectory(),
+ DependencyArtifactStubFactory.getUnpackableFileName( item.getArtifact() ) );
assertTrue( unpackedFile.exists() );
return unpackedFile;
}
-
+
// respects the createUnpackableFile flag of the ArtifactStubFactory
- private List<Dependency> createArtifacts( List<Dependency> items ) throws IOException {
+ private List<Dependency> createArtifacts( List<Dependency> items )
+ throws IOException
+ {
for ( Dependency item : items )
{
- String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
+ String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(),
- VersionRange.createFromVersion( item.getVersion() ), null,
- item.getType(), classifier, item.isOptional() );
+ VersionRange.createFromVersion( item.getVersion() ), null, item.getType(),
+ classifier, item.isOptional() );
}
return items;
}
-
- private Artifact createArtifact( Artifact art ) throws IOException
+
+ private Artifact createArtifact( Artifact art )
+ throws IOException
{
- String classifier = "".equals( art.getClassifier() ) ? null : art.getClassifier();
+ String classifier = "".equals( art.getClassifier() ) ? null : art.getClassifier();
stubFactory.createArtifact( art.getGroupId(), art.getArtifactId(),
- VersionRange.createFromVersion( art.getVersion() ), null,
- art.getType(), classifier, art.isOptional() );
+ VersionRange.createFromVersion( art.getVersion() ), null, art.getType(), classifier,
+ art.isOptional() );
return art;
}
-
- private ArtifactItem createArtifact( ArtifactItem item ) throws IOException
+
+ private ArtifactItem createArtifact( ArtifactItem item )
+ throws IOException
{
- String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
- stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(),
- item.getVersion(), null,
- item.getType(), classifier );
+ String classifier = "".equals( item.getClassifier() ) ? null : item.getClassifier();
+ stubFactory.createArtifact( item.getGroupId(), item.getArtifactId(), item.getVersion(), null, item.getType(),
+ classifier );
return item;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java
index bdb5fd5..25a9fcd 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestBuildClasspathMojo.java
@@ -44,7 +44,7 @@
/**
* tests the proper discovery and configuration of the mojo
*
- * @throws Exception
+ * @throws Exception in case of an error.
*/
public void testEnvironment()
throws Exception
@@ -84,8 +84,8 @@
assertNotNull( file );
assertTrue( file.length() > 0 );
- assertTrue(file.contains(File.pathSeparator));
- assertTrue(file.contains(File.separator));
+ assertTrue( file.contains( File.pathSeparator ) );
+ assertTrue( file.contains( File.separator ) );
String fileSep = "#####";
String pathSep = "%%%%%";
@@ -98,10 +98,10 @@
assertNotNull( file );
assertTrue( file.length() > 0 );
- assertFalse(file.contains(File.pathSeparator));
- assertFalse(file.contains(File.separator));
- assertTrue(file.contains(fileSep));
- assertTrue(file.contains(pathSep));
+ assertFalse( file.contains( File.pathSeparator ) );
+ assertFalse( file.contains( File.separator ) );
+ assertTrue( file.contains( fileSep ) );
+ assertTrue( file.contains( pathSep ) );
String propertyValue = project.getProperties().getProperty( "outputProperty" );
assertNull( propertyValue );
@@ -112,7 +112,8 @@
}
- public void testPath() throws Exception
+ public void testPath()
+ throws Exception
{
File testPom = new File( getBasedir(), "target/test-classes/unit/build-classpath-test/plugin-config.xml" );
BuildClasspathMojo mojo = (BuildClasspathMojo) lookupMojo( "build-classpath", testPom );
@@ -148,29 +149,31 @@
sb.setLength( 0 );
mojo.setPrependGroupId( true );
mojo.appendArtifactPath( artifact, sb );
- assertEquals("If prefix is null, prependGroupId has no impact ", "%M2_REPO%"+File.separator
- + DependencyUtil.getFormattedFileName( artifact, false, false ), sb.toString());
-
+ assertEquals( "If prefix is null, prependGroupId has no impact ",
+ "%M2_REPO%" + File.separator + DependencyUtil.getFormattedFileName( artifact, false, false ),
+ sb.toString() );
+
mojo.setLocalRepoProperty( "" );
mojo.setPrefix( "prefix" );
sb.setLength( 0 );
mojo.setPrependGroupId( true );
mojo.appendArtifactPath( artifact, sb );
- assertEquals("prefix"+File.separator+DependencyUtil.getFormattedFileName( artifact, false, true ),
- sb.toString());
+ assertEquals( "prefix" + File.separator + DependencyUtil.getFormattedFileName( artifact, false, true ),
+ sb.toString() );
mojo.setPrependGroupId( false );
-
+
mojo.setLocalRepoProperty( "" );
mojo.setPrefix( "prefix" );
sb.setLength( 0 );
mojo.appendArtifactPath( artifact, sb );
- assertEquals("prefix"+File.separator+artifact.getFile().getName(),sb.toString());
-
+ assertEquals( "prefix" + File.separator + artifact.getFile().getName(), sb.toString() );
+
mojo.setPrefix( "prefix" );
mojo.setStripVersion( true );
sb.setLength( 0 );
mojo.appendArtifactPath( artifact, sb );
- assertEquals( "prefix" + File.separator + DependencyUtil.getFormattedFileName( artifact, true ), sb.toString() );
-
+ assertEquals( "prefix" + File.separator + DependencyUtil.getFormattedFileName( artifact, true ),
+ sb.toString() );
+
}
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
index e7b901e..61fbdeb 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java
@@ -63,9 +63,9 @@
setVariableValueToObject( mojo, "session", session );
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
-
+
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
-
+
Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
artifacts.addAll( directArtifacts );
@@ -108,7 +108,7 @@
/**
* tests the proper discovery and configuration of the mojo
*
- * @throws Exception
+ * @throws Exception in case of an error.
*/
public void testMojo()
throws Exception
@@ -140,22 +140,21 @@
assertTrue( file.exists() );
}
}
-
+
public void testStripClassifier()
- throws Exception
+ throws Exception
+ {
+ mojo.stripClassifier = true;
+ mojo.execute();
+
+ Set<Artifact> artifacts = mojo.getProject().getArtifacts();
+ for ( Artifact artifact : artifacts )
{
- mojo.stripClassifier = true;
- mojo.execute();
-
- Set<Artifact> artifacts = mojo.getProject().getArtifacts();
- for ( Artifact artifact : artifacts )
- {
- String fileName = DependencyUtil.getFormattedFileName( artifact, false, false, false, true );
- File file = new File( mojo.outputDirectory, fileName );
- assertTrue( file.exists() );
- }
+ String fileName = DependencyUtil.getFormattedFileName( artifact, false, false, false, true );
+ File file = new File( mojo.outputDirectory, fileName );
+ assertTrue( file.exists() );
}
-
+ }
public void testUseBaseVersion()
throws Exception
@@ -212,7 +211,7 @@
mojo.includeTypes = "jar";
mojo.excludeTypes = "jar";
- //shouldn't get anything.
+ // shouldn't get anything.
mojo.execute();
@@ -236,7 +235,6 @@
}
}
-
public void testExcludeArtifactId()
throws Exception
{
@@ -262,7 +260,7 @@
mojo.includeArtifactIds = "one";
mojo.excludeArtifactIds = "one";
- //shouldn't get anything
+ // shouldn't get anything
mojo.execute();
@@ -293,7 +291,7 @@
mojo.getProject().setDependencyArtifacts( new HashSet<Artifact>() );
mojo.includeGroupIds = "one";
mojo.excludeGroupIds = "one";
- //shouldn't get anything
+ // shouldn't get anything
mojo.execute();
@@ -335,6 +333,7 @@
assertEquals( artifact.getGroupId().equals( "one" ), !file.exists() );
}
}
+
public void testExcludeMultipleGroupIds()
throws Exception
{
@@ -349,7 +348,8 @@
String fileName = DependencyUtil.getFormattedFileName( artifact, false );
File file = new File( mojo.outputDirectory, fileName );
- assertEquals( artifact.getGroupId().equals( "one" ) || artifact.getGroupId().equals( "two" ), !file.exists() );
+ assertEquals( artifact.getGroupId().equals( "one" ) || artifact.getGroupId().equals( "two" ),
+ !file.exists() );
}
}
@@ -378,7 +378,7 @@
mojo.includeClassifiers = "one";
mojo.excludeClassifiers = "one";
- //shouldn't get anything
+ // shouldn't get anything
mojo.execute();
@@ -415,8 +415,8 @@
for ( Artifact artifact : artifacts )
{
String fileName = DependencyUtil.getFormattedFileName( artifact, false );
- File folder = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, false, mojo.outputDirectory,
- artifact );
+ File folder = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, false,
+ mojo.outputDirectory, artifact );
File file = new File( folder, fileName );
assertTrue( file.exists() );
}
@@ -445,13 +445,14 @@
{
mojo.classifier = testClassifier;
mojo.type = testType;
-
- for( Artifact artifact : mojo.getProject().getArtifacts() )
+
+ for ( Artifact artifact : mojo.getProject().getArtifacts() )
{
String type = testType != null ? testType : artifact.getType();
-
- stubFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope(), type, testClassifier );
-
+
+ stubFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+ artifact.getScope(), type, testClassifier );
+
}
mojo.execute();
@@ -514,11 +515,9 @@
}
/*
- * public void testOverwrite() { stubFactory.setCreateFiles( false );
- * Artifact artifact = stubFactory.createArtifact( "test", "artifact", "1.0" );
- *
- * File testFile = new File( getBasedir() + File.separatorChar +
- * "target/test-classes/unit/copy-dependencies-test/test.zip" ); }
+ * public void testOverwrite() { stubFactory.setCreateFiles( false ); Artifact artifact =
+ * stubFactory.createArtifact( "test", "artifact", "1.0" ); File testFile = new File( getBasedir() +
+ * File.separatorChar + "target/test-classes/unit/copy-dependencies-test/test.zip" ); }
*/
public void testDontOverWriteRelease()
@@ -658,8 +657,8 @@
public void testGetDependencies()
throws MojoExecutionException
{
- assertEquals( mojo.getResolvedDependencies( true ).toString(), mojo.getDependencySets( true )
- .getResolvedDependencies().toString() );
+ assertEquals( mojo.getResolvedDependencies( true ).toString(),
+ mojo.getDependencySets( true ).getResolvedDependencies().toString() );
}
public void testExcludeProvidedScope()
@@ -770,7 +769,8 @@
Set<Artifact> set = new HashSet<Artifact>();
set.add( stubFactory.createArtifact( "org.apache.maven", "maven-artifact", "2.0.7", Artifact.SCOPE_COMPILE ) );
- stubFactory.createArtifact( "org.apache.maven", "maven-artifact", "2.0.7", Artifact.SCOPE_COMPILE, "pom", null );
+ stubFactory.createArtifact( "org.apache.maven", "maven-artifact", "2.0.7", Artifact.SCOPE_COMPILE, "pom",
+ null );
mojo.getProject().setArtifacts( set );
mojo.execute();
@@ -782,13 +782,13 @@
assertTrue( file + " doesn't exist", file.exists() );
}
}
-
- public void testPrependGroupId()
+
+ public void testPrependGroupId()
throws Exception
{
mojo.prependGroupId = true;
mojo.execute();
-
+
Set<Artifact> artifacts = mojo.getProject().getArtifacts();
for ( Artifact artifact : artifacts )
{
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
index f683b80..e4870bc 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
@@ -80,7 +80,7 @@
LegacySupport legacySupport = lookup( LegacySupport.class );
MavenSession session = newMavenSession( project );
setVariableValueToObject( mojo, "session", session );
-
+
legacySupport.setSession( session );
DefaultRepositorySystemSession repoSession =
(DefaultRepositorySystemSession) legacySupport.getRepositorySession();
@@ -213,8 +213,8 @@
for ( Artifact artifact : artifacts )
{
String fileName = DependencyUtil.getFormattedFileName( artifact, false );
- File folder = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, false, mojo.outputDirectory,
- artifact );
+ File folder = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, false,
+ mojo.outputDirectory, artifact );
File file = new File( folder, fileName );
assertTrue( file.exists() );
}
@@ -234,8 +234,8 @@
for ( Artifact artifact : artifacts )
{
String fileName = DependencyUtil.getFormattedFileName( artifact, false );
- File folder = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, false, mojo.outputDirectory,
- artifact );
+ File folder = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, false,
+ mojo.outputDirectory, artifact );
File file = new File( folder, fileName );
assertTrue( file.exists() );
}
@@ -255,8 +255,8 @@
for ( Artifact artifact : artifacts )
{
String fileName = DependencyUtil.getFormattedFileName( artifact, false );
- File folder = DependencyUtil.getFormattedOutputDirectory( true, false, true, false, false, mojo.outputDirectory,
- artifact );
+ File folder = DependencyUtil.getFormattedOutputDirectory( true, false, true, false, false,
+ mojo.outputDirectory, artifact );
File file = new File( folder, fileName );
assertTrue( file.exists() );
}
@@ -265,92 +265,81 @@
public void testRepositoryLayout()
throws Exception
{
- String baseVersion = "2.0-SNAPSHOT";
- String groupId = "testGroupId";
- String artifactId = "expanded-snapshot";
+ String baseVersion = "2.0-SNAPSHOT";
+ String groupId = "testGroupId";
+ String artifactId = "expanded-snapshot";
- Artifact expandedSnapshot = createExpandedVersionArtifact( baseVersion,
- groupId,
- artifactId,
- "compile",
- "jar",
- null);
+ Artifact expandedSnapshot =
+ createExpandedVersionArtifact( baseVersion, groupId, artifactId, "compile", "jar", null );
mojo.getProject().getArtifacts().add( expandedSnapshot );
mojo.getProject().getDependencyArtifacts().add( expandedSnapshot );
- Artifact pomExpandedSnapshot = createExpandedVersionArtifact( baseVersion,
- groupId,
- artifactId,
- "compile",
- "pom",
- null);
+ Artifact pomExpandedSnapshot =
+ createExpandedVersionArtifact( baseVersion, groupId, artifactId, "compile", "pom", null );
mojo.getProject().getArtifacts().add( pomExpandedSnapshot );
mojo.getProject().getDependencyArtifacts().add( pomExpandedSnapshot );
mojo.useRepositoryLayout = true;
mojo.execute();
-
+
ArtifactFactory artifactFactory = lookup( ArtifactFactory.class );
-
+
File outputDirectory = mojo.outputDirectory;
- ArtifactRepository targetRepository = new MavenArtifactRepository(
- "local",
- outputDirectory.toURL().toExternalForm(),
- new DefaultRepositoryLayout(),
- new ArtifactRepositoryPolicy(),
- new ArtifactRepositoryPolicy() );
+ ArtifactRepository targetRepository =
+ new MavenArtifactRepository( "local", outputDirectory.toURL().toExternalForm(),
+ new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(),
+ new ArtifactRepositoryPolicy() );
Set<Artifact> artifacts = mojo.getProject().getArtifacts();
for ( Artifact artifact : artifacts )
{
- assertArtifactExists( artifact, targetRepository );
-
- if ( ! artifact.getBaseVersion().equals( artifact.getVersion() ) )
+ assertArtifactExists( artifact, targetRepository );
+
+ if ( !artifact.getBaseVersion().equals( artifact.getVersion() ) )
{
- Artifact baseArtifact =
- artifactFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getBaseVersion(), artifact.getScope(),
- artifact.getType() );
- assertArtifactExists( baseArtifact, targetRepository );
+ Artifact baseArtifact = artifactFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getBaseVersion(), artifact.getScope(),
+ artifact.getType() );
+ assertArtifactExists( baseArtifact, targetRepository );
}
}
}
- private Artifact createExpandedVersionArtifact( String baseVersion,
- String groupId,
- String artifactId,
- String scope,
- String type,
- String classifier )
- throws IOException
- {
- Artifact expandedSnapshot = this.stubFactory.createArtifact( groupId, artifactId, VersionRange.createFromVersion( baseVersion ), scope, type, classifier, false );
+ private Artifact createExpandedVersionArtifact( String baseVersion, String groupId, String artifactId, String scope,
+ String type, String classifier )
+ throws IOException
+ {
+ Artifact expandedSnapshot =
+ this.stubFactory.createArtifact( groupId, artifactId, VersionRange.createFromVersion( baseVersion ), scope,
+ type, classifier, false );
Snapshot snapshot = new Snapshot();
snapshot.setTimestamp( "20130710.122148" );
snapshot.setBuildNumber( 1 );
RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( expandedSnapshot, snapshot );
String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber();
- expandedSnapshot.setResolvedVersion( StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion ) );
+ expandedSnapshot.setResolvedVersion( StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION,
+ newVersion ) );
expandedSnapshot.addMetadata( metadata );
- return expandedSnapshot;
- }
+ return expandedSnapshot;
+ }
- private void assertArtifactExists( Artifact artifact, ArtifactRepository targetRepository ) {
- File file = new File( targetRepository.getBasedir(),
- targetRepository.getLayout().pathOf( artifact ) );
- assertTrue( "File doesn't exist: " + file.getAbsolutePath(), file.exists() );
+ private void assertArtifactExists( Artifact artifact, ArtifactRepository targetRepository )
+ {
+ File file = new File( targetRepository.getBasedir(), targetRepository.getLayout().pathOf( artifact ) );
+ assertTrue( "File doesn't exist: " + file.getAbsolutePath(), file.exists() );
- Collection<ArtifactMetadata> metas = artifact.getMetadataList();
- for ( ArtifactMetadata meta : metas )
+ Collection<ArtifactMetadata> metas = artifact.getMetadataList();
+ for ( ArtifactMetadata meta : metas )
{
- File metaFile = new File( targetRepository.getBasedir(),
- targetRepository.getLayout().pathOfLocalRepositoryMetadata( meta, targetRepository) );
- assertTrue( metaFile.exists() );
+ File metaFile =
+ new File( targetRepository.getBasedir(),
+ targetRepository.getLayout().pathOfLocalRepositoryMetadata( meta, targetRepository ) );
+ assertTrue( metaFile.exists() );
}
- }
+ }
public void testSubPerArtifactRemoveVersion()
throws Exception
@@ -364,8 +353,8 @@
for ( Artifact artifact : artifacts )
{
String fileName = DependencyUtil.getFormattedFileName( artifact, true );
- File folder = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, true, mojo.outputDirectory,
- artifact );
+ File folder = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, true,
+ mojo.outputDirectory, artifact );
File file = new File( folder, fileName );
assertTrue( file.exists() );
}
@@ -386,8 +375,8 @@
for ( Artifact artifact : artifacts )
{
String fileName = DependencyUtil.getFormattedFileName( artifact, true );
- File folder = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, true, mojo.outputDirectory,
- artifact );
+ File folder = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, true,
+ mojo.outputDirectory, artifact );
File file = new File( folder, fileName );
assertTrue( file.exists() );
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java
index 499b924..70d3cc7 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestIncludeExcludeUnpackDependenciesMojo.java
@@ -28,21 +28,22 @@
import org.apache.maven.project.MavenProject;
public class TestIncludeExcludeUnpackDependenciesMojo
- extends AbstractDependencyMojoTestCase
+ extends AbstractDependencyMojoTestCase
{
- private final String PACKED_FILE = "test.zip";
+ private final String PACKED_FILE = "test.zip";
- private final String UNPACKED_FILE_PREFIX = "test";
- private final String UNPACKED_FILE_SUFFIX = ".txt";
+ private final String UNPACKED_FILE_PREFIX = "test";
- private final String PACKED_FILE_PATH = "target/test-classes/unit/unpack-dependencies-test/" + PACKED_FILE;
+ private final String UNPACKED_FILE_SUFFIX = ".txt";
- UnpackDependenciesMojo mojo;
+ private final String PACKED_FILE_PATH = "target/test-classes/unit/unpack-dependencies-test/" + PACKED_FILE;
+
+ UnpackDependenciesMojo mojo;
protected void setUp()
throws Exception
{
- // required for mojo lookups to work
+ // required for mojo lookups to work
super.setUp( "unpack-dependencies", true );
File testPom = new File( getBasedir(), "target/test-classes/unit/unpack-dependencies-test/plugin-config.xml" );
@@ -51,7 +52,7 @@
// mojo.silent = true;
// it needs to get the archivermanager
- //stubFactory.setUnpackableFile( mojo.getArchiverManager() );
+ // stubFactory.setUnpackableFile( mojo.getArchiverManager() );
// i'm using one file repeatedly to archive so I can test the name
// programmatically.
stubFactory.setSrcFile( new File( getBasedir() + File.separatorChar + PACKED_FILE_PATH ) );
@@ -86,101 +87,107 @@
/**
* This test will validate that only the 1 and 11 files get unpacked
- * @throws Exception
+ *
+ * @throws Exception in case of errors
*/
public void testUnpackIncludesManyFiles()
- throws Exception
- {
+ throws Exception
+ {
mojo.setIncludes( "**/*1" + UNPACKED_FILE_SUFFIX );
mojo.execute();
assertUnpacked( true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
/**
* This test will verify only the 2 file gets unpacked
- * @throws Exception
+ *
+ * @throws Exception in case of errors
*/
public void testUnpackIncludesSingleFile()
- throws Exception
- {
+ throws Exception
+ {
mojo.setIncludes( "**/test2" + UNPACKED_FILE_SUFFIX );
mojo.execute();
assertUnpacked( false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
/**
* This test will verify all files get unpacked
- * @throws Exception
+ *
+ * @throws Exception in case of errors
*/
public void testUnpackIncludesAllFiles()
- throws Exception
- {
+ throws Exception
+ {
mojo.setIncludes( "**/*" );
mojo.execute();
assertUnpacked( true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
/**
* This test will validate that only the 2 and 3 files get unpacked
- * @throws Exception
+ *
+ * @throws Exception in case of errors
*/
public void testUnpackExcludesManyFiles()
- throws Exception
- {
+ throws Exception
+ {
mojo.setExcludes( "**/*1" + UNPACKED_FILE_SUFFIX );
mojo.execute();
assertUnpacked( false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
/**
- * This test will verify only the 1, 11 & 3 files get unpacked
- * @throws Exception
+ * This test will verify only the 1, 11 & 3 files get unpacked
+ *
+ * @throws Exception in case of errors
*/
public void testUnpackExcludesSingleFile()
- throws Exception
- {
+ throws Exception
+ {
mojo.setExcludes( "**/test2" + UNPACKED_FILE_SUFFIX );
mojo.execute();
assertUnpacked( true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
/**
* This test will verify no files get unpacked
- * @throws Exception
+ *
+ * @throws Exception in case of errors
*/
public void testUnpackExcludesAllFiles()
- throws Exception
- {
+ throws Exception
+ {
mojo.setExcludes( "**/*" );
mojo.execute();
assertUnpacked( false, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( false, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
public void testNoIncludeExcludes()
- throws Exception
- {
+ throws Exception
+ {
mojo.execute();
assertUnpacked( true, UNPACKED_FILE_PREFIX + 1 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 11 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 2 + UNPACKED_FILE_SUFFIX );
assertUnpacked( true, UNPACKED_FILE_PREFIX + 3 + UNPACKED_FILE_SUFFIX );
- }
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java
index c85fd8e..1f81f76 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java
@@ -72,10 +72,10 @@
assertNotNull( mojo );
assertNotNull( mojo.getProject() );
MavenProject project = mojo.getProject();
-
+
MavenSession session = newMavenSession( project );
setVariableValueToObject( mojo, "session", session );
-
+
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
@@ -134,8 +134,9 @@
throws Exception
{
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -144,8 +145,9 @@
{
mojo.excludeTransitive = true;
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getDependencyArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getDependencyArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -157,8 +159,9 @@
mojo.excludeTypes = "jar";
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!artifact.getType().equalsIgnoreCase("jar"), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !artifact.getType().equalsIgnoreCase( "jar" ), artifact );
}
}
@@ -172,8 +175,9 @@
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!artifact.getScope().equals("provided"), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !artifact.getScope().equals( "provided" ), artifact );
}
}
@@ -188,8 +192,9 @@
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!artifact.getScope().equals("system"), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !artifact.getScope().equals( "system" ), artifact );
}
}
@@ -203,8 +208,9 @@
mojo.execute();
ScopeArtifactFilter saf = new ScopeArtifactFilter( mojo.excludeScope );
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!saf.include(artifact), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !saf.include( artifact ), artifact );
}
}
@@ -236,8 +242,9 @@
mojo.execute();
ScopeArtifactFilter saf = new ScopeArtifactFilter( mojo.excludeScope );
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!saf.include(artifact), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !saf.include( artifact ), artifact );
}
}
@@ -249,7 +256,7 @@
mojo.includeTypes = "jar";
mojo.excludeTypes = "jar";
- //shouldn't get anything
+ // shouldn't get anything
mojo.execute();
@@ -281,8 +288,9 @@
mojo.useSubDirectoryPerType = true;
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -292,8 +300,9 @@
mojo.useSubDirectoryPerArtifact = true;
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -306,8 +315,9 @@
mojo.useSubDirectoryPerType = true;
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -318,8 +328,9 @@
mojo.stripVersion = true;
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -333,8 +344,9 @@
mojo.stripVersion = true;
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( artifact );
}
}
@@ -347,8 +359,9 @@
mojo.execute();
ScopeArtifactFilter saf = new ScopeArtifactFilter( mojo.includeScope );
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(saf.include(artifact), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( saf.include( artifact ), artifact );
}
}
@@ -362,8 +375,9 @@
mojo.execute();
ScopeArtifactFilter saf = new ScopeArtifactFilter( mojo.includeScope );
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(saf.include(artifact), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( saf.include( artifact ), artifact );
}
}
@@ -376,8 +390,9 @@
mojo.execute();
ScopeArtifactFilter saf = new ScopeArtifactFilter( mojo.includeScope );
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(saf.include(artifact), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( saf.include( artifact ), artifact );
}
}
@@ -389,8 +404,9 @@
mojo.includeScope = "provided";
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(Artifact.SCOPE_PROVIDED.equals(artifact.getScope()), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ), artifact );
}
}
@@ -403,8 +419,9 @@
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(Artifact.SCOPE_SYSTEM.equals(artifact.getScope()), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ), artifact );
}
}
@@ -416,7 +433,7 @@
mojo.includeArtifactIds = "one";
mojo.excludeArtifactIds = "one";
- //shouldn't get anything
+ // shouldn't get anything
mojo.execute();
Iterator<Artifact> iter = mojo.getProject().getArtifacts().iterator();
@@ -448,8 +465,9 @@
// test - get all direct dependencies and verify that they exist if they
// do not have a classifier of "one"
// then delete the file and at the end, verify the folder is empty.
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!artifact.getArtifactId().equals("one"), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !artifact.getArtifactId().equals( "one" ), artifact );
}
}
@@ -461,8 +479,9 @@
mojo.excludeGroupIds = "one";
mojo.execute();
- for (Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts()) {
- assertUnpacked(!artifact.getGroupId().equals("one"), artifact);
+ for ( Artifact artifact : (Iterable<Artifact>) mojo.getProject().getArtifacts() )
+ {
+ assertUnpacked( !artifact.getGroupId().equals( "one" ), artifact );
}
}
@@ -473,7 +492,7 @@
mojo.getProject().setDependencyArtifacts( new HashSet<Artifact>() );
mojo.includeGroupIds = "one";
mojo.excludeGroupIds = "one";
- //shouldn't get anything
+ // shouldn't get anything
mojo.execute();
@@ -522,31 +541,34 @@
mojo.classifier = testClassifier;
mojo.type = testType;
- for (Artifact artifact : mojo.getProject().getArtifacts())
+ for ( Artifact artifact : mojo.getProject().getArtifacts() )
{
- String type = testType != null ? testType: artifact.getType();
+ String type = testType != null ? testType : artifact.getType();
this.stubFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
VersionRange.createFromVersion( artifact.getBaseVersion() ),
artifact.getScope(), type, testClassifier, false );
}
-
+
mojo.execute();
- for (Artifact artifact : mojo.getProject().getArtifacts()) {
+ for ( Artifact artifact : mojo.getProject().getArtifacts() )
+ {
String useClassifier = artifact.getClassifier();
String useType = artifact.getType();
- if (StringUtils.isNotEmpty(testClassifier)) {
+ if ( StringUtils.isNotEmpty( testClassifier ) )
+ {
useClassifier = testClassifier;
// type is only used if classifier is used.
- if (StringUtils.isNotEmpty(testType)) {
+ if ( StringUtils.isNotEmpty( testType ) )
+ {
useType = testType;
}
}
Artifact unpacked =
- stubFactory.createArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
- Artifact.SCOPE_COMPILE, useType, useClassifier);
- assertUnpacked(unpacked);
+ stubFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+ Artifact.SCOPE_COMPILE, useType, useClassifier );
+ assertUnpacked( unpacked );
}
}
@@ -580,11 +602,11 @@
public File getUnpackedFile( Artifact artifact )
{
- File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(),
- mojo.isUseSubDirectoryPerType(),
- mojo.isUseSubDirectoryPerArtifact(),
- mojo.useRepositoryLayout, mojo.stripVersion,
- mojo.getOutputDirectory(), artifact );
+ File destDir =
+ DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(),
+ mojo.isUseSubDirectoryPerType(),
+ mojo.isUseSubDirectoryPerArtifact(), mojo.useRepositoryLayout,
+ mojo.stripVersion, mojo.getOutputDirectory(), artifact );
File unpacked = new File( destDir, DependencyArtifactStubFactory.getUnpackableFileName( artifact ) );
assertTrue( unpacked.exists() );
return unpacked;
@@ -595,7 +617,6 @@
return new DefaultFileMarkerHandler( artifact, mojo.getMarkersDirectory() );
}
-
public void assertUnpacked( Artifact artifact, boolean overWrite )
throws InterruptedException, MojoExecutionException, MojoFailureException
{
diff --git a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java
index c8d7e46..56b5bed 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo2.java
@@ -86,11 +86,11 @@
public File getUnpackedFile( Artifact artifact )
{
- File destDir = DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(),
- mojo.isUseSubDirectoryPerType(),
- mojo.isUseSubDirectoryPerArtifact(),
- mojo.useRepositoryLayout, mojo.stripVersion,
- mojo.getOutputDirectory(), artifact );
+ File destDir =
+ DependencyUtil.getFormattedOutputDirectory( mojo.isUseSubDirectoryPerScope(),
+ mojo.isUseSubDirectoryPerType(),
+ mojo.isUseSubDirectoryPerArtifact(), mojo.useRepositoryLayout,
+ mojo.stripVersion, mojo.getOutputDirectory(), artifact );
File unpacked = new File( destDir, DependencyArtifactStubFactory.getUnpackableFileName( artifact ) );
assertTrue( unpacked.exists() );
return unpacked;
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java
index 1361b78..74b45f6 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojoTest.java
@@ -27,15 +27,16 @@
import org.apache.maven.plugins.dependency.AbstractDependencyMojoTestCase;
import org.apache.maven.plugins.dependency.utils.DependencyStatusSets;
-public class ResolveDependenciesMojoTest extends AbstractDependencyMojoTestCase
+public class ResolveDependenciesMojoTest
+ extends AbstractDependencyMojoTestCase
{
protected void setUp()
- throws Exception
+ throws Exception
{
// required for mojo lookups to work
super.setUp( "dss", true );
}
-
+
public void testDependencyStatusLog()
throws IOException
{
@@ -96,7 +97,8 @@
mojo.getOutput( true, false, false );
}
- private ResolveDependenciesMojo newMojo( final DependencyStatusSets dss ) {
+ private ResolveDependenciesMojo newMojo( final DependencyStatusSets dss )
+ {
ResolveDependenciesMojo mojo = new ResolveDependenciesMojo();
mojo.results = dss;
return mojo;
diff --git a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
index ccdd837..797071b 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/resolvers/TestResolveMojo.java
@@ -43,7 +43,7 @@
/**
* tests the proper discovery and configuration of the mojo
*
- * @throws Exception
+ * @throws Exception in case of errors.
*/
public void testresolveTestEnvironment()
throws Exception
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
index dcd4569..6f8ed9b 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyArtifactStubFactory.java
@@ -42,10 +42,9 @@
this.flattenedPath = flattenedPath;
}
-
/**
- * @param theWorkingDir
- * @param theCreateFiles
+ * @param theWorkingDir {@link File}
+ * @param theCreateFiles true/false.
*/
public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles )
{
@@ -67,14 +66,14 @@
}
return list;
}
-
+
@Override
public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope,
String type, String classifier, boolean optional )
throws IOException
{
File workingDir = getWorkingDir();
-
+
if ( !flattenedPath )
{
StringBuilder path = new StringBuilder( 128 );
@@ -88,11 +87,12 @@
// don't use flatten directories, won't happen at runtime
setWorkingDir( new File( workingDir, path.toString() ) );
}
-
- Artifact artifact = super.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional );
-
+
+ Artifact artifact =
+ super.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional );
+
setWorkingDir( workingDir );
-
+
return artifact;
}
- }
+}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyTestUtils.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyTestUtils.java
index d5e703e..adb73cb 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyTestUtils.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/DependencyTestUtils.java
@@ -42,12 +42,8 @@
/**
* Deletes a directory and its contents.
*
- * @param dir
- * The base directory of the included and excluded files.
- *
- * @throws IOException
- * @throws MojoExecutionException
- * When a directory failed to get deleted.
+ * @param dir {@link File} The base directory of the included and excluded files.
+ * @throws IOException in case of an error. When a directory failed to get deleted.
*/
public static void removeDirectory( File dir )
throws IOException
@@ -79,14 +75,12 @@
}
/**
- * convience method to set values to variables in objects that don't have
- * setters
+ * convenience method to set values to variables in objects that don't have setters
*
- * @param object
- * @param variable
- * @param value
- *
- * @throws IllegalAccessException
+ * @param object {@link Object}
+ * @param variable the field name.
+ * @param value The value to be set.
+ * @throws IllegalAccessException in case of an error.
*/
public static void setVariableValueToObject( Object object, String variable, Object value )
throws IllegalAccessException
@@ -106,7 +100,7 @@
long time = System.currentTimeMillis();
time = time - ( time % 1000 );
assertTrue( "Updating last modification time of marker file " + file.getAbsolutePath()
- + " failed unexpectedly.", file.setLastModified( time ) );
+ + " failed unexpectedly.", file.setLastModified( time ) );
// wait at least a second for filesystems that only record to the
// nearest second.
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java
index 79d2754..158255e 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DependencyProjectStub.java
@@ -60,8 +60,7 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
- * very simple stub of maven project, going to take a lot of work to make it
- * useful as a stub though
+ * very simple stub of maven project, going to take a lot of work to make it useful as a stub though
*/
public class DependencyProjectStub
extends MavenProject
@@ -157,7 +156,7 @@
private String defaultGoal;
private Set artifacts;
-
+
private Properties properties;
public DependencyProjectStub()
@@ -192,7 +191,8 @@
ArtifactHandler ah = new DefaultArtifactHandlerStub( "jar", null );
VersionRange vr = VersionRange.createFromVersion( "1.0" );
- Artifact art = new DefaultArtifact( "group", "artifact", vr, Artifact.SCOPE_COMPILE, "jar", null, ah, false );
+ Artifact art =
+ new DefaultArtifact( "group", "artifact", vr, Artifact.SCOPE_COMPILE, "jar", null, ah, false );
setArtifact( art );
}
return artifact;
@@ -262,10 +262,11 @@
return dependencies;
}
- public void setDependencyManagement(DependencyManagement depMgt)
+ public void setDependencyManagement( DependencyManagement depMgt )
{
this.dependencyManagement = depMgt;
}
+
public DependencyManagement getDependencyManagement()
{
if ( dependencyManagement == null )
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependencies2ProjectStub.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependencies2ProjectStub.java
index 5845a6f..0c33b6e 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependencies2ProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependencies2ProjectStub.java
@@ -27,8 +27,7 @@
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
/**
- * very simple stub of maven project, going to take a lot of work to make it
- * useful as a stub though
+ * very simple stub of maven project, going to take a lot of work to make it useful as a stub though
*/
public class DuplicateDependencies2ProjectStub
extends MavenProjectStub
@@ -58,7 +57,6 @@
setFile( pom );
}
-
/**
* @see org.apache.maven.plugin.testing.stubs.MavenProjectStub#getBasedir()
*/
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependenciesProjectStub.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependenciesProjectStub.java
index e91cbac..87340dd 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependenciesProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/DuplicateDependenciesProjectStub.java
@@ -27,8 +27,7 @@
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
/**
- * very simple stub of maven project, going to take a lot of work to make it
- * useful as a stub though
+ * very simple stub of maven project, going to take a lot of work to make it useful as a stub though
*/
public class DuplicateDependenciesProjectStub
extends MavenProjectStub
@@ -58,7 +57,6 @@
setFile( pom );
}
-
/**
* @see org.apache.maven.plugin.testing.stubs.MavenProjectStub#getBasedir()
*/
diff --git a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubUnpackFileMarkerHandler.java b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubUnpackFileMarkerHandler.java
index 134ee3b..216a2f4 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubUnpackFileMarkerHandler.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/testUtils/stubs/StubUnpackFileMarkerHandler.java
@@ -26,39 +26,40 @@
import org.codehaus.plexus.util.StringUtils;
public class StubUnpackFileMarkerHandler
- extends UnpackFileMarkerHandler
+ extends UnpackFileMarkerHandler
{
- public StubUnpackFileMarkerHandler( ArtifactItem artifactItem, File markerFilesDirectory )
+ public StubUnpackFileMarkerHandler( ArtifactItem artifactItem, File markerFilesDirectory )
{
super( artifactItem, markerFilesDirectory );
}
-
- protected File getMarkerFile()
+
+ protected File getMarkerFile()
{
- File markerFile;
- if ( this.artifactItem == null
- || ( StringUtils.isEmpty( this.artifactItem.getIncludes() )
- && StringUtils.isEmpty( this.artifactItem.getExcludes() ) ) )
- {
- markerFile = new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace( ':', '-' ) + ".marker" );
- }
- else
- {
- int includeExcludeHash = 0;
-
- if ( StringUtils.isNotEmpty( this.artifactItem.getIncludes() ) )
- {
- includeExcludeHash += this.artifactItem.getIncludes().hashCode();
- }
-
- if ( StringUtils.isNotEmpty( this.artifactItem.getExcludes() ) )
- {
- includeExcludeHash += this.artifactItem.getExcludes().hashCode();
- }
-
- markerFile = new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace( ':', '-' ) + includeExcludeHash );
- }
-
- return markerFile;
+ File markerFile;
+ if ( this.artifactItem == null || ( StringUtils.isEmpty( this.artifactItem.getIncludes() )
+ && StringUtils.isEmpty( this.artifactItem.getExcludes() ) ) )
+ {
+ markerFile =
+ new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace( ':', '-' ) + ".marker" );
+ }
+ else
+ {
+ int includeExcludeHash = 0;
+
+ if ( StringUtils.isNotEmpty( this.artifactItem.getIncludes() ) )
+ {
+ includeExcludeHash += this.artifactItem.getIncludes().hashCode();
+ }
+
+ if ( StringUtils.isNotEmpty( this.artifactItem.getExcludes() ) )
+ {
+ includeExcludeHash += this.artifactItem.getExcludes().hashCode();
+ }
+
+ markerFile = new StubMarkerFile( this.markerFilesDirectory,
+ this.artifact.getId().replace( ':', '-' ) + includeExcludeHash );
+ }
+
+ return markerFile;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java b/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java
index 3314042..2979eb5 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/tree/TestTreeMojo.java
@@ -64,7 +64,7 @@
/**
* Tests the proper discovery and configuration of the mojo.
*
- * @throws Exception
+ * @throws Exception in case of an error.
*/
public void _testTreeTestEnvironment()
throws Exception
@@ -96,7 +96,7 @@
/**
* Test the DOT format serialization
*
- * @throws Exception
+ * @throws Exception in case of an error.
*/
public void _testTreeDotSerializing()
throws Exception
@@ -111,8 +111,8 @@
/**
* Test the GraphML format serialization
- *
- * @throws Exception
+ *
+ * @throws Exception in case of an error.
*/
public void _testTreeGraphMLSerializing()
throws Exception
@@ -121,7 +121,8 @@
assertTrue( findString( contents, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ) );
assertTrue( findString( contents, "<y:NodeLabel>testGroupId:project:jar:1.0:compile</y:NodeLabel>" ) );
- assertTrue( findString( contents, "<y:NodeLabel>testGroupId:snapshot:jar:2.0-SNAPSHOT:compile</y:NodeLabel>" ) );
+ assertTrue( findString( contents,
+ "<y:NodeLabel>testGroupId:snapshot:jar:2.0-SNAPSHOT:compile</y:NodeLabel>" ) );
assertTrue( findString( contents, "<y:NodeLabel>testGroupId:release:jar:1.0:compile</y:NodeLabel>" ) );
assertTrue( findString( contents, "<key for=\"node\" id=\"d0\" yfiles.type=\"nodegraphics\"/>" ) );
assertTrue( findString( contents, "<key for=\"edge\" id=\"d1\" yfiles.type=\"edgegraphics\"/>" ) );
@@ -129,8 +130,8 @@
/**
* Test the TGF format serialization
- *
- * @throws Exception
+ *
+ * @throws Exception in case of an error.
*/
public void _testTreeTGFSerializing()
throws Exception
@@ -143,12 +144,14 @@
/**
* Help finding content in the given list of string
- * @param outputFile
- * @param format
+ *
+ * @param outputFile the outputFile.
+ * @param format The format.
+ * @throws Exception in case of an error.
* @return list of strings in the output file
*/
private List<String> runTreeMojo( String outputFile, String format )
- throws Exception
+ throws Exception
{
File testPom = new File( getBasedir(), "target/test-classes/unit/tree-test/plugin-config.xml" );
String outputFileName = testDir.getAbsolutePath() + outputFile;
@@ -180,19 +183,20 @@
}
fp1.close();
- return contents ;
+ return contents;
}
/**
* Help finding content in the given list of string
- * @param contents
- * @param str
+ *
+ * @param contents The contents.
+ * @param str The content which should be checked for.
*/
private boolean findString( List<String> contents, String str )
{
for ( String line : contents )
{
- if (line.contains(str))
+ if ( line.contains( str ) )
{
// if match then return here
return true;
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyStatusSets.java b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyStatusSets.java
index d3c7ffb..2a87501 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyStatusSets.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyStatusSets.java
@@ -39,8 +39,8 @@
* set ); assertSame( set, dss.getResolvedDependencies() ); set = new HashSet(); dss.setUnResolvedDependencies(
* set ); assertSame( set, dss.getUnResolvedDependencies() ); set = new HashSet(); dss.setSkippedDependencies(
* set ); assertSame( set, dss.getSkippedDependencies() ); assertNotSame( dss.getResolvedDependencies(),
- * dss.getSkippedDependencies() ); assertNotSame( dss.getResolvedDependencies(), dss.getUnResolvedDependencies() );
- * assertNotSame( dss.getSkippedDependencies(), dss.getUnResolvedDependencies() );
+ * dss.getSkippedDependencies() ); assertNotSame( dss.getResolvedDependencies(), dss.getUnResolvedDependencies()
+ * ); assertNotSame( dss.getSkippedDependencies(), dss.getUnResolvedDependencies() );
*/
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
index 7806c46..e015e5c 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
@@ -38,7 +38,6 @@
/**
* @author brianf
- *
*/
public class TestDependencyUtil
extends TestCase
@@ -74,7 +73,8 @@
ah = new DefaultArtifactHandlerStub( "war", null );
vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
- snapResolvedVersion = new DefaultArtifact( "test", "three", vr, Artifact.SCOPE_PROVIDED, "war", null, ah, false );
+ snapResolvedVersion =
+ new DefaultArtifact( "test", "three", vr, Artifact.SCOPE_PROVIDED, "war", null, ah, false );
snapResolvedVersion.setResolvedVersion( "1.1-20121003.035531-117" );
artifacts.add( snapResolvedVersion );
@@ -108,13 +108,13 @@
+ File.separatorChar + "1.1";
assertTrue( expectedResult.equalsIgnoreCase( name.getAbsolutePath() ) );
- name = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, false, folder, artifact );
+ name = DependencyUtil.getFormattedOutputDirectory( false, true, false, false, false, folder, artifact );
expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars";
assertTrue( expectedResult.equalsIgnoreCase( name.getAbsolutePath() ) );
- name = DependencyUtil.getFormattedOutputDirectory( true, false, false, false, false, folder, artifact );
+ name = DependencyUtil.getFormattedOutputDirectory( true, false, false, false, false, folder, artifact );
expectedResult = folder.getAbsolutePath() + File.separatorChar + "compile";
- assertEquals( expectedResult, name.getAbsolutePath() );
+ assertEquals( expectedResult, name.getAbsolutePath() );
assertTrue( expectedResult.equalsIgnoreCase( name.getAbsolutePath() ) );
name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, false, folder, artifact );
@@ -126,18 +126,18 @@
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, false, folder, artifact );
- expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar
- + "one-1.1-sources-jar";
+ expectedResult =
+ folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar + "one-1.1-sources-jar";
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, true, folder, artifact );
- expectedResult = folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar
- + "one-sources-jar";
+ expectedResult =
+ folder.getAbsolutePath() + File.separatorChar + "jars" + File.separatorChar + "one-sources-jar";
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( true, false, true, false, true, folder, artifact );
- expectedResult = folder.getAbsolutePath() + File.separatorChar + "compile" + File.separatorChar
- + "one-sources-jar";
+ expectedResult =
+ folder.getAbsolutePath() + File.separatorChar + "compile" + File.separatorChar + "one-sources-jar";
assertEquals( expectedResult, name.getAbsolutePath() );
}
@@ -164,8 +164,8 @@
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, true, true, false, false, folder, artifact );
- expectedResult = folder.getAbsolutePath() + File.separatorChar + "wars" + File.separatorChar
- + "two-1.1-SNAPSHOT-war";
+ expectedResult =
+ folder.getAbsolutePath() + File.separatorChar + "wars" + File.separatorChar + "two-1.1-SNAPSHOT-war";
assertEquals( expectedResult, name.getAbsolutePath() );
name = DependencyUtil.getFormattedOutputDirectory( false, false, true, false, true, folder, artifact );
@@ -220,8 +220,8 @@
{
ArtifactHandler ah = new DefaultArtifactHandlerStub( "test-jar", null );
VersionRange vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
- Artifact artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "test-jar", null, ah,
- false );
+ Artifact artifact =
+ new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "test-jar", null, ah, false );
String name = DependencyUtil.getFormattedFileName( artifact, false );
String expectedResult = "two-1.1-SNAPSHOT.jar";
@@ -234,8 +234,8 @@
{
ArtifactHandler ah = new DefaultArtifactHandlerStub( "jar", "sources" );
VersionRange vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
- Artifact artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "jar", "sources", ah,
- false );
+ Artifact artifact =
+ new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "jar", "sources", ah, false );
String name = DependencyUtil.getFormattedFileName( artifact, false );
String expectedResult = "two-1.1-SNAPSHOT-sources.jar";
@@ -244,11 +244,11 @@
name = DependencyUtil.getFormattedFileName( artifact, true );
expectedResult = "two-sources.jar";
assertEquals( expectedResult, name );
-
- name = DependencyUtil.getFormattedFileName(artifact, false, false, false, true);
+
+ name = DependencyUtil.getFormattedFileName( artifact, false, false, false, true );
expectedResult = "two-1.1-SNAPSHOT.jar";
assertEquals( expectedResult, name );
-
+
ah = new DefaultArtifactHandlerStub( "war", null );
artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", "", ah, false );
name = DependencyUtil.getFormattedFileName( artifact, true );
@@ -265,8 +265,8 @@
// set.
ArtifactHandler ah = new DefaultArtifactHandlerStub( "war", "sources" );
VersionRange vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
- Artifact artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", "sources", ah,
- false );
+ Artifact artifact =
+ new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", "sources", ah, false );
File file = new File( "/target", "test-file-name.jar" );
artifact.setFile( file );
@@ -277,11 +277,11 @@
name = DependencyUtil.getFormattedFileName( artifact, false, false, false, true );
expectedResult = "two-1.1-SNAPSHOT.war";
assertEquals( expectedResult, name );
-
+
name = DependencyUtil.getFormattedFileName( artifact, true );
expectedResult = "two-sources.war";
assertEquals( expectedResult, name );
-
+
artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", "", ah, false );
name = DependencyUtil.getFormattedFileName( artifact, true );
expectedResult = "two.war";
@@ -295,20 +295,20 @@
assertEquals( expectedResult, name );
}
-
+
public void testTokenizer()
{
- String [] tokens = DependencyUtil.tokenizer( " alpha,bravo, charlie , delta kappa, theta" );
+ String[] tokens = DependencyUtil.tokenizer( " alpha,bravo, charlie , delta kappa, theta" );
String[] expected = new String[] { "alpha", "bravo", "charlie", "delta kappa", "theta" };
// easier to see in the JUnit reports
assertEquals( StringUtils.join( expected, ", " ), StringUtils.join( tokens, ", " ) );
assertEquals( expected.length, tokens.length );
-
+
tokens = DependencyUtil.tokenizer( " \r\n a, \t \n \r b \t \n \r" );
assertEquals( 2, tokens.length );
assertEquals( "a", tokens[0] );
assertEquals( "b", tokens[1] );
-
+
tokens = DependencyUtil.tokenizer( null );
assertEquals( 0, tokens.length );
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java
index ef1c978..e2df590 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestDestFileFilter.java
@@ -37,7 +37,6 @@
/**
* @author brianf
- *
*/
public class TestDestFileFilter
extends TestCase
@@ -76,42 +75,44 @@
}
public File createFile( Artifact artifact, boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType,
- boolean removeVersion)
+ boolean removeVersion )
throws IOException
{
- return createFile(artifact, useSubDirectoryPerArtifact, useSubDirectoryPerType, removeVersion, false);
+ return createFile( artifact, useSubDirectoryPerArtifact, useSubDirectoryPerType, removeVersion, false );
}
-
- public File createFile(Artifact artifact, boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType,
- boolean removeVersion, boolean removeClassifier)
- throws IOException
+
+ public File createFile( Artifact artifact, boolean useSubDirectoryPerArtifact, boolean useSubDirectoryPerType,
+ boolean removeVersion, boolean removeClassifier )
+ throws IOException
{
File destFolder =
- DependencyUtil.getFormattedOutputDirectory(false, useSubDirectoryPerType, useSubDirectoryPerArtifact,
- false, false, outputFolder, artifact);
- File destFile = new File(destFolder, DependencyUtil.getFormattedFileName(artifact, removeVersion, false, false, removeClassifier));
+ DependencyUtil.getFormattedOutputDirectory( false, useSubDirectoryPerType, useSubDirectoryPerArtifact,
+ false, false, outputFolder, artifact );
+ File destFile =
+ new File( destFolder,
+ DependencyUtil.getFormattedFileName( artifact, removeVersion, false, false, removeClassifier ) );
destFile.getParentFile().mkdirs();
- assertTrue(destFile.createNewFile());
+ assertTrue( destFile.createNewFile() );
return destFile;
}
public void testDestFileRelease()
- throws IOException, ArtifactFilterException
+ throws IOException, ArtifactFilterException
{
DestFileFilter filter = new DestFileFilter( outputFolder );
Artifact artifact = fact.getReleaseArtifact();
assertTrue( filter.isArtifactIncluded( artifact ) );
createFile( artifact );
- assertFalse( filter.isArtifactIncluded( artifact) );
+ assertFalse( filter.isArtifactIncluded( artifact ) );
filter.setOverWriteReleases( true );
assertTrue( filter.isArtifactIncluded( artifact ) );
}
public void testDestFileSnapshot()
- throws IOException, ArtifactFilterException
+ throws IOException, ArtifactFilterException
{
DestFileFilter filter = new DestFileFilter( outputFolder );
Artifact artifact = fact.getSnapshotArtifact();
@@ -125,13 +126,13 @@
}
public void testDestFileStripVersion()
- throws IOException, ArtifactFilterException
+ throws IOException, ArtifactFilterException
{
DestFileFilter filter = new DestFileFilter( outputFolder );
Artifact artifact = fact.getSnapshotArtifact();
filter.setRemoveVersion( true );
- assertTrue( filter.isArtifactIncluded( artifact) );
+ assertTrue( filter.isArtifactIncluded( artifact ) );
createFile( artifact, false, false, true );
assertFalse( filter.isArtifactIncluded( artifact ) );
@@ -140,22 +141,22 @@
}
public void testDestFileStripClassifier()
- throws IOException, ArtifactFilterException
+ throws IOException, ArtifactFilterException
{
- DestFileFilter filter = new DestFileFilter(outputFolder);
+ DestFileFilter filter = new DestFileFilter( outputFolder );
Artifact artifact = fact.getSnapshotArtifact();
- filter.setRemoveClassifier(true);
+ filter.setRemoveClassifier( true );
- assertTrue(filter.isArtifactIncluded(artifact));
- createFile(artifact, false, false, false, true);
- assertFalse(filter.isArtifactIncluded(artifact));
+ assertTrue( filter.isArtifactIncluded( artifact ) );
+ createFile( artifact, false, false, false, true );
+ assertFalse( filter.isArtifactIncluded( artifact ) );
- filter.setOverWriteSnapshots(true);
- assertTrue(filter.isArtifactIncluded(artifact));
+ filter.setOverWriteSnapshots( true );
+ assertTrue( filter.isArtifactIncluded( artifact ) );
}
-
+
public void testDestFileSubPerArtifact()
- throws IOException, ArtifactFilterException
+ throws IOException, ArtifactFilterException
{
DestFileFilter filter = new DestFileFilter( outputFolder );
Artifact artifact = fact.getSnapshotArtifact();
@@ -176,7 +177,7 @@
Artifact artifact = fact.getSnapshotArtifact();
filter.setUseSubDirectoryPerType( true );
- assertTrue( filter.isArtifactIncluded( artifact) );
+ assertTrue( filter.isArtifactIncluded( artifact ) );
createFile( artifact, false, true, false );
assertFalse( filter.isArtifactIncluded( artifact ) );
@@ -196,7 +197,7 @@
filter.setOverWriteIfNewer( true );
// should pass because the file doesn't exist yet.
- assertTrue( filter.isArtifactIncluded( artifact) );
+ assertTrue( filter.isArtifactIncluded( artifact ) );
// create the file in the destination
File destFile = createFile( artifact, false, false, false );
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java
index 1ee16f7..474cd99 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestMarkerFileFilter.java
@@ -37,7 +37,6 @@
/**
* @author brianf
- *
*/
public class TestMarkerFileFilter
extends TestCase
@@ -69,10 +68,12 @@
DependencyTestUtils.removeDirectory( outputFolder );
}
- public void testMarkerFile() throws ArtifactFilterException
-
+ public void testMarkerFile()
+ throws ArtifactFilterException
+
{
- MarkerFileFilter filter = new MarkerFileFilter( true, true, false, new DefaultFileMarkerHandler( outputFolder ) );
+ MarkerFileFilter filter =
+ new MarkerFileFilter( true, true, false, new DefaultFileMarkerHandler( outputFolder ) );
Set<Artifact> result = filter.filter( artifacts );
assertEquals( 2, result.size() );
@@ -82,13 +83,15 @@
assertEquals( 2, result.size() );
}
- public void testMarkerSnapshots() throws ArtifactFilterException, MojoExecutionException, IOException
-
+ public void testMarkerSnapshots()
+ throws ArtifactFilterException, MojoExecutionException, IOException
+
{
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( fact.getSnapshotArtifact(), outputFolder );
handler.setMarker();
- MarkerFileFilter filter = new MarkerFileFilter( true, false, false, new DefaultFileMarkerHandler( outputFolder ) );
+ MarkerFileFilter filter =
+ new MarkerFileFilter( true, false, false, new DefaultFileMarkerHandler( outputFolder ) );
Set<Artifact> result = filter.filter( artifacts );
assertEquals( 1, result.size() );
@@ -106,13 +109,13 @@
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( fact.getReleaseArtifact(), outputFolder );
handler.setMarker();
- MarkerFileFilter filter = new MarkerFileFilter( false, false, false,
- new DefaultFileMarkerHandler( outputFolder ) );
+ MarkerFileFilter filter =
+ new MarkerFileFilter( false, false, false, new DefaultFileMarkerHandler( outputFolder ) );
Set<Artifact> result = filter.filter( artifacts );
assertEquals( 1, result.size() );
filter.setOverWriteReleases( true );
- result = filter.filter( artifacts);
+ result = filter.filter( artifacts );
assertEquals( 2, result.size() );
assertTrue( handler.clearMarker() );
@@ -134,7 +137,8 @@
DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( snap, outputFolder );
handler.setMarker();
assertTrue( snap.getFile().setLastModified( snap.getFile().lastModified() + 1500 ) );
- MarkerFileFilter filter = new MarkerFileFilter( false, false, true, new DefaultFileMarkerHandler( outputFolder ) );
+ MarkerFileFilter filter =
+ new MarkerFileFilter( false, false, true, new DefaultFileMarkerHandler( outputFolder ) );
Set<Artifact> result = filter.filter( tempArtifacts );
assertEquals( 2, result.size() );
@@ -142,7 +146,7 @@
handler.setMarker();
result = filter.filter( tempArtifacts );
assertEquals( 1, result.size() );
-
+
// filter won't include snapshot because it is older than marker
assertTrue( snap.getFile().setLastModified( snap.getFile().lastModified() - 10000 ) );
@@ -159,7 +163,8 @@
public void testGettersSetters()
{
- MarkerFileFilter filter = new MarkerFileFilter( true, false, true, new DefaultFileMarkerHandler( outputFolder ) );
+ MarkerFileFilter filter =
+ new MarkerFileFilter( true, false, true, new DefaultFileMarkerHandler( outputFolder ) );
assertEquals( true, filter.isOverWriteReleases() );
assertEquals( false, filter.isOverWriteSnapshots() );
assertEquals( true, filter.isOverWriteIfNewer() );
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java
index 2b81df7..ea47d1b 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/filters/TestResolveMarkerFileFilter.java
@@ -40,7 +40,6 @@
/**
* @author brianf
- *
*/
public class TestResolveMarkerFileFilter
extends TestCase
@@ -73,7 +72,7 @@
}
public void testResolveFile()
- throws IOException, ArtifactFilterException, MojoExecutionException
+ throws IOException, ArtifactFilterException, MojoExecutionException
{
SourcesFileMarkerHandler handler = new SourcesFileMarkerHandler( outputFolder );
@@ -82,9 +81,9 @@
ResolveFileFilter filter = new ResolveFileFilter( handler );
- assertTrue( filter.isArtifactIncluded( artifact) );
+ assertTrue( filter.isArtifactIncluded( artifact ) );
handler.setMarker();
- assertFalse( filter.isArtifactIncluded( artifact) );
+ assertFalse( filter.isArtifactIncluded( artifact ) );
}
}
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java
index 27db79c..71f1ff5 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestDefaultMarkerFileHandler.java
@@ -39,7 +39,6 @@
/**
* @author brianf
- *
*/
public class TestDefaultMarkerFileHandler
extends TestCase
@@ -80,8 +79,7 @@
public void testSetMarker()
throws MojoExecutionException
{
- DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder );
+ DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifacts.get( 0 ), this.outputFolder );
assertFalse( handler.isMarkerSet() );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
@@ -102,8 +100,7 @@
public void testMarkerFile()
throws MojoExecutionException, IOException
{
- DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder );
+ DefaultFileMarkerHandler handler = new DefaultFileMarkerHandler( artifacts.get( 0 ), this.outputFolder );
File handle = handler.getMarkerFile();
assertFalse( handle.exists() );
@@ -150,8 +147,8 @@
public void testMarkerFileException()
{
// this stub wraps the file with an object to throw exceptions
- StubDefaultFileMarkerHandler handler = new StubDefaultFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder );
+ StubDefaultFileMarkerHandler handler =
+ new StubDefaultFileMarkerHandler( artifacts.get( 0 ), this.outputFolder );
try
{
handler.setMarker();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java
index e00b46e..d9ebe78 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestSourcesMarkerFileHandler.java
@@ -39,7 +39,6 @@
/**
* @author brianf
- *
*/
public class TestSourcesMarkerFileHandler
extends TestCase
@@ -81,8 +80,7 @@
public void testSetMarkerResolved()
throws MojoExecutionException
{
- DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, true );
+ DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, true );
assertFalse( handler.isMarkerSet() );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
@@ -102,8 +100,7 @@
public void testSetMarkerUnresolved()
throws MojoExecutionException
{
- DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, false );
+ DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, false );
assertFalse( handler.isMarkerSet() );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
@@ -123,10 +120,9 @@
public void testBothMarkers()
throws MojoExecutionException
{
- DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 1 ),
- this.outputFolder, true );
- DefaultFileMarkerHandler handler2 = new SourcesFileMarkerHandler( artifacts.get( 1 ),
- this.outputFolder, false );
+ DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 1 ), this.outputFolder, true );
+ DefaultFileMarkerHandler handler2 =
+ new SourcesFileMarkerHandler( artifacts.get( 1 ), this.outputFolder, false );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
@@ -142,10 +138,9 @@
public void testMarkerFile()
throws MojoExecutionException, IOException
{
- DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, true );
- DefaultFileMarkerHandler handler2 = new SourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, false );
+ DefaultFileMarkerHandler handler = new SourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, true );
+ DefaultFileMarkerHandler handler2 =
+ new SourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, false );
File handle = handler.getMarkerFile();
File handle2 = handler2.getMarkerFile();
@@ -218,10 +213,10 @@
theFile.createNewFile();
Artifact theArtifact = artifacts.get( 0 );
theArtifact.setFile( theFile );
- SourcesFileMarkerHandler resolvedHandler = new SourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, resolved );
- SourcesFileMarkerHandler unResolvedHandler = new SourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, !resolved );
+ SourcesFileMarkerHandler resolvedHandler =
+ new SourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, resolved );
+ SourcesFileMarkerHandler unResolvedHandler =
+ new SourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, !resolved );
assertFalse( resolvedHandler.isMarkerSet() );
assertFalse( unResolvedHandler.isMarkerSet() );
@@ -250,8 +245,8 @@
public void testMarkerFileException()
{
// this stub wraps the file with an object to throw exceptions
- StubSourcesFileMarkerHandler handler = new StubSourcesFileMarkerHandler( artifacts.get( 0 ),
- this.outputFolder, true );
+ StubSourcesFileMarkerHandler handler =
+ new StubSourcesFileMarkerHandler( artifacts.get( 0 ), this.outputFolder, true );
try
{
handler.setMarker();
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
index ad34eae..c291eea 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/markers/TestUnpackMarkerFileHandler.java
@@ -35,32 +35,32 @@
import org.apache.maven.plugin.testing.SilentLog;
public class TestUnpackMarkerFileHandler
- extends AbstractMojoTestCase
+ extends AbstractMojoTestCase
{
- List<ArtifactItem> artifactItems = new ArrayList<ArtifactItem>();
+ List<ArtifactItem> artifactItems = new ArrayList<ArtifactItem>();
Log log = new SilentLog();
File outputFolder;
-
+
protected File testDir;
-
+
protected DependencyArtifactStubFactory stubFactory;
protected void setUp()
throws Exception
{
super.setUp();
-
+
testDir = new File( getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar
- + "unpack-markers" + File.separatorChar );
+ + "unpack-markers" + File.separatorChar );
DependencyTestUtils.removeDirectory( testDir );
assertFalse( testDir.exists() );
stubFactory = new DependencyArtifactStubFactory( this.testDir, false );
Artifact artifact = stubFactory.createArtifact( "test", "test", "1" );
ArtifactItem artifactItem;
- stubFactory.getArtifactItem(artifact);
+ stubFactory.getArtifactItem( artifact );
artifactItems.add( stubFactory.getArtifactItem( stubFactory.createArtifact( "test", "test", "1" ) ) );
artifact = stubFactory.createArtifact( "test2", "test2", "2" );
artifactItem = new ArtifactItem( artifact );
@@ -88,16 +88,14 @@
}
/**
+ * Assert that default functionality still exists
*
- * Assert that default functionallity still exists
- *
+ * @throws MojoExecutionException in case of an error.
*/
-
public void testSetMarker()
throws MojoExecutionException
{
- UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 0 ),
- this.outputFolder );
+ UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 0 ), this.outputFolder );
assertFalse( handler.isMarkerSet() );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
@@ -118,8 +116,7 @@
public void testMarkerFile()
throws MojoExecutionException, IOException
{
- UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 0 ),
- this.outputFolder );
+ UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 0 ), this.outputFolder );
File handle = handler.getMarkerFile();
assertFalse( handle.exists() );
@@ -167,8 +164,8 @@
public void testMarkerFileException()
{
// this stub wraps the file with an object to throw exceptions
- StubUnpackFileMarkerHandler handler = new StubUnpackFileMarkerHandler( artifactItems.get( 0 ),
- this.outputFolder );
+ StubUnpackFileMarkerHandler handler =
+ new StubUnpackFileMarkerHandler( artifactItems.get( 0 ), this.outputFolder );
try
{
handler.setMarker();
@@ -200,27 +197,27 @@
// the parent isn't set so this will create the marker in the local
// folder. We must clear the
// marker to avoid leaving test droppings in root.
- UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( null, null );
+ UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( null, null );
handler.setArtifactItem( artifactItems.get( 0 ) );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
handler.clearMarker();
assertFalse( handler.isMarkerSet() );
}
-
+
public void testIncludesMarker()
- throws MojoExecutionException, IOException
- {
- UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 1 ), outputFolder );
- File handle = handler.getMarkerFile();
+ throws MojoExecutionException, IOException
+ {
+ UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 1 ), outputFolder );
+ File handle = handler.getMarkerFile();
assertFalse( handle.exists() );
assertFalse( handler.isMarkerSet() );
handler.setMarker();
assertTrue( handler.isMarkerSet() );
assertTrue( handle.exists() );
- String hashCode = "" + ("**/*.xml".hashCode());
- assertTrue(handle.getName().contains(hashCode));
+ String hashCode = "" + ( "**/*.xml".hashCode() );
+ assertTrue( handle.getName().contains( hashCode ) );
handle.delete();
assertFalse( handler.isMarkerSet() );
@@ -230,55 +227,53 @@
handler.clearMarker();
assertFalse( handle.exists() );
- }
-
+ }
+
public void testExcludesMarker()
- throws MojoExecutionException, IOException
- {
- UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 2 ), outputFolder );
- File handle = handler.getMarkerFile();
- assertFalse( handle.exists() );
- assertFalse( handler.isMarkerSet() );
-
- handler.setMarker();
- assertTrue( handler.isMarkerSet() );
- assertTrue( handle.exists() );
- String hashCode = "" + ("**/*.class".hashCode());
- assertTrue(handle.getName().contains(hashCode));
-
- handle.delete();
- assertFalse( handler.isMarkerSet() );
-
- handle.createNewFile();
- assertTrue( handler.isMarkerSet() );
-
- handler.clearMarker();
- assertFalse( handle.exists() );
- }
-
+ throws MojoExecutionException, IOException
+ {
+ UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 2 ), outputFolder );
+ File handle = handler.getMarkerFile();
+ assertFalse( handle.exists() );
+ assertFalse( handler.isMarkerSet() );
+
+ handler.setMarker();
+ assertTrue( handler.isMarkerSet() );
+ assertTrue( handle.exists() );
+ String hashCode = "" + ( "**/*.class".hashCode() );
+ assertTrue( handle.getName().contains( hashCode ) );
+
+ handle.delete();
+ assertFalse( handler.isMarkerSet() );
+
+ handle.createNewFile();
+ assertTrue( handler.isMarkerSet() );
+
+ handler.clearMarker();
+ assertFalse( handle.exists() );
+ }
+
public void testIncludesExcludesMarker()
- throws MojoExecutionException, IOException
- {
- UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 3 ), outputFolder );
- File handle = handler.getMarkerFile();
- assertFalse( handle.exists() );
- assertFalse( handler.isMarkerSet() );
-
- handler.setMarker();
- assertTrue( handler.isMarkerSet() );
- assertTrue( handle.exists() );
- String hashCode = "" + ( 0 + "**/*.class".hashCode() + "**/*.xml".hashCode() );
- assertTrue(handle.getName().contains(hashCode));
-
- handle.delete();
- assertFalse( handler.isMarkerSet() );
-
- handle.createNewFile();
- assertTrue( handler.isMarkerSet() );
-
- handler.clearMarker();
- assertFalse( handle.exists() );
- }
+ throws MojoExecutionException, IOException
+ {
+ UnpackFileMarkerHandler handler = new UnpackFileMarkerHandler( artifactItems.get( 3 ), outputFolder );
+ File handle = handler.getMarkerFile();
+ assertFalse( handle.exists() );
+ assertFalse( handler.isMarkerSet() );
+
+ handler.setMarker();
+ assertTrue( handler.isMarkerSet() );
+ assertTrue( handle.exists() );
+ String hashCode = "" + ( 0 + "**/*.class".hashCode() + "**/*.xml".hashCode() );
+ assertTrue( handle.getName().contains( hashCode ) );
+
+ handle.delete();
+ assertFalse( handler.isMarkerSet() );
+
+ handle.createNewFile();
+ assertTrue( handler.isMarkerSet() );
+
+ handler.clearMarker();
+ assertFalse( handle.exists() );
+ }
}
-
-
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java b/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
index 7b72111..cec0197 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/translators/TestClassifierTypeTranslator.java
@@ -45,7 +45,6 @@
/**
* @author brianf
- *
*/
public class TestClassifierTypeTranslator
extends AbstractDependencyMojoTestCase
@@ -53,21 +52,21 @@
Set<Artifact> artifacts = new HashSet<Artifact>();
ArtifactFactory artifactFactory;
-
+
ArtifactRepository artifactRepository;
Log log = new SilentLog();
-
+
private RepositoryManager repoManager;
-
+
private ProjectBuildingRequest buildingRequest;
-
+
private ArtifactHandlerManager artifactHandlerManager;
protected void setUp()
throws Exception
{
- super.setUp( "classifiertype-translator", false);
+ super.setUp( "classifiertype-translator", false );
artifactHandlerManager = new DefaultArtifactHandlerManager();
this.setVariableValueToObject( artifactHandlerManager, "artifactHandlers", new HashMap() );
@@ -76,19 +75,18 @@
this.setVariableValueToObject( artifactFactory, "artifactHandlerManager", artifactHandlerManager );
artifactRepository = new StubArtifactRepository( null );
-
+
DependencyArtifactStubFactory factory = new DependencyArtifactStubFactory( null, false );
artifacts = factory.getMixedArtifacts();
-
+
repoManager = lookup( RepositoryManager.class );
-
- MavenSession session = newMavenSession( new MavenProjectStub() );
+
+ MavenSession session = newMavenSession( new MavenProjectStub() );
buildingRequest = session.getProjectBuildingRequest();
-
+
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( stubFactory.getWorkingDir() ) );
-
}
public void testNullClassifier()
@@ -112,12 +110,12 @@
{
Iterator<ArtifactCoordinate> resultIter = results.iterator();
boolean found = false;
- while (resultIter.hasNext())
+ while ( resultIter.hasNext() )
{
ArtifactCoordinate translatedArtifact = resultIter.next();
- if (artifact.getArtifactId().equals(translatedArtifact.getArtifactId())
- && artifact.getGroupId().equals(translatedArtifact.getGroupId())
- /*&& artifact.getScope().equals(translatedArtifact.getScope())*/)
+ if ( artifact.getArtifactId().equals( translatedArtifact.getArtifactId() )
+ && artifact.getGroupId().equals( translatedArtifact.getGroupId() )
+ /* && artifact.getScope().equals(translatedArtifact.getScope()) */ )
{
// classifier is null, should be the same as the artifact
assertEquals( artifact.getClassifier(), translatedArtifact.getClassifier() );
@@ -157,7 +155,7 @@
ArtifactCoordinate translatedArtifact = resultIter.next();
if ( artifact.getArtifactId() == translatedArtifact.getArtifactId()
&& artifact.getGroupId() == translatedArtifact.getGroupId()
- /*&& artifact.getScope() == translatedArtifact.getScope()*/ )
+ /* && artifact.getScope() == translatedArtifact.getScope() */ )
{
// classifier is null, should be the same as the artifact
assertEquals( classifier, translatedArtifact.getClassifier() );
@@ -187,7 +185,7 @@
ArtifactCoordinate translatedArtifact = resultIter.next();
if ( artifact.getArtifactId() == translatedArtifact.getArtifactId()
&& artifact.getGroupId() == translatedArtifact.getGroupId()
- /*&& artifact.getScope() == translatedArtifact.getScope()*/ )
+ /* && artifact.getScope() == translatedArtifact.getScope() */ )
{
assertEquals( translatedArtifact.getClassifier(), classifier );
assertEquals( translatedArtifact.getExtension(), type );
diff --git a/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java b/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java
index d06fb4c..81b9195 100644
--- a/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java
+++ b/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java
@@ -19,11 +19,9 @@
* under the License.
*/
-
/**
- * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS
- *
- * Interpolator interface. Based on existing RegexBasedInterpolator interface.
+ * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS Interpolator interface. Based on existing RegexBasedInterpolator
+ * interface.
*
* @author cstamas
* @deprecated Use plexus-interpolation APIs instead.
diff --git a/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java b/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java
index a451a94..9e0f6a7 100644
--- a/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java
+++ b/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java
@@ -19,7 +19,6 @@
* under the License.
*/
-
import java.util.List;
/**
@@ -42,15 +41,12 @@
super( valueSources );
}
- public RegexBasedInterpolator( String startRegex,
- String endRegex,
- List valueSources )
+ public RegexBasedInterpolator( String startRegex, String endRegex, List valueSources )
{
super( startRegex, endRegex, valueSources );
}
- public RegexBasedInterpolator( String startRegex,
- String endRegex )
+ public RegexBasedInterpolator( String startRegex, String endRegex )
{
super( startRegex, endRegex );
}
diff --git a/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java b/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java
index 03ee3c3..05d6bef 100644
--- a/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java
+++ b/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java
@@ -19,7 +19,6 @@
* under the License.
*/
-
/**
* COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS
*
@@ -27,7 +26,8 @@
* @deprecated Use plexus-interpolation APIs instead.
* @version $Id: ValueSource.java 12174 2010-05-16 21:04:35Z rfscholte $
*/
-public interface ValueSource extends org.codehaus.plexus.interpolation.ValueSource
+public interface ValueSource
+ extends org.codehaus.plexus.interpolation.ValueSource
{
}