maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r552364 - /maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
Date Sun, 01 Jul 2007 21:21:54 GMT
Author: dennisl
Date: Sun Jul  1 14:21:53 2007
New Revision: 552364

URL: http://svn.apache.org/viewvc?view=rev&rev=552364
Log:
[MNG-3081] [maven-model-converter] Convert reports

o Previously only reports that were also declared as plugin dependencies were added to the
V4 pom.
o Re-enabled the code that was in there, but commented out.
o Changed the default groupId of the reportPlugins to make it work well with the plugin relocators.

Modified:
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java

Modified: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java?view=diff&rev=552364&r1=552363&r2=552364
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
(original)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
Sun Jul  1 14:21:53 2007
@@ -33,6 +33,8 @@
 import org.apache.maven.model.Notifier;
 import org.apache.maven.model.Organization;
 import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.Reporting;
 import org.apache.maven.model.Resource;
 import org.apache.maven.model.Scm;
 import org.apache.maven.model.Site;
@@ -44,6 +46,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @author jdcasey
@@ -129,8 +133,8 @@
             model.setName( v3Model.getName() );
             model.setOrganization( translateOrganization( v3Model.getOrganization() ) );
             model.setPackaging( "jar" );
-            // TODO: not very good conversion - just omit for now
-//                model.setReporting( translateReports( v3Model.getReports(), reporter )
);
+            // TODO: Not a very good conversion - but it's better than nothing
+            model.setReporting( translateReports( v3Model.getReports() ) );
             model.setScm( translateScm( v3Model ) );
             model.setUrl( v3Model.getUrl() );
 
@@ -236,9 +240,7 @@
         return scm;
     }
 
-/*
-    private Reporting translateReports( List v3Reports, Reporter reporter )
-        throws ReportWriteException
+    private Reporting translateReports( List v3Reports )
     {
         Reporting reports = null;
         if ( v3Reports != null && !v3Reports.isEmpty() )
@@ -251,42 +253,37 @@
                 Pattern pluginNamePattern = Pattern.compile( "maven-(.+)-plugin" );
                 Matcher matcher = pluginNamePattern.matcher( reportName );
 
-                String reportPluginName;
                 if ( !matcher.matches() )
                 {
                     warnings.add(
-                        "Non-standard report name: \'" + reportName + "\'. Using entire name
for plugin artifactId." );
-
-                    reportPluginName = reportName;
+                        "Non-standard report: \'" + reportName + "\'. Skipping this one."
);
                 }
                 else
                 {
-                    reportPluginName = matcher.group( 1 );
-                }
+                    ReportPlugin reportPlugin = new ReportPlugin();
 
-                ReportPlugin reportPlugin = new ReportPlugin();
+                    reportPlugin.setGroupId( "org.apache.maven.plugins" );
 
-                reportPlugin.setGroupId( "maven" );
+                    reportPlugin.setArtifactId( reportName );
 
-                reportPlugin.setArtifactId( reportPluginName );
+                    StringBuffer info = new StringBuffer();
 
-                StringBuffer info = new StringBuffer();
+                    info.append( "Using some derived information for report: \'" ).append(
reportName ).append( "\'.\n" )
+                        .append( "\to groupId: \'" ).append(reportPlugin.getGroupId()).append("\'\n"
)
+                        .append( "\to artifactId: \'" ).append( reportName ).append( "\'\n"
)
+                        .append( "\to goal: \'report\'\n" )
+                        .append( "\n" )
+                        .append( "These values were extracted using the v3 report naming
convention, but may be wrong." );
 
-                info.append( "Using some derived information for report: \'" ).append( reportName
).append( "\'.\n" )
-                    .append( "\to groupId: \'maven\'\n" ).append( "\to artifactId: \'" ).append(
reportPluginName )
-                    .append( "\'\n" ).append( "\to goal: \'report\'\n" )
-                    .append( "\n" )
-                    .append( "These values were extracted using the v3 report naming convention,
but may be wrong." );
+                    warnings.add( info.toString() );
 
-                warnings.add( info.toString() );
-
-                reports.addPlugin( reportPlugin );
+                    reports.addPlugin( reportPlugin );
+                }
             }
         }
 
         return reports;
     }
-*/
 
     private Organization translateOrganization( org.apache.maven.model.v3_0_0.Organization
v3Organization )
     {



Mime
View raw message