PR: MPCHANGELOG-23
Auto select factory from connection git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@159318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -23,4 +23,3 @@
|
||||
maven.changelog.basedir=${basedir}
|
||||
|
||||
maven.changelog.range = 30
|
||||
maven.changelog.factory = org.apache.maven.cvslib.CvsChangeLogFactory
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
// commons imports
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -48,7 +50,7 @@ import org.apache.maven.project.Developer;
|
||||
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
|
||||
* @author <a href="mailto:bodewig@apache.org">Stefan Bodewig</a>
|
||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
|
||||
* @version $Id: ChangeLog.java,v 1.6 2004/07/08 08:36:51 evenisse Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ChangeLog
|
||||
{
|
||||
@@ -71,8 +73,9 @@ public class ChangeLog
|
||||
* The classname of our ChangeLogFactory, defaulting to Maven's built in
|
||||
* CVS factory.
|
||||
*/
|
||||
private String clFactoryClass =
|
||||
"org.apache.maven.cvslib.CvsChangeLogFactory";
|
||||
private String clFactoryClass = null;
|
||||
|
||||
private static final Map FACTORIES = new HashMap();
|
||||
|
||||
/** the connection string used to access the SCM */
|
||||
private String connection;
|
||||
@@ -94,6 +97,15 @@ public class ChangeLog
|
||||
/** output encoding for the xml document */
|
||||
private String outputEncoding;
|
||||
|
||||
static
|
||||
{
|
||||
FACTORIES.put( "cvs", "org.apache.maven.cvslib.CvsChangeLogFactory" );
|
||||
FACTORIES.put( "svn", "org.apache.maven.svnlib.SvnChangeLogFactory" );
|
||||
FACTORIES.put( "clearcase", "org.apache.maven.clearcaselib.ClearcaseChangeLogFactory" );
|
||||
FACTORIES.put( "perforce", "org.apache.maven.perforcelib.PerforceChangeLogFactory" );
|
||||
FACTORIES.put( "starteam", "org.apache.maven.starteamlib.StarteamChangeLogFactory" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ChangeLogFactory class name. If this isn't set, the factory
|
||||
* defaults to Maven's build in CVS factory.
|
||||
@@ -261,6 +273,24 @@ public class ChangeLog
|
||||
*/
|
||||
private ChangeLogFactory createFactory() throws IOException
|
||||
{
|
||||
if ( clFactoryClass == null )
|
||||
{
|
||||
if ( connection == null || connection.length() < 7 || !connection.startsWith( "scm:" ) )
|
||||
{
|
||||
LOG.warn( "Connection does not appear valid" );
|
||||
}
|
||||
else
|
||||
{
|
||||
clFactoryClass = (String) FACTORIES.get( connection.substring( 4, 7 ) );
|
||||
}
|
||||
|
||||
if ( clFactoryClass == null )
|
||||
{
|
||||
LOG.warn( "Could not derive factory from connection: using CVS (valid factories are: " + FACTORIES.keySet() + ")" );
|
||||
clFactoryClass = "org.apache.maven.cvslib.CvsChangeLogFactory";
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Class clazz = Class.forName(clFactoryClass);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.8-SNAPSHOT" date="in SVN">
|
||||
<action dev="brett" type="fix" issue="MPCHANGELOG-23">Guess factory from connection</action>
|
||||
<action dev="brett" type="fix">Allow local CVSROOT to only have 5 tokens (no host name)</action>
|
||||
</release>
|
||||
<release version="1.7.2" date="2005-01-08">
|
||||
|
||||
@@ -44,14 +44,6 @@
|
||||
document.
|
||||
</p>
|
||||
</section>
|
||||
<section name="Specifying the SCM">
|
||||
<p>
|
||||
The changelog plugin defaults to a CVS parser. To use an alternate
|
||||
SCM, please set the <code>maven.changelog.factory</code> property.
|
||||
For more information, please see the
|
||||
<a href="properties.html">Changelog properties reference</a>.
|
||||
</p>
|
||||
</section>
|
||||
<section name="CVSNT users">
|
||||
<p>
|
||||
This plugin does <strong>not</strong> use the cvs executable on your
|
||||
|
||||
Reference in New Issue
Block a user