You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2007/09/17 15:36:44 UTC

svn commit: r576428 - /maven/plugins/branches/maven-dependency-plugin-tree-1.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java

Author: markh
Date: Mon Sep 17 06:36:43 2007
New Revision: 576428

URL: http://svn.apache.org/viewvc?rev=576428&view=rev
Log:
Formatting

Modified:
    maven/plugins/branches/maven-dependency-plugin-tree-1.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java

Modified: maven/plugins/branches/maven-dependency-plugin-tree-1.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-dependency-plugin-tree-1.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java?rev=576428&r1=576427&r2=576428&view=diff
==============================================================================
--- maven/plugins/branches/maven-dependency-plugin-tree-1.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java (original)
+++ maven/plugins/branches/maven-dependency-plugin-tree-1.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java Mon Sep 17 06:36:43 2007
@@ -34,11 +34,9 @@
 import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 
-
 /**
- * This goal analyzes your project's dependencies and lists dependencies that
- * should be declared, but are not, and dependencies that are declared but
- * unused. It also executes the analyze-dep-mgt goal.
+ * This goal analyzes your project's dependencies and lists dependencies that should be declared, but are not, and
+ * dependencies that are declared but unused. It also executes the analyze-dep-mgt goal.
  * 
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
  * @version $Id$
@@ -62,6 +60,15 @@
     private MavenProject project;
 
     /**
+     * 
+     * 
+     * @parameter expression="${component.org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer}"
+     * @required
+     * @readonly
+     */
+    private ProjectDependencyAnalyzer analyzer;
+
+    /**
      * Fail Build on problem
      * 
      * @parameter expression="${mdep.analyze.failBuild}" default-value="false"
@@ -76,52 +83,45 @@
     private boolean displayUsed;
 
     /**
-     * 
-     * 
-     * @parameter expression="${component.org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer}"
-     * @required
-     * @readonly
-     */
-    private ProjectDependencyAnalyzer analyzer;
-
-    /**
      * Ignore Runtime,Provide,Test,System scopes for unused dependency analysis
      * 
-     * @parameter expression="${mdep.analyze.ignore.noncompile}"
-     *            default-value="true"
+     * @parameter expression="${mdep.analyze.ignore.noncompile}" default-value="true"
      */
     private boolean ignoreNonCompile;
 
     /**
      * Output the xml for the missing dependencies
-     * @since 2.0-alpha-5
+     * 
      * @parameter expression="${mdep.analyze.outputXML}" default-value="true"
+     * @since 2.0-alpha-5
      */
     private boolean outputXML;
-    
+
     /**
      * Output scriptable values
-     * @since 2.0-alpha-5
+     * 
      * @parameter expression="${mdep.analyze.scriptable}" default-value="false"
+     * @since 2.0-alpha-5
      */
     private boolean scriptableOutput;
-    
+
     /**
      * Flag to use for scriptable output
-     * @since 2.0-alpha-5
+     * 
      * @parameter expression="${mdep.analyze.flag}" default-value="$$$%%%"
+     * @since 2.0-alpha-5
      */
     private String scriptableFlag;
-    
+
     /**
      * Flag to use for scriptable output
      * 
-     * @parameter expression="${basedir}" 
+     * @parameter expression="${basedir}"
      * @readonly
      * @since 2.0-alpha-5
      */
     private File baseDir;
-    
+
     /**
      * Target folder
      * 
@@ -203,13 +203,13 @@
             {
                 writeDependencyXML( usedUndeclared );
             }
-            if (scriptableOutput)
+            if ( scriptableOutput )
             {
                 writeScriptableOutput( usedUndeclared );
             }
 
             if ( ( usedUndeclared != null && !usedUndeclared.isEmpty() ) || unusedDeclared != null
-                && !unusedDeclared.isEmpty() )
+                            && !unusedDeclared.isEmpty() )
             {
                 getLog().warn( "Potential problems discovered." );
                 result = true;
@@ -234,10 +234,10 @@
             for ( Iterator iterator = artifacts.iterator(); iterator.hasNext(); )
             {
                 Artifact artifact = (Artifact) iterator.next();
-                
-                //called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
+
+                // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
                 artifact.isSnapshot();
-                
+
                 if ( warn )
                 {
                     getLog().warn( "   " + artifact );
@@ -265,9 +265,9 @@
             {
                 Artifact artifact = (Artifact) iter.next();
 
-                //called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
+                // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
                 artifact.isSnapshot();
-                
+
                 writer.startElement( "dependency" );
                 writer.startElement( "groupId" );
                 writer.writeText( artifact.getGroupId() );
@@ -276,7 +276,7 @@
                 writer.writeText( artifact.getArtifactId() );
                 writer.endElement();
                 writer.startElement( "version" );
-                writer.writeText( artifact.getBaseVersion());
+                writer.writeText( artifact.getBaseVersion() );
                 writer.endElement();
 
                 if ( !Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
@@ -292,24 +292,26 @@
         }
     }
     
-   public void writeScriptableOutput(Set artifacts)
+    public void writeScriptableOutput( Set artifacts )
     {
-       if ( !artifacts.isEmpty() )
-       {
-           getLog().info( "Missing dependencies: " );
-           String pomFile = baseDir.getAbsolutePath()+File.separatorChar+"pom.xml";
-           StringBuffer buf = new StringBuffer();
-           Iterator iter = artifacts.iterator();
-           while ( iter.hasNext() )
-           {
-               Artifact artifact = (Artifact) iter.next();
-               
-               //called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
-               artifact.isSnapshot();
-               
-               buf.append( scriptableFlag+":"+pomFile+":"+artifact.getDependencyConflictId()+":"+artifact.getClassifier()+":"+artifact.getBaseVersion()+":"+artifact.getScope()+"\n");
-           }
-           getLog().info( "\n" +buf);
-       }
+        if ( !artifacts.isEmpty() )
+        {
+            getLog().info( "Missing dependencies: " );
+            String pomFile = baseDir.getAbsolutePath() + File.separatorChar + "pom.xml";
+            StringBuffer buf = new StringBuffer();
+            Iterator iter = artifacts.iterator();
+            while ( iter.hasNext() )
+            {
+                Artifact artifact = (Artifact) iter.next();
+
+                // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
+                artifact.isSnapshot();
+
+                buf.append( scriptableFlag + ":" + pomFile + ":" + artifact.getDependencyConflictId() + ":"
+                                + artifact.getClassifier() + ":" + artifact.getBaseVersion() + ":"
+                                + artifact.getScope() + "\n" );
+            }
+            getLog().info( "\n" + buf );
+        }
     }
 }