You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/04/21 23:09:24 UTC

svn commit: r164123 - in /maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean: RepositoryCleaner.java translate/PomV3ToV4Translator.java

Author: jdcasey
Date: Thu Apr 21 14:09:23 2005
New Revision: 164123

URL: http://svn.apache.org/viewcvs?rev=164123&view=rev
Log:
Fixed plus-to-minus formatting for pom translation, and for bridged pom file creation.

Modified:
    maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java
    maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomV3ToV4Translator.java

Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java?rev=164123&r1=164122&r2=164123&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java Thu Apr 21 14:09:23 2005
@@ -368,7 +368,7 @@
 
                         transaction.addFile( targetPom );
 
-                        File bridgedTargetPom = new File( targetRepositoryBase, bridgingLayout.pathOfMetadata( pom ) );
+                        File bridgedTargetPom = new File( targetRepositoryBase, bridgingLayout.pathOfMetadata( pom ).replace('+', '-') );
 
                         transaction.addFile( bridgedTargetPom );
 

Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomV3ToV4Translator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomV3ToV4Translator.java?rev=164123&r1=164122&r2=164123&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomV3ToV4Translator.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomV3ToV4Translator.java Thu Apr 21 14:09:23 2005
@@ -63,10 +63,10 @@
     {
         try
         {
-            String groupId = v3Model.getGroupId();
-            String artifactId = v3Model.getArtifactId();
+            String groupId = format( v3Model.getGroupId() );
+            String artifactId = format( v3Model.getArtifactId() );
 
-            String id = v3Model.getId();
+            String id = format( v3Model.getId() );
             if ( StringUtils.isNotEmpty( id ) )
             {
                 if ( StringUtils.isEmpty( groupId ) )
@@ -80,10 +80,10 @@
                 }
             }
 
-            String version = v3Model.getCurrentVersion();
+            String version = format( v3Model.getCurrentVersion() );
             if ( version == null )
             {
-                version = v3Model.getVersion();
+                version = format( v3Model.getVersion() );
             }
 
             PomKey pomKey = new PomKey( groupId, artifactId, version );
@@ -94,7 +94,7 @@
             try
             {
                 model = new Model();
-                model.setArtifactId( v3Model.getArtifactId() );
+                model.setArtifactId( artifactId );
 
                 // moved this above the translation of the build, to allow
                 // additional plugins to be defined in v3 poms via 
@@ -110,7 +110,7 @@
 
                 model.setDistributionManagement( translateDistributionManagement( pomKey, v3Model ) );
 
-                model.setGroupId( v3Model.getGroupId() );
+                model.setGroupId( groupId );
                 model.setInceptionYear( v3Model.getInceptionYear() );
                 model.setIssueManagement( translateIssueManagement( v3Model ) );
 
@@ -139,6 +139,11 @@
         }
     }
 
+    private String format( String source )
+    {
+        return (source == null)?(null):(source.replace('+', '-'));
+    }
+
     private CiManagement translateCiManagementInfo( org.apache.maven.model.v3_0_0.Build v3Build )
     {
         CiManagement ciMgmt = null;
@@ -501,11 +506,27 @@
             {
                 org.apache.maven.model.v3_0_0.Dependency v3Dep = (org.apache.maven.model.v3_0_0.Dependency) it.next();
 
+                String groupId = format( v3Dep.getGroupId() );
+                String artifactId = format( v3Dep.getArtifactId() );
+                
+                String id = format( v3Dep.getId() );
+                
+                if( StringUtils.isNotEmpty( id ) )
+                {
+                    if( StringUtils.isEmpty( groupId ) )
+                    {
+                        groupId = id;
+                    }
+                    
+                    if( StringUtils.isEmpty( artifactId ) )
+                    {
+                        artifactId = id;
+                    }
+                }
+
                 String type = v3Dep.getType();
                 if( "plugin".equals( type ) )
                 {
-                    String groupId = v3Dep.getGroupId();
-
                     if( "maven".equals( groupId ) )
                     {
                         groupId = "org.apache.maven.plugins";
@@ -513,8 +534,8 @@
                     
                     Plugin plugin = new Plugin();
                     plugin.setGroupId( groupId );
-                    plugin.setArtifactId( v3Dep.getArtifactId() );
-                    plugin.setVersion( v3Dep.getVersion() );
+                    plugin.setArtifactId( artifactId );
+                    plugin.setVersion( format( v3Dep.getVersion() ) );
 
                     Xpp3Dom config = new Xpp3Dom( "configuration" );
 
@@ -542,25 +563,13 @@
                 {
                     Dependency dep = new Dependency();
 
-                    String artifactId = v3Dep.getArtifactId();
-                    String groupId = v3Dep.getGroupId();
-                    
-                    if(StringUtils.isNotEmpty(artifactId) && StringUtils.isNotEmpty(groupId))
-                    {
-                        dep.setGroupId(groupId);
-                        dep.setArtifactId(artifactId);
-                    }
-                    else
-                    {
-                        dep.setGroupId(v3Dep.getId());
-                        dep.setArtifactId(v3Dep.getId());
-                    }
-
+                    dep.setGroupId(groupId);
+                    dep.setArtifactId(artifactId);
                     dep.setVersion( v3Dep.getVersion() );
                     dep.setType( v3Dep.getType() );
                     
                     String scope = v3Dep.getProperty( "scope" );
-                    if( scope != null && scope.trim().length() > 0 )
+                    if( StringUtils.isNotEmpty( scope ) )
                     {
                         dep.setScope( scope );
                     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org