Move maven1 project converter from sandbox/plugins/maven-maven1-plugin to maven-model-converter

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@423493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2006-07-19 15:30:31 +00:00
parent f7710dbb29
commit 7c69847387
68 changed files with 4304 additions and 1 deletions

View File

@ -45,7 +45,11 @@
<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>
</project>

View File

@ -0,0 +1,303 @@
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.PCCChangelog;
import org.apache.maven.model.converter.plugins.PCCChanges;
import org.apache.maven.model.converter.plugins.PCCCheckstyle;
import org.apache.maven.model.converter.plugins.PCCCompiler;
import org.apache.maven.model.converter.plugins.PCCJar;
import org.apache.maven.model.converter.plugins.PCCJavadoc;
import org.apache.maven.model.converter.plugins.PCCMultiproject;
import org.apache.maven.model.converter.plugins.PCCPmd;
import org.apache.maven.model.converter.plugins.PCCSurefire;
import org.apache.maven.model.converter.plugins.PCCTaglist;
import org.apache.maven.model.converter.plugins.PCCWar;
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.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$
*/
public class Maven1Converter
extends AbstractLogEnabled
{
private File basedir;
/**
* Available converters for specific plugin configurations
*/
private PluginConfigurationConverter[] converters = new PluginConfigurationConverter[]{new PCCChangelog(),
new PCCChanges(), new PCCCheckstyle(), new PCCCompiler(), new PCCJar(), new PCCJavadoc(), new PCCMultiproject(),
new PCCPmd(), new PCCSurefire(), new PCCTaglist(), new PCCWar()};
/**
* 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 ( int j = 0; j < converters.length; j++ )
{
converters[j].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;
}
}

View File

@ -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: PropertyUtils.java 410688 2006-05-31 22:21:07 +0000 (on, 31 maj 2006) carlos $
*/
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;
}
}

View File

@ -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 );
}
}

View File

@ -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;
}

View File

@ -0,0 +1,92 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCChangelog.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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" );
}
}
}

View File

@ -0,0 +1,52 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCChanges.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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" );
}
}

View File

@ -0,0 +1,116 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCCheckstyle.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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" );
}
}

View File

@ -0,0 +1,101 @@
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;
/**
* @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 ) );
}
}
}

View File

@ -0,0 +1,93 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCJar.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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" );
}
}

View File

@ -0,0 +1,169 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCJavadoc.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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" );
}
}
}

View File

@ -0,0 +1,47 @@
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;
/**
* @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 );
}
}
}

View File

@ -0,0 +1,97 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCPmd.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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;
}
}
}

View File

@ -0,0 +1,132 @@
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;
/**
* @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 );
}
}
}
}

View File

@ -0,0 +1,52 @@
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.
*
* @author Dennis Lundberg
* @version $Id: PCCTaglist.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
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" );
}
}

View File

@ -0,0 +1,54 @@
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.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.util.Properties;
/**
* @author Fabrizio Giustina
* @author Dennis Lundberg
* @version $Id$
*/
public class PCCWar
extends AbstractPluginConfigurationConverter
{
/**
* @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
*/
public String getArtifactId()
{
return "maven-war-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
{
String warSourceDirectory = projectProperties.getProperty( "maven.war.src" );
addConfigurationChild( configuration, "warSourceDirectory",
StringUtils.replace( warSourceDirectory, "${basedir}/", "" ) );
}
}

View File

@ -0,0 +1,33 @@
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 java.util.Properties;
import org.apache.maven.model.Model;
import org.apache.maven.model.converter.ProjectConverterException;
/**
* A plugin configuration converter reads properties from a v3 pom or project.properties and add them to the v4 pom.
* @author Fabrizio Giustina
* @version $Id$
*/
public interface PluginConfigurationConverter
{
void convertConfiguration( Model v4Model, org.apache.maven.model.v3_0_0.Model v3Model, Properties projectProperties )
throws ProjectConverterException;
}

View File

@ -0,0 +1,69 @@
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.
*/
/**
* Utility class which features various methods for converting String-based property values.
*
* @author Dennis Lundberg
* @version $Id$
*/
public class PropertyUtils
{
static String convertOnOffToBoolean( String value )
{
if ( value != null )
{
if ( "on".equalsIgnoreCase( value ) )
{
return Boolean.TRUE.toString();
}
if ( "off".equalsIgnoreCase( value ) )
{
return Boolean.FALSE.toString();
}
}
return null;
}
static String convertYesNoToBoolean( String value )
{
if ( value != null )
{
if ( "yes".equalsIgnoreCase( value ) )
{
return Boolean.TRUE.toString();
}
if ( "no".equalsIgnoreCase( value ) )
{
return Boolean.FALSE.toString();
}
}
return null;
}
static String invertBoolean( String stringValue )
{
if ( stringValue != null )
{
boolean booleanValue = Boolean.valueOf( stringValue ).booleanValue();
boolean invertedBooleanValue = !booleanValue;
return new Boolean( invertedBooleanValue ).toString();
}
return null;
}
}

View File

@ -0,0 +1,144 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.converter.ModelUtils;
import org.codehaus.plexus.logging.AbstractLogEnabled;
/**
* A general implementation of the <code>PluginRelocator</code> interface.
*
* @author Dennis Lundberg
* @version $Id: PluginRelocator.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) dennisl $
*/
public abstract class AbstractPluginRelocator
extends AbstractLogEnabled
implements PluginRelocator
{
/**
* If there is no replacement for this plugin, you can have the plugin
* removed from the v4 pom by returning <code>null</code> from this method
* and from getNewGroupId().
*
* @return The artifactId of the new Maven 2 plugin
*/
public abstract String getNewArtifactId();
/**
* If there is no replacement for this plugin, you can have the plugin
* removed from the v4 pom by returning <code>null</code> from this method
* and from getNewArtifactId().
*
* @return The groupId of the new Maven 2 plugin
*/
public abstract String getNewGroupId();
/**
* <strong>Note:</strong> Because we are working on the recently converted
* Maven 2 model, this method must return the artifactId that is in the
* model, after the model has been converted.
*
* @return The artifactId of the Maven 1 plugin.
* @see org.apache.maven.model.converter.PomV3ToV4Translator#translateDependencies( java.util.List )
*/
public abstract String getOldArtifactId();
/**
* <strong>Note:</strong> Because we are working on the recently converted
* Maven 2 model, this method must return the groupId that is in the model,
* after the model has been converted.
* <p/>
* Feel free to overload this method if your plugin has a different groupId.
* </p>
*
* @return The groupId of the Maven 1 plugin.
* @see org.apache.maven.model.converter.PomV3ToV4Translator#translateDependencies( java.util.List )
*/
public String getOldGroupId()
{
return "org.apache.maven.plugins";
}
/**
* {@inheritDoc}
*/
public void relocate( Model v4Model )
{
// Relocate build plugins
Plugin oldBuildPlugin = ModelUtils.findBuildPlugin( v4Model, getOldGroupId(), getOldArtifactId() );
if ( oldBuildPlugin != null )
{
if ( getNewArtifactId() == null && getNewGroupId() == null )
{
// Remove the old plugin
v4Model.getBuild().getPlugins().remove( oldBuildPlugin );
getLogger().info( "Removing build plugin " + getOldGroupId() + ":" + getOldArtifactId() );
}
else
{
Plugin newPlugin = ModelUtils.findBuildPlugin( v4Model, getNewGroupId(), getNewArtifactId() );
if ( newPlugin == null )
{
// The new plugin does not exist, relocate the old one
oldBuildPlugin.setArtifactId( getNewArtifactId() );
oldBuildPlugin.setGroupId( getNewGroupId() );
getLogger().info( "Relocating build plugin " + getOldGroupId() + ":" + getOldArtifactId() );
}
else
{
// The new plugin already exist, remove the old one
v4Model.getBuild().getPlugins().remove( oldBuildPlugin );
getLogger().info( "Removing old build plugin " + getOldGroupId() + ":" + getOldArtifactId() +
" because the new one already exist" );
}
}
}
// Relocate report plugins
ReportPlugin oldReportPlugin = ModelUtils.findReportPlugin( v4Model, getOldGroupId(), getOldArtifactId() );
if ( oldReportPlugin != null )
{
if ( getNewArtifactId() == null && getNewGroupId() == null )
{
// Remove the old plugin
v4Model.getReporting().getPlugins().remove( oldReportPlugin );
getLogger().info( "Removing report plugin " + getOldGroupId() + ":" + getOldArtifactId() );
}
else
{
ReportPlugin newPlugin = ModelUtils.findReportPlugin( v4Model, getNewGroupId(), getNewArtifactId() );
if ( newPlugin == null )
{
// The new plugin does not exist, relocate the old one
oldReportPlugin.setArtifactId( getNewArtifactId() );
oldReportPlugin.setGroupId( getNewGroupId() );
getLogger().info( "Relocating report plugin " + getOldGroupId() + ":" + getOldArtifactId() );
}
else
{
// The new plugin already exist, remove the old one
v4Model.getReporting().getPlugins().remove( oldReportPlugin );
getLogger().info( "Removing old report plugin " + getOldGroupId() + ":" + getOldArtifactId() +
" because the new one already exist" );
}
}
}
}
}

View File

@ -0,0 +1,34 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A parent <code>PluginRelocator</code> for SourceForge plugins.
*
* @author Dennis Lundberg
* @version $Id: AbstractSourceForgePluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) dennisl $
*/
public abstract class AbstractSourceForgePluginRelocator extends AbstractPluginRelocator
{
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getOldGroupId()
*/
public String getOldGroupId()
{
return "maven-plugins";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-cobertura-plugin.
*
* @author Dennis Lundberg
* @version $Id: CoberturaPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) dennisl $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="cobertura"
*/
public class CoberturaPluginRelocator extends AbstractSourceForgePluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "cobertura-maven-plugin";
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.codehaus.mojo";
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-cobertura-plugin";
}
}

View File

@ -0,0 +1,55 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.Collection;
import java.util.Map;
/**
* A default implementation of the <code>PluginRelocatorManager</code> interface.
*
* @author Dennis Lundberg
* @version $Id: DefaultPluginRelocatorManager.java 3420 2006-06-23 20:23:59Z dennisl $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocatorManager"
*/
public class DefaultPluginRelocatorManager extends AbstractLogEnabled implements PluginRelocatorManager
{
/**
* @plexus.requirement role="org.apache.maven.model.converter.relocators.PluginRelocator"
*/
private Map pluginRelocators;
public PluginRelocator getPluginRelocator( String pluginRelocatorId )
throws NoSuchPluginRelocatorException
{
PluginRelocator pluginRelocator = (PluginRelocator) pluginRelocators.get( pluginRelocatorId );
if ( pluginRelocator == null )
{
throw new NoSuchPluginRelocatorException( pluginRelocatorId );
}
return pluginRelocator;
}
public Collection getPluginRelocators()
{
return pluginRelocators.values();
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-developer-activity-plugin.
*
* @author Dennis Lundberg
* @version $Id: DeveloperActivityPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="developer-activity"
*/
public class DeveloperActivityPluginRelocator extends AbstractPluginRelocator
{
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "maven-changelog-plugin";
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.apache.maven.plugins";
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-developer-activity-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-faq-plugin.
*
* @author Dennis Lundberg
* @version $Id: FaqPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="faq"
*/
public class FaqPluginRelocator extends AbstractPluginRelocator
{
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return null;
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return null;
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-faq-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-file-activity-plugin.
*
* @author Dennis Lundberg
* @version $Id: DeveloperActivityPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="file-activity"
*/
public class FileActivityPluginRelocator extends AbstractPluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "maven-changelog-plugin";
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.apache.maven.plugins";
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-file-activity-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-findbugs-plugin.
*
* @author Dennis Lundberg
* @version $Id: FindbugsPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="findbugs"
*/
public class FindbugsPluginRelocator extends AbstractSourceForgePluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "findbugs-maven-plugin";
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.codehaus.mojo";
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-findbugs-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-jdepend-plugin.
*
* @author Dennis Lundberg
* @version $Id: TasklistPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="jdepend"
*/
public class JdependPluginRelocator extends AbstractPluginRelocator
{
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "jdepend-maven-plugin";
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.codehaus.mojo";
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-jdepend-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-jdiff-plugin.
*
* @author Dennis Lundberg
* @version $Id: JdiffPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="jdiff"
*/
public class JdiffPluginRelocator extends AbstractPluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "jdiff-maven-plugin";
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.codehaus.mojo";
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-jdiff-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-junit-report-plugin.
*
* @author Dennis Lundberg
* @version $Id: JunitReportPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="junit-report"
*/
public class JunitReportPluginRelocator extends AbstractPluginRelocator
{
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "maven-surefire-report-plugin";
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.apache.maven.plugins";
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-junit-report-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-license-plugin.
*
* @author Dennis Lundberg
* @version $Id: LicenseRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="license"
*/
public class LicenseRelocator extends AbstractPluginRelocator
{
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return null;
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return null;
}
/**
* @see org.apache.maven.model.converter.relocators.AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-license-plugin";
}
}

View File

@ -0,0 +1,38 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* @author Dennis Lundberg
* @version $Id: NoSuchPluginRelocatorException.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) dennisl $
*/
public class NoSuchPluginRelocatorException extends Exception
{
private final String pluginRelocatorId;
public NoSuchPluginRelocatorException( String pluginRelocatorId )
{
super( "No such plugin relocator '" + pluginRelocatorId + "'." );
this.pluginRelocatorId = pluginRelocatorId;
}
public String getPluginRelocatorId()
{
return pluginRelocatorId;
}
}

View File

@ -0,0 +1,39 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.Model;
/**
* A plugin relocator handles a plugin that has changed its groupId and/or
* artifactId between the Maven 1 version and the Maven 2 version. It changes
* the appropriate values in the v4 pom.
*
* @author Dennis Lundberg
* @version $Id: PluginRelocator.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public interface PluginRelocator
{
String ROLE = PluginRelocator.class.getName();
/**
* Relocate a plugin from one groupId/artifactId to another.
*
* @param v4Model The model where we look for the plugin
*/
void relocate( Model v4Model );
}

View File

@ -0,0 +1,47 @@
package org.apache.maven.model.converter.relocators;
import java.util.Collection;
/*
* 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.
*/
/**
* A manager for plugin relocators.
*
* @author Dennis Lundberg
* @version $Id: PluginRelocatorManager.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) dennisl $
*/
public interface PluginRelocatorManager
{
String ROLE = PluginRelocatorManager.class.getName();
/**
* Get a named plugin relocator.
*
* @param pluginRelocatorId The role-hint for the plexus component
* @return The named plugin relocator
* @throws NoSuchPluginRelocatorException If the named plugin relocator can not be found
*/
PluginRelocator getPluginRelocator( String pluginRelocatorId )
throws NoSuchPluginRelocatorException;
/**
* Get all available plugin relocators.
*
* @return A <code>Collection</code> of <code>PluginRelocator</code> objects
*/
Collection getPluginRelocators();
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-simian-plugin.
*
* @author Dennis Lundberg
* @version $Id: SimianPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="simian"
*/
public class SimianPluginRelocator extends AbstractPluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "simian-maven-plugin";
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.codehaus.mojo";
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-simian-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-tasklist-plugin.
*
* @author Dennis Lundberg
* @version $Id: TasklistPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="tasklist"
*/
public class TasklistPluginRelocator extends AbstractPluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return "taglist-maven-plugin";
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return "org.codehaus.mojo";
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-tasklist-plugin";
}
}

View File

@ -0,0 +1,52 @@
package org.apache.maven.model.converter.relocators;
/*
* 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.
*/
/**
* A <code>PluginRelocator</code> for the maven-xdoc-plugin.
*
* @author Dennis Lundberg
* @version $Id: XdocPluginRelocator.java 411318 2006-06-02 22:34:35 +0000 (fr, 02 jun 2006) carlos $
* @plexus.component role="org.apache.maven.model.converter.relocators.PluginRelocator"
* role-hint="xdoc"
*/
public class XdocPluginRelocator extends AbstractPluginRelocator
{
/**
* @see AbstractPluginRelocator#getNewArtifactId()
*/
public String getNewArtifactId()
{
return null;
}
/**
* @see AbstractPluginRelocator#getNewGroupId()
*/
public String getNewGroupId()
{
return null;
}
/**
* @see AbstractPluginRelocator#getOldArtifactId()
*/
public String getOldArtifactId()
{
return "maven-xdoc-plugin";
}
}

View File

@ -0,0 +1,47 @@
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.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.util.Properties;
/**
* @author Dennis Lundberg
* @version $Id$
*/
public class AbstractPCCTest extends PlexusTestCase
{
protected Xpp3Dom configuration;
protected AbstractPluginConfigurationConverter pluginConfigurationConverter;
protected Properties projectProperties;
protected org.apache.maven.model.v3_0_0.Model v3Model;
protected void setUp()
throws Exception
{
super.setUp();
configuration = new Xpp3Dom( "configuration" );
projectProperties = new Properties();
v3Model = new org.apache.maven.model.v3_0_0.Model();
v3Model.setBuild( new org.apache.maven.model.v3_0_0.Build() );
}
}

View File

@ -0,0 +1,139 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCChangelogTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCChangelogTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCChangelog();
}
public void testBuildConfiguration1()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCChangelogTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "commentFormat" ).getValue();
Assert.assertEquals( "check commentFormat value", "%Sn - %c - Activity: %[activity]p", value );
value = configuration.getChild( "dateFormat" ).getValue();
Assert.assertEquals( "check dateFormat value", "yyyy-MM-dd", value );
value = configuration.getChild( "outputEncoding" ).getValue();
Assert.assertEquals( "check outputEncoding value", "ISO-8859-1", value );
value = configuration.getChild( "tagBase" ).getValue();
Assert.assertEquals( "check tagBase value", "http://svn.apache.org/repos/asf/maven/plugins/", value );
value = configuration.getChild( "type" ).getValue();
Assert.assertEquals( "check type value", "date", value );
Xpp3Dom dates = configuration.getChild( "dates" );
if ( dates.getChildCount() == 1 )
{
Xpp3Dom date = dates.getChild( 0 );
Assert.assertEquals( "check dates/date value", "2005-01-01", date.getValue() );
}
else
{
Assert.fail( "Wrong number of date elements" );
}
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfiguration2()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCChangelogTest2.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "type" ).getValue();
Assert.assertEquals( "check type value", "range", value );
value = configuration.getChild( "range" ).getValue();
Assert.assertEquals( "check range value", "120", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfiguration3()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCChangelogTest3.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "type" ).getValue();
Assert.assertEquals( "check type value", "tag", value );
Xpp3Dom tags = configuration.getChild( "tags" );
if ( tags.getChildCount() == 1 )
{
Xpp3Dom tag = tags.getChild( 0 );
Assert.assertEquals( "check tags/tag value", "RELEASE-1_0", tag.getValue() );
}
else
{
Assert.fail( "Wrong number of tag elements" );
}
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,59 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCChangesTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCChangesTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCChanges();
}
public void testBuildConfiguration()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCChangesTest.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "link_template" ).getValue();
Assert.assertEquals( "check link_template value", "%URL%/browse/%ISSUE%", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,136 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCCheckstyleTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCCheckstyleTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCCheckstyle();
}
public void testBuildConfiguration1()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCCheckstyleTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "cacheFile" ).getValue();
Assert.assertEquals( "check cacheFile value", "target/checkstyle/myCachefile", value );
value = configuration.getChild( "configLocation" ).getValue();
Assert.assertEquals( "check configLocation value", "config/sun_checks.xml", value );
value = configuration.getChild( "excludes" ).getValue();
Assert.assertEquals( "check excludes value", "**/*.html", value );
value = configuration.getChild( "failsOnError" ).getValue();
Assert.assertEquals( "check failsOnError value", "true", value );
value = configuration.getChild( "headerLocation" ).getValue();
Assert.assertEquals( "check headerLocation value", "src/main/resources/HEADER.txt", value );
value = configuration.getChild( "includes" ).getValue();
Assert.assertEquals( "check includes value", "**/*.java", value );
value = configuration.getChild( "outputFile" ).getValue();
Assert.assertEquals( "check outputFile value", "target/checkstyle/checkstyle-raw-report.txt", value );
value = configuration.getChild( "outputFileFormat" ).getValue();
Assert.assertEquals( "check outputFileFormat value", "plain", value );
value = configuration.getChild( "suppressionsLocation" ).getValue();
Assert.assertEquals( "check suppressionsLocation value", "src/main/resources/mySuppressions.xml", value );
value = configuration.getChild( "useFile" ).getValue();
Assert.assertEquals( "check useFile value", "true", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfiguration2()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCCheckstyleTest2.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "configLocation" ).getValue();
Assert.assertEquals( "check configLocation value",
"http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml",
value );
value = configuration.getChild( "outputFile" ).getValue();
Assert.assertEquals( "check outputFile value", "target/checkstyle/checkstyle-raw-report.xml", value );
value = configuration.getChild( "outputFileFormat" ).getValue();
Assert.assertEquals( "check outputFileFormat value", "xml", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfiguration3()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCCheckstyleTest3.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "configLocation" ).getValue();
Assert.assertEquals( "check configLocation value", "checkstyle.xml", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,92 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id$
*/
public class PCCCompilerTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCCompiler();
}
public void testBuildConfiguration()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCCompilerTest.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "debug" ).getValue();
Assert.assertEquals( "check debug value", "true", value );
value = configuration.getChild( "showDeprecation" ).getValue();
Assert.assertEquals( "check deprecation value", "false", value );
value = configuration.getChild( "encoding" ).getValue();
Assert.assertEquals( "check encoding value", "UTF-8", value );
value = configuration.getChild( "executable" ).getValue();
Assert.assertEquals( "check executable value", "/usr/java/bin/javac-2", value );
value = configuration.getChild( "fork" ).getValue();
Assert.assertEquals( "check fork value", "true", value );
value = configuration.getChild( "meminitial" ).getValue();
Assert.assertEquals( "check meminitial value", "10m", value );
value = configuration.getChild( "maxmem" ).getValue();
Assert.assertEquals( "check maxmem value", "20m", value );
value = configuration.getChild( "optimize" ).getValue();
Assert.assertEquals( "check optimize value", "false", value );
value = configuration.getChild( "showWarnings" ).getValue();
Assert.assertEquals( "check showWarnings value", "false", value );
value = configuration.getChild( "source" ).getValue();
Assert.assertEquals( "check source value", "1.3", value );
value = configuration.getChild( "target" ).getValue();
Assert.assertEquals( "check target value", "1.1", value );
value = configuration.getChild( "verbose" ).getValue();
Assert.assertEquals( "check verbose value", "false", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,98 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCJarTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCJarTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCJar();
}
public void testBuildConfiguration()
{
String value;
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCJarTest.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
Xpp3Dom archive = configuration.getChild( "archive" );
if ( archive.getChildCount() > 0 )
{
value = archive.getChild( "compress" ).getValue();
Assert.assertEquals( "check compress value", "false", value );
value = archive.getChild( "index" ).getValue();
Assert.assertEquals( "check index value", "true", value );
Xpp3Dom manifest = archive.getChild( "manifest" );
if ( manifest.getChildCount() > 0 )
{
value = manifest.getChild( "addClasspath" ).getValue();
Assert.assertEquals( "check addClasspath value", "true", value );
value = manifest.getChild( "addExtensions" ).getValue();
Assert.assertEquals( "check addExtensions value", "true", value );
value = manifest.getChild( "mainClass" ).getValue();
Assert.assertEquals( "check mainClass value", "MyClass", value );
}
Xpp3Dom manifestEntries = archive.getChild( "manifestEntries" );
if ( manifestEntries.getChildCount() > 0 )
{
value = manifestEntries.getChild( "Bar-Attribute" ).getValue();
Assert.assertEquals( "check Bar-Attribute value", "I like toast and jam", value );
value = manifestEntries.getChild( "Foo-Attribute" ).getValue();
Assert.assertEquals( "check Foo-Attribute value", "I like bread and butter", value );
}
value = archive.getChild( "manifestFile" ).getValue();
Assert.assertEquals( "check manifestFile value", "manifest.mf", value );
}
value = configuration.getChild( "finalName" ).getValue();
Assert.assertEquals( "check finalName value", "my.jar", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,228 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCJavadocTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCJavadocTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCJavadoc();
}
public void testBuildConfiguration()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCJavadocTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "additionalparam" ).getValue();
Assert.assertEquals( "check additionalparam value", "-J-showversion", value );
value = configuration.getChild( "author" ).getValue();
Assert.assertEquals( "check author value", "false", value );
value = configuration.getChild( "bottom" ).getValue();
Assert.assertEquals( "check bottom value", "Copyright", value );
value = configuration.getChild( "destDir" ).getValue();
Assert.assertEquals( "check destDir value", "apidocs", value );
value = configuration.getChild( "docencoding" ).getValue();
Assert.assertEquals( "check docencoding value", "UTF-8", value );
value = configuration.getChild( "doclet" ).getValue();
Assert.assertEquals( "check doclet value", "org.apache.MyDoclet", value );
value = configuration.getChild( "docletPath" ).getValue();
Assert.assertEquals( "check docletPath value", "/path/to/doclet", value );
value = configuration.getChild( "doctitle" ).getValue();
Assert.assertEquals( "check doctitle value", "The title", value );
value = configuration.getChild( "encoding" ).getValue();
Assert.assertEquals( "check encoding value", "ISO-8859-1", value );
value = configuration.getChild( "excludePackageNames" ).getValue();
Assert.assertEquals( "check excludePackageNames value", "org.apache.internal,org.apache.test", value );
value = configuration.getChild( "footer" ).getValue();
Assert.assertEquals( "check footer value", "The footer", value );
value = configuration.getChild( "header" ).getValue();
Assert.assertEquals( "check header value", "The header", value );
value = configuration.getChild( "isOffline" ).getValue();
Assert.assertEquals( "check isOffline value", "false", value );
value = configuration.getChild( "links" ).getValue();
Assert.assertEquals( "check links value", "http://java.sun.com/j2se/1.4/docs/api/", value );
value = configuration.getChild( "locale" ).getValue();
Assert.assertEquals( "check locale value", "en_US", value );
value = configuration.getChild( "maxmemory" ).getValue();
Assert.assertEquals( "check maxmemory value", "1024m", value );
value = configuration.getChild( "offlineLinks" ).getValue();
Assert.assertEquals( "check offlineLinks value", "/opt/java-apidoc/j2sdk1.4.2/docs/api/", value );
value = configuration.getChild( "overview" ).getValue();
Assert.assertEquals( "check overview value", "src/main/java/org/apache/overview.html", value );
value = configuration.getChild( "source" ).getValue();
Assert.assertEquals( "check source value", "1.3", value );
value = configuration.getChild( "stylesheetfile" ).getValue();
Assert.assertEquals( "check stylesheetfile value", "myStylesheet.css", value );
value = configuration.getChild( "subpackages" ).getValue();
Assert.assertEquals( "check subpackages value", "org.apache.maven", value );
value = configuration.getChild( "taglet" ).getValue();
Assert.assertEquals( "check taglet value", "org.apache.MyTaglet", value );
value = configuration.getChild( "tagletpath" ).getValue();
Assert.assertEquals( "check tagletpath value", "/path/to/taglet", value );
Xpp3Dom tags = configuration.getChild( "tags" );
if ( tags.getChildCount() == 2 )
{
Xpp3Dom tagOne = tags.getChild( 0 );
value = tagOne.getChild( "head" ).getValue();
Assert.assertEquals( "check tags/tag/head value", "To Do:", value );
value = tagOne.getChild( "name" ).getValue();
Assert.assertEquals( "check tags/tag/name value", "todo", value );
value = tagOne.getChild( "placement" ).getValue();
Assert.assertEquals( "check tags/tag/placement value", "a", value );
Xpp3Dom tagTwo = tags.getChild( 1 );
value = tagTwo.getChild( "head" ).getValue();
Assert.assertEquals( "check tags/tag/head value", "Task:", value );
value = tagTwo.getChild( "name" ).getValue();
Assert.assertEquals( "check tags/tag/name value", "task", value );
value = tagTwo.getChild( "placement" ).getValue();
Assert.assertEquals( "check tags/tag/placement value", "Xa", value );
}
else
{
Assert.fail( "Wrong number of tag elements" );
}
value = configuration.getChild( "use" ).getValue();
Assert.assertEquals( "check use value", "true", value );
value = configuration.getChild( "version" ).getValue();
Assert.assertEquals( "check version value", "true", value );
value = configuration.getChild( "windowtitle" ).getValue();
Assert.assertEquals( "check windowtitle value", "The title", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfigurationShow1()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCJavadocTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "show" ).getValue();
Assert.assertEquals( "check show value", "package", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfigurationShow2()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCJavadocTest2.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "show" ).getValue();
Assert.assertEquals( "check show value", "private", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfigurationShow3()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCJavadocTest3.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "show" ).getValue();
Assert.assertEquals( "check show value", "public", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,87 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCPmdTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCPmdTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCPmd();
}
public void testBuildConfiguration()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCPmdTest.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "excludes" ).getValue();
Assert.assertEquals( "check excludes value", "**/*PropertyListParser*", value );
value = configuration.getChild( "failOnViolation" ).getValue();
Assert.assertEquals( "check failOnViolation value", "true", value );
value = configuration.getChild( "minimumTokens" ).getValue();
Assert.assertEquals( "check minimumTokens value", "50", value );
Xpp3Dom rulesets = configuration.getChild( "rulesets" );
if ( rulesets.getChildCount() == 3 )
{
Xpp3Dom rulesetOne = rulesets.getChild( 0 );
Assert.assertEquals( "check rulesets/ruleset value", "fileupload_basic.xml", rulesetOne.getValue() );
Xpp3Dom rulesetTwo = rulesets.getChild( 1 );
Assert.assertEquals( "check rulesets/ruleset value", "/rulesets/unusedcode.xml",
rulesetTwo.getValue() );
Xpp3Dom rulesetThree = rulesets.getChild( 2 );
Assert.assertEquals( "check rulesets/ruleset value", "/rulesets/imports.xml", rulesetThree.getValue() );
}
else
{
Assert.fail( "Wrong number of ruleset elements" );
}
value = configuration.getChild( "targetJdk" ).getValue();
Assert.assertEquals( "check targetJdk value", "1.4", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,157 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id$
*/
public class PCCSurefireTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCSurefire();
}
public void testBuildConfiguration()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "reportFormat" ).getValue();
Assert.assertEquals( "check reportFormat value", "xml", value );
value = configuration.getChild( "jvm" ).getValue();
Assert.assertEquals( "check jvm value", "java", value );
value = configuration.getChild( "argLine" ).getValue();
Assert.assertEquals( "check argLine value", "-Xmx160m -verbose", value );
value = configuration.getChild( "printSummary" ).getValue();
Assert.assertEquals( "check printSummary value", "false", value );
Xpp3Dom systemProperties = configuration.getChild( "systemProperties" );
if ( systemProperties.getChildCount() == 2 )
{
Xpp3Dom systemPropertyOne = systemProperties.getChild( 0 );
Assert.assertEquals( "check systemProperties/prop1 name", "prop1", systemPropertyOne.getName() );
Assert.assertEquals( "check systemProperties/prop1 value", "your value", systemPropertyOne.getValue() );
Xpp3Dom systemPropertyTwo = systemProperties.getChild( 1 );
Assert.assertEquals( "check systemProperties/prop2 name", "basedir", systemPropertyTwo.getName() );
Assert.assertEquals( "check systemProperties/prop2 value", "${basedir}", systemPropertyTwo.getValue() );
}
else
{
Assert.fail( "Wrong number of system properties" );
}
value = configuration.getChild( "useFile" ).getValue();
Assert.assertEquals( "check useFile value", "false", value );
value = configuration.getChild( "testFailureIgnore" ).getValue();
Assert.assertEquals( "check testFailureIgnore value", "true", value );
value = configuration.getChild( "skip" ).getValue();
Assert.assertEquals( "check skip value", "true", value );
}
catch ( ProjectConverterException e )
{
Assert.fail();
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfigurationFork1()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "forkMode" ).getValue();
Assert.assertEquals( "check forkMode value", "once", value );
}
catch ( ProjectConverterException e )
{
Assert.fail();
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfigurationFork2()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest2.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "forkMode" ).getValue();
Assert.assertEquals( "check forkMode value", "once", value );
}
catch ( ProjectConverterException e )
{
Assert.fail();
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfigurationFork3()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCSurefireTest3.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "forkMode" ).getValue();
Assert.assertEquals( "check forkMode value", "perTest", value );
}
catch ( ProjectConverterException e )
{
Assert.fail();
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,59 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCTaglistTest.java 410688 2006-05-31 22:21:07 +0000 (on, 31 maj 2006) carlos $
*/
public class PCCTaglistTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCTaglist();
}
public void testBuildConfiguration()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCTaglistTest.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "tags" ).getValue();
Assert.assertEquals( "check tags value", "@fixme", value );
}
catch ( ProjectConverterException e )
{
Assert.fail();
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,102 @@
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 junit.framework.Assert;
import org.apache.maven.model.converter.ProjectConverterException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.IOException;
/**
* @author Dennis Lundberg
* @version $Id: PCCWarTest.java 409264 2006-05-24 23:13:13 +0000 (on, 24 maj 2006) carlos $
*/
public class PCCWarTest
extends AbstractPCCTest
{
protected void setUp()
throws Exception
{
super.setUp();
pluginConfigurationConverter = new PCCWar();
}
public void testBuildConfiguration1()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest1.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "warSourceDirectory" ).getValue();
Assert.assertEquals( "check warSourceDirectory value", "myWebappDirectory", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfiguration2()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest2.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
String value = configuration.getChild( "warSourceDirectory" ).getValue();
Assert.assertEquals( "check warSourceDirectory value", "myWebappDirectory", value );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
public void testBuildConfiguration3()
{
try
{
projectProperties.load( getClassLoader().getResourceAsStream( "PCCWarTest3.properties" ) );
pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
Xpp3Dom child = configuration.getChild( "warSourceDirectory" );
Assert.assertEquals( "check warSourceDirectory element", null, child );
}
catch ( ProjectConverterException e )
{
Assert.fail( e.getMessage() );
}
catch ( IOException e )
{
Assert.fail( "Unable to find the requested resource." );
}
}
}

View File

@ -0,0 +1,57 @@
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 junit.framework.Assert;
import junit.framework.TestCase;
/**
* @author Dennis Lundberg
* @version $Id$
*/
public class PropertyUtilsTest extends TestCase
{
protected void setUp()
throws Exception
{
super.setUp();
}
public void testConvertOnOffToBoolean()
{
Assert.assertEquals( null, PropertyUtils.convertOnOffToBoolean( null ) );
Assert.assertEquals( null, PropertyUtils.convertOnOffToBoolean( "someValue" ) );
Assert.assertEquals( "true", PropertyUtils.convertOnOffToBoolean( "on" ) );
Assert.assertEquals( "false", PropertyUtils.convertOnOffToBoolean( "OFF" ) );
}
public void testConvertYesNoToBoolean()
{
Assert.assertEquals( null, PropertyUtils.convertYesNoToBoolean( null ) );
Assert.assertEquals( null, PropertyUtils.convertYesNoToBoolean( "someValue" ) );
Assert.assertEquals( "true", PropertyUtils.convertYesNoToBoolean( "yes" ) );
Assert.assertEquals( "false", PropertyUtils.convertYesNoToBoolean( "NO" ) );
}
public void testInvertBoolean()
{
Assert.assertEquals( null, PropertyUtils.invertBoolean( null ) );
Assert.assertEquals( "true", PropertyUtils.invertBoolean( "someValue" ) );
Assert.assertEquals( "true", PropertyUtils.invertBoolean( "false" ) );
Assert.assertEquals( "false", PropertyUtils.invertBoolean( "true" ) );
}
}

View File

@ -0,0 +1,21 @@
# 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.
maven.changelog.commentFormat=%Sn - %c - Activity: %[activity]p
maven.changelog.dateformat=yyyy-MM-dd
maven.changelog.svn.baseurl=http://svn.apache.org/repos/asf/maven/plugins/
maven.changelog.type=date
maven.changelog.date=2005-01-01
maven.docs.outputencoding=ISO-8859-1

View File

@ -0,0 +1,16 @@
# 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.
maven.changelog.type=range
maven.changelog.range=120

View File

@ -0,0 +1,16 @@
# 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.
maven.changelog.type=tag
maven.changelog.tag=RELEASE-1_0

View File

@ -0,0 +1,15 @@
# 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.
maven.changes.issue.template=%URL%/browse/%ISSUE%

View File

@ -0,0 +1,25 @@
# 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.
maven.checkstyle.cache.file=target/checkstyle/myCachefile
maven.checkstyle.excludes=**/*.html
maven.checkstyle.fail.on.violation=true
maven.checkstyle.format=sun
maven.checkstyle.header.file=src/main/resources/HEADER.txt
maven.checkstyle.includes=**/*.java
maven.checkstyle.output.txt=target/checkstyle/checkstyle-raw-report.txt
maven.checkstyle.properties=checkstyle.xml
maven.checkstyle.propertiesURL=http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml
maven.checkstyle.suppressions.file=src/main/resources/mySuppressions.xml
maven.checkstyle.usefile=true

View File

@ -0,0 +1,17 @@
# 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.
maven.checkstyle.output.xml=target/checkstyle/checkstyle-raw-report.xml
maven.checkstyle.properties=checkstyle.xml
maven.checkstyle.propertiesURL=http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-checkstyle-plugin/src/main/resources/config/avalon_checks.xml

View File

@ -0,0 +1,16 @@
# 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.
maven.checkstyle.output.xml=checkstyle-raw-report.xml
maven.checkstyle.properties=checkstyle.xml

View File

@ -0,0 +1,26 @@
# 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.
maven.compile.debug=on
maven.compile.deprecation=off
maven.compile.encoding=UTF-8
maven.compile.executable=/usr/java/bin/javac-2
maven.compile.fork=yes
maven.compile.memoryInitialSize=10m
maven.compile.memoryMaximumSize=20m
maven.compile.nowarn=On
maven.compile.optimize=Off
maven.compile.source=1.3
maven.compile.target=1.1
maven.compile.verbose=No

View File

@ -0,0 +1,24 @@
# 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.
maven.jar.compress=false
maven.jar.final.name=my.jar
maven.jar.index=true
maven.jar.mainclass=MyClass
maven.jar.manifest=manifest.mf
maven.jar.manifest.attributes.list=Bar-Attribute,Foo-Attribute
maven.jar.manifest.attribute.Bar-Attribute=I like toast and jam
maven.jar.manifest.attribute.Foo-Attribute=I like bread and butter
maven.jar.manifest.classpath.add=true
maven.jar.manifest.extensions.add=true

View File

@ -0,0 +1,57 @@
# 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.
maven.compile.encoding=ISO-8859-1
maven.docs.outputencoding=UTF-8
maven.javadoc.additionalparam=-J-showversion
maven.javadoc.author=false
maven.javadoc.bottom=Copyright
maven.javadoc.customtags=tag1 tag2
tag1.name=todo
tag1.description=To Do:
tag1.enabled=true
tag1.scope=all
tag2.name=task
tag2.description=Task:
tag2.enabled=false
tag2.scope=all
maven.javadoc.destdir=apidocs
maven.javadoc.doclet=org.apache.MyDoclet
maven.javadoc.docletpath=/path/to/doclet
maven.javadoc.excludepackagenames=org.apache.internal,org.apache.test
maven.javadoc.footer=The footer
maven.javadoc.header=The header
maven.javadoc.links=http://java.sun.com/j2se/1.4/docs/api/
maven.javadoc.locale=en_US
maven.javadoc.maxmemory=1024m
maven.javadoc.mode.online=true
maven.javadoc.offlineLinks=/opt/java-apidoc/j2sdk1.4.2/docs/api/
maven.javadoc.overview=src/main/java/org/apache/overview.html
maven.javadoc.package=true
maven.javadoc.private=false
maven.javadoc.public=false
maven.javadoc.source=1.3
maven.javadoc.stylesheet=myStylesheet.css
maven.javadoc.taglets=org.apache.MyTaglet
maven.javadoc.tagletpath=/path/to/taglet
maven.javadoc.use=true
maven.javadoc.version=true
maven.javadoc.windowtitle=The title
pom.package=org.apache.maven

View File

@ -0,0 +1,17 @@
# 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.
maven.javadoc.package=false
maven.javadoc.private=true
maven.javadoc.public=false

View File

@ -0,0 +1,17 @@
# 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.
maven.javadoc.package=false
maven.javadoc.private=false
maven.javadoc.public=true

View File

@ -0,0 +1,19 @@
# 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.
maven.pmd.cpd.minimumtokencount=50
maven.pmd.excludes=**/*PropertyListParser*
maven.pmd.failonruleviolation=true
maven.pmd.rulesetfiles=fileupload_basic.xml,rulesets/unusedcode.xml,rulesets/imports.xml
maven.pmd.targetjdk=1.4

View File

@ -0,0 +1,25 @@
# 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.
maven.junit.fork=yes
maven.junit.format=xml
maven.junit.jvm=java
maven.junit.jvmargs=-Xmx160m -verbose
maven.junit.printSummary=false
maven.junit.sysproperties=prop1 basedir
prop1=your value
basedir=${basedir}
maven.junit.usefile=false
maven.test.failure.ignore=true
maven.test.skip=true

View File

@ -0,0 +1,15 @@
# 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.
maven.junit.forkmode=once

View File

@ -0,0 +1,15 @@
# 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.
maven.junit.forkmode=perTest

View File

@ -0,0 +1,15 @@
# 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.
maven.tasklist.taskTag=@fixme

View File

@ -0,0 +1,15 @@
# 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.
maven.war.src=myWebappDirectory

View File

@ -0,0 +1,15 @@
# 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.
maven.war.src=${basedir}/myWebappDirectory

View File

@ -0,0 +1,13 @@
# 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.