PR: MPSCM-56

Submitted by: Dan Tran
Add Starteam support, plus scm:add, scm:status, scm:checkin


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@189906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett 2005-06-10 06:20:28 +00:00
parent 5bb03594d4
commit dd134e7011
9 changed files with 281 additions and 9 deletions

View File

@ -38,7 +38,7 @@
<define:jellybean
name="update"
method="update"
className="org.apache.maven.plugins.scm.ScmBean"
className="org.apache.maven.plugins.scm.ScmUpdateBean"
/>
<define:jellybean
name="tag"
@ -60,6 +60,12 @@
method="diff"
className="org.apache.maven.plugins.scm.ScmDiffBean"
/>
<define:jellybean
name="add"
method="add"
className="org.apache.maven.plugins.scm.ScmAddBean"
/>
</define:taglib>
<goal name="scm:find-connection">
@ -125,10 +131,21 @@
</goal>
<goal name="scm:update" prereqs="scm:find-connection" description="Update the project in the current directory from SCM">
<ant:echo>Updating from SCM</ant:echo>
<!-- Connection may not be used, but is needed for correct operation of Maven SCM at this point and for the tag in SVN if that were implemented -->
<scm:update url="${scmConnection}" workingDirectory="${basedir}" username="${maven.scm.username}" password="${maven.scm.password}" />
<j:if test="${scmConnection == null}">
<ant:fail>You must specify an SCM URL to connect to</ant:fail>
</j:if>
<scm:update
url="${scmConnection}"
workingDirectory="${basedir}"
includes="${maven.scm.src.includes}"
excludes="${maven.scm.src.excludes}"
username="${maven.scm.username}"
password="${maven.scm.password}" />
</goal>
<goal name="scm:tag" prereqs="scm:find-connection" description="Tag the project in the current directory in SCM">
@ -145,6 +162,60 @@
<scm:tag url="${scmConnection}" workingDirectory="${basedir}" tag="${maven.scm.tag}" tagBase="${maven.scm.svn.tag.base}" username="${maven.scm.username}" password="${maven.scm.password}" />
</goal>
<goal name="scm:checkin" prereqs="scm:find-connection" description="Checkin a set of files in the current directory of SCM" >
<ant:echo>Checkin files to SCM</ant:echo>
<j:if test="${scmConnection == null}">
<ant:fail>You must specify an SCM URL to connect to</ant:fail>
</j:if>
<scm:checkin
url="${scmConnection}"
workingDirectory="${basedir}"
username="${maven.scm.username}"
password="${maven.scm.password}"
excludes="${maven.scm.src.excludes}"
includes="${maven.scm.src.includes}"
message="${maven.scm.message}"
tag="${maven.scm.tag}" />
</goal>
<goal name="scm:add" prereqs="scm:find-connection" description="Add a set of files in the current directory of SCM" >
<ant:echo>Add files to SCM</ant:echo>
<j:if test="${scmConnection == null}">
<ant:fail>You must specify an SCM URL to connect to</ant:fail>
</j:if>
<scm:add
url="${scmConnection}"
workingDirectory="${basedir}"
username="${maven.scm.username}"
password="${maven.scm.password}"
excludes="${maven.scm.src.excludes}"
includes="${maven.scm.src.includes}" />
</goal>
<goal name="scm:status" prereqs="scm:find-connection" description="Query for status in the current directory of SCM" >
<ant:echo>Query for status</ant:echo>
<j:if test="${scmConnection == null}">
<ant:fail>You must specify an SCM URL to connect to</ant:fail>
</j:if>
<scm:status
url="${scmConnection}"
workingDirectory="${basedir}"
username="${maven.scm.username}"
password="${maven.scm.password}" />
</goal>
<!-- TODO: change prereqs to scm:find-connection only -->
<goal name="scm:perform-release" prereqs="scm:parse-connection,scm:check-deprecated-cvs-vars"
description="Perform a release from SCM">

View File

@ -41,6 +41,13 @@ maven.scm.bootstrap.pom.dir=
# check whether CVS tagged first, and warn
maven.scm.check.tagged=true
# settings for scm:checkin, scm:add
maven.scm.src.includes=
maven.scm.src.excludes=
#specific to scm:checkin
maven.scm.message=
#===============
# CVS Properties
#===============

View File

@ -22,7 +22,7 @@
<extend>../plugin-parent/project.xml</extend>
<id>maven-scm-plugin</id>
<name>Maven Source Control Management Plug-in</name>
<currentVersion>1.5</currentVersion>
<currentVersion>1.5.1-SNAPSHOT</currentVersion>
<description>A plugin for SCM tasks, currently CVS.</description>
<shortDescription>SCM Plugin for Maven.</shortDescription>
<url>http://maven.apache.org/reference/plugins/scm/</url>
@ -124,17 +124,22 @@
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.0-alpha-1</version>
<version>1.0-alpha-2-20050610.043511-1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvs</artifactId>
<version>1.0-alpha-1</version>
<version>1.0-alpha-2-20050610.043511-1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-svn</artifactId>
<version>1.0-alpha-1</version>
<version>1.0-alpha-2-20050610.054835-1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-starteam</artifactId>
<version>1.0-alpha-2-20050610.051724-1</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,58 @@
package org.apache.maven.plugins.scm;
/* ====================================================================
* 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.scm.ScmFileSet;
import org.apache.maven.scm.command.add.AddScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import java.io.File;
/**
* A bean for using the Maven SCM API because wrangling objects in Jelly is no fun.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
public class ScmAddBean extends ScmPatternBean
{
private String message;
public void add()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
AddScmResult result = scmManager.add( repository, new ScmFileSet( new File( getWorkingDirectory() ), getIncludes(), getExcludes() ) );
checkResult( result );
}
public void setMessage( String message )
{
this.message = message;
}
public String getMessage()
{
return message;
}
}

View File

@ -20,6 +20,7 @@ package org.apache.maven.plugins.scm;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
import org.apache.maven.scm.command.update.UpdateScmResult;
@ -119,6 +120,23 @@ public class ScmBean
svnRepo.setTagBase( tagBase );
}
}
if ( repository.getProvider().equals( "starteam" ) )
{
StarteamScmProviderRepository starteamRepo = (StarteamScmProviderRepository) repository.getProviderRepository();
/* TODO: reinstate when the provider supports it
if ( username != null && username.length() > 0 )
{
starteamRepo.setUser( username );
}
if ( password != null && password.length() > 0 )
{
starteamRepo.setPassword( password );
}
*/
}
return repository;
}

View File

@ -0,0 +1,50 @@
package org.apache.maven.plugins.scm;
/* ====================================================================
* 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.scm.ScmFileSet;
import org.apache.maven.scm.command.update.UpdateScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import java.io.File;
/**
* A bean for using the Maven SCM API because wrangling objects in Jelly is no fun.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
public class ScmUpdateBean extends ScmPatternBean
{
private String message;
public void update()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
UpdateScmResult result = scmManager.update( repository,
new ScmFileSet( new File( getWorkingDirectory() ), getIncludes(), getExcludes() ),
getTag() );
checkResult( result );
}
}

View File

@ -32,10 +32,18 @@
<name>scm:checkout</name>
<description>Checkout a project</description>
</goal>
<goal>
<name>scm:checkin</name>
<description>Check in a list files</description>
</goal>
<goal>
<name>scm:update</name>
<description>Update a project from SCM</description>
</goal>
<goal>
<name>scm:add</name>
<description>Add new files into SCM</description>
</goal>
<goal>
<name>scm:tag</name>
<description>Tag a project in the SCM</description>

View File

@ -118,7 +118,7 @@
<td>Yes</td>
<td>
<p>
The username to pass to the SCM. Currently only Subversion is known to honour this.
The username to pass to the SCM. Currently only Subversion and Starteam are known to honour this.
You can also add it to the URL, eg. <code>http://user@svn.mycompany.com/repos</code>.
</p>
</td>
@ -128,12 +128,45 @@
<td>Yes</td>
<td>
<p>
The password to give to the SCM. Currently only Subversion is known to honour this.
The password to give to the SCM. Currently only Subversion and Starteam are known to honour this.
It is not recommended that you use this property, and instead use an alternative authentication
technique such as an ssh agent or Subversion's password caching mechanism.
</p>
</td>
</tr>
<tr>
<td>maven.scm.message</td>
<td>Yes</td>
<td>
<p>
Add/Checkin comment. Default is blank.
</p>
</td>
</tr>
<tr>
<td>maven.scm.src.includes</td>
<td>Yes</td>
<td>
<p>
Comma or space separated list of Ant path patterns for scm:checkin, scm:update, scm:add goals
Default is blank.
</p>
</td>
</tr>
<tr>
<td>maven.scm.src.excludes</td>
<td>Yes</td>
<td>
<p>
Comma or space separated list of Ant path patterns for scm:checkin, scm:update, scm:add goals
Default is blank.
</p>
</td>
</tr>
</table>
</subsection>
<subsection name="Subversion Specific Settings">

View File

@ -64,7 +64,29 @@ scm:svn:file:///svn/root/module
scm:svn:http://svn.apache.org/svn/root/module
scm:cvs:https://username@svn.apache.org/svn/root/module</source>
</subsection>
<subsection name="StarTeam">
<p>
The full connection string for StarTeam is as follows:
</p>
<source>scm:starteam:username:password@hostName:endpoint/projectName/viewName/folderHierarchy</source>
<p>
<code>maven.scm.username</code> and <code>maven.scm.password</code>
are the prefer way to store authentication information.
</p>
<p>
For example:
</p>
<source>
scm:starteam:username:password@hostname:23456/project/view/folder1/folder2
scm:starteam:username@hostname:23456/project/view/folder
scm:starteam:hostname:23456/project/view/folder
</source>
</subsection>
</section>
</body>
</document>