merge 122828:178612 from scm-1.5-branch, closing branch

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@178616 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett 2005-05-26 07:24:47 +00:00
parent 306608bcbb
commit c87d09680e
19 changed files with 1339 additions and 498 deletions

24
scm/maven.xml Normal file
View File

@ -0,0 +1,24 @@
<project xmlns:ant="jelly:ant" xmlns:j="jelly:core">
<!--
TEMPORARY!!!
Remove before release - just simplifies the bundling of the beta version
-->
<postGoal name="java:jar-resources">
<j:set var="libdir" value="${maven.build.dest}/plugin-resources/lib" />
<ant:mkdir dir="${libdir}" />
<ant:copy tofile="${libdir}/maven-scm-api.jar" file="${pom.getDependencyPath('maven:maven-scm-api')}" />
<ant:copy tofile="${libdir}/maven-scm-provider-cvs.jar" file="${pom.getDependencyPath('maven:maven-scm-provider-cvs')}" />
<ant:copy tofile="${libdir}/maven-scm-provider-svn.jar" file="${pom.getDependencyPath('maven:maven-scm-provider-svn')}" />
<!-- Workaround JAR override bug with SNAPSHOT versions in 1.0.2 -->
<ant:replace file="${maven.build.dest}/project.xml" token="1.0-alpha-1-SNAPSHOT" value="1.0-alpha-1-dev" />
<j:file name="${maven.build.dest}/project.properties"><j:whitespace>
maven.jar.override=on
maven.jar.maven-scm-api=$${basedir}/plugin-resources/lib/maven-scm-api.jar
maven.jar.maven-scm-provider-cvs=$${basedir}/plugin-resources/lib/maven-scm-provider-cvs.jar
maven.jar.maven-scm-provider-svn=$${basedir}/plugin-resources/lib/maven-scm-provider-svn.jar
</j:whitespace></j:file>
</postGoal>
</project>

View File

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
@ -17,90 +18,245 @@
*/
-->
<project
xmlns:j="jelly:core"
xmlns:i="jelly:interaction"
xmlns:r="release:transform"
xmlns:c="changes:transform"
xmlns:log="jelly:log"
xmlns:define="jelly:define"
xmlns:ant="jelly:ant"
xmlns:doc="doc"
xmlns:scm="scm"
xmlns:util="jelly:util"
xmlns:maven="jelly:maven">
<j:set var="scmMethod" value="${maven.scm.method}"/>
<define:taglib uri="scm">
<define:jellybean
name="checkout"
method="checkout"
className="org.apache.maven.plugins.scm.ScmBean"
/>
<define:jellybean
name="update"
method="update"
className="org.apache.maven.plugins.scm.ScmBean"
/>
<define:jellybean
name="tag"
method="tag"
className="org.apache.maven.plugins.scm.ScmBean"
/>
<define:jellybean
name="status"
method="status"
className="org.apache.maven.plugins.scm.ScmStatusBean"
/>
<define:jellybean
name="checkin"
method="checkin"
className="org.apache.maven.plugins.scm.ScmCheckinBean"
/>
<define:jellybean
name="diff"
method="diff"
className="org.apache.maven.plugins.scm.ScmDiffBean"
/>
</define:taglib>
<!--==================================================================-->
<!-- Goal to validate SCM properties -->
<!--==================================================================-->
<goal name="scm:parse-connection">
<!-- ignore POM if the scm root is specified in command line -->
<j:if test="${!empty(context.getVariable('maven.scm.cvs.root')) ||
!empty(context.getVariable('maven.scm.svn.root'))}">
<j:set var="maven.scm.ignore.pom.connection" value="true"/>
</j:if>
<j:set var="checkValue" value="${maven.scm.ignore.pom.connection}"/>
<j:if test="${!checkValue}">
<goal name="scm:find-connection">
<j:set var="scmConnection" value="${maven.scm.url}" />
<j:if test="${scmConnection == null}">
<j:set var="checkValue" value="${maven.scm.ignore.pom.developerConnection}"/>
<j:if test="${!checkValue}">
<j:set var="value" value="${pom.repository.developerConnection}"/>
<j:if test="${!empty(value)}">
<echo>Using connection: ${pom.repository.developerConnection}</echo>
<j:set var="conn" value="${pom.repository.developerConnection}" />
</j:if>
</j:if>
<j:if test="${conn == null}">
<j:set var="value" value="${pom.repository.connection}"/>
<j:if test="${!empty(value)}">
<echo>Using connection: ${pom.repository.connection}</echo>
<j:set var="conn" value="${pom.repository.connection}" />
<j:set var="scmConnection" value="${pom.repository.developerConnection}" />
</j:if>
</j:if>
</j:if>
<j:if test="${scmConnection == null}">
<j:set var="value" value="${pom.repository.connection}"/>
<j:if test="${!empty(value)}">
<j:set var="scmConnection" value="${pom.repository.connection}" />
</j:if>
</j:if>
<j:if test="${conn != null}">
<j:set var="delim" value=":"/>
<j:if test="${value.length() gt 3}">
<j:set var="delim" value="${value.substring(3, 4)}"/>
</j:if>
<util:tokenize var="tokens" delim="${delim}">${conn}</util:tokenize>
<j:if test="${tokens[0] != 'scm'}">
<ant:fail>Invalid repository connection format</ant:fail>
</j:if>
<j:set var="maven.scm.method" value="${tokens[1]}"/>
<j:set var="scmMethod" value="${maven.scm.method}"/>
<log:info>Using SCM method: ${scmMethod}</log:info>
<j:if test="${scmConnection == null}">
<j:if test="${scmMethod == 'cvs'}">
<j:choose>
<j:when test="${tokens[2] == 'local'}">
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[4]}"/>
</j:when>
<j:otherwise>
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}:${tokens[4]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[5]}"/>
</j:otherwise>
</j:choose>
<log:info>Using CVSROOT: ${maven.scm.cvs.root}</log:info>
<log:info>Using module: ${maven.scm.cvs.module}</log:info>
<j:set var="value" value="${maven.scm.cvs.root}" />
<j:if test="${!empty(value)}">
<ant:echo>DEPRECATED: the maven.scm.cvs.root property is deprecated. Please specify maven.scm.url</ant:echo>
<j:set var="scmConnection" value="scm:cvs${maven.scm.cvs.root}:${maven.scm.cvs.module}" />
</j:if>
</j:if>
<j:if test="${scmMethod == 'svn'}">
<j:set var="maven.scm.svn.root" value="${tokens[2]}:${tokens[3]}"/>
<j:set var="maven.scm.svn.module" value="${tokens[4]}"/>
<log:info>Using SVN repository: ${maven.scm.svn.root}</log:info>
<log:info>Using module: ${maven.scm.svn.module}</log:info>
</j:if>
</j:if>
<ant:echo>Using connection: ${scmConnection}</ant:echo>
</goal>
<goal name="scm:checkout" prereqs="scm:find-connection"
description="Checkout a project from SCM">
<j:if test="${scmConnection == null}">
<ant:fail>You must specify an SCM URL to connect to</ant:fail>
</j:if>
<j:set var="msg" value="Checking out ${scmConnection}"/>
<j:set var="value" value="${maven.scm.tag}"/>
<j:if test="${!empty(value)}">
<j:set var="msg" value="${msg}; using tag: ${value}" />
</j:if>
<ant:echo>${msg}</ant:echo>
<scm:checkout var="checkoutBean" url="${scmConnection}" workingDirectory="${maven.scm.checkout.dir}" tag="${maven.scm.tag}" tagBase="${maven.scm.svn.tag.base}" username="${maven.scm.username}" password="${maven.scm.password}" />
</goal>
<goal name="scm:bootstrap" prereqs="scm:checkout" description="Boostrap a project from the SCM">
<ant:echo>Bootstrapping from ${checkoutBean.checkoutDirectory}/project.xml with goals ${maven.scm.bootstrap.goals}</ant:echo>
<j:set var="pomDir" value="${maven.scm.bootstrap.pom.dir}" />
<j:set var="dir" value="${checkoutBean.checkoutDirectory}" />
<j:if test="${!empty(pomDir)}">
<j:set var="dir" value="${dir}/${pomDir}" />
</j:if>
<maven:maven
descriptor="${dir}/project.xml"
goals="${maven.scm.bootstrap.goals}"
ignoreFailures="false"
/>
</goal>
<goal name="scm:update" prereqs="scm:find-connection" description="Update the project in the current directory from SCM">
<j:set var="msg" value="Updating from ${scmConnection}"/>
<j:set var="value" value="${maven.scm.tag}"/>
<j:if test="${!empty(value)}">
<j:set var="msg" value="${msg}; using tag: ${value}" />
</j:if>
<ant:echo>${msg}</ant:echo>
<scm:update url="${scmConnection}" workingDirectory="${basedir}" 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">
<j:if test="${scmConnection == null}">
<ant:fail>You must specify an SCM URL to connect to</ant:fail>
</j:if>
<j:set var="scmTag" value="${maven.scm.tag}"/>
<j:if test="${scmTag == null}">
<ant:fail>You must specify an SCM tag to apply</ant:fail>
</j:if>
<ant:echo>Tagging ${scmConnection} with ${maven.scm.tag}</ant:echo>
<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>
<!-- 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">
<j:if test="${scmConnection == null}">
<!-- TODO: remove these legacy methods -->
<j:if test="${scmMethod == 'cvs'}">
<j:set var="cvsRoot" value="${maven.scm.cvs.root}" />
<j:if test="${!empty(cvsRoot)}">
<ant:echo>DEPRECATED: use of maven.scm.cvs.root is deprecated</ant:echo>
<j:set var="module" value="${maven.scm.cvs.module}"/>
<j:if test="${empty(module)}">
<i:ask question="What CVS module are you releasing from?" answer="maven.scm.cvs.module"/>
</j:if>
<j:set var="scmConnection" value="scm:cvs${maven.scm.cvs.root}:${maven.scm.cvs.module}" />
</j:if>
</j:if>
<j:if test="${scmConnection == null}">
<i:ask question="What is the SCM URL you are releasing from?" answer="scmConnection" />
</j:if>
<j:if test="${scmConnection == null}">
<ant:fail>the SCM URL is required</ant:fail>
</j:if>
</j:if>
<j:set var="tag" value="${maven.scm.tag}"/>
<j:if test="${empty(tag)}">
<i:ask question="What tag are you releasing from?" answer="maven.scm.tag"/>
</j:if>
<j:set var="goals" value="${maven.scm.bootstrap.goals}"/>
<j:if test="${empty(goals)}">
<i:ask question="What goals are you using to build?" answer="goals" default="multiproject:deploy" />
<j:set var="maven.scm.bootstrap.goals" value="${goals.trim()}"/>
</j:if>
<attainGoal name="scm:bootstrap" />
</goal>
<!-- TODO: change prereqs to scm:find-connection only -->
<goal name="scm:prepare-release"
prereqs="scm:parse-connection,scm:check-deprecated-cvs-vars"
description="Prepare for a release in SCM">
<ant:echo>Verifying no modifications are present</ant:echo>
<scm:status var="scmStatusBean" url="${scmConnection}" workingDirectory="${basedir}" username="${maven.scm.username}" password="${maven.scm.password}" />
<j:set var="modifiedItems" value="${scmStatusBean.changedFiles}" />
<j:if test="${not empty modifiedItems}">
<ant:echo>Modified:</ant:echo>
<j:forEach var="item" items="${modifiedItems}">
<ant:echo>(${item.status}) ${item.path}</ant:echo>
</j:forEach>
<ant:fail>Cannot prepare a release - there are modifications outside of project.xml and changes.xml</ant:fail>
</j:if>
<j:if test="${tag_name != null}">
<ant:echo>DEPREACTED: Using tag_name directly is deprecated. Please use maven.scm.tag</ant:echo>
<j:set var="maven.scm.tag" value="${tag_name}" />
</j:if>
<i:ask
question="What is the new tag name?"
answer="tag_name"
default="${maven.scm.tag}"
/>
<i:ask
question="What is the new version?"
answer="version_name"
default="${tag_name}"
/>
<!-- TODO: verify that the name is valid for a tag -->
<!-- Update project.xml -->
<r:release-version version="${version_name}" tag="${tag_name}" />
<!-- Update changes.xml if it exists -->
<j:set var="changesFilename" value="${maven.docs.src}/changes.xml" />
<util:file var="file" name="${changesFilename}"/>
<j:if test="${file.exists()}">
<c:release-version version="${version_name}" />
</j:if>
<ant:echo>Committing descriptors</ant:echo>
<!-- No tag here - in this context it means the branch to commit to, and we want whatever this checkout current is on -->
<scm:checkin url="${scmConnection}" workingDirectory="${basedir}" includes="project.xml,xdocs/changes.xml" message="[maven-scm-plugin] prepare release ${version_name}" username="${maven.scm.username}" password="${maven.scm.password}" />
<ant:echo>Tagging source tree</ant:echo>
<scm:tag url="${scmConnection}" workingDirectory="${basedir}" tag="${tag_name}" tagBase="${maven.scm.svn.tag.base}" username="${maven.scm.username}" password="${maven.scm.password}" />
</goal>
<goal name="scm:create-patch" description="Create a patch file for changes single last SCM update" prereqs="scm:find-connection">
<ant:mkdir dir="${maven.scm.patch.dir}"/>
<scm:diff url="${scmConnection}" workingDirectory="${basedir}" patchFile="${maven.scm.patch.dir}/${maven.scm.patch.file}" username="${maven.scm.username}" password="${maven.scm.password}" />
<ant:echo>Patch created in ${maven.scm.patch.dir}/${maven.scm.patch.file}</ant:echo>
</goal>
<!--
DEPRECATED METHODS
-->
<goal name="scm:validate" prereqs="scm:parse-connection">
<j:choose>
<j:when test="${scmMethod == 'cvs'}">
<j:set var="cvsRoot" value="${maven.scm.cvs.root}"/>
<j:if test="${empty(cvsRoot)}">
<ant:fail>You must specify maven.scm.cvs.root</ant:fail>
</j:if>
<j:set var="cvsModule" value="${maven.scm.cvs.module}"/>
<j:if test="${empty(cvsModule)}">
<ant:fail>You must specify maven.scm.cvs.module</ant:fail>
@ -122,31 +278,116 @@
</j:choose>
</goal>
<!--==================================================================-->
<!-- Goal to checkout a project -->
<!--==================================================================-->
<goal name="scm:checkout-project"
prereqs="scm:validate"
description="Checkout a project">
<j:if test="${scmMethod == 'cvs'}">
<attainGoal name="scm:cvs-checkout-project"/>
prereqs="scm:validate">
<ant:echo>DEPRECATED: please use scm:checkout</ant:echo>
<j:choose>
<j:when test="${scmMethod == 'cvs'}">
<attainGoal name="scm:cvs-checkout-project"/>
</j:when>
<j:otherwise>
<ant:fail>Unsupported scm type: ${scmMethod}</ant:fail>
</j:otherwise>
</j:choose>
</goal>
<j:set var="scmMethod" value="${maven.scm.method}"/>
<goal name="scm:parse-connection" prereqs="scm:find-connection">
<j:if test="${scmConnection != null}">
<j:set var="delim" value=":"/>
<j:if test="${scmConnection.length() gt 3}">
<j:set var="delim" value="${scmConnection.substring(3, 4)}"/>
</j:if>
<util:tokenize var="tokens" delim="${delim}">${scmConnection}</util:tokenize>
<j:if test="${tokens[0] != 'scm'}">
<ant:fail>Invalid repository connection format</ant:fail>
</j:if>
<j:set var="maven.scm.method" value="${tokens[1]}"/>
<j:set var="scmMethod" value="${maven.scm.method}"/>
<ant:echo>Using SCM method: ${scmMethod}</ant:echo>
<j:if test="${scmMethod == 'cvs'}">
<j:choose>
<j:when test="${tokens[2] == 'local'}">
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[4]}"/>
</j:when>
<j:otherwise>
<j:set var="maven.scm.cvs.root" value=":${tokens[2]}:${tokens[3]}:${tokens[4]}"/>
<j:set var="maven.scm.cvs.module" value="${tokens[5]}"/>
</j:otherwise>
</j:choose>
<ant:echo>Using CVSROOT: ${maven.scm.cvs.root}</ant:echo>
<ant:echo>Using module: ${maven.scm.cvs.module}</ant:echo>
</j:if>
<j:if test="${scmMethod == 'svn'}">
<j:set var="maven.scm.svn.root" value="${tokens[2]}:${tokens[3]}"/>
<j:set var="maven.scm.svn.module" value="${tokens[4]}"/>
<ant:echo>Using SVN repository: ${maven.scm.svn.root}</ant:echo>
<ant:echo>Using module: ${maven.scm.svn.module}</ant:echo>
</j:if>
</j:if>
</goal>
<!--==================================================================-->
<!-- Goal to bootstrap a project from SCM -->
<!--==================================================================-->
<goal name="scm:bootstrap-project"
description="Bootstrap a project from SCM"
prereqs="scm:checkout-project">
<!-- TODO: check tagged syntax ok with other SCM than CVS, including in docs -->
<goal name="scm:cvs-update-project" prereqs="scm:check-deprecated-cvs-vars">
<attainGoal name="scm:update" />
</goal>
<goal name="scm:cvs-checkout-project" prereqs="scm:check-deprecated-cvs-vars">
<attainGoal name="scm:checkout" />
</goal>
<goal name="scm:cvs-tag-project" prereqs="scm:check-deprecated-cvs-vars">
<ant:echo>DEPRECATED: please use scm:tag goal instead</ant:echo>
<attainGoal name="scm:tag" />
</goal>
<goal name="scm:check-deprecated-cvs-vars">
<j:set var="scmFlags" value="${maven.scm.cvs.update.flags}"/>
<j:if test="${!empty(scmFlags)}">
<!-- TODO: should/can it be passed to maven SCM? -->
<ant:echo>DEPRECATED: maven.scm.cvs.update.flags no longer used - ignored</ant:echo>
</j:if>
<j:set var="scmFlags" value="${maven.scm.cvs.checkout.flags}"/>
<j:if test="${!empty(scmFlags)}">
<!-- TODO: should/can it be passed to maven SCM? -->
<ant:echo>DEPRECATED: maven.scm.cvs.checkout.flags no longer used - ignored</ant:echo>
</j:if>
<j:set var="scmRsh" value="${maven.scm.rsh}" />
<j:if test="${!empty(scmRsh)}">
<!-- TODO: should/can it be passed to maven SCM? -->
<ant:echo>DEPRECATED: maven.scm.cvs.rsh no longer used - ignored</ant:echo>
</j:if>
<j:set var="scmTag" value="${maven.scm.cvs.sticky.tag}"/>
<j:if test="${!empty(scmTag)}">
<j:set var="scmTag" value="${maven.scm.tag}"/>
<j:if test="${empty(scmTag)}">
<ant:echo>DEPRECATED: maven.scm.cvs.sticky.tag replaced by maven.scm.tag</ant:echo>
<j:set var="maven.scm.tag" value="${maven.scm.cvs.sticky.tag}" />
</j:if>
</j:if>
<j:set var="scmPatchDir" value="${maven.scm.cvs.patch.dir}"/>
<j:if test="${!empty(scmPatchDir)}">
<ant:echo>DEPRECATED: maven.scm.cvs.patch.dir replaced by maven.scm.patch.dir</ant:echo>
<j:set var="maven.scm.patch.dir" value="${maven.scm.cvs.patch.dir}" />
</j:if>
<j:set var="scmPatchDir" value="${maven.scm.cvs.patch.file}"/>
<j:if test="${!empty(scmPatchFile)}">
<ant:echo>DEPRECATED: maven.scm.cvs.patch.file replaced by maven.scm.patch.file</ant:echo>
<j:set var="maven.scm.patch.file" value="${maven.scm.cvs.patch.file}" />
</j:if>
</goal>
<goal name="scm:bootstrap-project" prereqs="scm:checkout-project">
<ant:echo>DEPRECATED: please use the scm:bootstrap goal instead</ant:echo>
<j:set var="checkTagged" value="${maven.scm.check.tagged}"/>
<j:if test="${checkTagged}">
<!-- TODO: what about branch tags? Check <version>? What about cvs command for such? -->
<j:set var="tag" value="${maven.scm.cvs.sticky.tag}"/>
<j:if test="${tag == 'HEAD'}">
<maven:pom var="project" projectDescriptor="${maven.scm.checkout.dir}/${maven.scm.cvs.module}/project.xml"/>
<log:info>WARNING: you are releasing HEAD. This will overwrite any previous release versioned '${project.currentVersion}'.</log:info>
<maven:pom var="project" projectDescriptor="${checkoutBean.checkoutDirectory}/${maven.scm.cvs.module}/project.xml"/>
<ant:echo>WARNING: you are releasing HEAD. This will overwrite any previous release versioned '${project.currentVersion}'.</ant:echo>
<i:ask
question="Are you sure (y/n)?"
answer="ok"
@ -158,217 +399,37 @@
</j:if>
</j:if>
<j:set var="pomDir" value="${maven.scm.bootstrap.pom.dir}" />
<j:if test="${empty(pomDir)}">
<j:set var="pomDir" value="." />
</j:if>
<maven:maven
descriptor="${maven.scm.bootstrap.pom.dir}/project.xml"
descriptor="${pomDir}/project.xml"
goals="${maven.scm.bootstrap.goals}"
ignoreFailures="false"
/>
</goal>
<!--==================================================================-->
<!-- Goal to update a project -->
<!--==================================================================-->
<goal name="scm:update-project"
prereqs="scm:validate"
description="Update a project from SCM">
<j:if test="${scmMethod == 'cvs'}">
<attainGoal name="scm:cvs-update-project"/>
</j:if>
</goal>
<!--==================================================================-->
<!-- Prepare Release -->
<!--==================================================================-->
<goal name="scm:prepare-release"
prereqs="scm:validate"
description="Prepare for a release in SCM">
<j:if test="${scmMethod == 'cvs'}">
<attainGoal name="scm:cvs-prepare-release"/>
</j:if>
</goal>
<!--==================================================================-->
<!-- Perform Release -->
<!-- TODO: we should be able to select what to deploy and so on, -->
<!-- tie in with multiproject-by-groupId idea -->
<!--==================================================================-->
<goal name="scm:perform-release" prereqs="scm:parse-connection"
description="Perform a release from SCM">
<!-- Setup variables -->
<goal name="scm:update-project" prereqs="scm:validate">
<ant:echo>DEPRECATED: please use the scm:update goal instead</ant:echo>
<j:choose>
<j:when test="${scmMethod == 'cvs'}">
<j:set var="module" value="${maven.scm.cvs.module}"/>
<j:if test="${empty(module)}">
<i:ask question="What CVS module are you releasing from?" answer="maven.scm.cvs.module"/>
</j:if>
<j:set var="tag" value="${maven.scm.cvs.sticky.tag}"/>
<j:if test="${empty(tag)}">
<i:ask question="What CVS tag are you releasing from?" answer="maven.scm.cvs.sticky.tag"/>
</j:if>
<attainGoal name="scm:cvs-update-project"/>
</j:when>
<j:when test="${empty(scmMethod)}">
<ant:fail>You must specify maven.scm.method</ant:fail>
</j:when>
<j:otherwise>
<ant:fail>Unknown SCM method: ${scmMethod}</ant:fail>
<ant:fail>Unsupported scm type: ${scmMethod}</ant:fail>
</j:otherwise>
</j:choose>
<j:set var="goals" value="${maven.scm.bootstrap.goals}"/>
<j:if test="${empty(goals)}">
<i:ask question="What goals are you using to build?" answer="goals" default="multiproject:deploy" />
<j:set var="maven.scm.bootstrap.goals" value="${goals.trim()}"/>
</j:if>
<attainGoal name="scm:bootstrap-project" />
</goal>
<!--==================================================================-->
<!-- Checkout - CVS -->
<!--==================================================================-->
<goal name="scm:cvs-checkout-project">
<j:set var="msg" value="Checking out ${maven.scm.cvs.module}" />
<j:set var="value" value="${maven.scm.cvs.root}"/>
<j:if test="${!empty(value)}">
<j:set var="msg" value="${msg}; from CVSROOT: ${value}" />
</j:if>
<j:set var="value" value="${maven.scm.cvs.sticky.tag}"/>
<j:if test="${!empty(value)}">
<j:set var="msg" value="${msg}; using tag: ${value}" />
</j:if>
<ant:echo>${msg}</ant:echo>
<j:set var="maven.scm.bootstrap.pom.dir" value="${maven.scm.checkout.dir}/${maven.scm.cvs.module}"/>
<ant:delete dir="${maven.scm.bootstrap.pom.dir}"/>
<ant:mkdir dir="${maven.scm.bootstrap.pom.dir}"/>
<ant:cvs command="checkout ${maven.scm.cvs.checkout.flags}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
dest="${maven.scm.checkout.dir}"
package="${maven.scm.cvs.module}"
tag="${maven.scm.cvs.sticky.tag}"
failonerror="true"
/>
</goal>
<!--==================================================================-->
<!-- Update - CVS -->
<!--==================================================================-->
<goal name="scm:cvs-update-project">
<ant:cvs command="update ${maven.scm.cvs.update.flags}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
tag="${maven.scm.cvs.sticky.tag}"
failonerror="true"
/>
</goal>
<!--==================================================================-->
<!-- Tag - CVS -->
<!--==================================================================-->
<goal name="scm:cvs-tag-project">
<ant:cvs command="tag -F ${maven.scm.cvs.tag}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
</goal>
<!--==================================================================-->
<!-- Prepare Release - CVS -->
<!--==================================================================-->
<goal name="scm:cvs-prepare-release">
<log:info>Verifying no modifications are present</log:info>
<j:set var="changesFilename" value="${maven.docs.src}/changes.xml" />
<util:file var="file" name="${changesFilename}"/>
<j:set var="changesExists" value="${file.exists()}" />
<!-- Need to move POM out of the way as mods there are allowed -->
<ant:move file="project.xml" tofile="project.xml.SCM.temp" />
<j:set var="documents" value="project.xml" />
<j:if test="${changesExists}">
<maven:makeRelativePath basedir="${basedir}" path="${changesFilename}" var="changesFilename" />
<util:replace var="changesFilename" value="${changesFilename}" oldChar="\\" newChar="/" />
<j:set var="documents" value="${documents} ${changesFilename}" />
<ant:move file="${changesFilename}" tofile="${changesFilename}.SCM.temp" />
</j:if>
<j:catch var="exception">
<ant:cvs command="update ${documents}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<ant:cvs command="tag -c dummy_tag"
noexec="true"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
</j:catch>
<ant:move file="project.xml.SCM.temp" tofile="project.xml" />
<j:if test="${changesExists}">
<ant:move file="${changesFilename}.SCM.temp" tofile="${changesFilename}" />
</j:if>
<j:if test="${exception != null}">
<ant:fail>${exception}</ant:fail>
</j:if>
<i:ask
question="What is the new tag name?"
answer="tag_name"
default="${tag_name}"
/>
<i:ask
question="What is the new version?"
answer="version_name"
default="${tag_name}"
/>
<log:info>Verifying valid tag name</log:info>
<ant:cvs command="tag -F ${tag_name} project.xml"
noexec="true"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<r:release-version version="${version_name}" tag="${tag_name}" />
<j:if test="${changesExists}">
<c:release-version version="${version_name}" />
</j:if>
<log:info>Committing new documents: ${documents}</log:info>
<ant:cvs command="commit -m '[maven-scm-plugin] prepare release ${version_name}' ${documents}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<log:info>Tagging source tree</log:info>
<ant:cvs command="tag -F ${tag_name}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="true"
/>
<ant:echo>DEPRECATED: please use scm:prepare-release</ant:echo>
<attainGoal name="scm:prepare-release"/>
</goal>
<!--==================================================================-->
<!-- Patch - CVS -->
<!--==================================================================-->
<goal name="scm:cvs-create-patch">
<ant:delete dir="${maven.scm.cvs.patch.dir}"/>
<ant:mkdir dir="${maven.scm.cvs.patch.dir}"/>
<cvs command="diff -u -w -N -R" output="${maven.scm.cvs.patch.dir}/${maven.scm.cvs.patch.file}"
quiet="${maven.scm.cvs.quiet}"
cvsRsh="${maven.scm.cvs.rsh}"
cvsRoot="${maven.scm.cvs.root}"
failonerror="false"/>
<ant:echo>Patch created in ${maven.scm.cvs.patch.dir}/${maven.scm.cvs.patch.file}</ant:echo>
<goal name="scm:cvs-create-patch" prereqs="scm:check-deprecated-cvs-vars">
<ant:echo>DEPRECATED: the scm:cvs-create-patch goal has been replaced by scm:create-patch</ant:echo>
<attainGoal name="scm:create-patch" />
</goal>
</project>

View File

@ -14,10 +14,20 @@
# limitations under the License.
# -------------------------------------------------------------------
# Available settings currently only CVS
maven.scm.method=cvs
# Directory to checkout to
maven.scm.checkout.dir=${maven.build.dir}/checkouts
maven.scm.checkout.dir=${maven.build.dir}/checkout
# Tag base for SVN if specified - should be a URL
maven.scm.svn.tag.base=
# Username to give to the SCM, can also be part of the URL
maven.scm.username=
# Password to give to the SCM, recommended that you use an alternative authentication technique
maven.scm.password=
# TODO: remove/review
maven.scm.method=cvs
# Set to true if you want to ignore the connection and developer connection parameters in the POM
maven.scm.ignore.pom.connection=false
# Set to true if you want to ignore the developer connection parameter only in the POM
@ -35,21 +45,7 @@ maven.scm.check.tagged=true
# CVS Properties
#===============
# Set to CVS RSH variable, or leave as is to use CVS_RSH from the environment
maven.scm.cvs.rsh=
# Set to CVS root, or leave as is to use CVSROOT from the environment
maven.scm.cvs.root=
# CVS module to check out, required
maven.scm.cvs.module=
# Flags after update. Default updates new directories and prunes empty ones
maven.scm.cvs.update.flags=-Pd
# Flags after checkout. Default prunes empty directories
maven.scm.cvs.checkout.flags=-P
# Sticky tag/branch to use. Default is trunk.
maven.scm.cvs.sticky.tag=
# Whether to use quiet mode
maven.scm.cvs.quiet=true
# The file name for the patch
maven.scm.cvs.patch.file=patch.txt
maven.scm.patch.file=patch.txt
# The working directory for patching
maven.scm.cvs.patch.dir=${maven.build.dir}/scm/patch
maven.scm.patch.dir=${maven.build.dir}/scm/patch

View File

@ -1,19 +0,0 @@
# -------------------------------------------------------------------
# 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.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -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.4.2-SNAPSHOT</currentVersion>
<currentVersion>1.5-beta-4-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>
@ -64,6 +64,21 @@
<name>1.4.1</name>
<tag>MAVEN_SCM_1_4_1</tag>
</version>
<version>
<id>1.5-beta-1</id>
<name>1.5-beta-1</name>
<tag>scm-1.5-beta-1</tag>
</version>
<version>
<id>1.5-beta-2</id>
<name>1.5-beta-2</name>
<tag>scm-1.5-beta-2</tag>
</version>
<version>
<id>1.5-beta-3</id>
<name>1.5-beta-3</name>
<tag>scm-1.5-beta-3</tag>
</version>
</versions>
<developers>
<developer>
@ -101,5 +116,35 @@
<artifactId>commons-jelly-tags-interaction</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-1</version>
</dependency>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0-alpha-1</version>
</dependency>
<dependency>
<groupId>classworlds</groupId>
<artifactId>classworlds</artifactId>
<version>1.1-alpha-1</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.0-alpha-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-scm-provider-cvs</artifactId>
<version>1.0-alpha-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-scm-provider-svn</artifactId>
<version>1.0-alpha-1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,241 @@
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.ScmResult;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
import org.apache.maven.scm.command.update.UpdateScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.codehaus.plexus.embed.Embedder;
import org.codehaus.plexus.util.FileUtils;
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 ScmBean
{
private String username;
private String password;
private String url;
private String tag;
private String workingDirectory;
// note - this should not have a setter
private File checkoutDirectory;
private String tagBase;
protected Embedder getEmbedder()
throws Exception
{
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
// TODO: allow this to be passed in as a parameter so Maven 1.1 can have one embedder only
Embedder embedder = new Embedder();
embedder.start();
Thread.currentThread().setContextClassLoader( oldClassLoader );
return embedder;
}
public void checkout()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
if ( repository.getProvider().equals( "svn" ) )
{
if ( tag != null )
{
checkoutDirectory = new File( checkoutDirectory, tag );
}
}
checkoutDirectory = new File( workingDirectory );
if ( checkoutDirectory.exists() )
{
// TODO: sanity check that it is not . or .. or lower
FileUtils.deleteDirectory( checkoutDirectory );
}
checkoutDirectory.mkdirs();
CheckOutScmResult result = scmManager.checkOut( repository, new ScmFileSet( checkoutDirectory ), tag );
checkResult( result );
}
protected ScmRepository getScmRepository( ScmManager scmManager )
throws ScmRepositoryException, NoSuchScmProviderException
{
ScmRepository repository = scmManager.makeScmRepository( url );
if ( repository.getProvider().equals( "svn" ) )
{
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
if ( username != null && username.length() > 0 )
{
svnRepo.setUser( username );
}
if ( password != null && password.length() > 0 )
{
svnRepo.setPassword( password );
}
if ( tagBase != null && tagBase.length() > 0 )
{
svnRepo.setTagBase( tagBase );
}
}
return repository;
}
protected ScmManager lookupScmManager()
throws Exception
{
Embedder embedder = getEmbedder();
ScmManager scmManager = (ScmManager) embedder.lookup( ScmManager.ROLE );
return scmManager;
}
protected void checkResult( ScmResult result )
throws Exception
{
if ( !result.isSuccess() )
{
// TODO: improve error handling
System.err.println( "Provider message:" );
System.err.println( result.getProviderMessage() );
System.err.println( "Command output:" );
System.err.println( result.getCommandOutput() );
throw new Exception( "Error!" );
}
}
public void update()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
checkoutDirectory = new File( workingDirectory );
// TODO: want includes/excludes?
UpdateScmResult result = scmManager.update( repository, new ScmFileSet( new File( workingDirectory ) ), tag );
checkResult( result );
}
public void tag()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
// TODO: want includes/excludes?
TagScmResult result = scmManager.tag( repository, new ScmFileSet( new File( workingDirectory ) ), tag );
checkResult( result );
}
public void setUrl( String url )
{
this.url = url;
}
public String getUrl()
{
return url;
}
public void setTag( String tag )
{
this.tag = tag;
}
public String getTag()
{
return tag;
}
public void setWorkingDirectory( String workingDirectory )
{
this.workingDirectory = workingDirectory;
}
public String getWorkingDirectory()
{
return workingDirectory;
}
public File getCheckoutDirectory()
{
return checkoutDirectory;
}
public String getTagBase()
{
return tagBase;
}
public void setTagBase( String tagBase )
{
this.tagBase = tagBase;
}
public String getUsername()
{
return username;
}
public void setUsername( String username )
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword( String password )
{
this.password = password;
}
}

View File

@ -0,0 +1,61 @@
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.checkin.CheckInScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.embed.Embedder;
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 ScmCheckinBean extends ScmPatternBean
{
private String message;
public void checkin()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
CheckInScmResult result = scmManager.checkIn( repository, new ScmFileSet( new File( getWorkingDirectory() ),
getIncludes(), getExcludes() ),
getTag(), message );
checkResult( result );
}
public void setMessage( String message )
{
this.message = message;
}
public String getMessage()
{
return message;
}
}

View File

@ -0,0 +1,63 @@
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.diff.DiffScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.embed.Embedder;
import org.codehaus.plexus.util.FileUtils;
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 ScmDiffBean extends ScmPatternBean
{
private String patchFile;
public void diff()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
ScmFileSet fileSet = new ScmFileSet( new File( getWorkingDirectory() ), getIncludes(), getExcludes() );
DiffScmResult result = scmManager.diff( repository, fileSet, null, null );
checkResult( result );
FileUtils.fileWrite( patchFile, result.getPatch() );
}
public void setPatchFile( String patchFile )
{
this.patchFile = patchFile;
}
public String getPatchFile()
{
return patchFile;
}
}

View File

@ -0,0 +1,51 @@
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.
* ====================================================================
*/
/**
* 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 ScmPatternBean extends ScmBean
{
private String includes;
private String excludes;
public void setIncludes( String includes )
{
this.includes = includes;
}
public String getIncludes()
{
return includes;
}
public void setExcludes( String excludes )
{
this.excludes = excludes;
}
public String getExcludes()
{
return excludes;
}
}

View File

@ -0,0 +1,71 @@
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.ScmFile;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.embed.Embedder;
import java.io.File;
import java.util.Iterator;
import java.util.List;
/**
* 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 ScmStatusBean extends ScmBean
{
private List changedFiles;
public void status()
throws Exception
{
ScmManager scmManager = lookupScmManager();
ScmRepository repository = getScmRepository( scmManager );
StatusScmResult result = scmManager.status( repository, new ScmFileSet( new File( getWorkingDirectory() ) ) );
checkResult( result );
changedFiles = result.getChangedFiles();
for ( Iterator i = changedFiles.iterator(); i.hasNext(); )
{
ScmFile f = (ScmFile) i.next();
if ( f.getPath().equals( "project.xml" ) ||
f.getPath().equals( "project.xml.backup" ) ||
f.getPath().equals( "xdocs/changes.xml" ) ||
f.getPath().equals( "xdocs/changes.xml.backup" ) )
{
i.remove();
}
}
}
public List getChangedFiles()
{
return changedFiles;
}
}

View File

@ -24,11 +24,17 @@
<author email="brett@apache.org">Brett Porter</author>
</properties>
<body>
<release version="1.4.2-SNAPSHOT" date="in CVS">
<release version="1.5-beta-4-SNAPSHOT" date="in SVN">
<action dev="brett" type="add">Add the ability to pass a username and password to the Subversion provider</action>
<action dev="brett" type="update">Check out into
<code>maven.scm.checkout.dir</code>rather than a subdirectory of it
</action>
<action dev="brett" type="add" issue="MPSCM-33">Use maven.scm.bootstrap.pom.dir</action>
<action dev="brett" type="add" issue="MPSCM-32">Add support for subversion</action>
<action dev="brett" type="add">Rewritten to utilise the Maven SCM library</action>
<action dev="dion" type="fix" issue="MPSCM-25">Ignore whitespace when creating a patch</action>
<action dev="carlos" type="fix">Ignore POM if the scm root is specified in command line</action>
</release>
<release version="1.4.1" date="2004-07-30">
<action dev="dion" type="fix" issue="MPSCM-16">Trim goals after prompting from the user</action>
<action dev="dion" type="add" issue="MPSCM-20">Add scm:cvs-create-patch goal to help in creating patches</action>

58
scm/xdocs/commontasks.xml Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Common SCM Tasks</title>
<author email="brett@apache.org">Brett Porter</author>
</properties>
<body>
<section name="Common SCM Tasks">
<p>
The Maven SCM plugin allows you to perform some common SCM actions.
</p>
<subsection name="Checking out a project">
<p>
This command is usually performed without a project, as that is what you are
checking out, so you need to specify the <a href="scmurl.html">SCM URL</a>. The URL takes the same format
as the <code>&lt;repository&gt;&lt;connection&gt;</code> element in your <code>project.xml</code>
file.
</p>
<source>maven scm:checkout -Dmaven.scm.url=scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/core/trunk</source>
</subsection>
<subsection name="Updating a project">
<p>
This command is always performed on an existing project. It is used to update to the latest code from the
server for the project.
</p>
<source>maven scm:update</source>
</subsection>
<subsection name="Tagging a project">
<p>
This command is always performed on an existing project. It will apply a tag (or equivalent operation in
your SCM) to the current checkout. You must specify a tag name.
</p>
<source>maven scm:tag -Dmaven.scm.tag=MAVEN_1_0</source>
</subsection>
</section>
</body>
</document>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* 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.
*/
-->
<faqs title="Frequently Asked Questions">
<part id="usage">
<title>Plugin Usage</title>
<faq id="how-use">
<question>How do I checkout all modules in HEAD for CVS?</question>
<answer>Set the <code>maven.scm.cvs.module</code> to a single period (i.e. <code>.</code>)</answer>
</faq>
</part>
</faqs>

View File

@ -25,17 +25,21 @@
<body>
<goals>
<goal>
<name>scm:bootstrap-project</name>
<name>scm:bootstrap</name>
<description>Bootstrap a project from SCM</description>
</goal>
<goal>
<name>scm:checkout-project</name>
<name>scm:checkout</name>
<description>Checkout a project</description>
</goal>
<goal>
<name>scm:update-project</name>
<name>scm:update</name>
<description>Update a project from SCM</description>
</goal>
<goal>
<name>scm:tag</name>
<description>Tag a project in the SCM</description>
</goal>
<goal>
<name>scm:prepare-release</name>
<description>
@ -56,9 +60,9 @@
</description>
</goal>
<goal>
<name>scm:cvs-create-patch</name>
<name>scm:create-patch</name>
<description>
Creates a patch in ${maven.scm.cvs.patch.dir}/${maven.scm.cvs.patch.file}
Creates a patch in ${maven.scm.patch.dir}/${maven.scm.patch.file}
of the changes made to the current project
</description>
</goal>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,18 +27,22 @@
<body>
<section name="Maven SCM Plugin">
<p>
A plugin for SCM tasks, currently CVS.
</p>
<p>
For more information on the functionality provided by this plugin,
please see the <a href="goals.html">Goals</a> document.
A plugin for SCM tasks, currently CVS and Subversion.
</p>
<p>
For more information on how to customise the functionality provided
by this plugin, please see the <a href="properties.html">properties</a>
document.
This documentation includes information on how to perform
<a href="commontasks.html">common SCM tasks</a> and also
how to <a href="releasing.html">make project releases from SCM</a>.
</p>
<p>
A reference on the <a href="scmurl.html">SCM URL format</a> is also included.
</p>
<p>
For a full reference of this plugins capabilities,
please see the <a href="goals.html">Goals</a> and
<a href="properties.html">Properties</a> documents.
</p>
</section>
</body>
</body>
</document>

View File

@ -25,11 +25,14 @@
<item href="http://maven.apache.org/" name="Maven">
</item>
</links>
<menu name="Overview">
<item href="/goals.html" name="Goals">
</item>
<item href="/properties.html" name="Properties">
</item>
<menu name="User Guide">
<item href="/commontasks.html" name="Common Tasks" />
<item href="/releasing.html" name="Making Releases" />
</menu>
<menu name="Reference">
<item href="/scmurl.html" name="SCM URL Format" />
<item href="/goals.html" name="Goals" />
<item href="/properties.html" name="Properties" />
</menu>
</body>
</project>

View File

@ -25,146 +25,199 @@
<body>
<section name="Maven Source Control Management Plug-in Settings">
<subsection name="General SCM Settings">
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.scm.method</td>
<td>Yes</td>
<td>
<p>Default value is
<code>cvs</code>.</p>
</td>
</tr>
<tr>
<td>maven.scm.checkout.dir</td>
<td>Yes</td>
<td>
<p>Default value is
<code>${basedir}/checkouts</code>.</p>
</td>
</tr>
<tr>
<td>maven.scm.check.tagged</td>
<td>Yes</td>
<td>
<p>When <code>true</code>, you will be asked for confirmation if
you are attempting to release from <code>HEAD</code>.
Default value is <code>true</code>.</p>
</td>
</tr>
<tr>
<td>maven.scm.bootstrap.goals</td>
<td>No</td>
<td>
<p>Goals to call on the checked out project.</p>
</td>
</tr>
<tr>
<td>maven.scm.bootstrap.pom.dir</td>
<td>Yes</td>
<td>
<p>Where to find project.xml in the checked out project.</p>
</td>
</tr>
</table>
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.scm.url</td>
<td>If there is no POM</td>
<td>
The URL to use. This overrides the connection setting in the POM if required.
It is required if there is no connection setting in the POM, or there is no POM at all.
</td>
</tr>
<tr>
<td>maven.scm.tag</td>
<td>Yes</td>
<td>
The tag to use when checking out or tagging a project.
</td>
</tr>
<tr>
<td>maven.scm.bootstrap.goals</td>
<td>Yes</td>
<td>
The goals to run on the clean checkout of a project for the bootstrap goal. If
none are specified, then the default goal for the project is executed.
Multiple goals should be comma separated.
</td>
</tr>
<tr>
<td>maven.scm.bootstrap.pom.dir</td>
<td>Yes</td>
<td>
The relative path to the <code>project.xml</code> file within the checkout for the
bootstrap goal.
</td>
</tr>
<tr>
<td>maven.scm.checkout.dir</td>
<td>Yes</td>
<td>
The directory to checkout the sources to for the bootstrap and checkout goals.
The default is <code>${maven.build.dir}/checkouts</code>.
</td>
</tr>
<tr>
<td>maven.scm.ignore.pom.developerConnection</td>
<td>Yes</td>
<td>
Set to true if you do not wish to use the developer connection for this URL.
The pom.connection setting will be used instead.
</td>
</tr>
<tr>
<td>maven.scm.patch.dir</td>
<td>Yes</td>
<td>
<p>Working directory for creating a patch file. Used by the
<code>create-patch</code> goal.
</p>
<p>Defaults to
<code>${maven.build.dir}/scm/patch</code>
</p>
</td>
</tr>
<tr>
<td>maven.scm.patch.file</td>
<td>Yes</td>
<td>
<p>
The name of the patch file created y the
<code>create-patch</code> goal.
in the
<code>${maven.scm.patch.dir}</code> directory
</p>
<p>Defaults to
<code>patch.diff</code>
</p>
</td>
</tr>
<tr>
<td>maven.scm.username</td>
<td>Yes</td>
<td>
<p>
The username to pass to the SCM. Currently only Subversion is known to honour this.
You can also add it to the URL, eg. <code>http://user@svn.mycompany.com/repos</code>.
</p>
</td>
</tr>
<tr>
<td>maven.scm.password</td>
<td>Yes</td>
<td>
<p>
The password to give to the SCM. Currently only Subversion is 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>
</table>
</subsection>
<subsection name="CVS Settings">
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.scm.cvs.root</td>
<td>Yes</td>
<td>
<p>
Default value is taken from CVSROOT in the environment.
If you have a valid Maven project descriptor and the repository
element is using CVS, you can set this property to
<code>${pom.repository.cvsRoot}</code>
</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.update.flags</td>
<td>Yes</td>
<td>
<p>Default value is
<code>-Pd</code>. Note that any environment settings
(eg .cvsrc) will also affect this.</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.module</td>
<td>No</td>
<td>
<p>The CVS module to checkout</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.sticky.tag</td>
<td>Yes</td>
<td>
<p>Sticky tag to use when checking out or updating. Default is none.</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.quiet</td>
<td>Yes</td>
<td>
<p>Default value is
<code>true</code>.</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.checkout.flags</td>
<td>Yes</td>
<td>
<p>Default value is
<code>-P</code>. Note that any environment settings
(eg .cvsrc) will also affect this.</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.rsh</td>
<td>Yes</td>
<td>
<p>Default value is taken from CVS_RSH in the environment.</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.tag</td>
<td>Yes</td>
<td>
<p>Used as the tag for the <code>cvs-tag-project</code> goal.</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.patch.dir</td>
<td>Yes</td>
<td>
<p>Working directory for creating a patch file. Used by the <code>cvs-create-patch</code> goal.</p>
<p>Defaults to <code>${maven.build.dir}/scm/patch</code></p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.patch.file</td>
<td>Yes</td>
<td>
<p>
The name of the patch file created y the <code>cvs-create-patch</code> goal.
in the <code>${maven.scm.cvs.patch.dir}</code> directory
</p>
<p>Defaults to <code>patch.txt</code></p>
</td>
</tr>
</table>
<subsection name="Subversion Specific Settings">
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.scm.svn.tag.base</td>
<td>Yes</td>
<td>
The Subversion URL to copy tagged sources to. The default is <code>../tags</code>, relative
to the URL for the current source tree.
</td>
</tr>
</table>
</subsection>
<subsection name="Deprecated SCM Properties">
<table>
<tr>
<th>Property</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.scm.method</td>
<td>Yes</td>
<td>
<p>Default value is
<code>cvs</code>.
</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.root</td>
<td>Yes</td>
<td>
<p>
Default value is taken from CVSROOT in the environment.
If you have a valid Maven project descriptor and the repository
element is using CVS, you do not need to set this property.
</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.module</td>
<td>Yes</td>
<td>
<p>The CVS module to checkout</p>
</td>
</tr>
<tr>
<td>maven.scm.svn.root</td>
<td>Yes</td>
<td>
<p>
If you have a valid Maven project descriptor and the repository
element is using SVN, you do not need to set this property.
</p>
</td>
</tr>
<tr>
<td>maven.scm.svn.module</td>
<td>Yes</td>
<td>
<p>The SVN module to checkout</p>
</td>
</tr>
<tr>
<td>maven.scm.cvs.sticky.tag</td>
<td>Yes</td>
<td>
<p>Sticky tag to use when checking out or updating. Default is none.</p>
</td>
</tr>
<tr>
<td>maven.scm.check.tagged</td>
<td>Yes</td>
<td>
<p>When
<code>true</code>, you will be asked for confirmation if
you are attempting to release from
<code>HEAD</code>.
Default value is
<code>true</code>.
</p>
</td>
</tr>
</table>
</subsection>
</section>
</body>

77
scm/xdocs/releasing.xml Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Making Releases</title>
<author email="brett@apache.org">Brett Porter</author>
</properties>
<!-- TODO: move to main documentation -->
<body>
<section name="Making Releases from SCM">
<p>
The SCM plugin provides some basic functionality for making releases, and updating the SCM accordingly.
A release is performed in 2 steps:
</p>
<ol>
<li>Prepare the release</li>
<li>Perform (deploy) the release</li>
</ol>
<subsection name="Preparing the release">
<p>
Release preparation usually happens on an existing checkout. This checkout should be in such a state that
with the exception of making final updates to the project.xml and changes.xml files, is ready to be
released.
</p>
<p>
Preparing a release performs the following steps:
</p>
<ol>
<li>Verify that there are no uncommitted changes in the checkout</li>
<li>Prompt for a desired version and tag name</li>
<li>Modify project.xml and changes.xml to set the released version and commit the changes</li>
<li>Tag the entire source tree with the new tag name</li>
</ol>
<p>
When this operation is over, your source control has the released code tagged and ready to deploy.
</p>
</subsection>
<subsection name="Performing the release">
<p>
The release is performed directly from source control. So while you can run it from an existing checkout
to pick up it's SCM URL, it is not necessary and can be run like a checkout:
</p>
<source>maven scm:perform-release -Dmaven.scm.url=scm:cvs:local:/cvs/root:module -Dmaven.scm.tag=RELEASE_1_0</source>
<p>
You will be prompted for the tag and goals if they are not specified. The goals you give are what are
required to deploy the release - the SCM side is all taken care of. For example, you might select to run
the goals:
</p>
<source>jar:deploy,site:deploy</source>
<p>
After prompting, <code>scm:perform-release</code> checks out a clean copy of the code from the tag, and
runs the goals selected on the clean copy.
</p>
</subsection>
</section>
</body>
</document>

70
scm/xdocs/scmurl.xml Normal file
View File

@ -0,0 +1,70 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>SCM URL Format</title>
<author email="brett@apache.org">Brett Porter</author>
</properties>
<!-- TODO: move to SCM documentation -->
<body>
<section name="SCM URL Format">
<p>
The SCM URL is used to provide any necessary information to connect to your
source control system. It is much like a JDBC connection URL.
</p>
<p>
The format is as follows:
</p>
<source>scm:&lt;provider&gt;[:&lt;provider specific connection string&gt;]</source>
<p>
The available providers and their particular connection strings are listed below.
</p>
<subsection name="CVS">
<p>
The full connection string for CVS is as follows:
</p>
<source>scm:cvs:&lt;protocol&gt;[:&lt;host&gt;]:&lt;CVS root&gt;:&lt;CVS module&gt;</source>
<p>
For example:
</p>
<source>
scm:cvs:pserver:anoncvs@cvs.apache.org:/cvs/root:module
scm:cvs:ext:username@cvs.apache.org:/cvs/root:module
scm:cvs:local:/cvs/root:module</source>
</subsection>
<subsection name="Subversion">
<p>
The full connection string for Subversion is as follows:
</p>
<source>scm:svn:&lt;url&gt;</source>
<p>
For example:
</p>
<source>
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>
</section>
</body>
</document>