maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r519529 - in /maven/plugins/trunk/maven-dependency-plugin: pom.xml src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java src/site/apt/introduction.apt
Date Sun, 18 Mar 2007 03:08:08 GMT
Author: brianf
Date: Sat Mar 17 20:08:08 2007
New Revision: 519529

URL: http://svn.apache.org/viewvc?view=rev&rev=519529
Log: (empty)

Removed:
    maven/plugins/trunk/maven-dependency-plugin/src/site/apt/introduction.apt
Modified:
    maven/plugins/trunk/maven-dependency-plugin/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java

Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?view=diff&rev=519529&r1=519528&r2=519529
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Sat Mar 17 20:08:08 2007
@@ -115,11 +115,6 @@
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.maven</groupId>
-			<artifactId>maven-core</artifactId>
-			<version>2.0.5</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven</groupId>
 			<artifactId>maven-artifact</artifactId>
 			<version>2.0.5</version>
 		</dependency>

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java?view=diff&rev=519529&r1=519528&r2=519529
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java
Sat Mar 17 20:08:08 2007
@@ -38,9 +38,12 @@
 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="http://jira.codehaus.org/browse/MNG-1577">MNG-1577</a>
for more info. 
- *  Note: Because Maven 2.0.6 fixes the problems this mojo is meant to detect, it will do
nothing in versions of Maven greater than 2.0.5.
+ * 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="http://jira.codehaus.org/browse/MNG-1577">MNG-1577</a> for more info.
+ * This mojo is also usefull 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: AnalyzeMojo.java 519377 2007-03-17 17:37:26Z brianf $
@@ -70,6 +73,13 @@
     private boolean failBuild = false;
 
     /**
+     * Ignore Direct Dependency Overrides of dependencyManagement section.
+     * 
+     * @parameter expression="${mdep.analyze.ignore.direct}"
+     */
+    private boolean ignoreDirect = true;
+
+    /**
      * Used to look up Artifacts in the remote repository.
      * 
      * @parameter expression="${component.org.apache.maven.execution.RuntimeInformation}"
@@ -86,22 +96,17 @@
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-        ArtifactVersion version = rti.getApplicationVersion();
-        ArtifactVersion checkVersion = new DefaultArtifactVersion( "2.0.6" );
-        if ( version.compareTo( checkVersion ) < 0 )
+        boolean result = checkDependencyManagement();
+        if ( result )
         {
-            boolean result = checkDependencyManagement();
-            if ( result )
-            {
-                if ( this.failBuild )
+            if ( this.failBuild )
 
-                {
-                    throw new MojoExecutionException( "Found Dependency errors." );
-                }
-                else
-                {
-                    getLog().warn( "Potential problems found in Dependency Management " );
-                }
+            {
+                throw new MojoExecutionException( "Found Dependency errors." );
+            }
+            else
+            {
+                getLog().warn( "Potential problems found in Dependency Management " );
             }
         }
     }
@@ -134,11 +139,15 @@
             }
 
             Set allDependencies = project.getArtifacts();
-            
-            //don't warn if a dependency that is directly listed overrides depMgt. That's
ok.
-            Set directDependencies = project.getDependencyArtifacts();
-            allDependencies.removeAll( directDependencies );
-       
+
+            // don't warn if a dependency that is directly listed overrides
+            // depMgt. That's ok.
+            if ( this.ignoreDirect )
+            {
+                Set directDependencies = project.getDependencyArtifacts();
+                allDependencies.removeAll( directDependencies );
+            }
+
             iter = allDependencies.iterator();
             while ( iter.hasNext() )
             {
@@ -232,10 +241,28 @@
     }
 
     /**
-     * @param theRti the rti to set
+     * @param theRti
+     *            the rti to set
      */
     public void setRti( RuntimeInformation theRti )
     {
         this.rti = theRti;
+    }
+
+    /**
+     * @return the ignoreDirect
+     */
+    public boolean isIgnoreDirect()
+    {
+        return this.ignoreDirect;
+    }
+
+    /**
+     * @param theIgnoreDirect
+     *            the ignoreDirect to set
+     */
+    public void setIgnoreDirect( boolean theIgnoreDirect )
+    {
+        this.ignoreDirect = theIgnoreDirect;
     }
 }

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java?view=diff&rev=519529&r1=519528&r2=519529
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
Sat Mar 17 20:08:08 2007
@@ -81,6 +81,13 @@
      * @readonly
      */
     protected RuntimeInformation rti;
+    
+    /**
+     * Ignore Direct Dependency Overrides of dependencyManagement section.
+     * 
+     * @parameter expression="${mdep.analyze.ignore.direct}"
+     */
+    private boolean ignoreDirect = true;
 
     // Mojo methods -----------------------------------------------------------
 
@@ -104,6 +111,7 @@
         adm.setFailBuild( this.failBuild );
         adm.setPluginContext( this.getPluginContext() );
         adm.setRti( rti );
+        adm.setIgnoreDirect( this.ignoreDirect );
         adm.execute();
     }
 



Mime
View raw message