You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ev...@apache.org on 2006/07/20 10:34:19 UTC
svn commit: r423824 [1/3] - in
/maven/components/branches/maven-2.0.x/maven-model-converter: ./
src/main/java/org/apache/maven/model/converter/
src/main/java/org/apache/maven/model/converter/plugins/
src/main/java/org/apache/maven/model/converter/reloc...
Author: evenisse
Date: Thu Jul 20 01:34:11 2006
New Revision: 423824
URL: http://svn.apache.org/viewvc?rev=423824&view=rev
Log:
merge with 423516
o Add m1 -> m2 project converter
o Convert it to plexus components
Added:
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCWar.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PluginConfigurationConverter.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PropertyUtils.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/AbstractPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/AbstractSourceForgePluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/CoberturaPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/DefaultPluginRelocatorManager.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/DeveloperActivityPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/FaqPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/FileActivityPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/FindbugsPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JdependPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JdiffPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JunitReportPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/LicenseRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/NoSuchPluginRelocatorException.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/PluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/PluginRelocatorManager.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/SimianPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/TasklistPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/XdocPluginRelocator.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/AbstractPCCTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCChangelogTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCChangesTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCCheckstyleTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCCompilerTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJarTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJavadocTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCPmdTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCSurefireTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCWarTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PropertyUtilsTest.java (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCChangelogTest1.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCChangelogTest2.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCChangelogTest3.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCChangesTest.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCCheckstyleTest1.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCCheckstyleTest2.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCCheckstyleTest3.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCCompilerTest.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCJarTest.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCJavadocTest1.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCJavadocTest2.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCJavadocTest3.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCPmdTest.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCSureFireTest1.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCSureFireTest2.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCSureFireTest3.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCTaglistTest.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCWarTest1.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCWarTest2.properties (with props)
maven/components/branches/maven-2.0.x/maven-model-converter/src/test/resources/PCCWarTest3.properties (with props)
Removed:
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/resources/
Modified:
maven/components/branches/maven-2.0.x/maven-model-converter/pom.xml
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java
maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java
Modified: maven/components/branches/maven-2.0.x/maven-model-converter/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/pom.xml?rev=423824&r1=423823&r2=423824&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/pom.xml (original)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/pom.xml Thu Jul 20 01:34:11 2006
@@ -45,7 +45,26 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
- <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.4</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,295 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.converter.plugins.PluginConfigurationConverter;
+import org.apache.maven.model.converter.relocators.PluginRelocator;
+import org.apache.maven.model.converter.relocators.PluginRelocatorManager;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Converts a Maven 1 project.xml (v3 pom) to a Maven 2 pom.xml (v4 pom).
+ *
+ * @author Fabrizio Giustina
+ * @author Dennis Lundberg
+ * @version $Id$
+ * @plexus.component role="org.apache.maven.model.converter.Maven1Converter"
+ */
+public class Maven1Converter
+ extends AbstractLogEnabled
+{
+ private File basedir;
+
+ /**
+ * Available converters for specific plugin configurations
+ *
+ * @plexus.requirement role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter"
+ */
+ private List converters;
+
+ /**
+ * Plexus component that manages plugin relocators
+ *
+ * @component
+ */
+ private PluginRelocatorManager pluginRelocatorManager;
+
+ public void execute()
+ throws ProjectConverterException
+ {
+ File projectxml = new File( basedir, "project.xml" );
+
+ if ( !projectxml.exists() )
+ {
+ throw new ProjectConverterException( "Missing project.xml in " + basedir.getAbsolutePath() );
+ }
+
+ PomV3ToV4Translator translator = new PomV3ToV4Translator();
+
+ org.apache.maven.model.v3_0_0.Model v3Model;
+ try
+ {
+ v3Model = loadV3Pom( projectxml );
+ }
+ catch ( Exception e )
+ {
+ throw new ProjectConverterException( "Exception caught while loading project.xml. " + e.getMessage(), e );
+ }
+
+ Model v4Model;
+ try
+ {
+ v4Model = translator.translate( v3Model );
+ removeDistributionManagementStatus( v4Model );
+ }
+ catch ( Exception e )
+ {
+ throw new ProjectConverterException( "Exception caught while converting project.xml. " + e.getMessage(),
+ e );
+ }
+
+ Properties properties = new Properties();
+
+ if ( v3Model.getExtend() != null )
+ {
+ loadProperties( properties, new File( new File( basedir, v3Model.getExtend() ).getParentFile(),
+ "project.properties" ) );
+ }
+
+ loadProperties( properties, new File( basedir, "project.properties" ) );
+
+ for ( Iterator i = converters.iterator(); i.hasNext(); )
+ {
+ PluginConfigurationConverter converter = (PluginConfigurationConverter) i.next();
+ converter.convertConfiguration( v4Model, v3Model, properties );
+ }
+
+ // @todo Should this be run before or after the configuration converters?
+ Collection pluginRelocators = pluginRelocatorManager.getPluginRelocators();
+ getLogger().info( "There are " + pluginRelocators.size() + " plugin relocators available" );
+ PluginRelocator pluginRelocator;
+ Iterator iterator = pluginRelocators.iterator();
+ while ( iterator.hasNext() )
+ {
+ pluginRelocator = (PluginRelocator) iterator.next();
+ pluginRelocator.relocate( v4Model );
+ }
+
+ writeV4Pom( v4Model );
+ }
+
+ private boolean isEmpty( String value )
+ {
+ return value == null || value.trim().length() == 0;
+ }
+
+ private void loadProperties( Properties properties, File propertiesFile )
+ {
+ if ( propertiesFile.exists() )
+ {
+ InputStream is = null;
+ try
+ {
+ is = new FileInputStream( propertiesFile );
+ properties.load( is );
+ }
+ catch ( IOException e )
+ {
+ getLogger().warn( "Unable to read " + propertiesFile.getAbsolutePath() + ", ignoring." );
+ }
+ finally
+ {
+ IOUtil.close( is );
+ }
+ }
+ }
+
+ private org.apache.maven.model.v3_0_0.Model loadV3Pom( File inputFile )
+ throws Exception
+ {
+ MavenXpp3Reader v3Reader = new MavenXpp3Reader();
+
+ org.apache.maven.model.v3_0_0.Model model;
+
+ model = v3Reader.read( new FileReader( inputFile ) );
+
+ SAXReader r = new SAXReader();
+
+ Document d = r.read( new FileReader( inputFile ) );
+
+ Element root = d.getRootElement();
+
+ Element idElement = root.element( "id" );
+
+ String id = null;
+
+ if ( idElement != null )
+ {
+ id = idElement.getText();
+ }
+ // String id = model.getId();
+
+ String groupId = model.getGroupId();
+
+ String artifactId = model.getArtifactId();
+
+ if ( !isEmpty( id ) )
+ {
+ int i = id.indexOf( "+" );
+
+ int j = id.indexOf( ":" );
+
+ if ( i > 0 )
+ {
+ model.setGroupId( id.substring( 0, i ) );
+
+ model.setArtifactId( id.replace( '+', '-' ) );
+ }
+ else if ( j > 0 )
+ {
+ model.setGroupId( id.substring( 0, j ) );
+
+ model.setArtifactId( id.substring( j + 1 ) );
+ }
+ else
+ {
+ model.setGroupId( id );
+
+ model.setArtifactId( id );
+ }
+
+ if ( !isEmpty( groupId ) )
+ {
+ getLogger().warn( "Both <id> and <groupId> is set, using <groupId>." );
+
+ model.setGroupId( groupId );
+ }
+
+ if ( !isEmpty( artifactId ) )
+ {
+ getLogger().warn( "Both <id> and <artifactId> is set, using <artifactId>." );
+
+ model.setArtifactId( artifactId );
+ }
+ }
+
+ return model;
+ }
+
+ /**
+ * The status element of the distributionManagement section must not be
+ * set in local projects. This method removes that element from the model.
+ */
+ private void removeDistributionManagementStatus( Model v4Model )
+ {
+ if ( v4Model.getDistributionManagement() != null )
+ {
+ if ( "converted".equals( v4Model.getDistributionManagement().getStatus() ) )
+ {
+ v4Model.getDistributionManagement().setStatus( null );
+ }
+ }
+ }
+
+ /**
+ * Write the pom to <code>${basedir}/pom.xml</code>. If the file exists it
+ * will be overwritten.
+ *
+ * @param v4Model
+ * @throws ProjectConverterException
+ */
+ private void writeV4Pom( Model v4Model )
+ throws ProjectConverterException
+ {
+ File pomxml = new File( basedir, "pom.xml" );
+
+ if ( pomxml.exists() )
+ {
+ getLogger().warn( "pom.xml in " + basedir.getAbsolutePath() + " already exists, overwriting" );
+ }
+
+ MavenXpp3Writer v4Writer = new MavenXpp3Writer();
+
+ // write the new pom.xml
+ getLogger().info( "Writing new pom to: " + pomxml.getAbsolutePath() );
+
+ Writer output = null;
+ try
+ {
+ output = new FileWriter( pomxml );
+ v4Writer.write( output, v4Model );
+ output.close();
+ }
+ catch ( IOException e )
+ {
+ throw new ProjectConverterException( "Unable to write pom.xml. " + e.getMessage(), e );
+ }
+ finally
+ {
+ IOUtil.close( output );
+ }
+ }
+
+ public File getBasedir()
+ {
+ return basedir;
+ }
+
+ public void setBasedir( File basedir )
+ {
+ this.basedir = basedir;
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,86 @@
+package org.apache.maven.model.converter;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+
+import java.util.Iterator;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Utility class which features various methods associated with Maven model.
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class ModelUtils
+{
+ /**
+ * Try to find a build plugin in a model.
+ *
+ * @param model Look for the build plugin in this model
+ * @param groupId The groupId for the build plugin to look for
+ * @param artifactId The artifactId for the build plugin to look for
+ * @return The requested build plugin if it exists, otherwise null
+ */
+ public static Plugin findBuildPlugin( Model model, String groupId, String artifactId )
+ {
+ if ( model.getBuild() == null || model.getBuild().getPlugins() == null )
+ {
+ return null;
+ }
+
+ Iterator iterator = model.getBuild().getPlugins().iterator();
+ while ( iterator.hasNext() )
+ {
+ Plugin plugin = (Plugin) iterator.next();
+ if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
+ {
+ return plugin;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Try to find a report plugin in a model.
+ *
+ * @param model Look for the report plugin in this model
+ * @param groupId The groupId for the report plugin to look for
+ * @param artifactId The artifactId for the report plugin to look for
+ * @return The requested report plugin if it exists, otherwise null
+ */
+ public static ReportPlugin findReportPlugin( Model model, String groupId, String artifactId )
+ {
+ if ( model.getReporting() == null || model.getReporting().getPlugins() == null )
+ {
+ return null;
+ }
+
+ Iterator iterator = model.getReporting().getPlugins().iterator();
+ while ( iterator.hasNext() )
+ {
+ ReportPlugin plugin = (ReportPlugin) iterator.next();
+ if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
+ {
+ return plugin;
+ }
+ }
+ return null;
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java?rev=423824&r1=423823&r2=423824&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java (original)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java Thu Jul 20 01:34:11 2006
@@ -44,6 +44,7 @@
/**
* @author jdcasey
+ * @plexus.component role="org.apache.maven.model.converter.ModelConverter"
*/
public class PomV3ToV4Translator
implements ModelConverter
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,19 @@
+package org.apache.maven.model.converter;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class ProjectConverterException
+ extends Exception
+{
+ public ProjectConverterException( String message )
+ {
+ super( message );
+ }
+
+ public ProjectConverterException( String message, Throwable throwable )
+ {
+ super( message, throwable );
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java?rev=423824&r1=423823&r2=423824&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java (original)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java Thu Jul 20 01:34:11 2006
@@ -30,10 +30,14 @@
/**
* @author jdcasey
+ * @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v3"
*/
public class V3PomRewriter
implements ArtifactPomRewriter
{
+ /**
+ * @plexus.requirement
+ */
private ModelConverter translator;
public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
Modified: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java?rev=423824&r1=423823&r2=423824&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java (original)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java Thu Jul 20 01:34:11 2006
@@ -22,15 +22,18 @@
import java.io.Reader;
import java.io.Writer;
-import java.util.ArrayList;
import java.util.List;
/**
* @author jdcasey
+ * @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v4"
*/
public class V4PomRewriter
implements ArtifactPomRewriter
{
+ /**
+ * @plexus.requirement
+ */
private ModelConverter translator;
public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,143 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.converter.ModelUtils;
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * @author Fabrizio Giustina
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public abstract class AbstractPluginConfigurationConverter implements PluginConfigurationConverter
+{
+ public static final String TYPE_BUILD_PLUGIN = "build plugin";
+ public static final String TYPE_REPORT_PLUGIN = "report plugin";
+
+ public abstract String getArtifactId();
+
+ public String getGroupId()
+ {
+ return "org.apache.maven.plugins";
+ }
+
+ public abstract String getType();
+
+ /**
+ * Add a child element to the configuration.
+ *
+ * @param configuration The configuration to add the element to
+ * @param projectProperties The M1 properties
+ * @param mavenOneProperty The name of the Maven 1 property to convert
+ * @param mavenTwoElement The name of the Maven 2 configuration element
+ */
+ protected void addConfigurationChild( Xpp3Dom configuration, Properties projectProperties, String mavenOneProperty,
+ String mavenTwoElement )
+ {
+ String value = projectProperties.getProperty( mavenOneProperty );
+ addConfigurationChild( configuration, mavenTwoElement, value );
+ }
+
+ /**
+ * Add a child element to the configuration.
+ *
+ * @param configuration The configuration to add the element to
+ * @param mavenTwoElement The name of the Maven 2 configuration element
+ * @param value Set the value of the element to this
+ */
+ protected void addConfigurationChild( Xpp3Dom configuration, String mavenTwoElement, String value )
+ {
+ if ( value != null )
+ {
+ Xpp3Dom child = new Xpp3Dom( mavenTwoElement );
+ child.setValue( value );
+ configuration.addChild( child );
+ }
+ }
+
+ public void convertConfiguration( Model v4Model, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ boolean addPlugin = false;
+
+ Xpp3Dom configuration = new Xpp3Dom( "configuration" );
+
+ buildConfiguration( configuration, v3Model, projectProperties );
+
+ if ( configuration.getChildCount() > 0 )
+ {
+ if ( TYPE_BUILD_PLUGIN.equals( getType() ) )
+ {
+ Plugin plugin = ModelUtils.findBuildPlugin( v4Model, getGroupId(), getArtifactId() );
+ if ( plugin == null )
+ {
+ addPlugin = true;
+ plugin = new Plugin();
+ plugin.setGroupId( getGroupId() );
+ plugin.setArtifactId( getArtifactId() );
+ }
+
+ plugin.setConfiguration( configuration );
+
+ if ( addPlugin )
+ {
+ if ( v4Model.getBuild() == null )
+ {
+ v4Model.setBuild( new Build() );
+ }
+ v4Model.getBuild().addPlugin( plugin );
+ }
+ }
+ else if ( TYPE_REPORT_PLUGIN.equals( getType() ) )
+ {
+ ReportPlugin plugin = ModelUtils.findReportPlugin( v4Model, getGroupId(), getArtifactId() );
+ if ( plugin == null )
+ {
+ addPlugin = true;
+ plugin = new ReportPlugin();
+ plugin.setGroupId( getGroupId() );
+ plugin.setArtifactId( getArtifactId() );
+ }
+
+ plugin.setConfiguration( configuration );
+
+ if ( addPlugin )
+ {
+ if ( v4Model.getReporting() == null )
+ {
+ v4Model.setReporting( new Reporting() );
+ }
+ v4Model.getReporting().addPlugin( plugin );
+ }
+ }
+ }
+ }
+
+ protected abstract void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException;
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,94 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-changelog-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="changelog"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCChangelog
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-changelog-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_REPORT_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.changelog.commentFormat", "commentFormat" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.changelog.dateformat", "dateFormat" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.changelog.svn.baseurl", "tagBase" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.changelog.type", "type" );
+
+ String type = projectProperties.getProperty( "maven.changelog.type" );
+ if ( type != null )
+ {
+ if ( "date".equals( type ) )
+ {
+ Xpp3Dom dates = new Xpp3Dom( "dates" );
+ addConfigurationChild( dates, projectProperties, "maven.changelog.date", "date" );
+ if ( dates.getChildCount() > 0 )
+ {
+ configuration.addChild( dates );
+ }
+ }
+ else if ( "range".equals( type ) )
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.changelog.range", "range" );
+ }
+ else if ( "tag".equals( type ) )
+ {
+ Xpp3Dom tags = new Xpp3Dom( "tags" );
+ addConfigurationChild( tags, projectProperties, "maven.changelog.tag", "tag" );
+ if ( tags.getChildCount() > 0 )
+ {
+ configuration.addChild( tags );
+ }
+ }
+ }
+
+ // Only add this if we have any other configuration for the changelog-plugin
+ if ( configuration.getChildCount() > 0 )
+ {
+ // The Maven 1 plugin uses the same outputencoding as the generated documentation.
+ addConfigurationChild( configuration, projectProperties, "maven.docs.outputencoding", "outputEncoding" );
+ }
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,54 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-changes-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="changes"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCChanges
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-changes-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_REPORT_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.changes.issue.template", "link_template" );
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,118 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-checkstyle-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="checkstyle"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCCheckstyle
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-checkstyle-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_REPORT_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.cache.file", "cacheFile" );
+
+ String format = projectProperties.getProperty( "maven.checkstyle.format" );
+ if ( format != null )
+ {
+ String mavenTwoformat = null;
+ if ( format.equals( "avalon" ) )
+ {
+ mavenTwoformat = "config/avalon_checks.xml";
+ }
+ else if ( format.equals( "turbine" ) )
+ {
+ mavenTwoformat = "config/turbine_checks.xml";
+ }
+ else if ( format.equals( "sun" ) )
+ {
+ mavenTwoformat = "config/sun_checks.xml";
+ }
+ if ( mavenTwoformat != null )
+ {
+ addConfigurationChild( configuration, "configLocation", mavenTwoformat );
+ }
+ }
+ else
+ {
+ String propertiesURL = projectProperties.getProperty( "maven.checkstyle.propertiesURL" );
+ if ( propertiesURL != null )
+ {
+ addConfigurationChild( configuration, "configLocation", propertiesURL );
+ }
+ else
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.properties",
+ "configLocation" );
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.excludes", "excludes" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.fail.on.violation", "failsOnError" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.header.file", "headerLocation" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.includes", "includes" );
+
+ String outputText = projectProperties.getProperty( "maven.checkstyle.output.txt" );
+ if ( outputText != null )
+ {
+ addConfigurationChild( configuration, "outputFile", outputText );
+ addConfigurationChild( configuration, "outputFileFormat", "plain" );
+ }
+ else
+ {
+ String outputXml = projectProperties.getProperty( "maven.checkstyle.output.xml" );
+ if ( outputXml != null )
+ {
+ addConfigurationChild( configuration, "outputFile", outputXml );
+ addConfigurationChild( configuration, "outputFileFormat", "xml" );
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.suppressions.file",
+ "suppressionsLocation" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.checkstyle.usefile", "useFile" );
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,103 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="compiler"
+ *
+ * @author Fabrizio Giustina
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCCompiler
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-compiler-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_BUILD_PLUGIN;
+ }
+
+ protected void addOnOffConfigurationChild( Xpp3Dom configuration, Properties projectProperties,
+ String mavenOneProperty, String mavenTwoElement )
+ throws ProjectConverterException
+ {
+ String value = projectProperties.getProperty( mavenOneProperty );
+ if ( value != null )
+ {
+ addConfigurationChild( configuration, mavenTwoElement, PropertyUtils.convertOnOffToBoolean( value ) );
+ }
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.debug", "debug" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.encoding", "encoding" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.executable", "executable" );
+
+ String fork = projectProperties.getProperty( "maven.compile.fork" );
+ if ( fork != null )
+ {
+ addConfigurationChild( configuration, "fork", PropertyUtils.convertYesNoToBoolean( fork ) );
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.memoryMaximumSize", "maxmem" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.memoryInitialSize", "meminitial" );
+
+ addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.optimize", "optimize" );
+
+ addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.deprecation", "showDeprecation" );
+
+ String nowarn = projectProperties.getProperty( "maven.compile.nowarn" );
+ if ( nowarn != null )
+ {
+ String convertedNowarn = PropertyUtils.convertOnOffToBoolean( nowarn );
+ if ( convertedNowarn != null )
+ {
+ String showWarnings = PropertyUtils.invertBoolean( convertedNowarn );
+ addConfigurationChild( configuration, "showWarnings", showWarnings );
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.source", "source" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.compile.target", "target" );
+
+ String value = projectProperties.getProperty( "maven.compile.verbose" );
+ if ( value != null )
+ {
+ addConfigurationChild( configuration, "verbose", PropertyUtils.convertYesNoToBoolean( value ) );
+ }
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,95 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-jar-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="jar"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCJar
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-jar-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_BUILD_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ Xpp3Dom archive = new Xpp3Dom( "archive" );
+ addConfigurationChild( archive, projectProperties, "maven.jar.compress", "compress" );
+ addConfigurationChild( archive, projectProperties, "maven.jar.index", "index" );
+
+ Xpp3Dom manifest = new Xpp3Dom( "manifest" );
+ addConfigurationChild( manifest, projectProperties, "maven.jar.manifest.classpath.add", "addClasspath" );
+ addConfigurationChild( manifest, projectProperties, "maven.jar.manifest.extensions.add", "addExtensions" );
+ if ( manifest.getChildCount() > 0 )
+ {
+ archive.addChild( manifest );
+ }
+ addConfigurationChild( manifest, projectProperties, "maven.jar.mainclass", "mainClass" );
+
+ String manifestEntriesProperty = projectProperties.getProperty( "maven.jar.manifest.attributes.list" );
+ if ( manifestEntriesProperty != null )
+ {
+ Xpp3Dom manifestEntries = new Xpp3Dom( "manifestEntries" );
+
+ // Loop through property and add values to manifestEntries
+ StringTokenizer tokenizer = new StringTokenizer( manifestEntriesProperty, "," );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String attribute = tokenizer.nextToken();
+ addConfigurationChild( manifestEntries, projectProperties, "maven.jar.manifest.attribute." + attribute,
+ attribute );
+ }
+
+ if ( manifestEntries.getChildCount() > 0 )
+ {
+ archive.addChild( manifestEntries );
+ }
+ }
+
+ addConfigurationChild( archive, projectProperties, "maven.jar.manifest", "manifestFile" );
+
+ if ( archive.getChildCount() > 0 )
+ {
+ configuration.addChild( archive );
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.jar.final.name", "finalName" );
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,171 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-javadoc-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="javadoc"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCJavadoc
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-javadoc-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_BUILD_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.additionalparam", "additionalparam" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.author", "author" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.bottom", "bottom" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.destdir", "destDir" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.doclet", "doclet" );
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.docletpath", "docletPath" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.windowtitle", "doctitle" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.excludepackagenames",
+ "excludePackageNames" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.footer", "footer" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.header", "header" );
+
+ String online = projectProperties.getProperty( "maven.javadoc.mode.online" );
+ if ( online != null )
+ {
+ addConfigurationChild( configuration, "isOffline", PropertyUtils.invertBoolean( online ) );
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.links", "links" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.locale", "locale" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.maxmemory", "maxmemory" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.offlineLinks", "offlineLinks" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.overview", "overview" );
+
+ String show = projectProperties.getProperty( "maven.javadoc.private" );
+ if ( show != null && Boolean.valueOf( show ).booleanValue() )
+ {
+ addConfigurationChild( configuration, "show", "private" );
+ }
+ else
+ {
+ show = projectProperties.getProperty( "maven.javadoc.package" );
+ if ( show != null && Boolean.valueOf( show ).booleanValue() )
+ {
+ addConfigurationChild( configuration, "show", "package" );
+ }
+ else
+ {
+ show = projectProperties.getProperty( "maven.javadoc.public" );
+ if ( show != null && Boolean.valueOf( show ).booleanValue() )
+ {
+ addConfigurationChild( configuration, "show", "public" );
+ }
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.source", "source" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.stylesheet", "stylesheetfile" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.taglets", "taglet" );
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.tagletpath", "tagletpath" );
+
+ String customtags = projectProperties.getProperty( "maven.javadoc.customtags" );
+ if ( customtags != null )
+ {
+ StringTokenizer tokenizer = new StringTokenizer( customtags );
+ if ( tokenizer.hasMoreTokens() )
+ {
+ Xpp3Dom tagsConfiguration = new Xpp3Dom( "tags" );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String tag = tokenizer.nextToken();
+ Xpp3Dom tagConfiguration = new Xpp3Dom( "tag" );
+ addConfigurationChild( tagConfiguration, projectProperties, tag + ".description", "head" );
+ addConfigurationChild( tagConfiguration, projectProperties, tag + ".name", "name" );
+ String placement = "";
+ String enabled = projectProperties.getProperty( tag + ".enabled" );
+ if ( !Boolean.valueOf( enabled ).booleanValue() )
+ {
+ placement = "X";
+ }
+ String scope = projectProperties.getProperty( tag + ".scope" );
+ if ( "all".equals( scope ) )
+ {
+ placement += "a";
+ }
+ if ( placement.length() > 0 )
+ {
+ addConfigurationChild( tagConfiguration, "placement", placement );
+ }
+ tagsConfiguration.addChild( tagConfiguration );
+ }
+ configuration.addChild( tagsConfiguration );
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.use", "use" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.version", "version" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.javadoc.windowtitle", "windowtitle" );
+
+ // Only add these if we have any other configuration for the javadoc-plugin
+ if ( configuration.getChildCount() > 0 )
+ {
+ // The Maven 1 plugin uses the same outputencoding as the generated documentation.
+ addConfigurationChild( configuration, projectProperties, "maven.docs.outputencoding", "docencoding" );
+
+ // The Maven 1 plugin uses the same encoding as the compile plugin.
+ addConfigurationChild( configuration, projectProperties, "maven.compile.encoding", "encoding" );
+
+ // The Maven 1 plugin uses the same package as the pom.
+ addConfigurationChild( configuration, projectProperties, "pom.package", "subpackages" );
+ }
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,49 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.converter.ProjectConverterException;
+
+import java.util.Properties;
+
+/**
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="multiproject"
+ *
+ * @author Fabrizio Giustina
+ * @version $Id$
+ */
+public class PCCMultiproject
+ implements PluginConfigurationConverter
+{
+
+ /**
+ * @see org.apache.maven.model.converter.plugins.PluginConfigurationConverter#convertConfiguration(org.apache.maven.model.Model, org.apache.maven.model.v3_0_0.Model, java.util.Properties)
+ */
+ public void convertConfiguration( Model v4Model, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ String projectType = projectProperties.getProperty( "maven.multiproject.type" );
+
+ if ( projectType != null )
+ {
+ v4Model.setPackaging( projectType );
+ }
+ }
+
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,99 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-pmd-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="pmd"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCPmd
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-pmd-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_REPORT_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.pmd.excludes", "excludes" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.pmd.failonruleviolation", "failOnViolation" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.pmd.cpd.minimumtokencount", "minimumTokens" );
+
+ String rulesetfiles = projectProperties.getProperty( "maven.pmd.rulesetfiles" );
+ if ( rulesetfiles != null )
+ {
+ StringTokenizer tokenizer = new StringTokenizer( rulesetfiles, "," );
+ if ( tokenizer.hasMoreTokens() )
+ {
+ Xpp3Dom rulesets = new Xpp3Dom( "rulesets" );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ addConfigurationChild( rulesets, "ruleset", translate( tokenizer.nextToken() ) );
+ }
+ if ( rulesets.getChildCount() > 0 )
+ {
+ configuration.addChild( rulesets );
+ }
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.pmd.targetjdk", "targetJdk" );
+ }
+
+ /**
+ * In the Maven 1 plugin the built-in rulesets where accessed by prefixing
+ * them with "rulesets/", but in the Maven 2 plugin the prefix "/rulesets/"
+ * is used.
+ *
+ * @param mavenOneRuleset A ruleset from the Maven 1 configuration
+ * @return A ruleset suitable for the Maven 2 configuration
+ */
+ private String translate( String mavenOneRuleset )
+ {
+ if ( mavenOneRuleset != null && mavenOneRuleset.startsWith( "rulesets/" ) )
+ {
+ return "/" + mavenOneRuleset;
+ }
+ else
+ {
+ return mavenOneRuleset;
+ }
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,134 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+/**
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="surefire"
+ *
+ * @author Fabrizio Giustina
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCSurefire
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-surefire-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_BUILD_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.junit.jvmargs", "argLine" );
+
+ String forkMode = projectProperties.getProperty( "maven.junit.forkmode" );
+ if ( forkMode == null )
+ {
+ String fork = projectProperties.getProperty( "maven.junit.fork" );
+ if ( fork != null )
+ {
+ boolean useFork = Boolean.valueOf( PropertyUtils.convertYesNoToBoolean( fork ) ).booleanValue();
+ if ( useFork )
+ {
+ // Use "once" here as that is the default forkMode
+ addConfigurationChild( configuration, "forkMode", "once" );
+ }
+ }
+ }
+ else
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.junit.forkmode", "forkMode" );
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.jvm", "jvm" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.printSummary", "printSummary" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.format", "reportFormat" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.test.skip", "skip" );
+
+ String sysproperties = projectProperties.getProperty( "maven.junit.sysproperties" );
+ if ( sysproperties != null )
+ {
+ StringTokenizer tokenizer = new StringTokenizer( sysproperties );
+ if ( tokenizer.hasMoreTokens() )
+ {
+ Xpp3Dom systemProperties = new Xpp3Dom( "systemProperties" );
+ while ( tokenizer.hasMoreTokens() )
+ {
+ String name = tokenizer.nextToken();
+ String value = projectProperties.getProperty( name );
+ addConfigurationChild( systemProperties, name, value );
+ }
+ if ( systemProperties.getChildCount() > 0 )
+ {
+ configuration.addChild( systemProperties );
+ }
+ }
+ }
+
+ addConfigurationChild( configuration, projectProperties, "maven.test.failure.ignore", "testFailureIgnore" );
+
+ addConfigurationChild( configuration, projectProperties, "maven.junit.usefile", "useFile" );
+
+ if ( v3Model.getBuild() != null && v3Model.getBuild().getUnitTest() != null )
+ {
+ org.apache.maven.model.v3_0_0.UnitTest v3UnitTest = v3Model.getBuild().getUnitTest();
+
+ List excludes = v3UnitTest.getExcludes();
+ if ( excludes != null && excludes.size() > 0 )
+ {
+ Xpp3Dom excludesConf = new Xpp3Dom( "excludes" );
+ for ( Iterator iter = excludes.iterator(); iter.hasNext(); )
+ {
+ addConfigurationChild( excludesConf, "exclude", (String) iter.next() );
+ }
+ configuration.addChild( excludesConf );
+ }
+
+ List includes = v3UnitTest.getIncludes();
+ if ( includes != null && includes.size() > 0 )
+ {
+ Xpp3Dom includesConf = new Xpp3Dom( "includes" );
+ for ( Iterator iter = includes.iterator(); iter.hasNext(); )
+ {
+ addConfigurationChild( includesConf, "include", (String) iter.next() );
+ }
+ configuration.addChild( includesConf );
+ }
+ }
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java?rev=423824&view=auto
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java (added)
+++ maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java Thu Jul 20 01:34:11 2006
@@ -0,0 +1,54 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * A <code>PluginConfigurationConverter</code> for the maven-tasklist-plugin.
+ *
+ * @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="taglist"
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class PCCTaglist
+ extends AbstractPluginConfigurationConverter
+{
+ /**
+ * @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return "maven-tasklist-plugin";
+ }
+
+ public String getType()
+ {
+ return TYPE_REPORT_PLUGIN;
+ }
+
+ protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+ Properties projectProperties )
+ throws ProjectConverterException
+ {
+ addConfigurationChild( configuration, projectProperties, "maven.tasklist.taskTag", "tags" );
+ }
+}
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/maven-2.0.x/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"