mirror of https://github.com/apache/maven.git
Moving to shared
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@433652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
42360ab766
commit
2d267a1303
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2005-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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>maven</artifactId>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>maven-model-converter</artifactId>
|
||||
<name>Maven Model Converter</name>
|
||||
<description>Converts between version 3.0.0 and version 4.0.0 models.</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model-v3</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,39 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2005-2005 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.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
*/
|
||||
public interface ArtifactPomRewriter
|
||||
{
|
||||
public static final String ROLE = ArtifactPomRewriter.class.getName();
|
||||
|
||||
public static final String V3_POM = "v3";
|
||||
|
||||
public static final String V4_POM = "v4";
|
||||
|
||||
public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
|
||||
String packaging )
|
||||
throws Exception;
|
||||
|
||||
List getWarnings();
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
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.
|
||||
*/
|
||||
|
||||
public interface ConverterListener
|
||||
{
|
||||
void debug( String message );
|
||||
|
||||
void debug( String message, Throwable throwable );
|
||||
|
||||
void info( String message );
|
||||
|
||||
void info( String message, Throwable throwable );
|
||||
|
||||
void warn( String message );
|
||||
|
||||
void warn( String message, Throwable throwable );
|
||||
|
||||
void error( String message);
|
||||
|
||||
void error( String message, Throwable throwable );
|
||||
}
|
|
@ -1,379 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.converter.plugins.PluginConfigurationConverter;
|
||||
import org.apache.maven.model.converter.relocators.PluginRelocator;
|
||||
import org.apache.maven.model.converter.relocators.PluginRelocatorManager;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.io.SAXReader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Converts a Maven 1 project.xml (v3 pom) to a Maven 2 pom.xml (v4 pom).
|
||||
*
|
||||
* @author Fabrizio Giustina
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id$
|
||||
* @plexus.component role="org.apache.maven.model.converter.Maven1Converter"
|
||||
*/
|
||||
public class Maven1Converter
|
||||
extends AbstractLogEnabled
|
||||
{
|
||||
/**
|
||||
* Available converters for specific plugin configurations
|
||||
*
|
||||
* @plexus.requirement role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter"
|
||||
*/
|
||||
private List converters;
|
||||
|
||||
/**
|
||||
* Plexus component that manages plugin relocators
|
||||
*
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private PluginRelocatorManager pluginRelocatorManager;
|
||||
|
||||
private File basedir;
|
||||
|
||||
private File outputdir;
|
||||
|
||||
private String fileName = "project.xml";
|
||||
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
public void execute()
|
||||
throws ProjectConverterException
|
||||
{
|
||||
File projectxml = new File( basedir, fileName );
|
||||
|
||||
if ( !projectxml.exists() )
|
||||
{
|
||||
throw new ProjectConverterException( "Missing " + fileName + " 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 " + fileName + ". " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
Model v4Model;
|
||||
try
|
||||
{
|
||||
v4Model = translator.translate( v3Model );
|
||||
removeDistributionManagementStatus( v4Model );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new ProjectConverterException( "Exception caught while converting " + fileName + ". " + e.getMessage(),
|
||||
e );
|
||||
}
|
||||
|
||||
Properties properties = new Properties();
|
||||
|
||||
if ( v3Model.getExtend() != null )
|
||||
{
|
||||
loadProperties( properties, new File( new File( basedir, v3Model.getExtend() ).getParentFile(),
|
||||
"project.properties" ) );
|
||||
}
|
||||
|
||||
loadProperties( properties, new File( basedir, "project.properties" ) );
|
||||
|
||||
for ( Iterator i = converters.iterator(); i.hasNext(); )
|
||||
{
|
||||
PluginConfigurationConverter converter = (PluginConfigurationConverter) i.next();
|
||||
converter.convertConfiguration( v4Model, v3Model, properties );
|
||||
}
|
||||
|
||||
// @todo Should this be run before or after the configuration converters?
|
||||
Collection pluginRelocators = pluginRelocatorManager.getPluginRelocators();
|
||||
sendInfoMessage( "There are " + pluginRelocators.size() + " plugin relocators available" );
|
||||
PluginRelocator pluginRelocator;
|
||||
Iterator iterator = pluginRelocators.iterator();
|
||||
while ( iterator.hasNext() )
|
||||
{
|
||||
pluginRelocator = (PluginRelocator) iterator.next();
|
||||
pluginRelocator.relocate( v4Model );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
writeV4Pom( v4Model );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectConverterException( "Failed to write the pom.xml.", e );
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
sendWarnMessage( "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 ) )
|
||||
{
|
||||
sendWarnMessage( "Both <id> and <groupId> is set, using <groupId>." );
|
||||
|
||||
model.setGroupId( groupId );
|
||||
}
|
||||
|
||||
if ( !isEmpty( artifactId ) )
|
||||
{
|
||||
sendWarnMessage( "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, IOException
|
||||
{
|
||||
if ( outputdir == null )
|
||||
{
|
||||
outputdir = basedir;
|
||||
}
|
||||
|
||||
if ( !outputdir.exists() && !outputdir.mkdirs() )
|
||||
{
|
||||
throw new IOException( "Failed to create directory " + outputdir );
|
||||
}
|
||||
|
||||
File pomxml = new File( outputdir, "pom.xml" );
|
||||
|
||||
if ( pomxml.exists() )
|
||||
{
|
||||
sendWarnMessage( "pom.xml in " + outputdir.getAbsolutePath() + " already exists, overwriting" );
|
||||
}
|
||||
|
||||
MavenXpp3Writer v4Writer = new MavenXpp3Writer();
|
||||
|
||||
// write the new pom.xml
|
||||
sendInfoMessage( "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;
|
||||
}
|
||||
|
||||
public String getProjectFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setProjectFileName( String projectFileName )
|
||||
{
|
||||
this.fileName = projectFileName;
|
||||
}
|
||||
|
||||
public void setProjectFile( File projectFile )
|
||||
{
|
||||
if ( projectFile != null )
|
||||
{
|
||||
basedir = projectFile.getParentFile();
|
||||
fileName = projectFile.getName();
|
||||
}
|
||||
}
|
||||
|
||||
public File getOutputdir()
|
||||
{
|
||||
return outputdir;
|
||||
}
|
||||
|
||||
public void setOutputdir( File outputdir )
|
||||
{
|
||||
this.outputdir = outputdir;
|
||||
}
|
||||
|
||||
public void addListener( ConverterListener listener )
|
||||
{
|
||||
if ( !listeners.contains( listener ) )
|
||||
{
|
||||
listeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
private void sendInfoMessage( String message )
|
||||
{
|
||||
getLogger().info( message );
|
||||
|
||||
for ( Iterator i = listeners.iterator(); i.hasNext(); )
|
||||
{
|
||||
ConverterListener listener = (ConverterListener) i.next();
|
||||
listener.info( message );
|
||||
}
|
||||
}
|
||||
|
||||
private void sendWarnMessage( String message )
|
||||
{
|
||||
getLogger().warn( message );
|
||||
|
||||
for ( Iterator i = listeners.iterator(); i.hasNext(); )
|
||||
{
|
||||
ConverterListener listener = (ConverterListener) i.next();
|
||||
listener.warn( message );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2005-2005 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 java.util.List;
|
||||
|
||||
/**
|
||||
* Model conversion interface.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface ModelConverter
|
||||
{
|
||||
String ROLE = ModelConverter.class.getName();
|
||||
|
||||
Model translate( org.apache.maven.model.v3_0_0.Model v3Model )
|
||||
throws PomTranslationException;
|
||||
|
||||
void validateV4Basics( Model model, String groupId, String artifactId, String version, String packaging );
|
||||
|
||||
List getWarnings();
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package org.apache.maven.model.converter;/*
|
||||
* Copyright 2001-2005 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 jdcasey
|
||||
*/
|
||||
public class PomTranslationException
|
||||
extends Exception
|
||||
{
|
||||
|
||||
private final String groupId;
|
||||
|
||||
private final String artifactId;
|
||||
|
||||
private final String version;
|
||||
|
||||
public PomTranslationException( String groupId, String artifactId, String version, String message )
|
||||
{
|
||||
this( groupId, artifactId, version, message, null );
|
||||
}
|
||||
|
||||
public PomTranslationException( String groupId, String artifactId, String version, Throwable cause )
|
||||
{
|
||||
this( groupId, artifactId, version, "[No message provided.]", cause );
|
||||
}
|
||||
|
||||
public PomTranslationException( String groupId, String artifactId, String version, String message, Throwable cause )
|
||||
{
|
||||
super( "In POM{" + groupId + ":" + artifactId + ":" + version + "}: " + message, cause );
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public String getArtifactId()
|
||||
{
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
|
@ -1,867 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 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.CiManagement;
|
||||
import org.apache.maven.model.Contributor;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.DeploymentRepository;
|
||||
import org.apache.maven.model.Developer;
|
||||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.model.IssueManagement;
|
||||
import org.apache.maven.model.License;
|
||||
import org.apache.maven.model.MailingList;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Notifier;
|
||||
import org.apache.maven.model.Organization;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.apache.maven.model.Scm;
|
||||
import org.apache.maven.model.Site;
|
||||
import org.apache.maven.model.v3_0_0.UnitTest;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
* @plexus.component role="org.apache.maven.model.converter.ModelConverter"
|
||||
*/
|
||||
public class PomV3ToV4Translator
|
||||
implements ModelConverter
|
||||
{
|
||||
private transient List discoveredPlugins = new ArrayList();
|
||||
|
||||
private List warnings;
|
||||
|
||||
public Model translate( org.apache.maven.model.v3_0_0.Model v3Model )
|
||||
throws PomTranslationException
|
||||
{
|
||||
warnings = new ArrayList();
|
||||
|
||||
try
|
||||
{
|
||||
String groupId = format( v3Model.getGroupId() );
|
||||
String artifactId = format( v3Model.getArtifactId() );
|
||||
|
||||
String id = v3Model.getId();
|
||||
|
||||
if ( StringUtils.isNotEmpty( id ) )
|
||||
{
|
||||
if ( StringUtils.isEmpty( groupId ) )
|
||||
{
|
||||
int plusIdx = id.indexOf( "+" );
|
||||
if ( plusIdx > -1 )
|
||||
{
|
||||
groupId = id.substring( 0, plusIdx );
|
||||
}
|
||||
else
|
||||
{
|
||||
groupId = id;
|
||||
}
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( artifactId ) )
|
||||
{
|
||||
artifactId = format( id );
|
||||
}
|
||||
}
|
||||
|
||||
String version = format( v3Model.getCurrentVersion() );
|
||||
|
||||
if ( version == null )
|
||||
{
|
||||
version = format( v3Model.getVersion() );
|
||||
}
|
||||
|
||||
PomKey pomKey = new PomKey( groupId, artifactId, version );
|
||||
|
||||
warnOfUnsupportedMainModelElements( v3Model );
|
||||
|
||||
Model model = new Model();
|
||||
model.setArtifactId( artifactId );
|
||||
|
||||
// moved this above the translation of the build, to allow
|
||||
// additional plugins to be defined in v3 poms via
|
||||
// <dependency><type>plugin</type></dependency>
|
||||
model.setDependencies( translateDependencies( v3Model.getDependencies() ) );
|
||||
|
||||
model.setBuild( translateBuild( v3Model.getBuild() ) );
|
||||
model.setCiManagement( translateCiManagementInfo( v3Model.getBuild() ) );
|
||||
model.setContributors( translateContributors( v3Model.getContributors() ) );
|
||||
|
||||
model.setDescription( v3Model.getDescription() );
|
||||
model.setDevelopers( translateDevelopers( v3Model.getDevelopers() ) );
|
||||
|
||||
model.setDistributionManagement( translateDistributionManagement( pomKey, v3Model ) );
|
||||
|
||||
model.setGroupId( groupId );
|
||||
model.setInceptionYear( v3Model.getInceptionYear() );
|
||||
model.setIssueManagement( translateIssueManagement( v3Model ) );
|
||||
|
||||
model.setLicenses( translateLicenses( v3Model.getLicenses() ) );
|
||||
model.setMailingLists( translateMailingLists( v3Model.getMailingLists() ) );
|
||||
model.setModelVersion( "4.0.0" );
|
||||
model.setName( v3Model.getName() );
|
||||
model.setOrganization( translateOrganization( v3Model.getOrganization() ) );
|
||||
model.setPackaging( "jar" );
|
||||
// TODO: not very good conversion - just omit for now
|
||||
// model.setReporting( translateReports( v3Model.getReports(), reporter ) );
|
||||
model.setScm( translateScm( v3Model ) );
|
||||
model.setUrl( v3Model.getUrl() );
|
||||
|
||||
model.setVersion( version );
|
||||
|
||||
return model;
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.discoveredPlugins.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private String format( String source )
|
||||
{
|
||||
return source == null ? null : source.replace( '+', '-' );
|
||||
}
|
||||
|
||||
private CiManagement translateCiManagementInfo( org.apache.maven.model.v3_0_0.Build v3Build )
|
||||
{
|
||||
CiManagement ciMgmt = null;
|
||||
|
||||
if ( v3Build != null )
|
||||
{
|
||||
String nagEmailAddress = v3Build.getNagEmailAddress();
|
||||
|
||||
if ( StringUtils.isNotEmpty( nagEmailAddress ) )
|
||||
{
|
||||
Notifier notifier = new Notifier();
|
||||
|
||||
notifier.setType( "mail" );
|
||||
notifier.addConfiguration( "address", nagEmailAddress );
|
||||
|
||||
ciMgmt = new CiManagement();
|
||||
ciMgmt.addNotifier( notifier );
|
||||
}
|
||||
}
|
||||
|
||||
return ciMgmt;
|
||||
}
|
||||
|
||||
private void warnOfUnsupportedMainModelElements( org.apache.maven.model.v3_0_0.Model v3Model )
|
||||
{
|
||||
if ( StringUtils.isNotEmpty( v3Model.getExtend() ) )
|
||||
{
|
||||
warnings.add( "Ignoring non-portable parent declaration: " + v3Model.getExtend() );
|
||||
}
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Model.getGumpRepositoryId() ) )
|
||||
{
|
||||
warnings.add( "Ignoring gump repository id: \'" + v3Model.getGumpRepositoryId() +
|
||||
"\'. This is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( notEmpty( v3Model.getVersions() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <versions/> section. This is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( notEmpty( v3Model.getBranches() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <branches/> section. This is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
Properties v3ModelProperties = v3Model.getProperties();
|
||||
|
||||
if ( v3ModelProperties != null && !v3ModelProperties.isEmpty() )
|
||||
{
|
||||
warnings.add( "Ignoring <properties/> section. It is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Model.getPackage() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <package/>. It is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( notEmpty( v3Model.getPackageGroups() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <packageGroups/> section. It is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Model.getLogo() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <logo/> for project. It is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Model.getShortDescription() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <shortDescription/>. It is not supported in v4 POMs." );
|
||||
}
|
||||
}
|
||||
|
||||
private Scm translateScm( org.apache.maven.model.v3_0_0.Model v3Model )
|
||||
{
|
||||
Scm scm = null;
|
||||
|
||||
org.apache.maven.model.v3_0_0.Repository repo = v3Model.getRepository();
|
||||
if ( repo != null )
|
||||
{
|
||||
scm = new Scm();
|
||||
scm.setConnection( repo.getConnection() );
|
||||
scm.setDeveloperConnection( repo.getDeveloperConnection() );
|
||||
scm.setUrl( repo.getUrl() );
|
||||
}
|
||||
|
||||
return scm;
|
||||
}
|
||||
|
||||
/*
|
||||
private Reporting translateReports( List v3Reports, Reporter reporter )
|
||||
throws ReportWriteException
|
||||
{
|
||||
Reporting reports = null;
|
||||
if ( v3Reports != null && !v3Reports.isEmpty() )
|
||||
{
|
||||
reports = new Reporting();
|
||||
for ( Iterator it = v3Reports.iterator(); it.hasNext(); )
|
||||
{
|
||||
String reportName = (String) it.next();
|
||||
|
||||
Pattern pluginNamePattern = Pattern.compile( "maven-(.+)-plugin" );
|
||||
Matcher matcher = pluginNamePattern.matcher( reportName );
|
||||
|
||||
String reportPluginName;
|
||||
if ( !matcher.matches() )
|
||||
{
|
||||
warnings.add(
|
||||
"Non-standard report name: \'" + reportName + "\'. Using entire name for plugin artifactId." );
|
||||
|
||||
reportPluginName = reportName;
|
||||
}
|
||||
else
|
||||
{
|
||||
reportPluginName = matcher.group( 1 );
|
||||
}
|
||||
|
||||
ReportPlugin reportPlugin = new ReportPlugin();
|
||||
|
||||
reportPlugin.setGroupId( "maven" );
|
||||
|
||||
reportPlugin.setArtifactId( reportPluginName );
|
||||
|
||||
StringBuffer info = new StringBuffer();
|
||||
|
||||
info.append( "Using some derived information for report: \'" ).append( reportName ).append( "\'.\n" )
|
||||
.append( "\to groupId: \'maven\'\n" ).append( "\to artifactId: \'" ).append( reportPluginName )
|
||||
.append( "\'\n" ).append( "\to goal: \'report\'\n" )
|
||||
.append( "\n" )
|
||||
.append( "These values were extracted using the v3 report naming convention, but may be wrong." );
|
||||
|
||||
warnings.add( info.toString() );
|
||||
|
||||
reports.addPlugin( reportPlugin );
|
||||
}
|
||||
}
|
||||
|
||||
return reports;
|
||||
}
|
||||
*/
|
||||
|
||||
private Organization translateOrganization( org.apache.maven.model.v3_0_0.Organization v3Organization )
|
||||
{
|
||||
Organization organization = null;
|
||||
|
||||
if ( v3Organization != null )
|
||||
{
|
||||
organization = new Organization();
|
||||
|
||||
organization.setName( v3Organization.getName() );
|
||||
organization.setUrl( v3Organization.getUrl() );
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Organization.getLogo() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <organization><logo/></organization>. It is not supported in v4 POMs." );
|
||||
}
|
||||
}
|
||||
|
||||
return organization;
|
||||
}
|
||||
|
||||
private List translateMailingLists( List v3MailingLists )
|
||||
{
|
||||
List mailingLists = new ArrayList();
|
||||
|
||||
if ( notEmpty( v3MailingLists ) )
|
||||
{
|
||||
for ( Iterator it = v3MailingLists.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.MailingList v3List = (org.apache.maven.model.v3_0_0.MailingList) it
|
||||
.next();
|
||||
MailingList list = new MailingList();
|
||||
list.setArchive( v3List.getArchive() );
|
||||
list.setName( v3List.getName() );
|
||||
list.setSubscribe( v3List.getSubscribe() );
|
||||
list.setUnsubscribe( v3List.getUnsubscribe() );
|
||||
|
||||
mailingLists.add( list );
|
||||
}
|
||||
}
|
||||
|
||||
return mailingLists;
|
||||
}
|
||||
|
||||
private List translateLicenses( List v3Licenses )
|
||||
{
|
||||
List licenses = new ArrayList();
|
||||
|
||||
if ( notEmpty( v3Licenses ) )
|
||||
{
|
||||
for ( Iterator it = v3Licenses.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.License v3License = (org.apache.maven.model.v3_0_0.License) it.next();
|
||||
License license = new License();
|
||||
license.setComments( v3License.getComments() );
|
||||
license.setName( v3License.getName() );
|
||||
license.setUrl( v3License.getUrl() );
|
||||
|
||||
licenses.add( license );
|
||||
}
|
||||
}
|
||||
|
||||
return licenses;
|
||||
}
|
||||
|
||||
private IssueManagement translateIssueManagement( org.apache.maven.model.v3_0_0.Model v3Model )
|
||||
{
|
||||
IssueManagement issueMgmt = null;
|
||||
|
||||
String issueTrackingUrl = v3Model.getIssueTrackingUrl();
|
||||
if ( StringUtils.isNotEmpty( issueTrackingUrl ) )
|
||||
{
|
||||
issueMgmt = new IssueManagement();
|
||||
issueMgmt.setUrl( issueTrackingUrl );
|
||||
}
|
||||
|
||||
return issueMgmt;
|
||||
}
|
||||
|
||||
private DistributionManagement translateDistributionManagement( PomKey pomKey,
|
||||
org.apache.maven.model.v3_0_0.Model v3Model )
|
||||
throws PomTranslationException
|
||||
{
|
||||
DistributionManagement distributionManagement = new DistributionManagement();
|
||||
|
||||
Site site = null;
|
||||
|
||||
String siteAddress = v3Model.getSiteAddress();
|
||||
|
||||
String siteDirectory = v3Model.getSiteDirectory();
|
||||
|
||||
if ( StringUtils.isEmpty( siteAddress ) )
|
||||
{
|
||||
if ( !StringUtils.isEmpty( siteDirectory ) )
|
||||
{
|
||||
site = new Site();
|
||||
|
||||
site.setId( "default" );
|
||||
|
||||
site.setName( "Default Site" );
|
||||
|
||||
site.setUrl( "file://" + siteDirectory );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( StringUtils.isEmpty( siteDirectory ) )
|
||||
{
|
||||
throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(),
|
||||
"Missing 'siteDirectory': Both siteAddress and siteDirectory must be set at the same time." );
|
||||
}
|
||||
|
||||
site = new Site();
|
||||
|
||||
site.setId( "default" );
|
||||
|
||||
site.setName( "Default Site" );
|
||||
|
||||
site.setUrl( "scp://" + siteAddress + "/" + siteDirectory );
|
||||
}
|
||||
|
||||
distributionManagement.setSite( site );
|
||||
|
||||
String distributionSite = v3Model.getDistributionSite();
|
||||
|
||||
String distributionDirectory = v3Model.getDistributionDirectory();
|
||||
|
||||
DeploymentRepository repository = null;
|
||||
|
||||
if ( StringUtils.isEmpty( distributionSite ) )
|
||||
{
|
||||
if ( !StringUtils.isEmpty( distributionDirectory ) )
|
||||
{
|
||||
repository = new DeploymentRepository();
|
||||
|
||||
repository.setId( "default" );
|
||||
|
||||
repository.setName( "Default Repository" );
|
||||
|
||||
repository.setUrl( "file://" + distributionDirectory );
|
||||
// throw new Exception( "Missing 'distributionSite': Both distributionSite and
|
||||
// distributionDirectory must be set." );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( StringUtils.isEmpty( distributionDirectory ) )
|
||||
{
|
||||
throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(),
|
||||
"Missing 'distributionDirectory': must be set is 'distributionSite' is set." );
|
||||
}
|
||||
|
||||
repository = new DeploymentRepository();
|
||||
|
||||
repository.setId( "default" );
|
||||
|
||||
repository.setName( "Default Repository" );
|
||||
|
||||
repository.setUrl( distributionSite + "/" + distributionDirectory );
|
||||
}
|
||||
|
||||
distributionManagement.setRepository( repository );
|
||||
|
||||
distributionManagement.setStatus( "converted" );
|
||||
|
||||
if ( site == null && repository == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return distributionManagement;
|
||||
}
|
||||
|
||||
private List translateDevelopers( List v3Developers )
|
||||
{
|
||||
List developers = new ArrayList();
|
||||
|
||||
if ( notEmpty( v3Developers ) )
|
||||
{
|
||||
for ( Iterator it = v3Developers.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.Developer v3Developer = (org.apache.maven.model.v3_0_0.Developer) it
|
||||
.next();
|
||||
|
||||
Developer developer = new Developer();
|
||||
|
||||
developer.setEmail( v3Developer.getEmail() );
|
||||
developer.setId( v3Developer.getId() );
|
||||
developer.setName( v3Developer.getName() );
|
||||
developer.setOrganization( v3Developer.getOrganization() );
|
||||
developer.setRoles( v3Developer.getRoles() );
|
||||
developer.setTimezone( v3Developer.getTimezone() );
|
||||
developer.setUrl( v3Developer.getUrl() );
|
||||
|
||||
developers.add( developer );
|
||||
}
|
||||
}
|
||||
|
||||
return developers;
|
||||
}
|
||||
|
||||
private List translateDependencies( List v3Deps )
|
||||
{
|
||||
List deps = new ArrayList();
|
||||
|
||||
if ( notEmpty( v3Deps ) )
|
||||
{
|
||||
boolean isJunitPresent = false;
|
||||
|
||||
for ( Iterator it = v3Deps.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.Dependency v3Dep = (org.apache.maven.model.v3_0_0.Dependency) it.next();
|
||||
|
||||
String groupId = format( v3Dep.getGroupId() );
|
||||
String artifactId = format( v3Dep.getArtifactId() );
|
||||
|
||||
String id = v3Dep.getId();
|
||||
|
||||
if ( StringUtils.isNotEmpty( id ) )
|
||||
{
|
||||
if ( StringUtils.isEmpty( groupId ) )
|
||||
{
|
||||
int plusIdx = id.indexOf( "+" );
|
||||
|
||||
if ( plusIdx > -1 )
|
||||
{
|
||||
groupId = id.substring( 0, plusIdx );
|
||||
}
|
||||
else
|
||||
{
|
||||
groupId = id;
|
||||
}
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( artifactId ) )
|
||||
{
|
||||
artifactId = format( id );
|
||||
}
|
||||
}
|
||||
|
||||
if ( "junit".equals( groupId ) && "junit".equals( artifactId ) )
|
||||
{
|
||||
isJunitPresent = true;
|
||||
}
|
||||
|
||||
String type = v3Dep.getType();
|
||||
if ( "plugin".equals( type ) )
|
||||
{
|
||||
if ( "maven".equals( groupId ) )
|
||||
{
|
||||
groupId = "org.apache.maven.plugins";
|
||||
}
|
||||
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setGroupId( groupId );
|
||||
plugin.setArtifactId( artifactId );
|
||||
plugin.setVersion( format( v3Dep.getVersion() ) );
|
||||
|
||||
Xpp3Dom config = new Xpp3Dom( "configuration" );
|
||||
|
||||
Properties props = v3Dep.getProperties();
|
||||
|
||||
if ( !props.isEmpty() )
|
||||
{
|
||||
for ( Iterator propertyIterator = props.keySet().iterator(); propertyIterator.hasNext(); )
|
||||
{
|
||||
String key = (String) propertyIterator.next();
|
||||
String value = props.getProperty( key );
|
||||
|
||||
Xpp3Dom child = new Xpp3Dom( key );
|
||||
child.setValue( value );
|
||||
|
||||
config.addChild( child );
|
||||
}
|
||||
}
|
||||
|
||||
plugin.setConfiguration( config );
|
||||
|
||||
this.discoveredPlugins.add( plugin );
|
||||
}
|
||||
else
|
||||
{
|
||||
Dependency dep = new Dependency();
|
||||
|
||||
dep.setGroupId( groupId );
|
||||
dep.setArtifactId( artifactId );
|
||||
dep.setVersion( v3Dep.getVersion() );
|
||||
dep.setType( v3Dep.getType() );
|
||||
|
||||
String scope = v3Dep.getProperty( "scope" );
|
||||
if ( StringUtils.isNotEmpty( scope ) )
|
||||
{
|
||||
dep.setScope( scope );
|
||||
}
|
||||
|
||||
String optional = v3Dep.getProperty( "optional" );
|
||||
if ( StringUtils.isNotEmpty( optional ) )
|
||||
{
|
||||
dep.setOptional( Boolean.valueOf( optional ).booleanValue() );
|
||||
}
|
||||
|
||||
deps.add( dep );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isJunitPresent )
|
||||
{
|
||||
Dependency junitDep = new Dependency();
|
||||
junitDep.setGroupId( "junit" );
|
||||
junitDep.setArtifactId( "junit" );
|
||||
junitDep.setVersion( "3.8.2" );
|
||||
junitDep.setScope( "test" );
|
||||
deps.add( junitDep );
|
||||
}
|
||||
}
|
||||
|
||||
return deps;
|
||||
}
|
||||
|
||||
private List translateContributors( List v3Contributors )
|
||||
{
|
||||
List contributors = new ArrayList();
|
||||
|
||||
if ( notEmpty( v3Contributors ) )
|
||||
{
|
||||
for ( Iterator it = v3Contributors.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.Contributor v3Contributor = (org.apache.maven.model.v3_0_0.Contributor) it
|
||||
.next();
|
||||
|
||||
Contributor contributor = new Contributor();
|
||||
|
||||
contributor.setEmail( v3Contributor.getEmail() );
|
||||
contributor.setName( v3Contributor.getName() );
|
||||
contributor.setOrganization( v3Contributor.getOrganization() );
|
||||
contributor.setRoles( v3Contributor.getRoles() );
|
||||
contributor.setTimezone( v3Contributor.getTimezone() );
|
||||
contributor.setUrl( v3Contributor.getUrl() );
|
||||
|
||||
contributors.add( contributor );
|
||||
}
|
||||
}
|
||||
|
||||
return contributors;
|
||||
}
|
||||
|
||||
private Build translateBuild( org.apache.maven.model.v3_0_0.Build v3Build )
|
||||
{
|
||||
Build build = null;
|
||||
if ( v3Build != null )
|
||||
{
|
||||
build = new Build();
|
||||
|
||||
warnOfUnsupportedBuildElements( v3Build );
|
||||
|
||||
build.setSourceDirectory( v3Build.getSourceDirectory() );
|
||||
build.setTestSourceDirectory( v3Build.getUnitTestSourceDirectory() );
|
||||
|
||||
build.setResources( translateResources( v3Build.getResources() ) );
|
||||
|
||||
UnitTest unitTest = v3Build.getUnitTest();
|
||||
if ( unitTest != null )
|
||||
{
|
||||
build.setTestResources( translateResources( unitTest.getResources() ) );
|
||||
|
||||
List testIncludes = unitTest.getIncludes();
|
||||
|
||||
List testExcludes = new ArrayList( unitTest.getExcludes() );
|
||||
|
||||
if ( notEmpty( testIncludes ) || notEmpty( testExcludes ) )
|
||||
{
|
||||
Plugin plugin = new Plugin();
|
||||
plugin.setGroupId( "org.apache.maven.plugins" );
|
||||
plugin.setArtifactId( "maven-surefire-plugin" );
|
||||
|
||||
Xpp3Dom config = new Xpp3Dom( "configuration" );
|
||||
|
||||
if ( notEmpty( testIncludes ) )
|
||||
{
|
||||
Xpp3Dom includes = new Xpp3Dom( "includes" );
|
||||
for ( Iterator it = testIncludes.iterator(); it.hasNext(); )
|
||||
{
|
||||
String includePattern = (String) it.next();
|
||||
Xpp3Dom include = new Xpp3Dom( "include" );
|
||||
include.setValue( includePattern );
|
||||
|
||||
includes.addChild( include );
|
||||
}
|
||||
|
||||
config.addChild( includes );
|
||||
}
|
||||
|
||||
if ( notEmpty( testExcludes ) )
|
||||
{
|
||||
Xpp3Dom excludes = new Xpp3Dom( "excludes" );
|
||||
for ( Iterator it = testExcludes.iterator(); it.hasNext(); )
|
||||
{
|
||||
String excludePattern = (String) it.next();
|
||||
Xpp3Dom exclude = new Xpp3Dom( "exclude" );
|
||||
exclude.setValue( excludePattern );
|
||||
|
||||
excludes.addChild( exclude );
|
||||
}
|
||||
|
||||
config.addChild( excludes );
|
||||
}
|
||||
|
||||
if ( config.getChildCount() > 0 )
|
||||
{
|
||||
plugin.setConfiguration( config );
|
||||
}
|
||||
|
||||
build.addPlugin( plugin );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !this.discoveredPlugins.isEmpty() )
|
||||
{
|
||||
if ( build == null )
|
||||
{
|
||||
build = new Build();
|
||||
}
|
||||
|
||||
for ( Iterator it = this.discoveredPlugins.iterator(); it.hasNext(); )
|
||||
{
|
||||
Plugin plugin = (Plugin) it.next();
|
||||
|
||||
build.addPlugin( plugin );
|
||||
}
|
||||
}
|
||||
|
||||
return build;
|
||||
}
|
||||
|
||||
private void warnOfUnsupportedBuildElements( org.apache.maven.model.v3_0_0.Build v3Build )
|
||||
{
|
||||
if ( notEmpty( v3Build.getSourceModifications() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <sourceModifications/> section. It is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Build.getAspectSourceDirectory() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <aspectSourceDirectory/>. It is not supported in v4 POMs." );
|
||||
}
|
||||
|
||||
if ( StringUtils.isNotEmpty( v3Build.getIntegrationUnitTestSourceDirectory() ) )
|
||||
{
|
||||
warnings.add( "Ignoring <integrationUnitTestSourceDirectory/>. It is not supported in v4 POMs." );
|
||||
}
|
||||
}
|
||||
|
||||
private List translateResources( List v3Resources )
|
||||
{
|
||||
List resources = new ArrayList();
|
||||
|
||||
if ( notEmpty( v3Resources ) )
|
||||
{
|
||||
for ( Iterator it = v3Resources.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.Resource v3Resource = (org.apache.maven.model.v3_0_0.Resource) it.next();
|
||||
Resource resource = new Resource();
|
||||
|
||||
if ( v3Resource.getDirectory() == null )
|
||||
{
|
||||
resource.setDirectory( "." );
|
||||
}
|
||||
else
|
||||
{
|
||||
resource.setDirectory( v3Resource.getDirectory() );
|
||||
}
|
||||
|
||||
List excludes = new ArrayList( v3Resource.getExcludes() );
|
||||
|
||||
resource.setExcludes( excludes );
|
||||
|
||||
resource.setIncludes( v3Resource.getIncludes() );
|
||||
resource.setTargetPath( v3Resource.getTargetPath() );
|
||||
|
||||
resources.add( resource );
|
||||
}
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
|
||||
// private String pathPatternsToString( List patterns )
|
||||
// {
|
||||
// StringBuffer result = new StringBuffer();
|
||||
//
|
||||
// if ( notEmpty( patterns ) )
|
||||
// {
|
||||
// for ( Iterator it = patterns.iterator(); it.hasNext(); )
|
||||
// {
|
||||
// String pattern = (String) it.next();
|
||||
//
|
||||
// result.append( "," ).append( pattern );
|
||||
// }
|
||||
//
|
||||
// result.setLength( result.length() - 1 );
|
||||
// }
|
||||
//
|
||||
// return result.toString();
|
||||
// }
|
||||
|
||||
private boolean notEmpty( List test )
|
||||
{
|
||||
return test != null && !test.isEmpty();
|
||||
}
|
||||
|
||||
public void validateV4Basics( Model model, String groupId, String artifactId, String version, String packaging )
|
||||
{
|
||||
if ( StringUtils.isEmpty( model.getModelVersion() ) )
|
||||
{
|
||||
model.setModelVersion( "4.0.0" );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( model.getGroupId() ) )
|
||||
{
|
||||
warnings.add( "Setting groupId on model using artifact information." );
|
||||
model.setGroupId( groupId );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( model.getArtifactId() ) )
|
||||
{
|
||||
warnings.add( "Setting artifactId on model using artifact information." );
|
||||
model.setArtifactId( artifactId );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( model.getVersion() ) )
|
||||
{
|
||||
warnings.add( "Setting version on model using artifact information." );
|
||||
model.setVersion( version );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( model.getPackaging() ) )
|
||||
{
|
||||
warnings.add( "Setting packaging on model using artifact type information." );
|
||||
model.setPackaging( packaging );
|
||||
}
|
||||
}
|
||||
|
||||
public List getWarnings()
|
||||
{
|
||||
return warnings;
|
||||
}
|
||||
|
||||
private static class PomKey
|
||||
{
|
||||
private final String groupId;
|
||||
|
||||
private final String artifactId;
|
||||
|
||||
private final String version;
|
||||
|
||||
PomKey( String groupId, String artifactId, String version )
|
||||
{
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String groupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public String artifactId()
|
||||
{
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public String version()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
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 );
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 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.v3_0_0.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
* @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v3"
|
||||
*/
|
||||
public class V3PomRewriter
|
||||
implements ArtifactPomRewriter
|
||||
{
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ModelConverter translator;
|
||||
|
||||
public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
|
||||
String packaging )
|
||||
throws Exception
|
||||
{
|
||||
Model v4Model;
|
||||
|
||||
if ( from != null )
|
||||
{
|
||||
MavenXpp3Reader v3Reader = new MavenXpp3Reader();
|
||||
|
||||
StringWriter w = new StringWriter();
|
||||
IOUtil.copy( from, w );
|
||||
String content = StringUtils.replace( w.toString(), "${pom.currentVersion}", "${project.version}" );
|
||||
|
||||
org.apache.maven.model.v3_0_0.Model v3Model = v3Reader.read( new StringReader( content ) );
|
||||
v4Model = translator.translate( v3Model );
|
||||
}
|
||||
else
|
||||
{
|
||||
v4Model = new Model();
|
||||
}
|
||||
|
||||
if ( v4Model != null )
|
||||
{
|
||||
translator.validateV4Basics( v4Model, groupId, artifactId, version, packaging );
|
||||
|
||||
if ( !reportOnly )
|
||||
{
|
||||
MavenXpp3Writer v4Writer = new MavenXpp3Writer();
|
||||
v4Writer.write( to, v4Model );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List getWarnings()
|
||||
{
|
||||
return translator.getWarnings();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 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.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
* @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v4"
|
||||
*/
|
||||
public class V4PomRewriter
|
||||
implements ArtifactPomRewriter
|
||||
{
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ModelConverter translator;
|
||||
|
||||
public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
|
||||
String packaging )
|
||||
throws Exception
|
||||
{
|
||||
Model model = null;
|
||||
|
||||
if ( from != null )
|
||||
{
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
|
||||
model = reader.read( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new Model();
|
||||
}
|
||||
|
||||
if ( model != null )
|
||||
{
|
||||
translator.validateV4Basics( model, groupId, artifactId, version, packaging );
|
||||
|
||||
if ( !reportOnly )
|
||||
{
|
||||
MavenXpp3Writer writer = new MavenXpp3Writer();
|
||||
writer.write( to, model );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List getWarnings()
|
||||
{
|
||||
return translator.getWarnings();
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-changelog-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="changelog"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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" );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-changes-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="changes"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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" );
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-checkstyle-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="checkstyle"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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" );
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="compiler"
|
||||
*
|
||||
* @author Fabrizio Giustina
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PCCCompiler
|
||||
extends AbstractPluginConfigurationConverter
|
||||
{
|
||||
/**
|
||||
* @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
|
||||
*/
|
||||
public String getArtifactId()
|
||||
{
|
||||
return "maven-compiler-plugin";
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return TYPE_BUILD_PLUGIN;
|
||||
}
|
||||
|
||||
protected void addOnOffConfigurationChild( Xpp3Dom configuration, Properties projectProperties,
|
||||
String mavenOneProperty, String mavenTwoElement )
|
||||
throws ProjectConverterException
|
||||
{
|
||||
String value = projectProperties.getProperty( mavenOneProperty );
|
||||
if ( value != null )
|
||||
{
|
||||
addConfigurationChild( configuration, mavenTwoElement, PropertyUtils.convertOnOffToBoolean( value ) );
|
||||
}
|
||||
}
|
||||
|
||||
protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
|
||||
Properties projectProperties )
|
||||
throws ProjectConverterException
|
||||
{
|
||||
addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.debug", "debug" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.compile.encoding", "encoding" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.compile.executable", "executable" );
|
||||
|
||||
String fork = projectProperties.getProperty( "maven.compile.fork" );
|
||||
if ( fork != null )
|
||||
{
|
||||
addConfigurationChild( configuration, "fork", PropertyUtils.convertYesNoToBoolean( fork ) );
|
||||
}
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.compile.memoryMaximumSize", "maxmem" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.compile.memoryInitialSize", "meminitial" );
|
||||
|
||||
addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.optimize", "optimize" );
|
||||
|
||||
addOnOffConfigurationChild( configuration, projectProperties, "maven.compile.deprecation", "showDeprecation" );
|
||||
|
||||
String nowarn = projectProperties.getProperty( "maven.compile.nowarn" );
|
||||
if ( nowarn != null )
|
||||
{
|
||||
String convertedNowarn = PropertyUtils.convertOnOffToBoolean( nowarn );
|
||||
if ( convertedNowarn != null )
|
||||
{
|
||||
String showWarnings = PropertyUtils.invertBoolean( convertedNowarn );
|
||||
addConfigurationChild( configuration, "showWarnings", showWarnings );
|
||||
}
|
||||
}
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.compile.source", "source" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.compile.target", "target" );
|
||||
|
||||
String value = projectProperties.getProperty( "maven.compile.verbose" );
|
||||
if ( value != null )
|
||||
{
|
||||
addConfigurationChild( configuration, "verbose", PropertyUtils.convertYesNoToBoolean( value ) );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-jar-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="jar"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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" );
|
||||
}
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-javadoc-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="javadoc"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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" );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="multiproject"
|
||||
*
|
||||
* @author Fabrizio Giustina
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PCCMultiproject
|
||||
implements PluginConfigurationConverter
|
||||
{
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.model.converter.plugins.PluginConfigurationConverter#convertConfiguration(org.apache.maven.model.Model, org.apache.maven.model.v3_0_0.Model, java.util.Properties)
|
||||
*/
|
||||
public void convertConfiguration( Model v4Model, org.apache.maven.model.v3_0_0.Model v3Model,
|
||||
Properties projectProperties )
|
||||
throws ProjectConverterException
|
||||
{
|
||||
String projectType = projectProperties.getProperty( "maven.multiproject.type" );
|
||||
|
||||
if ( projectType != null )
|
||||
{
|
||||
v4Model.setPackaging( projectType );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-pmd-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="pmd"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="surefire"
|
||||
*
|
||||
* @author Fabrizio Giustina
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PCCSurefire
|
||||
extends AbstractPluginConfigurationConverter
|
||||
{
|
||||
/**
|
||||
* @see org.apache.maven.model.converter.plugins.AbstractPluginConfigurationConverter#getArtifactId()
|
||||
*/
|
||||
public String getArtifactId()
|
||||
{
|
||||
return "maven-surefire-plugin";
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return TYPE_BUILD_PLUGIN;
|
||||
}
|
||||
|
||||
protected void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
|
||||
Properties projectProperties )
|
||||
throws ProjectConverterException
|
||||
{
|
||||
addConfigurationChild( configuration, projectProperties, "maven.junit.jvmargs", "argLine" );
|
||||
|
||||
String forkMode = projectProperties.getProperty( "maven.junit.forkmode" );
|
||||
if ( forkMode == null )
|
||||
{
|
||||
String fork = projectProperties.getProperty( "maven.junit.fork" );
|
||||
if ( fork != null )
|
||||
{
|
||||
boolean useFork = Boolean.valueOf( PropertyUtils.convertYesNoToBoolean( fork ) ).booleanValue();
|
||||
if ( useFork )
|
||||
{
|
||||
// Use "once" here as that is the default forkMode
|
||||
addConfigurationChild( configuration, "forkMode", "once" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addConfigurationChild( configuration, projectProperties, "maven.junit.forkmode", "forkMode" );
|
||||
}
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.junit.jvm", "jvm" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.junit.printSummary", "printSummary" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.junit.format", "reportFormat" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.test.skip", "skip" );
|
||||
|
||||
String sysproperties = projectProperties.getProperty( "maven.junit.sysproperties" );
|
||||
if ( sysproperties != null )
|
||||
{
|
||||
StringTokenizer tokenizer = new StringTokenizer( sysproperties );
|
||||
if ( tokenizer.hasMoreTokens() )
|
||||
{
|
||||
Xpp3Dom systemProperties = new Xpp3Dom( "systemProperties" );
|
||||
while ( tokenizer.hasMoreTokens() )
|
||||
{
|
||||
String name = tokenizer.nextToken();
|
||||
String value = projectProperties.getProperty( name );
|
||||
addConfigurationChild( systemProperties, name, value );
|
||||
}
|
||||
if ( systemProperties.getChildCount() > 0 )
|
||||
{
|
||||
configuration.addChild( systemProperties );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.test.failure.ignore", "testFailureIgnore" );
|
||||
|
||||
addConfigurationChild( configuration, projectProperties, "maven.junit.usefile", "useFile" );
|
||||
|
||||
if ( v3Model.getBuild() != null && v3Model.getBuild().getUnitTest() != null )
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.UnitTest v3UnitTest = v3Model.getBuild().getUnitTest();
|
||||
|
||||
List excludes = v3UnitTest.getExcludes();
|
||||
if ( excludes != null && excludes.size() > 0 )
|
||||
{
|
||||
Xpp3Dom excludesConf = new Xpp3Dom( "excludes" );
|
||||
for ( Iterator iter = excludes.iterator(); iter.hasNext(); )
|
||||
{
|
||||
addConfigurationChild( excludesConf, "exclude", (String) iter.next() );
|
||||
}
|
||||
configuration.addChild( excludesConf );
|
||||
}
|
||||
|
||||
List includes = v3UnitTest.getIncludes();
|
||||
if ( includes != null && includes.size() > 0 )
|
||||
{
|
||||
Xpp3Dom includesConf = new Xpp3Dom( "includes" );
|
||||
for ( Iterator iter = includes.iterator(); iter.hasNext(); )
|
||||
{
|
||||
addConfigurationChild( includesConf, "include", (String) iter.next() );
|
||||
}
|
||||
configuration.addChild( includesConf );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package org.apache.maven.model.converter.plugins;
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.converter.ProjectConverterException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* A <code>PluginConfigurationConverter</code> for the maven-tasklist-plugin.
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="taglist"
|
||||
*
|
||||
* @author Dennis Lundberg
|
||||
* @version $Id: 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" );
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @plexus.component role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter" role-hint="war"
|
||||
*
|
||||
* @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}/", "" ) );
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
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;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
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.ConverterListener;
|
||||
import org.apache.maven.model.converter.ModelUtils;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
private List listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
sendInfoMessage( "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() );
|
||||
sendInfoMessage( "Relocating build plugin " + getOldGroupId() + ":" + getOldArtifactId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The new plugin already exist, remove the old one
|
||||
v4Model.getBuild().getPlugins().remove( oldBuildPlugin );
|
||||
sendInfoMessage( "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 );
|
||||
sendInfoMessage( "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() );
|
||||
sendInfoMessage( "Relocating report plugin " + getOldGroupId() + ":" + getOldArtifactId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The new plugin already exist, remove the old one
|
||||
v4Model.getReporting().getPlugins().remove( oldReportPlugin );
|
||||
sendInfoMessage( "Removing old report plugin " + getOldGroupId() + ":" + getOldArtifactId() +
|
||||
" because the new one already exist" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener( ConverterListener listener )
|
||||
{
|
||||
if ( !listeners.contains( listener ) )
|
||||
{
|
||||
listeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
public void addListeners( List listeners )
|
||||
{
|
||||
for ( Iterator i = listeners.iterator(); i.hasNext(); )
|
||||
{
|
||||
ConverterListener listener = (ConverterListener) i.next();
|
||||
addListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
private void sendInfoMessage( String message )
|
||||
{
|
||||
getLogger().info( message );
|
||||
|
||||
for ( Iterator i = listeners.iterator(); i.hasNext(); )
|
||||
{
|
||||
ConverterListener listener = (ConverterListener) i.next();
|
||||
listener.info( message );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
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.converter.ConverterListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
/**
|
||||
* Add a listener for all messages sended by the relocator.
|
||||
*
|
||||
* @param listener The listener that will receive messages
|
||||
*/
|
||||
void addListener( ConverterListener listener );
|
||||
|
||||
/**
|
||||
* Add a listeners list for all messages sended by the relocator.
|
||||
*
|
||||
* @param listeners The listeners list that will receive messages
|
||||
*/
|
||||
void addListeners( List listeners );
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
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();
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
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";
|
||||
}
|
||||
}
|
|
@ -1,165 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 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.Build;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class PomV3ToV4TranslatorTest
|
||||
extends PlexusTestCase
|
||||
{
|
||||
|
||||
private ModelConverter translator;
|
||||
|
||||
private org.apache.maven.model.v3_0_0.Dependency v3Dep;
|
||||
|
||||
private org.apache.maven.model.v3_0_0.Model v3Model;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
translator = (ModelConverter) lookup( ModelConverter.ROLE );
|
||||
|
||||
v3Dep = new org.apache.maven.model.v3_0_0.Dependency();
|
||||
v3Dep.setGroupId( "testGroup" );
|
||||
v3Dep.setArtifactId( "testArtifact" );
|
||||
v3Dep.setVersion( "1.0" );
|
||||
|
||||
v3Model = new org.apache.maven.model.v3_0_0.Model();
|
||||
v3Model.setBuild( new org.apache.maven.model.v3_0_0.Build() );
|
||||
}
|
||||
|
||||
public void testConvertedEmptyResourceDirectory()
|
||||
throws PomTranslationException
|
||||
{
|
||||
org.apache.maven.model.v3_0_0.Resource v3Resource = new org.apache.maven.model.v3_0_0.Resource();
|
||||
v3Resource.setIncludes( Arrays.asList( new String[]{"**/*.properties"} ) );
|
||||
v3Model.getBuild().addResource( v3Resource );
|
||||
|
||||
Model result = translator.translate( v3Model );
|
||||
Resource resource = (Resource) result.getBuild().getResources().get( 0 );
|
||||
Assert.assertEquals( "check directory of v3Resource", ".", resource.getDirectory() );
|
||||
}
|
||||
|
||||
public void testShouldConvertScopePropertyToDependencyScope()
|
||||
throws Exception
|
||||
{
|
||||
v3Dep.addProperty( "scope", "test" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
Model result = translator.translate( v3Model );
|
||||
Assert.assertEquals( "test", ( (Dependency) result.getDependencies().get( 0 ) ).getScope() );
|
||||
|
||||
}
|
||||
|
||||
public void testShouldConvertOptionalPropertyToDependencyOptional()
|
||||
throws Exception
|
||||
{
|
||||
v3Dep.addProperty( "optional", "true" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
Model result = translator.translate( v3Model );
|
||||
Assert.assertTrue( ( (Dependency) result.getDependencies().get( 0 ) ).isOptional() );
|
||||
|
||||
v3Dep.addProperty( "optional", "TRUE" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
result = translator.translate( v3Model );
|
||||
Assert.assertTrue( ( (Dependency) result.getDependencies().get( 0 ) ).isOptional() );
|
||||
}
|
||||
|
||||
public void testDontBreakWithMalformedOptionalProperty()
|
||||
throws Exception
|
||||
{
|
||||
v3Dep.addProperty( "optional", "xxx" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
Model result = translator.translate( v3Model );
|
||||
Assert.assertFalse( ( (Dependency) result.getDependencies().get( 0 ) ).isOptional() );
|
||||
|
||||
v3Dep.addProperty( "optional", "" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
result = translator.translate( v3Model );
|
||||
Assert.assertFalse( ( (Dependency) result.getDependencies().get( 0 ) ).isOptional() );
|
||||
}
|
||||
|
||||
public void testShouldConvertDependencyWithTypePluginToBuildPluginEntry()
|
||||
throws Exception
|
||||
{
|
||||
v3Dep.setType( "plugin" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
Model result = translator.translate( v3Model );
|
||||
|
||||
Build build = result.getBuild();
|
||||
|
||||
Plugin plugin = (Plugin) build.getPlugins().get( 0 );
|
||||
|
||||
Assert.assertEquals( "testGroup", plugin.getGroupId() );
|
||||
Assert.assertEquals( "testArtifact", plugin.getArtifactId() );
|
||||
Assert.assertEquals( "1.0", plugin.getVersion() );
|
||||
|
||||
Assert.assertEquals( "check one dependency", 1, result.getDependencies().size() );
|
||||
Dependency dep = (Dependency) result.getDependencies().get( 0 );
|
||||
Assert.assertEquals( "junit", dep.getGroupId() );
|
||||
Assert.assertEquals( "junit", dep.getArtifactId() );
|
||||
Assert.assertEquals( "3.8.2", dep.getVersion() );
|
||||
Assert.assertEquals( "test", dep.getScope() );
|
||||
}
|
||||
|
||||
public void testShouldConvertDependencyWithTypePluginAndGroupMavenToBuildPluginEntryWithOAMPluginsGroup()
|
||||
throws Exception
|
||||
{
|
||||
v3Dep.setGroupId( "maven" );
|
||||
v3Dep.setType( "plugin" );
|
||||
|
||||
v3Model.addDependency( v3Dep );
|
||||
|
||||
Model result = translator.translate( v3Model );
|
||||
|
||||
Build build = result.getBuild();
|
||||
|
||||
Plugin plugin = (Plugin) build.getPlugins().get( 0 );
|
||||
|
||||
Assert.assertEquals( "org.apache.maven.plugins", plugin.getGroupId() );
|
||||
Assert.assertEquals( "testArtifact", plugin.getArtifactId() );
|
||||
Assert.assertEquals( "1.0", plugin.getVersion() );
|
||||
|
||||
Assert.assertEquals( "check one dependencies", 1, result.getDependencies().size() );
|
||||
Dependency dep = (Dependency) result.getDependencies().get( 0 );
|
||||
Assert.assertEquals( "junit", dep.getGroupId() );
|
||||
Assert.assertEquals( "junit", dep.getArtifactId() );
|
||||
Assert.assertEquals( "3.8.2", dep.getVersion() );
|
||||
Assert.assertEquals( "test", dep.getScope() );
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package org.apache.maven.model.converter;
|
||||
|
||||
/*
|
||||
* Copyright 2005-2005 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 org.codehaus.plexus.util.xml.Xpp3DomBuilder;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* Test rewriter.
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class V3PomRewriterTest
|
||||
extends PlexusTestCase
|
||||
{
|
||||
private V3PomRewriter rewriter;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
rewriter = (V3PomRewriter) lookup( V3PomRewriter.ROLE );
|
||||
}
|
||||
|
||||
public void testCurrentVersionExpressionConversion()
|
||||
throws Exception
|
||||
{
|
||||
String pom =
|
||||
"<project><dependencies><dependency><groupId>g</groupId><artifactId>a</artifactId><version>${pom.currentVersion}</version></dependency></dependencies></project>";
|
||||
|
||||
Writer to = new StringWriter();
|
||||
rewriter.rewrite( new StringReader( pom ), to, false, null, null, null, null );
|
||||
|
||||
Xpp3Dom dom = Xpp3DomBuilder.build( new StringReader( to.toString() ) );
|
||||
String version = dom.getChild( "dependencies" ).getChild( 0 ).getChild( "version" ).getValue();
|
||||
assertEquals( "check new version expression", "${project.version}", version );
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
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() );
|
||||
}
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,228 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
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." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
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" ) );
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
# 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
|
|
@ -1,16 +0,0 @@
|
|||
# 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
|
|
@ -1,16 +0,0 @@
|
|||
# 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
|
|
@ -1,15 +0,0 @@
|
|||
# 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%
|
|
@ -1,25 +0,0 @@
|
|||
# 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
|
|
@ -1,17 +0,0 @@
|
|||
# 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
|
|
@ -1,16 +0,0 @@
|
|||
# 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
|
|
@ -1,26 +0,0 @@
|
|||
# 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
|
|
@ -1,24 +0,0 @@
|
|||
# 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
|
|
@ -1,57 +0,0 @@
|
|||
# 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
|
|
@ -1,17 +0,0 @@
|
|||
# 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
|
|
@ -1,17 +0,0 @@
|
|||
# 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
|
|
@ -1,19 +0,0 @@
|
|||
# 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
|
|
@ -1,25 +0,0 @@
|
|||
# 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
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
|
@ -1,15 +0,0 @@
|
|||
# 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
|
|
@ -1,13 +0,0 @@
|
|||
# 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.
|
Loading…
Reference in New Issue