o Adding new repository cleanup tool which does:

- artifact-to-POM correlation
 - artifact-to-MD5 correlation and synchronization
 - v3-to-v4 POM syntax conversion
 - v4 model validation (minimum required)
 - v4 model patching from POM path in repo (reconstructs some missing info from loss of <extends/>).

o This application has been tested and should be ready to run. Will try to arrange test with a copy of the ibiblio-v1 repo on beaver.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163602 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-03-17 22:56:42 +00:00
parent 84c5379bd8
commit a436d8a8b6
61 changed files with 13506 additions and 0 deletions

View File

@ -0,0 +1,56 @@
#!/bin/sh
echo ""
echo "*******************"
echo "* NOTE: Usage for this script is: 'sh ./install.sh /path/to/install/target /path/to/local/repo'"
echo "*******************"
echo ""
(
# First, ensure that the repoclean library has been built.
echo "-----------------------------------------------------------------------"
echo " Building a clean copy of repoclean ... "
echo "-----------------------------------------------------------------------"
m2 clean:clean package
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
)
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
(
# Now, install the bash script and dependencies to the specified target dir.
echo ""
echo "-----------------------------------------------------------------------"
echo " Installing repoclean to ${1} ... "
echo "-----------------------------------------------------------------------"
echo ""
mkdir -p $1/lib && \
echo "Copying application libraries..."
echo ""
cp target/repoclean-1.0-SNAPSHOT.jar $1/lib && \
cp $2/plexus/jars/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar $1/lib && \
cp $2/plexus/jars/plexus-utils-1.0-alpha-2-SNAPSHOT.jar $1/lib && \
cp $2/classworlds/jars/classworlds-1.1-alpha-1.jar $1/lib && \
echo "Copying startup script, and changing its permissions to '+x'..."
echo ""
cp src/main/bash/repoclean.sh $1 && \
chmod +x $1/repoclean.sh
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
)
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
echo ""
echo "*******************"
echo "* repoclean utility has been installed to: ${1}."
echo "*"
echo "* To run, change to '${1}' and execute './repoclean.sh', which will give further usage instructions."
echo "*******************"
echo ""

34
sandbox/repoclean/pom.xml Normal file
View File

@ -0,0 +1,34 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>maven</groupId>
<artifactId>repoclean</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven v3-to-v4 Repository Cleaner</name>
<dependencies>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>classworlds</groupId>
<artifactId>classworlds</artifactId>
<version>1.1-alpha-1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,8 @@
#!/bin/bash
CP=./lib/repoclean-1.0-SNAPSHOT.jar
CP=$CP:./lib/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar
CP=$CP:./lib/plexus-utils-1.0-alpha-2-SNAPSHOT.jar
CP=$CP:./lib/classworlds-1.1-alpha-1.jar
java -classpath ${CP} org.apache.maven.tools.repoclean.Main $* | tee repoclean-log.txt

View File

@ -0,0 +1,52 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Branch.
*
* @version $Revision$ $Date$
*/
public class Branch
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field tag
*/
private String tag;
//-----------/
//- Methods -/
//-----------/
/**
* Method getTag
*/
public String getTag()
{
return this.tag;
} //-- String getTag()
/**
* Method setTag
*
* @param tag
*/
public void setTag( String tag )
{
this.tag = tag;
} //-- void setTag(String)
}

View File

@ -0,0 +1,263 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Build.
*
* @version $Revision$ $Date$
*/
public class Build
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field nagEmailAddress
*/
private String nagEmailAddress;
/**
* Field sourceDirectory
*/
private String sourceDirectory;
/**
* Field unitTestSourceDirectory
*/
private String unitTestSourceDirectory;
/**
* Field aspectSourceDirectory
*/
private String aspectSourceDirectory;
/**
* Field integrationUnitTestSourceDirectory
*/
private String integrationUnitTestSourceDirectory;
/**
* Field sourceModifications
*/
private java.util.List sourceModifications;
/**
* Field unitTest
*/
private UnitTest unitTest = new UnitTest();
/**
* Field resources
*/
private java.util.List resources;
//-----------/
//- Methods -/
//-----------/
/**
* Method addResource
*
* @param resource
*/
public void addResource( Resource resource )
{
getResources().add( resource );
} //-- void addResource(Resource)
/**
* Method addSourceModification
*
* @param sourceModification
*/
public void addSourceModification( SourceModification sourceModification )
{
getSourceModifications().add( sourceModification );
} //-- void addSourceModification(SourceModification)
/**
* Method getAspectSourceDirectory
*/
public String getAspectSourceDirectory()
{
return this.aspectSourceDirectory;
} //-- String getAspectSourceDirectory()
/**
* Method getIntegrationUnitTestSourceDirectory
*/
public String getIntegrationUnitTestSourceDirectory()
{
return this.integrationUnitTestSourceDirectory;
} //-- String getIntegrationUnitTestSourceDirectory()
/**
* Method getNagEmailAddress
*/
public String getNagEmailAddress()
{
return this.nagEmailAddress;
} //-- String getNagEmailAddress()
/**
* Method getResources
*/
public java.util.List getResources()
{
if ( this.resources == null )
{
this.resources = new java.util.ArrayList();
}
return this.resources;
} //-- java.util.List getResources()
/**
* Method getSourceDirectory
*/
public String getSourceDirectory()
{
return this.sourceDirectory;
} //-- String getSourceDirectory()
/**
* Method getSourceModifications
*/
public java.util.List getSourceModifications()
{
if ( this.sourceModifications == null )
{
this.sourceModifications = new java.util.ArrayList();
}
return this.sourceModifications;
} //-- java.util.List getSourceModifications()
/**
* Method getUnitTest
*/
public UnitTest getUnitTest()
{
return this.unitTest;
} //-- UnitTest getUnitTest()
/**
* Method getUnitTestSourceDirectory
*/
public String getUnitTestSourceDirectory()
{
return this.unitTestSourceDirectory;
} //-- String getUnitTestSourceDirectory()
/**
* Method removeResource
*
* @param resource
*/
public void removeResource( Resource resource )
{
getResources().remove( resource );
} //-- void removeResource(Resource)
/**
* Method removeSourceModification
*
* @param sourceModification
*/
public void removeSourceModification( SourceModification sourceModification )
{
getSourceModifications().remove( sourceModification );
} //-- void removeSourceModification(SourceModification)
/**
* Method setAspectSourceDirectory
*
* @param aspectSourceDirectory
*/
public void setAspectSourceDirectory( String aspectSourceDirectory )
{
this.aspectSourceDirectory = aspectSourceDirectory;
} //-- void setAspectSourceDirectory(String)
/**
* Method setIntegrationUnitTestSourceDirectory
*
* @param integrationUnitTestSourceDirectory
*/
public void setIntegrationUnitTestSourceDirectory( String integrationUnitTestSourceDirectory )
{
this.integrationUnitTestSourceDirectory = integrationUnitTestSourceDirectory;
} //-- void setIntegrationUnitTestSourceDirectory(String)
/**
* Method setNagEmailAddress
*
* @param nagEmailAddress
*/
public void setNagEmailAddress( String nagEmailAddress )
{
this.nagEmailAddress = nagEmailAddress;
} //-- void setNagEmailAddress(String)
/**
* Method setResources
*
* @param resources
*/
public void setResources( java.util.List resources )
{
this.resources = resources;
} //-- void setResources(java.util.List)
/**
* Method setSourceDirectory
*
* @param sourceDirectory
*/
public void setSourceDirectory( String sourceDirectory )
{
this.sourceDirectory = sourceDirectory;
} //-- void setSourceDirectory(String)
/**
* Method setSourceModifications
*
* @param sourceModifications
*/
public void setSourceModifications( java.util.List sourceModifications )
{
this.sourceModifications = sourceModifications;
} //-- void setSourceModifications(java.util.List)
/**
* Method setUnitTest
*
* @param unitTest
*/
public void setUnitTest( UnitTest unitTest )
{
this.unitTest = unitTest;
} //-- void setUnitTest(UnitTest)
/**
* Method setUnitTestSourceDirectory
*
* @param unitTestSourceDirectory
*/
public void setUnitTestSourceDirectory( String unitTestSourceDirectory )
{
this.unitTestSourceDirectory = unitTestSourceDirectory;
} //-- void setUnitTestSourceDirectory(String)
}

View File

@ -0,0 +1,192 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Contributor.
*
* @version $Revision$ $Date$
*/
public class Contributor
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field email
*/
private String email;
/**
* Field url
*/
private String url;
/**
* Field organization
*/
private String organization;
/**
* Field roles
*/
private java.util.List roles;
/**
* Field timezone
*/
private String timezone;
//-----------/
//- Methods -/
//-----------/
/**
* Method addRole
*
* @param string
*/
public void addRole( String string )
{
getRoles().add( string );
} //-- void addRole(String)
/**
* Method getEmail
*/
public String getEmail()
{
return this.email;
} //-- String getEmail()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getOrganization
*/
public String getOrganization()
{
return this.organization;
} //-- String getOrganization()
/**
* Method getRoles
*/
public java.util.List getRoles()
{
if ( this.roles == null )
{
this.roles = new java.util.ArrayList();
}
return this.roles;
} //-- java.util.List getRoles()
/**
* Method getTimezone
*/
public String getTimezone()
{
return this.timezone;
} //-- String getTimezone()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method removeRole
*
* @param string
*/
public void removeRole( String string )
{
getRoles().remove( string );
} //-- void removeRole(String)
/**
* Method setEmail
*
* @param email
*/
public void setEmail( String email )
{
this.email = email;
} //-- void setEmail(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setOrganization
*
* @param organization
*/
public void setOrganization( String organization )
{
this.organization = organization;
} //-- void setOrganization(String)
/**
* Method setRoles
*
* @param roles
*/
public void setRoles( java.util.List roles )
{
this.roles = roles;
} //-- void setRoles(java.util.List)
/**
* Method setTimezone
*
* @param timezone
*/
public void setTimezone( String timezone )
{
this.timezone = timezone;
} //-- void setTimezone(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,298 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Dependency.
*
* @version $Revision$ $Date$
*/
public class Dependency
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field id
*/
private String id;
/**
* Field groupId
*/
private String groupId;
/**
* Field artifactId
*/
private String artifactId;
/**
* Field version
*/
private String version;
/**
* Field url
*/
private String url;
/**
* Field jar
*/
private String jar;
/**
* Field type
*/
private String type = "jar";
/**
* Field properties
*/
private java.util.Properties properties;
//-----------/
//- Methods -/
//-----------/
/**
* Method addProperty
*
* @param key
* @param value
*/
public void addProperty( String key, String value )
{
getProperties().put( key, value );
} //-- void addProperty(String, String)
/**
* Method getArtifactId
*/
public String getArtifactId()
{
return this.artifactId;
} //-- String getArtifactId()
/**
* Method getGroupId
*/
public String getGroupId()
{
return this.groupId;
} //-- String getGroupId()
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method getJar
*/
public String getJar()
{
return this.jar;
} //-- String getJar()
/**
* Method getProperties
*/
public java.util.Properties getProperties()
{
if ( this.properties == null )
{
this.properties = new java.util.Properties();
}
return this.properties;
} //-- java.util.Properties getProperties()
/**
* Method getType
*/
public String getType()
{
return this.type;
} //-- String getType()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method getVersion
*/
public String getVersion()
{
return this.version;
} //-- String getVersion()
/**
* Method setArtifactId
*
* @param artifactId
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
} //-- void setArtifactId(String)
/**
* Method setGroupId
*
* @param groupId
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
} //-- void setGroupId(String)
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
/**
* Method setJar
*
* @param jar
*/
public void setJar( String jar )
{
this.jar = jar;
} //-- void setJar(String)
/**
* Method setProperties
*
* @param properties
*/
public void setProperties( java.util.Properties properties )
{
this.properties = properties;
} //-- void setProperties(java.util.Properties)
/**
* Method setType
*
* @param type
*/
public void setType( String type )
{
this.type = type;
} //-- void setType(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
/**
* Method setVersion
*
* @param version
*/
public void setVersion( String version )
{
this.version = version;
} //-- void setVersion(String)
public String toString()
{
return groupId + "/" + type + "s:" + artifactId + "-" + version;
}
public String getKey()
{
return getId() + ":" + getType();
}
public String getArtifactDirectory()
{
return getGroupId();
}
public String getArtifact()
{
// If the jar name has been explicty set then use that. This
// is when the <jar/> element is explicity used in the POM.
if ( getJar() != null )
{
return getJar();
}
return getArtifactId() + "-" + getVersion() + "." + getExtension();
}
public String getExtension()
{
if ( "ejb".equals( getType() ) || "plugin".equals( getType() ) || "aspect".equals( getType() ) )
return "jar";
return getType();
}
public boolean isAddedToClasspath()
{
return ( "jar".equals( getType() ) || "ejb".equals( getType() ) );
}
public boolean isPlugin()
{
return ( "plugin".equals( getType() ) );
}
public String getProperty( String property )
{
return getProperties().getProperty( property );
}
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( !( o instanceof Dependency ) )
{
return false;
}
Dependency d = (Dependency) o;
return getId().equals( d.getId() );
}
public int hashCode()
{
return getId().hashCode();
}
}

View File

@ -0,0 +1,53 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Developer.
*
* @version $Revision$ $Date$
*/
public class Developer
extends Contributor
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field id
*/
private String id;
//-----------/
//- Methods -/
//-----------/
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
}

View File

@ -0,0 +1,53 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class FileSet.
*
* @version $Revision$ $Date$
*/
public class FileSet
extends PatternSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field directory
*/
private String directory;
//-----------/
//- Methods -/
//-----------/
/**
* Method getDirectory
*/
public String getDirectory()
{
return this.directory;
} //-- String getDirectory()
/**
* Method setDirectory
*
* @param directory
*/
public void setDirectory( String directory )
{
this.directory = directory;
} //-- void setDirectory(String)
}

View File

@ -0,0 +1,121 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class License.
*
* @version $Revision$ $Date$
*/
public class License
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field url
*/
private String url;
/**
* Field distribution
*/
private String distribution;
/**
* Field comments
*/
private String comments;
//-----------/
//- Methods -/
//-----------/
/**
* Method getComments
*/
public String getComments()
{
return this.comments;
} //-- String getComments()
/**
* Method getDistribution
*/
public String getDistribution()
{
return this.distribution;
} //-- String getDistribution()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setComments
*
* @param comments
*/
public void setComments( String comments )
{
this.comments = comments;
} //-- void setComments(String)
/**
* Method setDistribution
*
* @param distribution
*/
public void setDistribution( String distribution )
{
this.distribution = distribution;
} //-- void setDistribution(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,121 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class MailingList.
*
* @version $Revision$ $Date$
*/
public class MailingList
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field subscribe
*/
private String subscribe;
/**
* Field unsubscribe
*/
private String unsubscribe;
/**
* Field archive
*/
private String archive;
//-----------/
//- Methods -/
//-----------/
/**
* Method getArchive
*/
public String getArchive()
{
return this.archive;
} //-- String getArchive()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getSubscribe
*/
public String getSubscribe()
{
return this.subscribe;
} //-- String getSubscribe()
/**
* Method getUnsubscribe
*/
public String getUnsubscribe()
{
return this.unsubscribe;
} //-- String getUnsubscribe()
/**
* Method setArchive
*
* @param archive
*/
public void setArchive( String archive )
{
this.archive = archive;
} //-- void setArchive(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setSubscribe
*
* @param subscribe
*/
public void setSubscribe( String subscribe )
{
this.subscribe = subscribe;
} //-- void setSubscribe(String)
/**
* Method setUnsubscribe
*
* @param unsubscribe
*/
public void setUnsubscribe( String unsubscribe )
{
this.unsubscribe = unsubscribe;
} //-- void setUnsubscribe(String)
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Organization.
*
* @version $Revision$ $Date$
*/
public class Organization
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field url
*/
private String url;
/**
* Field logo
*/
private String logo;
//-----------/
//- Methods -/
//-----------/
/**
* Method getLogo
*/
public String getLogo()
{
return this.logo;
} //-- String getLogo()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setLogo
*
* @param logo
*/
public void setLogo( String logo )
{
this.logo = logo;
} //-- void setLogo(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,75 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class PackageGroup.
*
* @version $Revision$ $Date$
*/
public class PackageGroup
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field title
*/
private String title;
/**
* Field packages
*/
private String packages;
//-----------/
//- Methods -/
//-----------/
/**
* Method getPackages
*/
public String getPackages()
{
return this.packages;
} //-- String getPackages()
/**
* Method getTitle
*/
public String getTitle()
{
return this.title;
} //-- String getTitle()
/**
* Method setPackages
*
* @param packages
*/
public void setPackages( String packages )
{
this.packages = packages;
} //-- void setPackages(String)
/**
* Method setTitle
*
* @param title
*/
public void setTitle( String title )
{
this.title = title;
} //-- void setTitle(String)
}

View File

@ -0,0 +1,152 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import java.util.ArrayList;
import java.util.List;
/**
* Class PatternSet.
*
* @version $Revision$ $Date$
*/
public class PatternSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field includes
*/
private java.util.List includes;
/**
* Field excludes
*/
private java.util.List excludes;
//-----------/
//- Methods -/
//-----------/
/**
* Method addExclude
*
* @param string
*/
public void addExclude( String string )
{
getExcludes().add( string );
} //-- void addExclude(String)
/**
* Method addInclude
*
* @param string
*/
public void addInclude( String string )
{
getIncludes().add( string );
} //-- void addInclude(String)
/**
* Method getExcludes
*/
public java.util.List getExcludes()
{
if ( this.excludes == null )
{
this.excludes = new java.util.ArrayList();
}
return this.excludes;
} //-- java.util.List getExcludes()
/**
* Method getIncludes
*/
public java.util.List getIncludes()
{
if ( this.includes == null )
{
this.includes = new java.util.ArrayList();
}
return this.includes;
} //-- java.util.List getIncludes()
/**
* Method removeExclude
*
* @param string
*/
public void removeExclude( String string )
{
getExcludes().remove( string );
} //-- void removeExclude(String)
/**
* Method removeInclude
*
* @param string
*/
public void removeInclude( String string )
{
getIncludes().remove( string );
} //-- void removeInclude(String)
/**
* Method setExcludes
*
* @param excludes
*/
public void setExcludes( java.util.List excludes )
{
this.excludes = excludes;
} //-- void setExcludes(java.util.List)
/**
* Method setIncludes
*
* @param includes
*/
public void setIncludes( java.util.List includes )
{
this.includes = includes;
} //-- void setIncludes(java.util.List)
public List getDefaultExcludes()
{
List defaultExcludes = new ArrayList();
defaultExcludes.add( "**/*~" );
defaultExcludes.add( "**/#*#" );
defaultExcludes.add( "**/.#*" );
defaultExcludes.add( "**/%*%" );
defaultExcludes.add( "**/._*" );
// CVS
defaultExcludes.add( "**/CVS" );
defaultExcludes.add( "**/CVS/**" );
defaultExcludes.add( "**/.cvsignore" );
// SCCS
defaultExcludes.add( "**/SCCS" );
defaultExcludes.add( "**/SCCS/**" );
// Visual SourceSafe
defaultExcludes.add( "**/vssver.scc" );
// Subversion
defaultExcludes.add( "**/.svn" );
defaultExcludes.add( "**/.svn/**" );
// Mac
defaultExcludes.add( "**/.DS_Store" );
return defaultExcludes;
}
}

View File

@ -0,0 +1,98 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Repository.
*
* @version $Revision$ $Date$
*/
public class Repository
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field connection
*/
private String connection;
/**
* Field developerConnection
*/
private String developerConnection;
/**
* Field url
*/
private String url;
//-----------/
//- Methods -/
//-----------/
/**
* Method getConnection
*/
public String getConnection()
{
return this.connection;
} //-- String getConnection()
/**
* Method getDeveloperConnection
*/
public String getDeveloperConnection()
{
return this.developerConnection;
} //-- String getDeveloperConnection()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setConnection
*
* @param connection
*/
public void setConnection( String connection )
{
this.connection = connection;
} //-- void setConnection(String)
/**
* Method setDeveloperConnection
*
* @param developerConnection
*/
public void setDeveloperConnection( String developerConnection )
{
this.developerConnection = developerConnection;
} //-- void setDeveloperConnection(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,76 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Resource.
*
* @version $Revision$ $Date$
*/
public class Resource
extends FileSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field targetPath
*/
private String targetPath;
/**
* Field filtering
*/
private boolean filtering = false;
//-----------/
//- Methods -/
//-----------/
/**
* Method getTargetPath
*/
public String getTargetPath()
{
return this.targetPath;
} //-- String getTargetPath()
/**
* Method isFiltering
*/
public boolean isFiltering()
{
return this.filtering;
} //-- boolean isFiltering()
/**
* Method setFiltering
*
* @param filtering
*/
public void setFiltering( boolean filtering )
{
this.filtering = filtering;
} //-- void setFiltering(boolean)
/**
* Method setTargetPath
*
* @param targetPath
*/
public void setTargetPath( String targetPath )
{
this.targetPath = targetPath;
} //-- void setTargetPath(String)
}

View File

@ -0,0 +1,76 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class SourceModification.
*
* @version $Revision$ $Date$
*/
public class SourceModification
extends FileSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field className
*/
private String className;
/**
* Field property
*/
private String property;
//-----------/
//- Methods -/
//-----------/
/**
* Method getClassName
*/
public String getClassName()
{
return this.className;
} //-- String getClassName()
/**
* Method getProperty
*/
public String getProperty()
{
return this.property;
} //-- String getProperty()
/**
* Method setClassName
*
* @param className
*/
public void setClassName( String className )
{
this.className = className;
} //-- void setClassName(String)
/**
* Method setProperty
*
* @param property
*/
public void setProperty( String property )
{
this.property = property;
} //-- void setProperty(String)
}

View File

@ -0,0 +1,78 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class UnitTest.
*
* @version $Revision$ $Date$
*/
public class UnitTest
extends PatternSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field resources
*/
private java.util.List resources;
//-----------/
//- Methods -/
//-----------/
/**
* Method addResource
*
* @param resource
*/
public void addResource( Resource resource )
{
getResources().add( resource );
} //-- void addResource(Resource)
/**
* Method getResources
*/
public java.util.List getResources()
{
if ( this.resources == null )
{
this.resources = new java.util.ArrayList();
}
return this.resources;
} //-- java.util.List getResources()
/**
* Method removeResource
*
* @param resource
*/
public void removeResource( Resource resource )
{
getResources().remove( resource );
} //-- void removeResource(Resource)
/**
* Method setResources
*
* @param resources
*/
public void setResources( java.util.List resources )
{
this.resources = resources;
} //-- void setResources(java.util.List)
}

View File

@ -0,0 +1,102 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Version.
*
* @version $Revision$ $Date$
*/
public class Version
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field tag
*/
private String tag;
/**
* Field id
*/
private String id;
//-----------/
//- Methods -/
//-----------/
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getTag
*/
public String getTag()
{
return this.tag;
} //-- String getTag()
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setTag
*
* @param tag
*/
public void setTag( String tag )
{
this.tag = tag;
} //-- void setTag(String)
public String toString()
{
return getId();
}
}

View File

@ -0,0 +1,945 @@
/*
* $Id$
*/
package org.apache.maven.model.v3_0_0.io.xpp3;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.apache.maven.model.v3_0_0.Branch;
import org.apache.maven.model.v3_0_0.Build;
import org.apache.maven.model.v3_0_0.Contributor;
import org.apache.maven.model.v3_0_0.Dependency;
import org.apache.maven.model.v3_0_0.Developer;
import org.apache.maven.model.v3_0_0.FileSet;
import org.apache.maven.model.v3_0_0.License;
import org.apache.maven.model.v3_0_0.MailingList;
import org.apache.maven.model.v3_0_0.Model;
import org.apache.maven.model.v3_0_0.Organization;
import org.apache.maven.model.v3_0_0.PackageGroup;
import org.apache.maven.model.v3_0_0.PatternSet;
import org.apache.maven.model.v3_0_0.Repository;
import org.apache.maven.model.v3_0_0.Resource;
import org.apache.maven.model.v3_0_0.SourceModification;
import org.apache.maven.model.v3_0_0.UnitTest;
import org.apache.maven.model.v3_0_0.Version;
import org.codehaus.plexus.util.xml.pull.MXSerializer;
import org.codehaus.plexus.util.xml.pull.XmlSerializer;
import java.io.Writer;
import java.util.Iterator;
/**
* Class MavenXpp3Writer.
*
* @version $Revision$ $Date$
*/
public class MavenXpp3Writer
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field serializer
*/
private org.codehaus.plexus.util.xml.pull.XmlSerializer serializer;
/**
* Field NAMESPACE
*/
private String NAMESPACE;
//-----------/
//- Methods -/
//-----------/
/**
* Method write
*
* @param writer
* @param model
*/
public void write( Writer writer, Model model ) throws Exception
{
serializer = new MXSerializer();
serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " );
serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" );
serializer.setOutput( writer );
writeModel( model, "model", serializer );
} //-- void write(Writer, Model)
/**
* Method writeBranch
*
* @param branch
* @param serializer
* @param tagName
*/
private void writeBranch( Branch branch, String tagName, XmlSerializer serializer ) throws Exception
{
if ( branch != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( branch.getTag() != null )
{
serializer.startTag( NAMESPACE, "tag" ).text( branch.getTag() ).endTag( NAMESPACE, "tag" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeBranch(Branch, String, XmlSerializer)
/**
* Method writeBuild
*
* @param build
* @param serializer
* @param tagName
*/
private void writeBuild( Build build, String tagName, XmlSerializer serializer ) throws Exception
{
if ( build != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( build.getNagEmailAddress() != null )
{
serializer.startTag( NAMESPACE, "nagEmailAddress" ).text( build.getNagEmailAddress() )
.endTag( NAMESPACE, "nagEmailAddress" );
}
if ( build.getSourceDirectory() != null )
{
serializer.startTag( NAMESPACE, "sourceDirectory" ).text( build.getSourceDirectory() )
.endTag( NAMESPACE, "sourceDirectory" );
}
if ( build.getUnitTestSourceDirectory() != null )
{
serializer.startTag( NAMESPACE, "unitTestSourceDirectory" ).text( build.getUnitTestSourceDirectory() )
.endTag( NAMESPACE, "unitTestSourceDirectory" );
}
if ( build.getAspectSourceDirectory() != null )
{
serializer.startTag( NAMESPACE, "aspectSourceDirectory" ).text( build.getAspectSourceDirectory() )
.endTag( NAMESPACE, "aspectSourceDirectory" );
}
if ( build.getIntegrationUnitTestSourceDirectory() != null )
{
serializer.startTag( NAMESPACE, "integrationUnitTestSourceDirectory" )
.text( build.getIntegrationUnitTestSourceDirectory() )
.endTag( NAMESPACE, "integrationUnitTestSourceDirectory" );
}
if ( build.getSourceModifications() != null && build.getSourceModifications().size() > 0 )
{
serializer.startTag( NAMESPACE, "sourceModifications" );
for ( Iterator iter = build.getSourceModifications().iterator(); iter.hasNext(); )
{
SourceModification sourceModification = (SourceModification) iter.next();
writeSourceModification( sourceModification, "sourceModification", serializer );
}
serializer.endTag( NAMESPACE, "sourceModifications" );
}
if ( build.getUnitTest() != null )
{
writeUnitTest( build.getUnitTest(), "unitTest", serializer );
}
if ( build.getResources() != null && build.getResources().size() > 0 )
{
serializer.startTag( NAMESPACE, "resources" );
for ( Iterator iter = build.getResources().iterator(); iter.hasNext(); )
{
Resource resource = (Resource) iter.next();
writeResource( resource, "resource", serializer );
}
serializer.endTag( NAMESPACE, "resources" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeBuild(Build, String, XmlSerializer)
/**
* Method writeContributor
*
* @param contributor
* @param serializer
* @param tagName
*/
private void writeContributor( Contributor contributor, String tagName, XmlSerializer serializer ) throws Exception
{
if ( contributor != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( contributor.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( contributor.getName() ).endTag( NAMESPACE, "name" );
}
if ( contributor.getEmail() != null )
{
serializer.startTag( NAMESPACE, "email" ).text( contributor.getEmail() ).endTag( NAMESPACE, "email" );
}
if ( contributor.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( contributor.getUrl() ).endTag( NAMESPACE, "url" );
}
if ( contributor.getOrganization() != null )
{
serializer.startTag( NAMESPACE, "organization" ).text( contributor.getOrganization() )
.endTag( NAMESPACE, "organization" );
}
if ( contributor.getRoles() != null && contributor.getRoles().size() > 0 )
{
serializer.startTag( NAMESPACE, "roles" );
for ( Iterator iter = contributor.getRoles().iterator(); iter.hasNext(); )
{
String role = (String) iter.next();
serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" );
}
serializer.endTag( NAMESPACE, "roles" );
}
if ( contributor.getTimezone() != null )
{
serializer.startTag( NAMESPACE, "timezone" ).text( contributor.getTimezone() ).endTag( NAMESPACE,
"timezone" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeContributor(Contributor, String, XmlSerializer)
/**
* Method writeDependency
*
* @param dependency
* @param serializer
* @param tagName
*/
private void writeDependency( Dependency dependency, String tagName, XmlSerializer serializer ) throws Exception
{
if ( dependency != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( dependency.getId() != null )
{
serializer.startTag( NAMESPACE, "id" ).text( dependency.getId() ).endTag( NAMESPACE, "id" );
}
if ( dependency.getGroupId() != null )
{
serializer.startTag( NAMESPACE, "groupId" ).text( dependency.getGroupId() ).endTag( NAMESPACE,
"groupId" );
}
if ( dependency.getArtifactId() != null )
{
serializer.startTag( NAMESPACE, "artifactId" ).text( dependency.getArtifactId() ).endTag( NAMESPACE,
"artifactId" );
}
if ( dependency.getVersion() != null )
{
serializer.startTag( NAMESPACE, "version" ).text( dependency.getVersion() ).endTag( NAMESPACE,
"version" );
}
if ( dependency.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( dependency.getUrl() ).endTag( NAMESPACE, "url" );
}
if ( dependency.getJar() != null )
{
serializer.startTag( NAMESPACE, "jar" ).text( dependency.getJar() ).endTag( NAMESPACE, "jar" );
}
if ( dependency.getType() != null )
{
serializer.startTag( NAMESPACE, "type" ).text( dependency.getType() ).endTag( NAMESPACE, "type" );
}
if ( dependency.getProperties() != null && dependency.getProperties().size() > 0 )
{
serializer.startTag( NAMESPACE, "properties" );
for ( Iterator iter = dependency.getProperties().keySet().iterator(); iter.hasNext(); )
{
String key = (String) iter.next();
String value = (String) dependency.getProperties().get( key );
serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );
}
serializer.endTag( NAMESPACE, "properties" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeDependency(Dependency, String, XmlSerializer)
/**
* Method writeDeveloper
*
* @param developer
* @param serializer
* @param tagName
*/
private void writeDeveloper( Developer developer, String tagName, XmlSerializer serializer ) throws Exception
{
if ( developer != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( developer.getId() != null )
{
serializer.startTag( NAMESPACE, "id" ).text( developer.getId() ).endTag( NAMESPACE, "id" );
}
if ( developer.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( developer.getName() ).endTag( NAMESPACE, "name" );
}
if ( developer.getEmail() != null )
{
serializer.startTag( NAMESPACE, "email" ).text( developer.getEmail() ).endTag( NAMESPACE, "email" );
}
if ( developer.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( developer.getUrl() ).endTag( NAMESPACE, "url" );
}
if ( developer.getOrganization() != null )
{
serializer.startTag( NAMESPACE, "organization" ).text( developer.getOrganization() )
.endTag( NAMESPACE, "organization" );
}
if ( developer.getRoles() != null && developer.getRoles().size() > 0 )
{
serializer.startTag( NAMESPACE, "roles" );
for ( Iterator iter = developer.getRoles().iterator(); iter.hasNext(); )
{
String role = (String) iter.next();
serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" );
}
serializer.endTag( NAMESPACE, "roles" );
}
if ( developer.getTimezone() != null )
{
serializer.startTag( NAMESPACE, "timezone" ).text( developer.getTimezone() ).endTag( NAMESPACE,
"timezone" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeDeveloper(Developer, String, XmlSerializer)
/**
* Method writeFileSet
*
* @param fileSet
* @param serializer
* @param tagName
*/
private void writeFileSet( FileSet fileSet, String tagName, XmlSerializer serializer ) throws Exception
{
if ( fileSet != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( fileSet.getDirectory() != null )
{
serializer.startTag( NAMESPACE, "directory" ).text( fileSet.getDirectory() ).endTag( NAMESPACE,
"directory" );
}
if ( fileSet.getIncludes() != null && fileSet.getIncludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "includes" );
for ( Iterator iter = fileSet.getIncludes().iterator(); iter.hasNext(); )
{
String include = (String) iter.next();
serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
}
serializer.endTag( NAMESPACE, "includes" );
}
if ( fileSet.getExcludes() != null && fileSet.getExcludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "excludes" );
for ( Iterator iter = fileSet.getExcludes().iterator(); iter.hasNext(); )
{
String exclude = (String) iter.next();
serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
}
serializer.endTag( NAMESPACE, "excludes" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeFileSet(FileSet, String, XmlSerializer)
/**
* Method writeLicense
*
* @param license
* @param serializer
* @param tagName
*/
private void writeLicense( License license, String tagName, XmlSerializer serializer ) throws Exception
{
if ( license != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( license.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( license.getName() ).endTag( NAMESPACE, "name" );
}
if ( license.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( license.getUrl() ).endTag( NAMESPACE, "url" );
}
if ( license.getDistribution() != null )
{
serializer.startTag( NAMESPACE, "distribution" ).text( license.getDistribution() )
.endTag( NAMESPACE, "distribution" );
}
if ( license.getComments() != null )
{
serializer.startTag( NAMESPACE, "comments" ).text( license.getComments() ).endTag( NAMESPACE,
"comments" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeLicense(License, String, XmlSerializer)
/**
* Method writeMailingList
*
* @param mailingList
* @param serializer
* @param tagName
*/
private void writeMailingList( MailingList mailingList, String tagName, XmlSerializer serializer ) throws Exception
{
if ( mailingList != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( mailingList.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( mailingList.getName() ).endTag( NAMESPACE, "name" );
}
if ( mailingList.getSubscribe() != null )
{
serializer.startTag( NAMESPACE, "subscribe" ).text( mailingList.getSubscribe() ).endTag( NAMESPACE,
"subscribe" );
}
if ( mailingList.getUnsubscribe() != null )
{
serializer.startTag( NAMESPACE, "unsubscribe" ).text( mailingList.getUnsubscribe() )
.endTag( NAMESPACE, "unsubscribe" );
}
if ( mailingList.getArchive() != null )
{
serializer.startTag( NAMESPACE, "archive" ).text( mailingList.getArchive() ).endTag( NAMESPACE,
"archive" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeMailingList(MailingList, String, XmlSerializer)
/**
* Method writeModel
*
* @param model
* @param serializer
* @param tagName
*/
private void writeModel( Model model, String tagName, XmlSerializer serializer ) throws Exception
{
if ( model != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( model.getExtend() != null )
{
serializer.startTag( NAMESPACE, "extend" ).text( model.getExtend() ).endTag( NAMESPACE, "extend" );
}
if ( model.getPomVersion() != null )
{
serializer.startTag( NAMESPACE, "pomVersion" ).text( model.getPomVersion() ).endTag( NAMESPACE,
"pomVersion" );
}
if ( model.getId() != null )
{
serializer.startTag( NAMESPACE, "id" ).text( model.getId() ).endTag( NAMESPACE, "id" );
}
if ( model.getGroupId() != null )
{
serializer.startTag( NAMESPACE, "groupId" ).text( model.getGroupId() ).endTag( NAMESPACE, "groupId" );
}
if ( model.getArtifactId() != null )
{
serializer.startTag( NAMESPACE, "artifactId" ).text( model.getArtifactId() ).endTag( NAMESPACE,
"artifactId" );
}
if ( model.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" );
}
if ( model.getCurrentVersion() != null )
{
serializer.startTag( NAMESPACE, "currentVersion" ).text( model.getCurrentVersion() )
.endTag( NAMESPACE, "currentVersion" );
}
if ( model.getShortDescription() != null )
{
serializer.startTag( NAMESPACE, "shortDescription" ).text( model.getShortDescription() )
.endTag( NAMESPACE, "shortDescription" );
}
if ( model.getDescription() != null )
{
serializer.startTag( NAMESPACE, "description" ).text( model.getDescription() ).endTag( NAMESPACE,
"description" );
}
if ( model.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( model.getUrl() ).endTag( NAMESPACE, "url" );
}
if ( model.getLogo() != null )
{
serializer.startTag( NAMESPACE, "logo" ).text( model.getLogo() ).endTag( NAMESPACE, "logo" );
}
if ( model.getIssueTrackingUrl() != null )
{
serializer.startTag( NAMESPACE, "issueTrackingUrl" ).text( model.getIssueTrackingUrl() )
.endTag( NAMESPACE, "issueTrackingUrl" );
}
if ( model.getInceptionYear() != null )
{
serializer.startTag( NAMESPACE, "inceptionYear" ).text( model.getInceptionYear() )
.endTag( NAMESPACE, "inceptionYear" );
}
if ( model.getGumpRepositoryId() != null )
{
serializer.startTag( NAMESPACE, "gumpRepositoryId" ).text( model.getGumpRepositoryId() )
.endTag( NAMESPACE, "gumpRepositoryId" );
}
if ( model.getSiteAddress() != null )
{
serializer.startTag( NAMESPACE, "siteAddress" ).text( model.getSiteAddress() ).endTag( NAMESPACE,
"siteAddress" );
}
if ( model.getSiteDirectory() != null )
{
serializer.startTag( NAMESPACE, "siteDirectory" ).text( model.getSiteDirectory() )
.endTag( NAMESPACE, "siteDirectory" );
}
if ( model.getDistributionSite() != null )
{
serializer.startTag( NAMESPACE, "distributionSite" ).text( model.getDistributionSite() )
.endTag( NAMESPACE, "distributionSite" );
}
if ( model.getDistributionDirectory() != null )
{
serializer.startTag( NAMESPACE, "distributionDirectory" ).text( model.getDistributionDirectory() )
.endTag( NAMESPACE, "distributionDirectory" );
}
if ( model.getMailingLists() != null && model.getMailingLists().size() > 0 )
{
serializer.startTag( NAMESPACE, "mailingLists" );
for ( Iterator iter = model.getMailingLists().iterator(); iter.hasNext(); )
{
MailingList mailingList = (MailingList) iter.next();
writeMailingList( mailingList, "mailingList", serializer );
}
serializer.endTag( NAMESPACE, "mailingLists" );
}
if ( model.getDevelopers() != null && model.getDevelopers().size() > 0 )
{
serializer.startTag( NAMESPACE, "developers" );
for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); )
{
Developer developer = (Developer) iter.next();
writeDeveloper( developer, "developer", serializer );
}
serializer.endTag( NAMESPACE, "developers" );
}
if ( model.getContributors() != null && model.getContributors().size() > 0 )
{
serializer.startTag( NAMESPACE, "contributors" );
for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); )
{
Contributor contributor = (Contributor) iter.next();
writeContributor( contributor, "contributor", serializer );
}
serializer.endTag( NAMESPACE, "contributors" );
}
if ( model.getDependencies() != null && model.getDependencies().size() > 0 )
{
serializer.startTag( NAMESPACE, "dependencies" );
for ( Iterator iter = model.getDependencies().iterator(); iter.hasNext(); )
{
Dependency dependency = (Dependency) iter.next();
writeDependency( dependency, "dependency", serializer );
}
serializer.endTag( NAMESPACE, "dependencies" );
}
if ( model.getLicenses() != null && model.getLicenses().size() > 0 )
{
serializer.startTag( NAMESPACE, "licenses" );
for ( Iterator iter = model.getLicenses().iterator(); iter.hasNext(); )
{
License license = (License) iter.next();
writeLicense( license, "license", serializer );
}
serializer.endTag( NAMESPACE, "licenses" );
}
if ( model.getVersions() != null && model.getVersions().size() > 0 )
{
serializer.startTag( NAMESPACE, "versions" );
for ( Iterator iter = model.getVersions().iterator(); iter.hasNext(); )
{
Version version = (Version) iter.next();
writeVersion( version, "version", serializer );
}
serializer.endTag( NAMESPACE, "versions" );
}
if ( model.getBranches() != null && model.getBranches().size() > 0 )
{
serializer.startTag( NAMESPACE, "branches" );
for ( Iterator iter = model.getBranches().iterator(); iter.hasNext(); )
{
Branch branch = (Branch) iter.next();
writeBranch( branch, "branch", serializer );
}
serializer.endTag( NAMESPACE, "branches" );
}
if ( model.getPackageGroups() != null && model.getPackageGroups().size() > 0 )
{
serializer.startTag( NAMESPACE, "packageGroups" );
for ( Iterator iter = model.getPackageGroups().iterator(); iter.hasNext(); )
{
PackageGroup packageGroup = (PackageGroup) iter.next();
writePackageGroup( packageGroup, "packageGroup", serializer );
}
serializer.endTag( NAMESPACE, "packageGroups" );
}
if ( model.getReports() != null && model.getReports().size() > 0 )
{
serializer.startTag( NAMESPACE, "reports" );
for ( Iterator iter = model.getReports().iterator(); iter.hasNext(); )
{
String report = (String) iter.next();
serializer.startTag( NAMESPACE, "report" ).text( report ).endTag( NAMESPACE, "report" );
}
serializer.endTag( NAMESPACE, "reports" );
}
if ( model.getRepository() != null )
{
writeRepository( model.getRepository(), "repository", serializer );
}
if ( model.getBuild() != null )
{
writeBuild( model.getBuild(), "build", serializer );
}
if ( model.getOrganization() != null )
{
writeOrganization( model.getOrganization(), "organization", serializer );
}
if ( model.getProperties() != null && model.getProperties().size() > 0 )
{
serializer.startTag( NAMESPACE, "properties" );
for ( Iterator iter = model.getProperties().keySet().iterator(); iter.hasNext(); )
{
String key = (String) iter.next();
String value = (String) model.getProperties().get( key );
serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" );
}
serializer.endTag( NAMESPACE, "properties" );
}
if ( model.getPackageName() != null )
{
serializer.startTag( NAMESPACE, "package" ).text( model.getPackageName() )
.endTag( NAMESPACE, "package" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeModel(Model, String, XmlSerializer)
/**
* Method writeOrganization
*
* @param organization
* @param serializer
* @param tagName
*/
private void writeOrganization( Organization organization, String tagName, XmlSerializer serializer )
throws Exception
{
if ( organization != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( organization.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( organization.getName() ).endTag( NAMESPACE, "name" );
}
if ( organization.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( organization.getUrl() ).endTag( NAMESPACE, "url" );
}
if ( organization.getLogo() != null )
{
serializer.startTag( NAMESPACE, "logo" ).text( organization.getLogo() ).endTag( NAMESPACE, "logo" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeOrganization(Organization, String, XmlSerializer)
/**
* Method writePackageGroup
*
* @param packageGroup
* @param serializer
* @param tagName
*/
private void writePackageGroup( PackageGroup packageGroup, String tagName, XmlSerializer serializer )
throws Exception
{
if ( packageGroup != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( packageGroup.getTitle() != null )
{
serializer.startTag( NAMESPACE, "title" ).text( packageGroup.getTitle() ).endTag( NAMESPACE, "title" );
}
if ( packageGroup.getPackages() != null )
{
serializer.startTag( NAMESPACE, "packages" ).text( packageGroup.getPackages() ).endTag( NAMESPACE,
"packages" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writePackageGroup(PackageGroup, String, XmlSerializer)
/**
* Method writePatternSet
*
* @param patternSet
* @param serializer
* @param tagName
*/
private void writePatternSet( PatternSet patternSet, String tagName, XmlSerializer serializer ) throws Exception
{
if ( patternSet != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( patternSet.getIncludes() != null && patternSet.getIncludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "includes" );
for ( Iterator iter = patternSet.getIncludes().iterator(); iter.hasNext(); )
{
String include = (String) iter.next();
serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
}
serializer.endTag( NAMESPACE, "includes" );
}
if ( patternSet.getExcludes() != null && patternSet.getExcludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "excludes" );
for ( Iterator iter = patternSet.getExcludes().iterator(); iter.hasNext(); )
{
String exclude = (String) iter.next();
serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
}
serializer.endTag( NAMESPACE, "excludes" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writePatternSet(PatternSet, String, XmlSerializer)
/**
* Method writeRepository
*
* @param repository
* @param serializer
* @param tagName
*/
private void writeRepository( Repository repository, String tagName, XmlSerializer serializer ) throws Exception
{
if ( repository != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( repository.getConnection() != null )
{
serializer.startTag( NAMESPACE, "connection" ).text( repository.getConnection() ).endTag( NAMESPACE,
"connection" );
}
if ( repository.getDeveloperConnection() != null )
{
serializer.startTag( NAMESPACE, "developerConnection" ).text( repository.getDeveloperConnection() )
.endTag( NAMESPACE, "developerConnection" );
}
if ( repository.getUrl() != null )
{
serializer.startTag( NAMESPACE, "url" ).text( repository.getUrl() ).endTag( NAMESPACE, "url" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeRepository(Repository, String, XmlSerializer)
/**
* Method writeResource
*
* @param resource
* @param serializer
* @param tagName
*/
private void writeResource( Resource resource, String tagName, XmlSerializer serializer ) throws Exception
{
if ( resource != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( resource.getTargetPath() != null )
{
serializer.startTag( NAMESPACE, "targetPath" ).text( resource.getTargetPath() ).endTag( NAMESPACE,
"targetPath" );
}
if ( resource.isFiltering() != false )
{
serializer.startTag( NAMESPACE, "filtering" ).text( String.valueOf( resource.isFiltering() ) )
.endTag( NAMESPACE, "filtering" );
}
if ( resource.getDirectory() != null )
{
serializer.startTag( NAMESPACE, "directory" ).text( resource.getDirectory() ).endTag( NAMESPACE,
"directory" );
}
if ( resource.getIncludes() != null && resource.getIncludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "includes" );
for ( Iterator iter = resource.getIncludes().iterator(); iter.hasNext(); )
{
String include = (String) iter.next();
serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
}
serializer.endTag( NAMESPACE, "includes" );
}
if ( resource.getExcludes() != null && resource.getExcludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "excludes" );
for ( Iterator iter = resource.getExcludes().iterator(); iter.hasNext(); )
{
String exclude = (String) iter.next();
serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
}
serializer.endTag( NAMESPACE, "excludes" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeResource(Resource, String, XmlSerializer)
/**
* Method writeSourceModification
*
* @param sourceModification
* @param serializer
* @param tagName
*/
private void writeSourceModification( SourceModification sourceModification, String tagName,
XmlSerializer serializer ) throws Exception
{
if ( sourceModification != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( sourceModification.getClassName() != null )
{
serializer.startTag( NAMESPACE, "className" ).text( sourceModification.getClassName() )
.endTag( NAMESPACE, "className" );
}
if ( sourceModification.getProperty() != null )
{
serializer.startTag( NAMESPACE, "property" ).text( sourceModification.getProperty() )
.endTag( NAMESPACE, "property" );
}
if ( sourceModification.getDirectory() != null )
{
serializer.startTag( NAMESPACE, "directory" ).text( sourceModification.getDirectory() )
.endTag( NAMESPACE, "directory" );
}
if ( sourceModification.getIncludes() != null && sourceModification.getIncludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "includes" );
for ( Iterator iter = sourceModification.getIncludes().iterator(); iter.hasNext(); )
{
String include = (String) iter.next();
serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
}
serializer.endTag( NAMESPACE, "includes" );
}
if ( sourceModification.getExcludes() != null && sourceModification.getExcludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "excludes" );
for ( Iterator iter = sourceModification.getExcludes().iterator(); iter.hasNext(); )
{
String exclude = (String) iter.next();
serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
}
serializer.endTag( NAMESPACE, "excludes" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeSourceModification(SourceModification, String, XmlSerializer)
/**
* Method writeUnitTest
*
* @param unitTest
* @param serializer
* @param tagName
*/
private void writeUnitTest( UnitTest unitTest, String tagName, XmlSerializer serializer ) throws Exception
{
if ( unitTest != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( unitTest.getResources() != null && unitTest.getResources().size() > 0 )
{
serializer.startTag( NAMESPACE, "resources" );
for ( Iterator iter = unitTest.getResources().iterator(); iter.hasNext(); )
{
Resource resource = (Resource) iter.next();
writeResource( resource, "resource", serializer );
}
serializer.endTag( NAMESPACE, "resources" );
}
if ( unitTest.getIncludes() != null && unitTest.getIncludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "includes" );
for ( Iterator iter = unitTest.getIncludes().iterator(); iter.hasNext(); )
{
String include = (String) iter.next();
serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" );
}
serializer.endTag( NAMESPACE, "includes" );
}
if ( unitTest.getExcludes() != null && unitTest.getExcludes().size() > 0 )
{
serializer.startTag( NAMESPACE, "excludes" );
for ( Iterator iter = unitTest.getExcludes().iterator(); iter.hasNext(); )
{
String exclude = (String) iter.next();
serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" );
}
serializer.endTag( NAMESPACE, "excludes" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeUnitTest(UnitTest, String, XmlSerializer)
/**
* Method writeVersion
*
* @param version
* @param serializer
* @param tagName
*/
private void writeVersion( Version version, String tagName, XmlSerializer serializer ) throws Exception
{
if ( version != null )
{
serializer.startTag( NAMESPACE, tagName );
if ( version.getName() != null )
{
serializer.startTag( NAMESPACE, "name" ).text( version.getName() ).endTag( NAMESPACE, "name" );
}
if ( version.getTag() != null )
{
serializer.startTag( NAMESPACE, "tag" ).text( version.getTag() ).endTag( NAMESPACE, "tag" );
}
if ( version.getId() != null )
{
serializer.startTag( NAMESPACE, "id" ).text( version.getId() ).endTag( NAMESPACE, "id" );
}
serializer.endTag( NAMESPACE, tagName );
}
} //-- void writeVersion(Version, String, XmlSerializer)
}

View File

@ -0,0 +1,357 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Build.
*
* @version $Revision$ $Date$
*/
public class Build
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field sourceDirectory
*/
private String sourceDirectory;
/**
* Field scriptSourceDirectory
*/
private String scriptSourceDirectory;
/**
* Field testSourceDirectory
*/
private String testSourceDirectory;
/**
* Field resources
*/
private java.util.List resources;
/**
* Field testResources
*/
private java.util.List testResources;
/**
* Field directory
*/
private String directory;
/**
* Field outputDirectory
*/
private String outputDirectory;
/**
* Field finalName
*/
private String finalName;
/**
* Field testOutputDirectory
*/
private String testOutputDirectory;
/**
* Field plugins
*/
private java.util.List plugins;
/**
* Field pluginManagement
*/
private PluginManagement pluginManagement;
//-----------/
//- Methods -/
//-----------/
/**
* Method addPlugin
*
* @param plugin
*/
public void addPlugin( Plugin plugin )
{
getPlugins().add( plugin );
} //-- void addPlugin(Plugin)
/**
* Method addResource
*
* @param resource
*/
public void addResource( Resource resource )
{
getResources().add( resource );
} //-- void addResource(Resource)
/**
* Method addTestResource
*
* @param resource
*/
public void addTestResource( Resource resource )
{
getTestResources().add( resource );
} //-- void addTestResource(Resource)
/**
* Method getDirectory
*/
public String getDirectory()
{
return this.directory;
} //-- String getDirectory()
/**
* Method getFinalName
*/
public String getFinalName()
{
return this.finalName;
} //-- String getFinalName()
/**
* Method getOutputDirectory
*/
public String getOutputDirectory()
{
return this.outputDirectory;
} //-- String getOutputDirectory()
/**
* Method getPluginManagement
*/
public PluginManagement getPluginManagement()
{
return this.pluginManagement;
} //-- PluginManagement getPluginManagement()
/**
* Method getPlugins
*/
public java.util.List getPlugins()
{
if ( this.plugins == null )
{
this.plugins = new java.util.ArrayList();
}
return this.plugins;
} //-- java.util.List getPlugins()
/**
* Method getResources
*/
public java.util.List getResources()
{
if ( this.resources == null )
{
this.resources = new java.util.ArrayList();
}
return this.resources;
} //-- java.util.List getResources()
/**
* Method getScriptSourceDirectory
*/
public String getScriptSourceDirectory()
{
return this.scriptSourceDirectory;
} //-- String getScriptSourceDirectory()
/**
* Method getSourceDirectory
*/
public String getSourceDirectory()
{
return this.sourceDirectory;
} //-- String getSourceDirectory()
/**
* Method getTestOutputDirectory
*/
public String getTestOutputDirectory()
{
return this.testOutputDirectory;
} //-- String getTestOutputDirectory()
/**
* Method getTestResources
*/
public java.util.List getTestResources()
{
if ( this.testResources == null )
{
this.testResources = new java.util.ArrayList();
}
return this.testResources;
} //-- java.util.List getTestResources()
/**
* Method getTestSourceDirectory
*/
public String getTestSourceDirectory()
{
return this.testSourceDirectory;
} //-- String getTestSourceDirectory()
/**
* Method removePlugin
*
* @param plugin
*/
public void removePlugin( Plugin plugin )
{
getPlugins().remove( plugin );
} //-- void removePlugin(Plugin)
/**
* Method removeResource
*
* @param resource
*/
public void removeResource( Resource resource )
{
getResources().remove( resource );
} //-- void removeResource(Resource)
/**
* Method removeTestResource
*
* @param resource
*/
public void removeTestResource( Resource resource )
{
getTestResources().remove( resource );
} //-- void removeTestResource(Resource)
/**
* Method setDirectory
*
* @param directory
*/
public void setDirectory( String directory )
{
this.directory = directory;
} //-- void setDirectory(String)
/**
* Method setFinalName
*
* @param finalName
*/
public void setFinalName( String finalName )
{
this.finalName = finalName;
} //-- void setFinalName(String)
/**
* Method setOutputDirectory
*
* @param outputDirectory
*/
public void setOutputDirectory( String outputDirectory )
{
this.outputDirectory = outputDirectory;
} //-- void setOutputDirectory(String)
/**
* Method setPluginManagement
*
* @param pluginManagement
*/
public void setPluginManagement( PluginManagement pluginManagement )
{
this.pluginManagement = pluginManagement;
} //-- void setPluginManagement(PluginManagement)
/**
* Method setPlugins
*
* @param plugins
*/
public void setPlugins( java.util.List plugins )
{
this.plugins = plugins;
} //-- void setPlugins(java.util.List)
/**
* Method setResources
*
* @param resources
*/
public void setResources( java.util.List resources )
{
this.resources = resources;
} //-- void setResources(java.util.List)
/**
* Method setScriptSourceDirectory
*
* @param scriptSourceDirectory
*/
public void setScriptSourceDirectory( String scriptSourceDirectory )
{
this.scriptSourceDirectory = scriptSourceDirectory;
} //-- void setScriptSourceDirectory(String)
/**
* Method setSourceDirectory
*
* @param sourceDirectory
*/
public void setSourceDirectory( String sourceDirectory )
{
this.sourceDirectory = sourceDirectory;
} //-- void setSourceDirectory(String)
/**
* Method setTestOutputDirectory
*
* @param testOutputDirectory
*/
public void setTestOutputDirectory( String testOutputDirectory )
{
this.testOutputDirectory = testOutputDirectory;
} //-- void setTestOutputDirectory(String)
/**
* Method setTestResources
*
* @param testResources
*/
public void setTestResources( java.util.List testResources )
{
this.testResources = testResources;
} //-- void setTestResources(java.util.List)
/**
* Method setTestSourceDirectory
*
* @param testSourceDirectory
*/
public void setTestSourceDirectory( String testSourceDirectory )
{
this.testSourceDirectory = testSourceDirectory;
} //-- void setTestSourceDirectory(String)
}

View File

@ -0,0 +1,123 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class CiManagement.
*
* @version $Revision$ $Date$
*/
public class CiManagement
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field system
*/
private String system;
/**
* Field url
*/
private String url;
/**
* Field notifiers
*/
private java.util.List notifiers;
//-----------/
//- Methods -/
//-----------/
/**
* Method addNotifier
*
* @param notifier
*/
public void addNotifier( Notifier notifier )
{
getNotifiers().add( notifier );
} //-- void addNotifier(Notifier)
/**
* Method getNotifiers
*/
public java.util.List getNotifiers()
{
if ( this.notifiers == null )
{
this.notifiers = new java.util.ArrayList();
}
return this.notifiers;
} //-- java.util.List getNotifiers()
/**
* Method getSystem
*/
public String getSystem()
{
return this.system;
} //-- String getSystem()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method removeNotifier
*
* @param notifier
*/
public void removeNotifier( Notifier notifier )
{
getNotifiers().remove( notifier );
} //-- void removeNotifier(Notifier)
/**
* Method setNotifiers
*
* @param notifiers
*/
public void setNotifiers( java.util.List notifiers )
{
this.notifiers = notifiers;
} //-- void setNotifiers(java.util.List)
/**
* Method setSystem
*
* @param system
*/
public void setSystem( String system )
{
this.system = system;
} //-- void setSystem(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,192 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Contributor.
*
* @version $Revision$ $Date$
*/
public class Contributor
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field email
*/
private String email;
/**
* Field url
*/
private String url;
/**
* Field organization
*/
private String organization;
/**
* Field roles
*/
private java.util.List roles;
/**
* Field timezone
*/
private String timezone;
//-----------/
//- Methods -/
//-----------/
/**
* Method addRole
*
* @param string
*/
public void addRole( String string )
{
getRoles().add( string );
} //-- void addRole(String)
/**
* Method getEmail
*/
public String getEmail()
{
return this.email;
} //-- String getEmail()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getOrganization
*/
public String getOrganization()
{
return this.organization;
} //-- String getOrganization()
/**
* Method getRoles
*/
public java.util.List getRoles()
{
if ( this.roles == null )
{
this.roles = new java.util.ArrayList();
}
return this.roles;
} //-- java.util.List getRoles()
/**
* Method getTimezone
*/
public String getTimezone()
{
return this.timezone;
} //-- String getTimezone()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method removeRole
*
* @param string
*/
public void removeRole( String string )
{
getRoles().remove( string );
} //-- void removeRole(String)
/**
* Method setEmail
*
* @param email
*/
public void setEmail( String email )
{
this.email = email;
} //-- void setEmail(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setOrganization
*
* @param organization
*/
public void setOrganization( String organization )
{
this.organization = organization;
} //-- void setOrganization(String)
/**
* Method setRoles
*
* @param roles
*/
public void setRoles( java.util.List roles )
{
this.roles = roles;
} //-- void setRoles(java.util.List)
/**
* Method setTimezone
*
* @param timezone
*/
public void setTimezone( String timezone )
{
this.timezone = timezone;
} //-- void setTimezone(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,158 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Dependency.
*
* @version $Revision$ $Date$
*/
public class Dependency
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field groupId
*/
private String groupId;
/**
* Field artifactId
*/
private String artifactId;
/**
* Field version
*/
private String version;
/**
* Field type
*/
private String type = "jar";
/**
* Field scope
*/
private String scope = "compile";
//-----------/
//- Methods -/
//-----------/
/**
* Method getArtifactId
*/
public String getArtifactId()
{
return this.artifactId;
} //-- String getArtifactId()
/**
* Method getGroupId
*/
public String getGroupId()
{
return this.groupId;
} //-- String getGroupId()
/**
* Method getScope
*/
public String getScope()
{
return this.scope;
} //-- String getScope()
/**
* Method getType
*/
public String getType()
{
return this.type;
} //-- String getType()
/**
* Method getVersion
*/
public String getVersion()
{
return this.version;
} //-- String getVersion()
/**
* Method setArtifactId
*
* @param artifactId
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
} //-- void setArtifactId(String)
/**
* Method setGroupId
*
* @param groupId
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
} //-- void setGroupId(String)
/**
* Method setScope
*
* @param scope
*/
public void setScope( String scope )
{
this.scope = scope;
} //-- void setScope(String)
/**
* Method setType
*
* @param type
*/
public void setType( String type )
{
this.type = type;
} //-- void setType(String)
/**
* Method setVersion
*
* @param version
*/
public void setVersion( String version )
{
this.version = version;
} //-- void setVersion(String)
public String toString()
{
return groupId + "/" + type + "s:" + artifactId + "-" + version;
}
public String getId()
{
return groupId + ":" + artifactId + ":" + type + ":" + version;
}
public String getManagementKey()
{
return groupId + ":" + artifactId + ":" + type;
}
}

View File

@ -0,0 +1,77 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class DependencyManagement.
*
* @version $Revision$ $Date$
*/
public class DependencyManagement
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field dependencies
*/
private java.util.List dependencies;
//-----------/
//- Methods -/
//-----------/
/**
* Method addDependency
*
* @param dependency
*/
public void addDependency( Dependency dependency )
{
getDependencies().add( dependency );
} //-- void addDependency(Dependency)
/**
* Method getDependencies
*/
public java.util.List getDependencies()
{
if ( this.dependencies == null )
{
this.dependencies = new java.util.ArrayList();
}
return this.dependencies;
} //-- java.util.List getDependencies()
/**
* Method removeDependency
*
* @param dependency
*/
public void removeDependency( Dependency dependency )
{
getDependencies().remove( dependency );
} //-- void removeDependency(Dependency)
/**
* Method setDependencies
*
* @param dependencies
*/
public void setDependencies( java.util.List dependencies )
{
this.dependencies = dependencies;
} //-- void setDependencies(java.util.List)
}

View File

@ -0,0 +1,53 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Developer.
*
* @version $Revision$ $Date$
*/
public class Developer
extends Contributor
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field id
*/
private String id;
//-----------/
//- Methods -/
//-----------/
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
}

View File

@ -0,0 +1,75 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class DistributionManagement.
*
* @version $Revision$ $Date$
*/
public class DistributionManagement
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field repository
*/
private Repository repository;
/**
* Field site
*/
private Site site;
//-----------/
//- Methods -/
//-----------/
/**
* Method getRepository
*/
public Repository getRepository()
{
return this.repository;
} //-- Repository getRepository()
/**
* Method getSite
*/
public Site getSite()
{
return this.site;
} //-- Site getSite()
/**
* Method setRepository
*
* @param repository
*/
public void setRepository( Repository repository )
{
this.repository = repository;
} //-- void setRepository(Repository)
/**
* Method setSite
*
* @param site
*/
public void setSite( Site site )
{
this.site = site;
} //-- void setSite(Site)
}

View File

@ -0,0 +1,53 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class FileSet.
*
* @version $Revision$ $Date$
*/
public class FileSet
extends PatternSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field directory
*/
private String directory;
//-----------/
//- Methods -/
//-----------/
/**
* Method getDirectory
*/
public String getDirectory()
{
return this.directory;
} //-- String getDirectory()
/**
* Method setDirectory
*
* @param directory
*/
public void setDirectory( String directory )
{
this.directory = directory;
} //-- void setDirectory(String)
}

View File

@ -0,0 +1,114 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Goal.
*
* @version $Revision$ $Date$
*/
public class Goal
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field id
*/
private String id;
/**
* Field disabled
*/
private Boolean disabled;
/**
* Field configuration
*/
private java.util.Properties configuration;
//-----------/
//- Methods -/
//-----------/
/**
* Method addConfiguration
*
* @param key
* @param value
*/
public void addConfiguration( String key, String value )
{
getConfiguration().put( key, value );
} //-- void addConfiguration(String, String)
/**
* Method getConfiguration
*/
public java.util.Properties getConfiguration()
{
if ( this.configuration == null )
{
this.configuration = new java.util.Properties();
}
return this.configuration;
} //-- java.util.Properties getConfiguration()
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method isDisabled
*/
public Boolean isDisabled()
{
return this.disabled;
} //-- Boolean isDisabled()
/**
* Method setConfiguration
*
* @param configuration
*/
public void setConfiguration( java.util.Properties configuration )
{
this.configuration = configuration;
} //-- void setConfiguration(java.util.Properties)
/**
* Method setDisabled
*
* @param disabled
*/
public void setDisabled( Boolean disabled )
{
this.disabled = disabled;
} //-- void setDisabled(Boolean)
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
}

View File

@ -0,0 +1,75 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class IssueManagement.
*
* @version $Revision$ $Date$
*/
public class IssueManagement
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field system
*/
private String system;
/**
* Field url
*/
private String url;
//-----------/
//- Methods -/
//-----------/
/**
* Method getSystem
*/
public String getSystem()
{
return this.system;
} //-- String getSystem()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setSystem
*
* @param system
*/
public void setSystem( String system )
{
this.system = system;
} //-- void setSystem(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,98 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class License.
*
* @version $Revision$ $Date$
*/
public class License
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field url
*/
private String url;
/**
* Field comments
*/
private String comments;
//-----------/
//- Methods -/
//-----------/
/**
* Method getComments
*/
public String getComments()
{
return this.comments;
} //-- String getComments()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setComments
*
* @param comments
*/
public void setComments( String comments )
{
this.comments = comments;
} //-- void setComments(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,192 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class MailingList.
*
* @version $Revision$ $Date$
*/
public class MailingList
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field subscribe
*/
private String subscribe;
/**
* Field unsubscribe
*/
private String unsubscribe;
/**
* Field post
*/
private String post;
/**
* Field archive
*/
private String archive;
/**
* Field otherArchives
*/
private java.util.List otherArchives;
//-----------/
//- Methods -/
//-----------/
/**
* Method addOtherArchive
*
* @param string
*/
public void addOtherArchive( String string )
{
getOtherArchives().add( string );
} //-- void addOtherArchive(String)
/**
* Method getArchive
*/
public String getArchive()
{
return this.archive;
} //-- String getArchive()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getOtherArchives
*/
public java.util.List getOtherArchives()
{
if ( this.otherArchives == null )
{
this.otherArchives = new java.util.ArrayList();
}
return this.otherArchives;
} //-- java.util.List getOtherArchives()
/**
* Method getPost
*/
public String getPost()
{
return this.post;
} //-- String getPost()
/**
* Method getSubscribe
*/
public String getSubscribe()
{
return this.subscribe;
} //-- String getSubscribe()
/**
* Method getUnsubscribe
*/
public String getUnsubscribe()
{
return this.unsubscribe;
} //-- String getUnsubscribe()
/**
* Method removeOtherArchive
*
* @param string
*/
public void removeOtherArchive( String string )
{
getOtherArchives().remove( string );
} //-- void removeOtherArchive(String)
/**
* Method setArchive
*
* @param archive
*/
public void setArchive( String archive )
{
this.archive = archive;
} //-- void setArchive(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setOtherArchives
*
* @param otherArchives
*/
public void setOtherArchives( java.util.List otherArchives )
{
this.otherArchives = otherArchives;
} //-- void setOtherArchives(java.util.List)
/**
* Method setPost
*
* @param post
*/
public void setPost( String post )
{
this.post = post;
} //-- void setPost(String)
/**
* Method setSubscribe
*
* @param subscribe
*/
public void setSubscribe( String subscribe )
{
this.subscribe = subscribe;
} //-- void setSubscribe(String)
/**
* Method setUnsubscribe
*
* @param unsubscribe
*/
public void setUnsubscribe( String unsubscribe )
{
this.unsubscribe = unsubscribe;
} //-- void setUnsubscribe(String)
}

View File

@ -0,0 +1,867 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Model.
*
* @version $Revision$ $Date$
*/
public class Model
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field extend
*/
private String extend;
/**
* Field parent
*/
private Parent parent;
/**
* Field modelVersion
*/
private String modelVersion;
/**
* Field groupId
*/
private String groupId;
/**
* Field artifactId
*/
private String artifactId;
/**
* Field packaging
*/
private String packaging = "jar";
/**
* Field modules
*/
private java.util.List modules;
/**
* Field name
*/
private String name;
/**
* Field version
*/
private String version;
/**
* Field description
*/
private String description;
/**
* Field url
*/
private String url;
/**
* Field issueManagement
*/
private IssueManagement issueManagement;
/**
* Field ciManagement
*/
private CiManagement ciManagement;
/**
* Field inceptionYear
*/
private String inceptionYear;
/**
* Field repositories
*/
private java.util.List repositories;
/**
* This may be removed or relocated in the near future. It is
* undecided whether plugins really need a remote repository
* set of their own.
*/
private java.util.List pluginRepositories;
/**
* Field mailingLists
*/
private java.util.List mailingLists;
/**
* Field developers
*/
private java.util.List developers;
/**
* Field contributors
*/
private java.util.List contributors;
/**
* These should ultimately only be compile time dependencies
* when transitive dependencies come into play.
*/
private java.util.List dependencies;
/**
* Field licenses
*/
private java.util.List licenses;
/**
* Field reports
*/
private Reports reports;
/**
* Field scm
*/
private Scm scm;
/**
* Field build
*/
private Build build;
/**
* Field organization
*/
private Organization organization;
/**
* Field distributionManagement
*/
private DistributionManagement distributionManagement;
/**
* Field dependencyManagement
*/
private DependencyManagement dependencyManagement;
//-----------/
//- Methods -/
//-----------/
/**
* Method addContributor
*
* @param contributor
*/
public void addContributor( Contributor contributor )
{
getContributors().add( contributor );
} //-- void addContributor(Contributor)
/**
* Method addDependency
*
* @param dependency
*/
public void addDependency( Dependency dependency )
{
getDependencies().add( dependency );
} //-- void addDependency(Dependency)
/**
* Method addDeveloper
*
* @param developer
*/
public void addDeveloper( Developer developer )
{
getDevelopers().add( developer );
} //-- void addDeveloper(Developer)
/**
* Method addLicense
*
* @param license
*/
public void addLicense( License license )
{
getLicenses().add( license );
} //-- void addLicense(License)
/**
* Method addMailingList
*
* @param mailingList
*/
public void addMailingList( MailingList mailingList )
{
getMailingLists().add( mailingList );
} //-- void addMailingList(MailingList)
/**
* Method addModule
*
* @param string
*/
public void addModule( String string )
{
getModules().add( string );
} //-- void addModule(String)
/**
* Method addPluginRepository
*
* @param repository
*/
public void addPluginRepository( Repository repository )
{
getPluginRepositories().add( repository );
} //-- void addPluginRepository(Repository)
/**
* Method addRepository
*
* @param repository
*/
public void addRepository( Repository repository )
{
getRepositories().add( repository );
} //-- void addRepository(Repository)
/**
* Method getArtifactId
*/
public String getArtifactId()
{
return this.artifactId;
} //-- String getArtifactId()
/**
* Method getBuild
*/
public Build getBuild()
{
return this.build;
} //-- Build getBuild()
/**
* Method getCiManagement
*/
public CiManagement getCiManagement()
{
return this.ciManagement;
} //-- CiManagement getCiManagement()
/**
* Method getContributors
*/
public java.util.List getContributors()
{
if ( this.contributors == null )
{
this.contributors = new java.util.ArrayList();
}
return this.contributors;
} //-- java.util.List getContributors()
/**
* Method getDependencies
*/
public java.util.List getDependencies()
{
if ( this.dependencies == null )
{
this.dependencies = new java.util.ArrayList();
}
return this.dependencies;
} //-- java.util.List getDependencies()
/**
* Method getDependencyManagement
*/
public DependencyManagement getDependencyManagement()
{
return this.dependencyManagement;
} //-- DependencyManagement getDependencyManagement()
/**
* Method getDescription
*/
public String getDescription()
{
return this.description;
} //-- String getDescription()
/**
* Method getDevelopers
*/
public java.util.List getDevelopers()
{
if ( this.developers == null )
{
this.developers = new java.util.ArrayList();
}
return this.developers;
} //-- java.util.List getDevelopers()
/**
* Method getDistributionManagement
*/
public DistributionManagement getDistributionManagement()
{
return this.distributionManagement;
} //-- DistributionManagement getDistributionManagement()
/**
* Method getExtend
*/
public String getExtend()
{
return this.extend;
} //-- String getExtend()
/**
* Method getGroupId
*/
public String getGroupId()
{
return this.groupId;
} //-- String getGroupId()
/**
* Method getInceptionYear
*/
public String getInceptionYear()
{
return this.inceptionYear;
} //-- String getInceptionYear()
/**
* Method getIssueManagement
*/
public IssueManagement getIssueManagement()
{
return this.issueManagement;
} //-- IssueManagement getIssueManagement()
/**
* Method getLicenses
*/
public java.util.List getLicenses()
{
if ( this.licenses == null )
{
this.licenses = new java.util.ArrayList();
}
return this.licenses;
} //-- java.util.List getLicenses()
/**
* Method getMailingLists
*/
public java.util.List getMailingLists()
{
if ( this.mailingLists == null )
{
this.mailingLists = new java.util.ArrayList();
}
return this.mailingLists;
} //-- java.util.List getMailingLists()
/**
* Method getModelVersion
*/
public String getModelVersion()
{
return this.modelVersion;
} //-- String getModelVersion()
/**
* Method getModules
*/
public java.util.List getModules()
{
if ( this.modules == null )
{
this.modules = new java.util.ArrayList();
}
return this.modules;
} //-- java.util.List getModules()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getOrganization
*/
public Organization getOrganization()
{
return this.organization;
} //-- Organization getOrganization()
/**
* Method getPackaging
*/
public String getPackaging()
{
return this.packaging;
} //-- String getPackaging()
/**
* Method getParent
*/
public Parent getParent()
{
return this.parent;
} //-- Parent getParent()
/**
* Method getPluginRepositories
*/
public java.util.List getPluginRepositories()
{
if ( this.pluginRepositories == null )
{
this.pluginRepositories = new java.util.ArrayList();
}
return this.pluginRepositories;
} //-- java.util.List getPluginRepositories()
/**
* Method getReports
*/
public Reports getReports()
{
return this.reports;
} //-- Reports getReports()
/**
* Method getRepositories
*/
public java.util.List getRepositories()
{
if ( this.repositories == null )
{
this.repositories = new java.util.ArrayList();
}
return this.repositories;
} //-- java.util.List getRepositories()
/**
* Method getScm
*/
public Scm getScm()
{
return this.scm;
} //-- Scm getScm()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method getVersion
*/
public String getVersion()
{
return this.version;
} //-- String getVersion()
/**
* Method removeContributor
*
* @param contributor
*/
public void removeContributor( Contributor contributor )
{
getContributors().remove( contributor );
} //-- void removeContributor(Contributor)
/**
* Method removeDependency
*
* @param dependency
*/
public void removeDependency( Dependency dependency )
{
getDependencies().remove( dependency );
} //-- void removeDependency(Dependency)
/**
* Method removeDeveloper
*
* @param developer
*/
public void removeDeveloper( Developer developer )
{
getDevelopers().remove( developer );
} //-- void removeDeveloper(Developer)
/**
* Method removeLicense
*
* @param license
*/
public void removeLicense( License license )
{
getLicenses().remove( license );
} //-- void removeLicense(License)
/**
* Method removeMailingList
*
* @param mailingList
*/
public void removeMailingList( MailingList mailingList )
{
getMailingLists().remove( mailingList );
} //-- void removeMailingList(MailingList)
/**
* Method removeModule
*
* @param string
*/
public void removeModule( String string )
{
getModules().remove( string );
} //-- void removeModule(String)
/**
* Method removePluginRepository
*
* @param repository
*/
public void removePluginRepository( Repository repository )
{
getPluginRepositories().remove( repository );
} //-- void removePluginRepository(Repository)
/**
* Method removeRepository
*
* @param repository
*/
public void removeRepository( Repository repository )
{
getRepositories().remove( repository );
} //-- void removeRepository(Repository)
/**
* Method setArtifactId
*
* @param artifactId
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
} //-- void setArtifactId(String)
/**
* Method setBuild
*
* @param build
*/
public void setBuild( Build build )
{
this.build = build;
} //-- void setBuild(Build)
/**
* Method setCiManagement
*
* @param ciManagement
*/
public void setCiManagement( CiManagement ciManagement )
{
this.ciManagement = ciManagement;
} //-- void setCiManagement(CiManagement)
/**
* Method setContributors
*
* @param contributors
*/
public void setContributors( java.util.List contributors )
{
this.contributors = contributors;
} //-- void setContributors(java.util.List)
/**
* Method setDependencies
*
* @param dependencies
*/
public void setDependencies( java.util.List dependencies )
{
this.dependencies = dependencies;
} //-- void setDependencies(java.util.List)
/**
* Method setDependencyManagement
*
* @param dependencyManagement
*/
public void setDependencyManagement( DependencyManagement dependencyManagement )
{
this.dependencyManagement = dependencyManagement;
} //-- void setDependencyManagement(DependencyManagement)
/**
* Method setDescription
*
* @param description
*/
public void setDescription( String description )
{
this.description = description;
} //-- void setDescription(String)
/**
* Method setDevelopers
*
* @param developers
*/
public void setDevelopers( java.util.List developers )
{
this.developers = developers;
} //-- void setDevelopers(java.util.List)
/**
* Method setDistributionManagement
*
* @param distributionManagement
*/
public void setDistributionManagement( DistributionManagement distributionManagement )
{
this.distributionManagement = distributionManagement;
} //-- void setDistributionManagement(DistributionManagement)
/**
* Method setExtend
*
* @param extend
*/
public void setExtend( String extend )
{
this.extend = extend;
} //-- void setExtend(String)
/**
* Method setGroupId
*
* @param groupId
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
} //-- void setGroupId(String)
/**
* Method setInceptionYear
*
* @param inceptionYear
*/
public void setInceptionYear( String inceptionYear )
{
this.inceptionYear = inceptionYear;
} //-- void setInceptionYear(String)
/**
* Method setIssueManagement
*
* @param issueManagement
*/
public void setIssueManagement( IssueManagement issueManagement )
{
this.issueManagement = issueManagement;
} //-- void setIssueManagement(IssueManagement)
/**
* Method setLicenses
*
* @param licenses
*/
public void setLicenses( java.util.List licenses )
{
this.licenses = licenses;
} //-- void setLicenses(java.util.List)
/**
* Method setMailingLists
*
* @param mailingLists
*/
public void setMailingLists( java.util.List mailingLists )
{
this.mailingLists = mailingLists;
} //-- void setMailingLists(java.util.List)
/**
* Method setModelVersion
*
* @param modelVersion
*/
public void setModelVersion( String modelVersion )
{
this.modelVersion = modelVersion;
} //-- void setModelVersion(String)
/**
* Method setModules
*
* @param modules
*/
public void setModules( java.util.List modules )
{
this.modules = modules;
} //-- void setModules(java.util.List)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setOrganization
*
* @param organization
*/
public void setOrganization( Organization organization )
{
this.organization = organization;
} //-- void setOrganization(Organization)
/**
* Method setPackaging
*
* @param packaging
*/
public void setPackaging( String packaging )
{
this.packaging = packaging;
} //-- void setPackaging(String)
/**
* Method setParent
*
* @param parent
*/
public void setParent( Parent parent )
{
this.parent = parent;
} //-- void setParent(Parent)
/**
* Method setPluginRepositories
*
* @param pluginRepositories
*/
public void setPluginRepositories( java.util.List pluginRepositories )
{
this.pluginRepositories = pluginRepositories;
} //-- void setPluginRepositories(java.util.List)
/**
* Method setReports
*
* @param reports
*/
public void setReports( Reports reports )
{
this.reports = reports;
} //-- void setReports(Reports)
/**
* Method setRepositories
*
* @param repositories
*/
public void setRepositories( java.util.List repositories )
{
this.repositories = repositories;
} //-- void setRepositories(java.util.List)
/**
* Method setScm
*
* @param scm
*/
public void setScm( Scm scm )
{
this.scm = scm;
} //-- void setScm(Scm)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
/**
* Method setVersion
*
* @param version
*/
public void setVersion( String version )
{
this.version = version;
} //-- void setVersion(String)
public String getId()
{
StringBuffer id = new StringBuffer();
id.append( getGroupId() );
id.append( ":" );
id.append( getArtifactId() );
id.append( ":" );
id.append( getPackaging() );
id.append( ":" );
id.append( getVersion() );
return id.toString();
}
}

View File

@ -0,0 +1,114 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Notifier.
*
* @version $Revision$ $Date$
*/
public class Notifier
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field type
*/
private String type = "email";
/**
* Field address
*/
private String address;
/**
* Field configuration
*/
private java.util.Properties configuration;
//-----------/
//- Methods -/
//-----------/
/**
* Method addConfiguration
*
* @param key
* @param value
*/
public void addConfiguration( String key, String value )
{
getConfiguration().put( key, value );
} //-- void addConfiguration(String, String)
/**
* Method getAddress
*/
public String getAddress()
{
return this.address;
} //-- String getAddress()
/**
* Method getConfiguration
*/
public java.util.Properties getConfiguration()
{
if ( this.configuration == null )
{
this.configuration = new java.util.Properties();
}
return this.configuration;
} //-- java.util.Properties getConfiguration()
/**
* Method getType
*/
public String getType()
{
return this.type;
} //-- String getType()
/**
* Method setAddress
*
* @param address
*/
public void setAddress( String address )
{
this.address = address;
} //-- void setAddress(String)
/**
* Method setConfiguration
*
* @param configuration
*/
public void setConfiguration( java.util.Properties configuration )
{
this.configuration = configuration;
} //-- void setConfiguration(java.util.Properties)
/**
* Method setType
*
* @param type
*/
public void setType( String type )
{
this.type = type;
} //-- void setType(String)
}

View File

@ -0,0 +1,75 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Organization.
*
* @version $Revision$ $Date$
*/
public class Organization
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field name
*/
private String name;
/**
* Field url
*/
private String url;
//-----------/
//- Methods -/
//-----------/
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,98 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Parent.
*
* @version $Revision$ $Date$
*/
public class Parent
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field artifactId
*/
private String artifactId;
/**
* Field groupId
*/
private String groupId;
/**
* Field version
*/
private String version;
//-----------/
//- Methods -/
//-----------/
/**
* Method getArtifactId
*/
public String getArtifactId()
{
return this.artifactId;
} //-- String getArtifactId()
/**
* Method getGroupId
*/
public String getGroupId()
{
return this.groupId;
} //-- String getGroupId()
/**
* Method getVersion
*/
public String getVersion()
{
return this.version;
} //-- String getVersion()
/**
* Method setArtifactId
*
* @param artifactId
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
} //-- void setArtifactId(String)
/**
* Method setGroupId
*
* @param groupId
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
} //-- void setGroupId(String)
/**
* Method setVersion
*
* @param version
*/
public void setVersion( String version )
{
this.version = version;
} //-- void setVersion(String)
}

View File

@ -0,0 +1,106 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import java.util.ArrayList;
import java.util.List;
/**
* Class PatternSet.
*
* @version $Revision$ $Date$
*/
public class PatternSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field includes
*/
private String includes;
/**
* Field excludes
*/
private String excludes;
//-----------/
//- Methods -/
//-----------/
/**
* Method getExcludes
*/
public String getExcludes()
{
return this.excludes;
} //-- String getExcludes()
/**
* Method getIncludes
*/
public String getIncludes()
{
return this.includes;
} //-- String getIncludes()
/**
* Method setExcludes
*
* @param excludes
*/
public void setExcludes( String excludes )
{
this.excludes = excludes;
} //-- void setExcludes(String)
/**
* Method setIncludes
*
* @param includes
*/
public void setIncludes( String includes )
{
this.includes = includes;
} //-- void setIncludes(String)
public List getDefaultExcludes()
{
List defaultExcludes = new ArrayList();
defaultExcludes.add( "**/*~" );
defaultExcludes.add( "**/#*#" );
defaultExcludes.add( "**/.#*" );
defaultExcludes.add( "**/%*%" );
defaultExcludes.add( "**/._*" );
// CVS
defaultExcludes.add( "**/CVS" );
defaultExcludes.add( "**/CVS/**" );
defaultExcludes.add( "**/.cvsignore" );
// SCCS
defaultExcludes.add( "**/SCCS" );
defaultExcludes.add( "**/SCCS/**" );
// Visual SourceSafe
defaultExcludes.add( "**/vssver.scc" );
// Subversion
defaultExcludes.add( "**/.svn" );
defaultExcludes.add( "**/.svn/**" );
// Mac
defaultExcludes.add( "**/.DS_Store" );
return defaultExcludes;
}
}

View File

@ -0,0 +1,208 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Plugin.
*
* @version $Revision$ $Date$
*/
public class Plugin
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field groupId
*/
private String groupId = "maven";
/**
* Field artifactId
*/
private String artifactId;
/**
* Field version
*/
private String version;
/**
* Field disabled
*/
private Boolean disabled;
/**
* Field configuration
*/
private java.util.Properties configuration;
/**
* Field goals
*/
private java.util.List goals;
//-----------/
//- Methods -/
//-----------/
/**
* Method addConfiguration
*
* @param key
* @param value
*/
public void addConfiguration( String key, String value )
{
getConfiguration().put( key, value );
} //-- void addConfiguration(String, String)
/**
* Method addGoal
*
* @param goal
*/
public void addGoal( Goal goal )
{
getGoals().add( goal );
} //-- void addGoal(Goal)
/**
* Method getArtifactId
*/
public String getArtifactId()
{
return this.artifactId;
} //-- String getArtifactId()
/**
* Method getConfiguration
*/
public java.util.Properties getConfiguration()
{
if ( this.configuration == null )
{
this.configuration = new java.util.Properties();
}
return this.configuration;
} //-- java.util.Properties getConfiguration()
/**
* Method getGoals
*/
public java.util.List getGoals()
{
if ( this.goals == null )
{
this.goals = new java.util.ArrayList();
}
return this.goals;
} //-- java.util.List getGoals()
/**
* Method getGroupId
*/
public String getGroupId()
{
return this.groupId;
} //-- String getGroupId()
/**
* Method getVersion
*/
public String getVersion()
{
return this.version;
} //-- String getVersion()
/**
* Method isDisabled
*/
public Boolean isDisabled()
{
return this.disabled;
} //-- Boolean isDisabled()
/**
* Method removeGoal
*
* @param goal
*/
public void removeGoal( Goal goal )
{
getGoals().remove( goal );
} //-- void removeGoal(Goal)
/**
* Method setArtifactId
*
* @param artifactId
*/
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
} //-- void setArtifactId(String)
/**
* Method setConfiguration
*
* @param configuration
*/
public void setConfiguration( java.util.Properties configuration )
{
this.configuration = configuration;
} //-- void setConfiguration(java.util.Properties)
/**
* Method setDisabled
*
* @param disabled
*/
public void setDisabled( Boolean disabled )
{
this.disabled = disabled;
} //-- void setDisabled(Boolean)
/**
* Method setGoals
*
* @param goals
*/
public void setGoals( java.util.List goals )
{
this.goals = goals;
} //-- void setGoals(java.util.List)
/**
* Method setGroupId
*
* @param groupId
*/
public void setGroupId( String groupId )
{
this.groupId = groupId;
} //-- void setGroupId(String)
/**
* Method setVersion
*
* @param version
*/
public void setVersion( String version )
{
this.version = version;
} //-- void setVersion(String)
}

View File

@ -0,0 +1,77 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class PluginManagement.
*
* @version $Revision$ $Date$
*/
public class PluginManagement
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field plugins
*/
private java.util.List plugins;
//-----------/
//- Methods -/
//-----------/
/**
* Method addPlugin
*
* @param plugin
*/
public void addPlugin( Plugin plugin )
{
getPlugins().add( plugin );
} //-- void addPlugin(Plugin)
/**
* Method getPlugins
*/
public java.util.List getPlugins()
{
if ( this.plugins == null )
{
this.plugins = new java.util.ArrayList();
}
return this.plugins;
} //-- java.util.List getPlugins()
/**
* Method removePlugin
*
* @param plugin
*/
public void removePlugin( Plugin plugin )
{
getPlugins().remove( plugin );
} //-- void removePlugin(Plugin)
/**
* Method setPlugins
*
* @param plugins
*/
public void setPlugins( java.util.List plugins )
{
this.plugins = plugins;
} //-- void setPlugins(java.util.List)
}

View File

@ -0,0 +1,100 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Reports.
*
* @version $Revision$ $Date$
*/
public class Reports
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field outputDirectory
*/
private String outputDirectory;
/**
* Field plugins
*/
private java.util.List plugins;
//-----------/
//- Methods -/
//-----------/
/**
* Method addPlugin
*
* @param plugin
*/
public void addPlugin( Plugin plugin )
{
getPlugins().add( plugin );
} //-- void addPlugin(Plugin)
/**
* Method getOutputDirectory
*/
public String getOutputDirectory()
{
return this.outputDirectory;
} //-- String getOutputDirectory()
/**
* Method getPlugins
*/
public java.util.List getPlugins()
{
if ( this.plugins == null )
{
this.plugins = new java.util.ArrayList();
}
return this.plugins;
} //-- java.util.List getPlugins()
/**
* Method removePlugin
*
* @param plugin
*/
public void removePlugin( Plugin plugin )
{
getPlugins().remove( plugin );
} //-- void removePlugin(Plugin)
/**
* Method setOutputDirectory
*
* @param outputDirectory
*/
public void setOutputDirectory( String outputDirectory )
{
this.outputDirectory = outputDirectory;
} //-- void setOutputDirectory(String)
/**
* Method setPlugins
*
* @param plugins
*/
public void setPlugins( java.util.List plugins )
{
this.plugins = plugins;
} //-- void setPlugins(java.util.List)
}

View File

@ -0,0 +1,111 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Repository.
*
* @version $Revision$ $Date$
*/
public class Repository
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field id
*/
private String id;
/**
* Field name
*/
private String name;
/**
* Field url
*/
private String url;
//-----------/
//- Methods -/
//-----------/
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
public boolean equals( Object obj )
{
Repository other = (Repository) obj;
boolean retValue = false;
if ( id != null )
{
retValue = id.equals( other.id );
}
return retValue;
}
}

View File

@ -0,0 +1,53 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Resource.
*
* @version $Revision$ $Date$
*/
public class Resource
extends FileSet
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field targetPath
*/
private String targetPath;
//-----------/
//- Methods -/
//-----------/
/**
* Method getTargetPath
*/
public String getTargetPath()
{
return this.targetPath;
} //-- String getTargetPath()
/**
* Method setTargetPath
*
* @param targetPath
*/
public void setTargetPath( String targetPath )
{
this.targetPath = targetPath;
} //-- void setTargetPath(String)
}

View File

@ -0,0 +1,98 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Scm.
*
* @version $Revision$ $Date$
*/
public class Scm
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field connection
*/
private String connection;
/**
* Field developerConnection
*/
private String developerConnection;
/**
* Field url
*/
private String url;
//-----------/
//- Methods -/
//-----------/
/**
* Method getConnection
*/
public String getConnection()
{
return this.connection;
} //-- String getConnection()
/**
* Method getDeveloperConnection
*/
public String getDeveloperConnection()
{
return this.developerConnection;
} //-- String getDeveloperConnection()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setConnection
*
* @param connection
*/
public void setConnection( String connection )
{
this.connection = connection;
} //-- void setConnection(String)
/**
* Method setDeveloperConnection
*
* @param developerConnection
*/
public void setDeveloperConnection( String developerConnection )
{
this.developerConnection = developerConnection;
} //-- void setDeveloperConnection(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,98 @@
/*
* $Id$
*/
package org.apache.maven.model.v4_0_0;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class Site.
*
* @version $Revision$ $Date$
*/
public class Site
implements java.io.Serializable
{
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/**
* Field id
*/
private String id;
/**
* Field name
*/
private String name;
/**
* Field url
*/
private String url;
//-----------/
//- Methods -/
//-----------/
/**
* Method getId
*/
public String getId()
{
return this.id;
} //-- String getId()
/**
* Method getName
*/
public String getName()
{
return this.name;
} //-- String getName()
/**
* Method getUrl
*/
public String getUrl()
{
return this.url;
} //-- String getUrl()
/**
* Method setId
*
* @param id
*/
public void setId( String id )
{
this.id = id;
} //-- void setId(String)
/**
* Method setName
*
* @param name
*/
public void setName( String name )
{
this.name = name;
} //-- void setName(String)
/**
* Method setUrl
*
* @param url
*/
public void setUrl( String url )
{
this.url = url;
} //-- void setUrl(String)
}

View File

@ -0,0 +1,78 @@
package org.apache.maven.tools.repoclean;
/* ====================================================================
* Copyright 2001-2004 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.classworlds.ClassWorld;
import org.codehaus.plexus.embed.Embedder;
/**
* @author jdcasey
*/
public class Main
{
public static void main( String[] inputArgs )
{
Embedder embedder = new Embedder();
try
{
embedder.start( new ClassWorld() );
String[] args = inputArgs;
if ( args.length < 2 )
{
printUsage();
System.exit( 0 );
}
boolean reportOnly = false;
if ( args.length > 2 )
{
reportOnly = Boolean.valueOf( args[2] ).booleanValue();
}
RepositoryCleaner cleaner = null;
try
{
cleaner = (RepositoryCleaner) embedder.lookup( RepositoryCleaner.ROLE );
cleaner.cleanRepository( args[0], args[1], reportOnly );
}
finally
{
if ( cleaner != null )
{
embedder.release( cleaner );
}
}
}
catch ( Exception e )
{
e.printStackTrace();
}
}
private static void printUsage()
{
System.out.println( "No repository directory specified.\n\n" + "Usage:\n"
+ "--------------------------------------------------\n\n"
+ "repoclean <repository-path> <reports-path> [<report-only (use true|false)>]\n" );
}
}

View File

@ -0,0 +1,249 @@
package org.apache.maven.tools.repoclean;
/* ====================================================================
* Copyright 2001-2004 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.tools.repoclean.correlate.ArtifactMd5Correlator;
import org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator;
import org.apache.maven.tools.repoclean.patch.V4ModelPatcher;
import org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator;
import org.apache.maven.tools.repoclean.report.Reporter;
import org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.IOUtil;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
/**
* @author jdcasey
*/
public class RepositoryCleaner
extends AbstractLogEnabled
{
public static final String ROLE = RepositoryCleaner.class.getName();
private ArtifactPomCorrelator artifactPomCorrelator;
private ArtifactMd5Correlator artifactMd5Correlator;
private PomV3ToV4Translator pomV3ToV4Translator;
private V4ModelIndependenceValidator v4ModelIndependenceValidator;
private V4ModelPatcher v4ModelPatcher;
public void cleanRepository( String repositoryPath, String reportsDir, boolean reportOnly )
{
Logger logger = getLogger();
File reportsBase = new File( reportsDir );
if ( !reportsBase.exists() )
{
logger.info( "Creating reports directory: \'" + reportsDir + "\'" );
reportsBase.mkdirs();
}
else if ( !reportsBase.isDirectory() )
{
logger.error( "Cannot write reports to \'" + reportsDir + "\' because it is not a directory." );
reportsBase = null;
}
File repositoryBase = new File( repositoryPath );
if ( !repositoryBase.exists() )
{
logger.error( "Cannot clean repository \'" + repositoryPath + "\' because it does not exist." );
repositoryBase = null;
}
else if ( !repositoryBase.isDirectory() )
{
logger.error( "Cannot clean repository \'" + repositoryPath + "\' because it is not a directory." );
repositoryBase = null;
}
// do not proceed if we cannot produce reports, or if the repository is
// invalid.
if ( reportsBase != null && repositoryBase != null )
{
logger.info( "Scanning for POMs." );
String[] poms = scanPoms( repositoryPath );
logger.info( "Scanning for artifacts." );
String[] artifacts = scanArtifacts( repositoryPath );
Reporter repoReporter = new Reporter( reportsBase, "repository.report.txt" );
logger.info( "Correlating artifacts to POMs." );
artifactPomCorrelator.correlateArtifactsToPoms( poms, artifacts, repoReporter );
logger.info( "Correlating artifacts to MD5 digest files." );
artifactMd5Correlator.correlateArtifactsToMd5( repositoryBase, artifacts, repoReporter, reportOnly );
logger.info( "Translating POMs to V4 format." );
for ( int i = 0; i < poms.length; i++ )
{
String pom = poms[i];
Reporter pomReporter = new Reporter( reportsBase, pom + ".report.txt" );
logger.info( "Reading POM: \'" + pom + "\'" );
org.apache.maven.model.v3_0_0.Model v3Model = null;
try
{
v3Model = readV3( repositoryBase, pom );
}
catch ( Exception e )
{
logger.error( "Error reading POM: \'" + pom + "\'", e );
}
if ( v3Model != null )
{
logger.info( "Translating POM: \'" + pom + "\'" );
org.apache.maven.model.v4_0_0.Model v4Model = pomV3ToV4Translator.translate( v3Model, pomReporter );
logger.info( "Performing validation on resulting v4 model for POM: \'" + pom + "\'" );
boolean isValid = v4ModelIndependenceValidator.validate( v4Model, pomReporter, true );
if ( !isValid )
{
logger.info( "Patching v4 model for POM: \'" + pom + "\' using information glean from path." );
v4ModelPatcher.patchModel( v4Model, pom, pomReporter );
logger.info( "Re-performing validation on patched v4 model for POM: \'" + pom + "\'" );
isValid = v4ModelIndependenceValidator.validate( v4Model, pomReporter, false );
}
if ( pomReporter.hasError() )
{
repoReporter.warn( "Translation of POM: \'" + pom + "\' encountered errors." );
}
if ( !reportOnly )
{
logger.info( "Writing POM: \'" + pom + "\'" );
try
{
writeV4( repositoryBase, pom, v4Model );
}
catch ( Exception e )
{
logger.error( "Error writing POM: \'" + pom + "\'", e );
}
}
else
{
logger.info( "NOT writing POM: \'" + pom + "\'; we are in report-only mode." );
}
}
else
{
pomReporter.error( "Cannot translate pom. V3 model is null." );
}
try
{
pomReporter.writeReport();
}
catch ( IOException e )
{
logger.error( "Error writing report for POM: \'" + pom + "\'", e );
}
}
try
{
repoReporter.writeReport();
}
catch ( IOException e )
{
logger.error( "Error writing report for repository", e );
}
}
}
private void writeV4( File repositoryBase, String pom, org.apache.maven.model.v4_0_0.Model model ) throws Exception
{
FileWriter writer = null;
try
{
File pomFile = new File( repositoryBase, pom );
writer = new FileWriter( pomFile );
org.apache.maven.model.v4_0_0.io.xpp3.MavenXpp3Writer modelWriter = new org.apache.maven.model.v4_0_0.io.xpp3.MavenXpp3Writer();
modelWriter.write( writer, model );
}
finally
{
IOUtil.close( writer );
}
}
private org.apache.maven.model.v3_0_0.Model readV3( File repositoryBase, String pom ) throws Exception
{
org.apache.maven.model.v3_0_0.Model model = null;
FileReader reader = null;
try
{
File pomFile = new File( repositoryBase, pom );
reader = new FileReader( pomFile );
org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader modelReader = new org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader();
model = modelReader.read( reader );
}
finally
{
IOUtil.close( reader );
}
return model;
}
private String[] scanPoms( String repositoryPath )
{
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( repositoryPath );
scanner.setIncludes( new String[] { "**/poms/*.pom" } );
scanner.scan();
return scanner.getIncludedFiles();
}
private String[] scanArtifacts( String repositoryPath )
{
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( repositoryPath );
scanner.setExcludes( new String[] { "**/poms/*.pom", "**/*.md5" } );
scanner.scan();
return scanner.getIncludedFiles();
}
}

View File

@ -0,0 +1,89 @@
package org.apache.maven.tools.repoclean.correlate;
/* ====================================================================
* Copyright 2001-2004 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.tools.repoclean.digest.ArtifactDigestException;
import org.apache.maven.tools.repoclean.digest.ArtifactDigestor;
import org.apache.maven.tools.repoclean.report.Reporter;
import org.codehaus.plexus.util.DirectoryScanner;
import java.io.File;
import java.util.Arrays;
import java.util.List;
/**
* @author jdcasey
*/
public class ArtifactMd5Correlator
{
public static final String ROLE = ArtifactMd5Correlator.class.getName();
private ArtifactDigestor artifactDigestor;
public void correlateArtifactsToMd5( File repositoryBase, String[] artifacts, Reporter reporter, boolean reportOnly )
{
reporter.info( "Starting artifact-to-MD5 correlation." );
List md5s = scanMd5s( repositoryBase );
for ( int i = 0; i < artifacts.length; i++ )
{
String artifact = artifacts[i];
String md5 = artifact + ".md5";
if ( !md5s.contains( md5 ) )
{
reporter.warn( "Cannot find digest file for artifact: \'" + artifact + "\'." );
if ( !reportOnly )
{
reporter.info( "Creating digest file: \'" + md5 + "\'" );
File artifactFile = new File( repositoryBase, artifact );
File md5File = new File( repositoryBase, md5 );
try
{
artifactDigestor.createArtifactDigest( artifactFile, md5File, ArtifactDigestor.MD5 );
}
catch ( ArtifactDigestException e )
{
reporter.error( "Error creating digest for artifact: \'" + artifact + "\'", e );
}
}
}
}
reporter.info( "Finished artifact-to-MD5 correlation." );
}
private List scanMd5s( File repositoryBase )
{
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( repositoryBase );
scanner.setIncludes( new String[] { "**/*.md5" } );
scanner.scan();
String[] md5s = scanner.getIncludedFiles();
return Arrays.asList( md5s );
}
}

View File

@ -0,0 +1,85 @@
package org.apache.maven.tools.repoclean.correlate;
/* ====================================================================
* Copyright 2001-2004 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.tools.repoclean.report.Reporter;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author jdcasey
*/
public class ArtifactPomCorrelator
{
public static final String ROLE = ArtifactPomCorrelator.class.getName();
public void correlateArtifactsToPoms( String[] poms, String[] artifacts, Reporter reporter )
{
reporter.info( "Starting artifact-to-POM correlation." );
Map pomMap = new TreeMap();
for ( int i = 0; i < poms.length; i++ )
{
String key = keyOf( poms[i] );
if ( key == null )
{
reporter.error( "Found POM with invalid name: \'" + poms[i] + "\'" );
}
else
{
pomMap.put( key, poms[i] );
}
}
for ( int i = 0; i < artifacts.length; i++ )
{
String key = keyOf( artifacts[i] );
if ( key == null )
{
reporter.error( "Found artifact with invalid name: \'" + artifacts[i] + "\'" );
}
else if ( !pomMap.containsKey( key ) )
{
reporter.error( "Cannot find POM for artifact: \'" + artifacts[i] + "\'" );
}
}
reporter.info( "Finished artifact-to-POM correlation." );
}
private String keyOf( String artifact )
{
Pattern keyPattern = Pattern.compile( "(.+)\\.(jar|pom)" );
Matcher matcher = keyPattern.matcher( artifact );
String key = null;
if ( matcher.matches() )
{
key = matcher.group( 1 );
}
return key;
}
}

View File

@ -0,0 +1,37 @@
package org.apache.maven.tools.repoclean.digest;
/* ====================================================================
* Copyright 2001-2004 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 ArtifactDigestException
extends Exception
{
public ArtifactDigestException( String message )
{
super( message );
}
public ArtifactDigestException( String message, Throwable cause )
{
super( message, cause );
}
}

View File

@ -0,0 +1,100 @@
/* Created on Sep 20, 2004 */
package org.apache.maven.tools.repoclean.digest;
import org.codehaus.plexus.util.IOUtil;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* @author jdcasey
*/
public class ArtifactDigestor
{
public static final String ROLE = ArtifactDigestor.class.getName();
public static final String MD5 = "MD5";
public static final String SHA = "SHA";
public void createArtifactDigest( File artifactFile, File digestFile, String algorithm )
throws ArtifactDigestException
{
byte[] data = null;
try
{
data = readArtifactFile( artifactFile );
}
catch ( IOException e )
{
throw new ArtifactDigestException( "Error reading artifact data from: \'" + artifactFile + "\'", e );
}
MessageDigest digest = null;
try
{
digest = MessageDigest.getInstance( algorithm );
}
catch ( NoSuchAlgorithmException e )
{
throw new ArtifactDigestException( "Cannot load digest algoritm provider.", e );
}
digest.update( data );
byte[] digestData = digest.digest();
try
{
writeDigestFile( digestFile, digestData );
}
catch ( IOException e )
{
throw new ArtifactDigestException( "Cannot write digest to file: \'" + digestFile + "\'", e );
}
}
private void writeDigestFile( File digestFile, byte[] digestData ) throws IOException
{
FileOutputStream out = null;
try
{
out = new FileOutputStream( digestFile );
out.write( digestData );
out.flush();
}
finally
{
IOUtil.close( out );
}
}
private byte[] readArtifactFile( File artifactFile ) throws IOException
{
BufferedInputStream in = null;
try
{
in = new BufferedInputStream( new FileInputStream( artifactFile ) );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[16];
int read = -1;
while ( ( read = in.read( buffer ) ) > -1 )
{
baos.write( buffer, 0, read );
}
return baos.toByteArray();
}
finally
{
IOUtil.close( in );
}
}
}

View File

@ -0,0 +1,72 @@
package org.apache.maven.tools.repoclean.patch;
import org.apache.maven.model.v4_0_0.Model;
import org.apache.maven.tools.repoclean.report.Reporter;
import org.codehaus.plexus.util.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* ====================================================================
* Copyright 2001-2004 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 V4ModelPatcher
{
public static final String ROLE = V4ModelPatcher.class.getName();
public void patchModel( Model model, String pomPath, Reporter reporter )
{
// TODO: Need to add more test scenarios to the unit test for this pattern.
// I'm not convinced that this will catch everything.
Pattern pathInfoPattern = Pattern.compile( "(.+)\\/poms\\/([-a-zA-Z0-9]+)-([0-9]+[-.0-9a-zA-Z]+).pom" );
Matcher matcher = pathInfoPattern.matcher( pomPath );
if ( !matcher.matches() )
{
reporter.info( "POM path: \'" + pomPath
+ "\' does not match naming convention. Cannot reliably patch model information from POM path." );
}
String parsedGroup = matcher.group( 1 );
String parsedArtifact = matcher.group( 2 );
String parsedVersion = matcher.group( 3 );
if ( StringUtils.isEmpty( model.getGroupId() ) )
{
reporter.info( "Patching missing Group Id with parsed data: \'" + parsedGroup + "\'" );
model.setGroupId( parsedGroup );
}
if ( StringUtils.isEmpty( model.getArtifactId() ) )
{
reporter.info( "Patching missing Artifact Id with parsed data: \'" + parsedArtifact + "\'" );
model.setArtifactId( parsedArtifact );
}
if ( StringUtils.isEmpty( model.getVersion() ) )
{
reporter.info( "Patching missing Version with parsed data: \'" + parsedVersion + "\'" );
model.setVersion( parsedVersion );
}
}
}

View File

@ -0,0 +1,50 @@
package org.apache.maven.tools.repoclean.pom;
/* ====================================================================
* Copyright 2001-2004 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;
}
}

View File

@ -0,0 +1,688 @@
package org.apache.maven.tools.repoclean.pom;
import org.apache.maven.model.v4_0_0.Build;
import org.apache.maven.model.v4_0_0.CiManagement;
import org.apache.maven.model.v4_0_0.Contributor;
import org.apache.maven.model.v4_0_0.Dependency;
import org.apache.maven.model.v4_0_0.Developer;
import org.apache.maven.model.v4_0_0.DistributionManagement;
import org.apache.maven.model.v4_0_0.Goal;
import org.apache.maven.model.v4_0_0.IssueManagement;
import org.apache.maven.model.v4_0_0.License;
import org.apache.maven.model.v4_0_0.MailingList;
import org.apache.maven.model.v4_0_0.Model;
import org.apache.maven.model.v4_0_0.Notifier;
import org.apache.maven.model.v4_0_0.Organization;
import org.apache.maven.model.v4_0_0.Plugin;
import org.apache.maven.model.v4_0_0.Reports;
import org.apache.maven.model.v4_0_0.Repository;
import org.apache.maven.model.v4_0_0.Resource;
import org.apache.maven.model.v4_0_0.Scm;
import org.apache.maven.model.v4_0_0.Site;
import org.apache.maven.tools.repoclean.report.Reporter;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* ====================================================================
* Copyright 2001-2004 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 PomV3ToV4Translator
extends AbstractLogEnabled
{
public static final String ROLE = PomV3ToV4Translator.class.getName();
public Model translate( org.apache.maven.model.v3_0_0.Model v3Model, Reporter reporter )
{
String groupId = v3Model.getGroupId();
String artifactId = v3Model.getArtifactId();
String id = v3Model.getId();
if ( StringUtils.isNotEmpty( id ) )
{
if ( StringUtils.isEmpty( groupId ) )
{
groupId = id;
}
if ( StringUtils.isEmpty( artifactId ) )
{
artifactId = id;
}
}
String version = v3Model.getCurrentVersion();
if ( version == null )
{
version = v3Model.getVersion();
}
PomKey pomKey = new PomKey( groupId, artifactId, version );
StringBuffer logHeader = new StringBuffer();
logHeader.append( "Translation of POM {" ).append( v3Model.getGroupId() ).append( ":" )
.append( v3Model.getArtifactId() ).append( ":" ).append( version ).append( "}\n" );
reporter.info( "[START] " + logHeader.toString() );
warnOfUnsupportedMainModelElements( v3Model, reporter );
Model model = null;
try
{
model = new Model();
model.setArtifactId( v3Model.getArtifactId() );
model.setBuild( translateBuild( v3Model.getBuild(), reporter ) );
model.setCiManagement( translateCiManagementInfo( v3Model.getBuild() ) );
model.setContributors( translateContributors( v3Model.getContributors() ) );
model.setDependencies( translateDependencies( v3Model.getDependencies() ) );
model.setDescription( v3Model.getDescription() );
model.setDevelopers( translateDevelopers( v3Model.getDevelopers() ) );
model.setDistributionManagement( translateDistributionManagement( pomKey, v3Model ) );
model.setGroupId( v3Model.getGroupId() );
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(), reporter ) );
model.setPackaging( "jar" );
model.setReports( translateReports( v3Model.getReports(), reporter ) );
model.setScm( translateScm( v3Model ) );
model.setUrl( v3Model.getUrl() );
model.setVersion( version );
reporter.info( "[END] " + logHeader.toString() );
}
catch ( PomTranslationException e )
{
reporter.error( "Invalid POM detected. Cannot translate.", e );
}
return model;
}
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.setAddress( nagEmailAddress );
notifier.setType( "email" );
ciMgmt = new CiManagement();
ciMgmt.addNotifier( notifier );
}
}
return ciMgmt;
}
private void warnOfUnsupportedMainModelElements( org.apache.maven.model.v3_0_0.Model v3Model, Reporter reporter )
{
if ( StringUtils.isNotEmpty( v3Model.getExtend() ) )
{
reporter.warn( "Ignoring non-portable parent declaration: " + v3Model.getExtend() );
}
if ( StringUtils.isNotEmpty( v3Model.getGumpRepositoryId() ) )
{
reporter.warn( "Ignoring gump repository id: \'" + v3Model.getGumpRepositoryId()
+ "\'. This is not supported in v4 POMs." );
}
if ( notEmpty( v3Model.getVersions() ) )
{
reporter.warn( "Ignoring <versions/> section. This is not supported in v4 POMs." );
}
if ( notEmpty( v3Model.getBranches() ) )
{
reporter.warn( "Ignoring <branches/> section. This is not supported in v4 POMs." );
}
Properties v3ModelProperties = v3Model.getProperties();
if ( v3ModelProperties != null && !v3ModelProperties.isEmpty() )
{
reporter.warn( "Ignoring <properties/> section. It is not supported in v4 POMs." );
}
if ( StringUtils.isNotEmpty( v3Model.getPackage() ) )
{
reporter.warn( "Ignoring <package/>. It is not supported in v4 POMs." );
}
if ( notEmpty( v3Model.getPackageGroups() ) )
{
reporter.warn( "Ignoring <packageGroups/> section. It is not supported in v4 POMs." );
}
if ( StringUtils.isNotEmpty( v3Model.getLogo() ) )
{
reporter.warn( "Ignoring <logo/> for project. It is not supported in v4 POMs." );
}
if ( StringUtils.isNotEmpty( v3Model.getShortDescription() ) )
{
reporter.warn( "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 Reports translateReports( List v3Reports, Reporter reporter )
{
Reports reports = null;
if ( v3Reports != null && !v3Reports.isEmpty() )
{
reports = new Reports();
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 = null;
if ( !matcher.matches() )
{
reporter.warn( "Non-standard report name: \'" + reportName
+ "\'. Using entire name for plugin artifactId." );
reportPluginName = reportName;
}
else
{
reportPluginName = matcher.group( 1 );
}
Plugin reportPlugin = new Plugin();
reportPlugin.setGroupId( "maven" );
reportPlugin.setArtifactId( reportPluginName );
reportPlugin.setVersion( "1.0-SNAPSHOT" );
StringBuffer info = new StringBuffer();
info.append( "Using some contrived information for report: \'" ).append( reportName ).append( "\'.\n" )
.append( "\to groupId: \'maven\'\n" ).append( "\to artifactId: \'" ).append( reportPluginName )
.append( "\'\n" ).append( "\to version: \'1.0-SNAPSHOT\'\n" ).append( "\to goal: \'report\'\n" )
.append( "\n" )
.append( "These values were extracted using the v3 report naming convention, but may be wrong." );
reporter.info( info.toString() );
Goal reportGoal = new Goal();
reportGoal.setId( "report" );
reportPlugin.addGoal( reportGoal );
reports.addPlugin( reportPlugin );
}
}
return reports;
}
private org.apache.maven.model.v4_0_0.Organization translateOrganization(
org.apache.maven.model.v3_0_0.Organization v3Organization,
Reporter reporter )
{
Organization organization = null;
if ( v3Organization != null )
{
organization = new Organization();
organization.setName( v3Organization.getName() );
organization.setUrl( v3Organization.getUrl() );
if ( StringUtils.isNotEmpty( v3Organization.getLogo() ) )
{
reporter.warn( "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();
Repository repository = null;
if ( StringUtils.isEmpty( distributionSite ) )
{
if ( !StringUtils.isEmpty( distributionDirectory ) )
{
repository = new Repository();
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 Repository();
repository.setId( "default" );
repository.setName( "Default Repository" );
repository.setUrl( distributionSite + "/" + distributionDirectory );
}
distributionManagement.setRepository( repository );
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 ) )
{
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();
Dependency dep = new Dependency();
dep.setArtifactId( v3Dep.getArtifactId() );
dep.setGroupId( v3Dep.getGroupId() );
dep.setVersion( v3Dep.getVersion() );
dep.setType( v3Dep.getType() );
deps.add( dep );
}
}
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, Reporter reporter )
{
Build build = null;
if ( v3Build != null )
{
build = new Build();
warnOfUnsupportedBuildElements( v3Build, reporter );
build.setSourceDirectory( v3Build.getSourceDirectory() );
build.setTestSourceDirectory( v3Build.getUnitTestSourceDirectory() );
build.setResources( translateResources( v3Build.getResources() ) );
org.apache.maven.model.v3_0_0.UnitTest unitTest = v3Build.getUnitTest();
if ( unitTest != null )
{
build.setTestResources( translateResources( unitTest.getResources() ) );
List testIncludes = unitTest.getIncludes();
List testExcludes = new ArrayList( unitTest.getExcludes() );
testExcludes.addAll( unitTest.getDefaultExcludes() );
if ( notEmpty( testIncludes ) || notEmpty( testExcludes ) )
{
Plugin plugin = new Plugin();
plugin.setGroupId( "maven" );
plugin.setArtifactId( "surefire" );
plugin.setVersion( "1.0-SNAPSHOT" );
Properties config = new Properties();
String includes = pathPatternsToString( testIncludes );
if ( StringUtils.isNotEmpty( includes ) )
{
config.setProperty( "includes", includes );
}
String excludes = pathPatternsToString( testExcludes );
if ( StringUtils.isNotEmpty( excludes ) )
{
config.setProperty( "excludes", excludes );
}
if ( !config.isEmpty() )
{
plugin.setConfiguration( config );
}
build.addPlugin( plugin );
}
}
}
return build;
}
private void warnOfUnsupportedBuildElements( org.apache.maven.model.v3_0_0.Build v3Build, Reporter reporter )
{
if ( notEmpty( v3Build.getSourceModifications() ) )
{
reporter.warn( "Ignoring <sourceModifications/> section. It is not supported in v4 POMs." );
}
if ( StringUtils.isNotEmpty( v3Build.getAspectSourceDirectory() ) )
{
reporter.warn( "Ignoring <aspectSourceDirectory/>. It is not supported in v4 POMs." );
}
if ( StringUtils.isNotEmpty( v3Build.getIntegrationUnitTestSourceDirectory() ) )
{
reporter.warn( "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();
resource.setDirectory( v3Resource.getDirectory() );
resource.setExcludes( pathPatternsToString( v3Resource.getExcludes() ) );
resource.setIncludes( pathPatternsToString( 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();
}
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;
}
}
}

View File

@ -0,0 +1,179 @@
package org.apache.maven.tools.repoclean.report;
import org.codehaus.plexus.util.IOUtil;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* ====================================================================
* Copyright 2001-2004 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 Reporter
{
private static final String WARN_LEVEL = "[WARNING] ";
private static final String INFO_LEVEL = "[INFO] ";
private static final String ERROR_LEVEL = "[ERROR] ";
private File reportsFile;
private List messages = new ArrayList();
private boolean hasError = false;
private boolean hasWarning = false;
public Reporter( File reportsBase, String reportPath )
{
this.reportsFile = new File( reportsBase, reportPath );
File parentDir = reportsFile.getParentFile();
if ( !parentDir.exists() )
{
parentDir.mkdirs();
}
if ( !parentDir.isDirectory() )
{
throw new IllegalArgumentException( "path: \'" + parentDir.getAbsolutePath()
+ "\' refers to a file, not a directory.\n" + "Cannot write report file: \'"
+ reportsFile.getAbsolutePath() + "\'." );
}
}
public void writeReport() throws IOException
{
BufferedWriter writer = null;
try
{
writer = new BufferedWriter( new FileWriter( reportsFile ) );
for ( Iterator it = messages.iterator(); it.hasNext(); )
{
Object message = it.next();
if ( message instanceof List )
{
writer.write( format( (List) message ).toString() );
}
else
{
writer.write( String.valueOf( message ) );
}
writer.newLine();
}
}
finally
{
IOUtil.close( writer );
}
}
public boolean hasWarning()
{
return hasWarning;
}
public boolean hasError()
{
return hasError;
}
public void warn( String message )
{
hasWarning = true;
messages.add( new AppendingList( 2 ).append( WARN_LEVEL ).append( message ) );
}
public void info( String message )
{
messages.add( new AppendingList( 2 ).append( INFO_LEVEL ).append( message ) );
}
public void error( String message, Throwable error )
{
hasError = true;
messages.add( new AppendingList( 3 ).append( ERROR_LEVEL ).append( message ).append( error ) );
}
public void error( String message )
{
hasError = true;
messages.add( new AppendingList( 2 ).append( ERROR_LEVEL ).append( message ) );
}
private CharSequence format( List messageParts )
{
StringBuffer buffer = new StringBuffer();
for ( Iterator it = messageParts.iterator(); it.hasNext(); )
{
Object part = it.next();
if ( part instanceof Throwable )
{
part = formatThrowable( (Throwable) part );
}
buffer.append( part );
}
return buffer;
}
private String formatThrowable( Throwable throwable )
{
StringWriter sWriter = new StringWriter();
PrintWriter pWriter = new PrintWriter( sWriter );
throwable.printStackTrace( pWriter );
return sWriter.toString();
}
private static class AppendingList
extends ArrayList
{
public AppendingList()
{
}
public AppendingList( int size )
{
super( size );
}
public AppendingList append( Object item )
{
super.add( item );
return this;
}
}
}

View File

@ -0,0 +1,75 @@
package org.apache.maven.tools.repoclean.validate;
import org.apache.maven.model.v4_0_0.Model;
import org.apache.maven.tools.repoclean.report.Reporter;
import org.codehaus.plexus.util.StringUtils;
/* ====================================================================
* Copyright 2001-2004 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 V4ModelIndependenceValidator
{
public static final String ROLE = V4ModelIndependenceValidator.class.getName();
public boolean validate( Model model, Reporter reporter, boolean warnOnly )
{
boolean isValid = true;
if ( StringUtils.isEmpty( model.getModelVersion() ) )
{
problem( "Model-version declaration is missing in resulting v4 model.", reporter, warnOnly );
isValid = false;
}
if ( StringUtils.isEmpty( model.getGroupId() ) )
{
problem( "Group ID is missing in resulting v4 model.", reporter, warnOnly );
isValid = false;
}
if ( StringUtils.isEmpty( model.getArtifactId() ) )
{
problem( "Artifact ID is missing in resulting v4 model.", reporter, warnOnly );
isValid = false;
}
if ( StringUtils.isEmpty( model.getVersion() ) )
{
problem( "Version is missing in resulting v4 model.", reporter, warnOnly );
isValid = false;
}
return isValid;
}
private void problem( String message, Reporter reporter, boolean warnOnly )
{
if ( warnOnly )
{
reporter.warn( message );
}
else
{
reporter.error( message );
}
}
}

View File

@ -0,0 +1,89 @@
<component-set>
<components>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.RepositoryCleaner</role>
<implementation>org.apache.maven.tools.repoclean.RepositoryCleaner</implementation>
<requirements>
<requirement>
<role>org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator</role>
</requirement>
<requirement>
<role>org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator</role>
</requirement>
<requirement>
<role>org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator</role>
</requirement>
<requirement>
<role>org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator</role>
</requirement>
<requirement>
<role>org.apache.maven.tools.repoclean.patch.V4ModelPatcher</role>
</requirement>
</requirements>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator</role>
<implementation>org.apache.maven.tools.repoclean.pom.PomV3ToV4Translator</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator</role>
<implementation>org.apache.maven.tools.repoclean.correlate.ArtifactMd5Correlator</implementation>
<requirements>
<requirement>
<role>org.apache.maven.tools.repoclean.digest.ArtifactDigestor</role>
</requirement>
</requirements>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator</role>
<implementation>org.apache.maven.tools.repoclean.correlate.ArtifactPomCorrelator</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator</role>
<implementation>org.apache.maven.tools.repoclean.validate.V4ModelIndependenceValidator</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.patch.V4ModelPatcher</role>
<implementation>org.apache.maven.tools.repoclean.patch.V4ModelPatcher</implementation>
</component>
<!--
|
|
|
-->
<component>
<role>org.apache.maven.tools.repoclean.digest.ArtifactDigestor</role>
<implementation>org.apache.maven.tools.repoclean.digest.ArtifactDigestor</implementation>
</component>
</components>
</component-set>

View File

@ -0,0 +1,64 @@
package org.apache.maven.tools.repoclean.patch;
import org.apache.maven.model.v4_0_0.Model;
import org.apache.maven.tools.repoclean.report.Reporter;
import java.io.File;
import junit.framework.TestCase;
/* ====================================================================
* Copyright 2001-2004 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 V4ModelPatcherTest
extends TestCase
{
public void testShouldPatchWithInfoFromXPP3PomPath()
{
String pomPath = "xpp3/poms/xpp3-1.1.3.3.pom";
Model model = new Model();
V4ModelPatcher patcher = new V4ModelPatcher();
Reporter reporter = new Reporter( new File( "." ), "testXpp3Patching.txt" );
patcher.patchModel( model, pomPath, reporter );
assertEquals( "xpp3", model.getGroupId() );
assertEquals( "xpp3", model.getArtifactId() );
assertEquals( "1.1.3.3", model.getVersion() );
}
public void testShouldPatchWithInfoFromPlexusContainerDefaultPomPath()
{
String pomPath = "plexus/poms/plexus-container-default-1.0-alpha-2-SNAPSHOT.pom";
Model model = new Model();
V4ModelPatcher patcher = new V4ModelPatcher();
Reporter reporter = new Reporter( new File( "." ), "testPlexusPatching.txt" );
patcher.patchModel( model, pomPath, reporter );
assertEquals( "plexus", model.getGroupId() );
assertEquals( "plexus-container-default", model.getArtifactId() );
assertEquals( "1.0-alpha-2-SNAPSHOT", model.getVersion() );
}
}