You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2007/11/27 08:44:52 UTC

svn commit: r598543 - in /maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse: EclipseToMavenMojo.java MakeArtifactsMojo.java

Author: carlos
Date: Mon Nov 26 23:44:51 2007
New Revision: 598543

URL: http://svn.apache.org/viewvc?rev=598543&view=rev
Log:
Do not resolve version ranges by default

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java?rev=598543&r1=598542&r2=598543&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java Mon Nov 26 23:44:51 2007
@@ -69,7 +69,7 @@
  * directory, copy plugins jars to the local maven repo, and generates appropriate poms. This is the official central
  * repository builder for Eclipse plugins, so it has the necessary default values. For customized repositories see
  * {@link MakeArtifactsMojo} Typical usage:
- * <code>mvn eclipse:to-maven -DdeployTo=maven.org::default::scpexe://repo1.maven.org/home/maven/repository-staging/to-ibiblio/eclipse -DeclipseDir=.</code>
+ * <code>mvn eclipse:to-maven -DdeployTo=maven.org::default::scpexe://repo1.maven.org/home/maven/repository-staging/to-ibiblio/eclipse-staging -DeclipseDir=.</code>
  * 
  * @author Fabrizio Giustina
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
@@ -200,31 +200,8 @@
             File file = files[j];
 
             getLog().info( "Processing file " + file.getAbsolutePath() );
-
-            EclipseOsgiPlugin plugin = getEclipsePlugin( file );
-
-            if ( plugin == null )
-            {
-                getLog().warn( "Skipping file " + file.getAbsolutePath() );
-                continue;
-            }
-
-            Model model = createModel( plugin );
-
-            if ( model == null )
-            {
-                continue;
-            }
-
-            if ( plugins.containsKey( getKey( model ) ) )
-            {
-                throw new MojoFailureException(
-                                                "There are two versions of the same plugin, can not resolve versions: " +
-                                                    getKey( model ) );
-            }
-
-            plugins.put( getKey( model ), plugin );
-            models.put( getKey( model ), model );
+            
+            processFile(file, plugins, models);
         }
 
         int i = 1;
@@ -234,17 +211,44 @@
             String key = (String) it.next();
             EclipseOsgiPlugin plugin = (EclipseOsgiPlugin) plugins.get( key );
             Model model = (Model) models.get( key );
-            resolveVersionRanges( model, models );
             writeArtifact( plugin, model, remoteRepo );
         }
     }
 
-    private String getKey( Model model )
+    protected void processFile( File file, Map plugins, Map models )
+        throws MojoExecutionException, MojoFailureException
+    {
+        EclipseOsgiPlugin plugin = getEclipsePlugin( file );
+
+        if ( plugin == null )
+        {
+            getLog().warn( "Skipping file " + file.getAbsolutePath() );
+            return;
+        }
+
+        Model model = createModel( plugin );
+
+        if ( model == null )
+        {
+            return;
+        }
+
+        processPlugin( plugin, model, plugins, models );
+    }
+
+    protected void processPlugin( EclipseOsgiPlugin plugin, Model model, Map plugins, Map models )
+        throws MojoExecutionException, MojoFailureException
+    {
+        plugins.put( getKey( model ), plugin );
+        models.put( getKey( model ), model );
+    }
+
+    protected String getKey( Model model )
     {
         return model.getGroupId() + "." + model.getArtifactId();
     }
 
-    private String getKey( Dependency dependency )
+    private String getKey(Dependency dependency)
     {
         return dependency.getGroupId() + "." + dependency.getArtifactId();
     }
@@ -396,7 +400,7 @@
 
         return model;
     }
-
+    
     /**
      * Writes the artifact to the repo
      * 

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java?rev=598543&r1=598542&r2=598543&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java Mon Nov 26 23:44:51 2007
@@ -22,7 +22,9 @@
 import java.util.StringTokenizer;
 
 import org.apache.maven.model.Model;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.eclipse.osgiplugin.EclipseOsgiPlugin;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -122,4 +124,17 @@
             // do nothing
         }
     }
+
+    protected void processPlugin( EclipseOsgiPlugin plugin, Model model, Map plugins, Map models )
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( this.resolveVersionRanges && plugins.containsKey( getKey( model ) ) )
+        {
+            throw new MojoFailureException( "There are two versions of the same plugin, can not resolve versions: "
+                + getKey( model ) );
+        }
+
+        super.processPlugin( plugin, model, plugins, models );
+    }
+
 }