From dd134e7011902e34418a9f5337a7d565771c29fd Mon Sep 17 00:00:00 2001 From: brett Date: Fri, 10 Jun 2005 06:20:28 +0000 Subject: [PATCH] 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 --- scm/plugin.jelly | 77 ++++++++++++++++++- scm/plugin.properties | 7 ++ scm/project.xml | 13 +++- .../apache/maven/plugins/scm/ScmAddBean.java | 58 ++++++++++++++ .../org/apache/maven/plugins/scm/ScmBean.java | 18 +++++ .../maven/plugins/scm/ScmUpdateBean.java | 50 ++++++++++++ scm/xdocs/goals.xml | 8 ++ scm/xdocs/properties.xml | 37 ++++++++- scm/xdocs/scmurl.xml | 22 ++++++ 9 files changed, 281 insertions(+), 9 deletions(-) create mode 100644 scm/src/main/org/apache/maven/plugins/scm/ScmAddBean.java create mode 100644 scm/src/main/org/apache/maven/plugins/scm/ScmUpdateBean.java diff --git a/scm/plugin.jelly b/scm/plugin.jelly index e6a81d56..53007e02 100644 --- a/scm/plugin.jelly +++ b/scm/plugin.jelly @@ -38,7 +38,7 @@ + + @@ -125,10 +131,21 @@ + Updating from SCM - - + + You must specify an SCM URL to connect to + + + + @@ -145,6 +162,60 @@ + + + Checkin files to SCM + + + You must specify an SCM URL to connect to + + + + + + + + + Add files to SCM + + + You must specify an SCM URL to connect to + + + + + + + + + Query for status + + + You must specify an SCM URL to connect to + + + + + + diff --git a/scm/plugin.properties b/scm/plugin.properties index 8c6a2abe..f5b53426 100644 --- a/scm/plugin.properties +++ b/scm/plugin.properties @@ -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 #=============== diff --git a/scm/project.xml b/scm/project.xml index a43e0642..2cb6fe8e 100644 --- a/scm/project.xml +++ b/scm/project.xml @@ -22,7 +22,7 @@ ../plugin-parent/project.xml maven-scm-plugin Maven Source Control Management Plug-in - 1.5 + 1.5.1-SNAPSHOT A plugin for SCM tasks, currently CVS. SCM Plugin for Maven. http://maven.apache.org/reference/plugins/scm/ @@ -124,17 +124,22 @@ org.apache.maven.scm maven-scm-api - 1.0-alpha-1 + 1.0-alpha-2-20050610.043511-1 org.apache.maven.scm maven-scm-provider-cvs - 1.0-alpha-1 + 1.0-alpha-2-20050610.043511-1 org.apache.maven.scm maven-scm-provider-svn - 1.0-alpha-1 + 1.0-alpha-2-20050610.054835-1 + + + org.apache.maven.scm + maven-scm-provider-starteam + 1.0-alpha-2-20050610.051724-1 diff --git a/scm/src/main/org/apache/maven/plugins/scm/ScmAddBean.java b/scm/src/main/org/apache/maven/plugins/scm/ScmAddBean.java new file mode 100644 index 00000000..85f42385 --- /dev/null +++ b/scm/src/main/org/apache/maven/plugins/scm/ScmAddBean.java @@ -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 Brett Porter + */ +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; + } + +} + diff --git a/scm/src/main/org/apache/maven/plugins/scm/ScmBean.java b/scm/src/main/org/apache/maven/plugins/scm/ScmBean.java index 256725ba..51fda3d3 100644 --- a/scm/src/main/org/apache/maven/plugins/scm/ScmBean.java +++ b/scm/src/main/org/apache/maven/plugins/scm/ScmBean.java @@ -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; } diff --git a/scm/src/main/org/apache/maven/plugins/scm/ScmUpdateBean.java b/scm/src/main/org/apache/maven/plugins/scm/ScmUpdateBean.java new file mode 100644 index 00000000..e6bf1f1f --- /dev/null +++ b/scm/src/main/org/apache/maven/plugins/scm/ScmUpdateBean.java @@ -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 Brett Porter + */ +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 ); + } + +} + diff --git a/scm/xdocs/goals.xml b/scm/xdocs/goals.xml index fd235e11..89e6108a 100644 --- a/scm/xdocs/goals.xml +++ b/scm/xdocs/goals.xml @@ -32,10 +32,18 @@ scm:checkout Checkout a project + + scm:checkin + Check in a list files + scm:update Update a project from SCM + + scm:add + Add new files into SCM + scm:tag Tag a project in the SCM diff --git a/scm/xdocs/properties.xml b/scm/xdocs/properties.xml index 905db114..80232017 100644 --- a/scm/xdocs/properties.xml +++ b/scm/xdocs/properties.xml @@ -118,7 +118,7 @@ Yes

- 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. http://user@svn.mycompany.com/repos.

@@ -128,12 +128,45 @@ Yes

- 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.

+ + + maven.scm.message + Yes + +

+ Add/Checkin comment. Default is blank. +

+ + + + + maven.scm.src.includes + Yes + +

+ Comma or space separated list of Ant path patterns for scm:checkin, scm:update, scm:add goals + Default is blank. +

+ + + + maven.scm.src.excludes + Yes + +

+ Comma or space separated list of Ant path patterns for scm:checkin, scm:update, scm:add goals + Default is blank. +

+ + + + diff --git a/scm/xdocs/scmurl.xml b/scm/xdocs/scmurl.xml index a7da75ed..1a750126 100644 --- a/scm/xdocs/scmurl.xml +++ b/scm/xdocs/scmurl.xml @@ -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 + + +

+ The full connection string for StarTeam is as follows: +

+ scm:starteam:username:password@hostName:endpoint/projectName/viewName/folderHierarchy +

+ maven.scm.username and maven.scm.password + are the prefer way to store authentication information. +

+

+ For example: +

+ +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 + +
+ + +