Author: gboue
Date: Mon Jan  9 01:21:56 2017
New Revision: 1777925

URL: http://svn.apache.org/viewvc?rev=1777925&view=rev
Log:
[MRELEASE-976] release:branch should also support project version policies

Adding parameter projectVersionPolicyId to the branch and update-versions 
goals. The ITs are done by creating a stub version policy that switches between 
snapshot and release and testing that it is possible to invoke release:branch, 
release:update-versions and release:prepare on a sample project with this 
custom policy. This closes #9.

Added:
    
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/
    
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/
    
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/
    
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml
   (with props)
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/
    
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java
   (with props)
Modified:
    
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
    
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.release.it</groupId>
+  <artifactId>mrelease-976</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <url>https://issues.apache.org/jira/browse/MRELEASE-976</url>
+  <description>Tests that release:branch supports setting a custom 
projectVersionPolicyId</description>
+  <scm>
+    <connection>scm:dummy|nul</connection>
+    <developerConnection>scm:dummy|nul</developerConnection>
+  </scm>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <branchName>branch-mrelease-976</branchName>
+          <projectVersionPolicyId>StubVersionPolicy</projectVersionPolicyId>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.maven.its.release</groupId>
+            <artifactId>maven-scm-provider-dummy</artifactId>
+            <version>1.0</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.maven.its.release</groupId>
+            <artifactId>maven-project-version-stub-policy</artifactId>
+            <version>1.0</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,28 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
+assert project.version.text() == "1.0-SNAPSHOT"
+
+// verifies that the version is unchanged because of the custom policy: 
1.0-SNAPSHOT -> 1.0-SNAPSHOT
+def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) )
+assert projectNext.version.text() == "1.0-SNAPSHOT"
+
+return true

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/branch/MRELEASE-976/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.release.it</groupId>
+  <artifactId>mrelease-976</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <url>https://issues.apache.org/jira/browse/MRELEASE-976</url>
+  <description>Tests that release:prepare supports setting a custom 
projectVersionPolicyId</description>
+  <scm>
+    <connection>scm:dummy|nul</connection>
+    <developerConnection>scm:dummy|nul</developerConnection>
+  </scm>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <projectVersionPolicyId>StubVersionPolicy</projectVersionPolicyId>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.maven.its.release</groupId>
+            <artifactId>maven-scm-provider-dummy</artifactId>
+            <version>1.0</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.maven.its.release</groupId>
+            <artifactId>maven-project-version-stub-policy</artifactId>
+            <version>1.0</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,30 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
+assert project.version.text() == "1.0-SNAPSHOT"
+
+def projectTag = new XmlSlurper().parse( new File( basedir, "pom.xml.tag" ) )
+assert projectTag.version.text() == "1.0"
+
+def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) )
+assert projectNext.version.text() == "1.0-SNAPSHOT"
+
+return true

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.release.it</groupId>
+  <artifactId>mrelease-976</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <url>https://issues.apache.org/jira/browse/MRELEASE-976</url>
+  <description>Tests that release:update-versions supports setting a custom 
projectVersionPolicyId</description>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <projectVersionPolicyId>StubVersionPolicy</projectVersionPolicyId>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.maven.its.release</groupId>
+            <artifactId>maven-project-version-stub-policy</artifactId>
+            <version>1.0</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,25 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+// verifies that the version is unchanged because of the custom policy: 
1.0-SNAPSHOT -> 1.0 -> 1.0-SNAPSHOT
+def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
+assert project.version.text() == "1.0-SNAPSHOT"
+
+return true

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+invoker.goals = install

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.release</groupId>
+  <artifactId>maven-project-version-stub-policy</artifactId>
+  <version>1.0</version>
+
+  <name>Maven Release Stub Policy</name>
+  <description>
+    Provides a project version policy that switches between snapshot and 
release version.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.release</groupId>
+      <artifactId>maven-release-manager</artifactId>
+      <version>@project.version@</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-component-metadata</artifactId>
+        <version>1.6</version>
+        <executions>
+          <execution>
+            <id>process-classes</id>
+            <goals>
+              <goal>generate-metadata</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java?rev=1777925&view=auto
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java
 (added)
+++ 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java
 Mon Jan  9 01:21:56 2017
@@ -0,0 +1,45 @@
+package org.apache.maven.shared.release.policy.stub;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.shared.release.policy.version.VersionPolicy;
+import org.apache.maven.shared.release.policy.version.VersionPolicyRequest;
+import org.apache.maven.shared.release.policy.version.VersionPolicyResult;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * A {@link VersionPolicy} implementation that switches continously between 
shapsnot and release version.
+ */
+@Component( role = VersionPolicy.class, hint = "StubVersionPolicy" )
+public final class StubVersionPolicy
+    implements VersionPolicy
+{
+
+    public VersionPolicyResult getReleaseVersion( VersionPolicyRequest request 
)
+    {
+        return new VersionPolicyResult().setVersion( 
request.getVersion().replace( "-SNAPSHOT", "" ) );
+    }
+
+    public VersionPolicyResult getDevelopmentVersion( VersionPolicyRequest 
request )
+    {
+        return new VersionPolicyResult().setVersion( 
request.getVersion().replace( "-SNAPSHOT", "" ) + "-SNAPSHOT" );
+    }
+
+}

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/release/trunk/maven-release-plugin/src/it/setup/maven-project-version-stub-policy/src/main/java/org/apache/maven/shared/release/policy/stub/StubVersionPolicy.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java?rev=1777925&r1=1777924&r2=1777925&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
 Mon Jan  9 01:21:56 2017
@@ -192,6 +192,14 @@ public class BranchReleaseMojo
     private String developmentVersion;
 
     /**
+     * The role-hint for the VersionPolicy implementation used to calculate 
the project versions.
+     *
+     * @since 3.0.0
+     */
+    @Parameter( defaultValue = "default", property = "projectVersionPolicyId" )
+    private String projectVersionPolicyId;
+
+    /**
      * {@inheritDoc}
      */
     public void execute()
@@ -214,6 +222,7 @@ public class BranchReleaseMojo
         config.setDefaultReleaseVersion( releaseVersion );
         config.setDefaultDevelopmentVersion( developmentVersion );
         config.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeBranch 
);
+        config.setProjectVersionPolicyId( projectVersionPolicyId );
 
         // Create a config containing values from the session properties (ie 
command line properties with cli).
         ReleaseDescriptor sysPropertiesConfig

Modified: 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java?rev=1777925&r1=1777924&r2=1777925&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java
 Mon Jan  9 01:21:56 2017
@@ -88,7 +88,15 @@ public class UpdateVersionsMojo
      */
     @Parameter( defaultValue = "false", property = "useEditMode" )
     private boolean useEditMode;
-    
+
+    /**
+     * The role-hint for the VersionPolicy implementation used to calculate 
the project versions.
+     *
+     * @since 3.0.0
+     */
+    @Parameter( defaultValue = "default", property = "projectVersionPolicyId" )
+    private String projectVersionPolicyId;
+
     /**
      * {@inheritDoc}
      */
@@ -101,6 +109,7 @@ public class UpdateVersionsMojo
         config.setDefaultDevelopmentVersion( developmentVersion );
         config.setScmUseEditMode( useEditMode );
         config.setUpdateDependencies( updateDependencies );
+        config.setProjectVersionPolicyId( projectVersionPolicyId );
 
         Map<String, Scm> originalScmInfo = new HashMap<String, Scm>();
         originalScmInfo.put( ArtifactUtils.versionlessKey( 
project.getGroupId(), project.getArtifactId() ),


Reply via email to