You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2010/01/27 15:42:14 UTC

svn commit: r903662 - in /maven/release/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/ site/apt/ site/apt/examples/

Author: brett
Date: Wed Jan 27 14:42:14 2010
New Revision: 903662

URL: http://svn.apache.org/viewvc?rev=903662&view=rev
Log:
[MRELEASE-3] release:prepare should not require multimodule artifacts to be in the local repository
Reverted addition of @requiresDependencyResolution as discussed in <4B...@udo.edu>, and created a new class to facilitate the usecase in MRELEASE-240

Added:
    maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java
Modified:
    maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
    maven/release/trunk/maven-release-plugin/src/site/apt/examples/prepare-release.apt
    maven/release/trunk/maven-release-plugin/src/site/apt/index.apt

Modified: maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java?rev=903662&r1=903661&r2=903662&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java (original)
+++ maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java Wed Jan 27 14:42:14 2010
@@ -38,7 +38,6 @@
  * @version $Id$
  * @aggregator
  * @goal prepare
- * @requiresDependencyResolution test
  * @todo [!] check how this works with version ranges
  */
 public class PrepareReleaseMojo
@@ -53,7 +52,7 @@
     private boolean resume;
 
     /**
-     * Whether to generate <code>release-pom.xml</code> files that contain resolved information about the project.
+     * @deprecated Please use release:prepare-with-pom instead.
      *
      * @parameter default-value="false" expression="${generateReleasePoms}"
      */
@@ -173,6 +172,19 @@
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+        if ( generateReleasePoms )
+        {
+            throw new MojoFailureException(
+                "Generating release POMs is no longer supported in release:prepare. Please run release:prepare-with-pom instead." );
+        }
+
+        prepareRelease( generateReleasePoms );
+    }
+
+    protected void prepareRelease( boolean generateReleasePoms )
+        throws MojoExecutionException, MojoFailureException
+    {
+        // this is here so the subclass can call it without getting the extra generateReleasePoms check in execute() above
         super.execute();
 
         ReleaseDescriptor config = createReleaseDescriptor();

Added: maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java?rev=903662&view=auto
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java (added)
+++ maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareWithPomReleaseMojo.java Wed Jan 27 14:42:14 2010
@@ -0,0 +1,50 @@
+package org.apache.maven.plugins.release;
+
+/*
+ * 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.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Prepare for a release in SCM, fully resolving dependencies for the purpose of producing a "release POM".
+ * For more info see <a href="/plugins/maven-release-plugin/examples/prepare-release.html">this example</a>.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @aggregator
+ * @goal prepare-with-pom
+ * @requiresDependencyResolution test
+ * @since 2.0
+ */
+public class PrepareWithPomReleaseMojo
+    extends PrepareReleaseMojo
+{
+    /**
+     * Whether to generate <code>release-pom.xml</code> files that contain resolved information about the project.
+     *
+     * @parameter default-value="true" expression="${generateReleasePoms}"
+     */
+    private boolean generateReleasePoms;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        prepareRelease( generateReleasePoms );
+    }
+}

Modified: maven/release/trunk/maven-release-plugin/src/site/apt/examples/prepare-release.apt
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/site/apt/examples/prepare-release.apt?rev=903662&r1=903661&r2=903662&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/site/apt/examples/prepare-release.apt (original)
+++ maven/release/trunk/maven-release-plugin/src/site/apt/examples/prepare-release.apt Wed Jan 27 14:42:14 2010
@@ -80,3 +80,17 @@
   If you prefer that every module gets the same version as the parent POM,
   you can set the option <<<autoVersionSubmodules>>> to <<<true>>>. Now you will
   be asked only once for the release version and the next development version.
+
+* Generating release POMs
+
+  It is possible to generate a <<<release-pom.xml>>> file for each project that contains the fully resolved project used
+  at release time as a record for later. As of the 2.0 release, this requires calling an alternate goal:
+
+---
+mvn release:prepare-with-pom
+---
+
+  This goal is equivalent to the <<<release:prepare>>> goal, except that it requires a previous build of the project to
+  exist to properly populate the <<<release-pom.xml>>> files.
+
+

Modified: maven/release/trunk/maven-release-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/site/apt/index.apt?rev=903662&r1=903661&r2=903662&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/site/apt/index.apt (original)
+++ maven/release/trunk/maven-release-plugin/src/site/apt/index.apt Wed Jan 27 14:42:14 2010
@@ -36,6 +36,9 @@
 
   * {{{./prepare-mojo.html}release:prepare}} Prepare for a release in SCM.
 
+  * {{{./prepare-with-pom-mojo.html}release:prepare-with-pom}} Prepare for a release in SCM, and generate release POMs
+    that record the fully resolved projects used.
+
   * {{{./rollback-mojo.html}release:rollback}} Rollback a previous release.
 
   * {{{./perform-mojo.html}release:perform}} Perform a release from SCM.