You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/07/22 00:43:51 UTC

svn commit: r1149397 - in /maven/plugins/branches/maven-site-plugin-3.x/src: it/site-attach-descriptor/ it/site-attach-descriptor/child/ it/site-attach-descriptor/child/src/ it/site-attach-descriptor/child/src/site/ main/java/org/apache/maven/plugins/s...

Author: hboutemy
Date: Thu Jul 21 22:43:49 2011
New Revision: 1149397

URL: http://svn.apache.org/viewvc?rev=1149397&view=rev
Log:
[MSITE-597] do attach-descriptor job only for pom packaging by default

Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml   (with props)
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/goals.txt
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/verify.bsh
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java
    maven/plugins/branches/maven-site-plugin-3.x/src/site/apt/maven-3.apt.vm

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml?rev=1149397&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml Thu Jul 21 22:43:49 2011
@@ -0,0 +1,36 @@
+<!--
+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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.plugins.site.its</groupId>
+    <artifactId>site-attach-descriptor</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>jar-site-attach-descriptor</artifactId>
+  <packaging>jar</packaging>
+
+  <name>site-attach-descriptor IT for jar</name>
+  <description>the site descriptor should not be attached: only when packaging = pom, see http://jira.codehaus.org/browse/MSITE-597</description>
+</project>

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml?rev=1149397&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml Thu Jul 21 22:43:49 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<!--
+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 name="MSITE-597" xmlns="http://maven.apache.org/DECORATION/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+</project>

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/child/src/site/site.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/goals.txt?rev=1149397&r1=1149396&r2=1149397&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/goals.txt (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/goals.txt Thu Jul 21 22:43:49 2011
@@ -1 +1 @@
-clean site:attach-descriptor deploy
\ No newline at end of file
+clean deploy
\ No newline at end of file

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/pom.xml?rev=1149397&r1=1149396&r2=1149397&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/pom.xml Thu Jul 21 22:43:49 2011
@@ -29,6 +29,10 @@ under the License.
 
   <name>site-attach-descriptor IT</name>
 
+  <modules>
+    <module>child</module>
+  </modules>
+
   <properties>
     <currentVersion>2.0.7</currentVersion>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -83,4 +87,31 @@ under the License.
       </plugin>
     </plugins>
   </reporting>
+
+  <profiles>
+    <profile>
+      <id>maven-3</id>
+      <activation>
+        <file>
+          <!--  This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
+          <exists>${basedir}</exists>
+        </file>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-site-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-descriptor</id>
+                <goals>
+                  <goal>attach-descriptor</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/verify.bsh?rev=1149397&r1=1149396&r2=1149397&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/verify.bsh (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/site-attach-descriptor/verify.bsh Thu Jul 21 22:43:49 2011
@@ -47,20 +47,41 @@ try
     }
 
 
-    File artifactsDirectory = new File( target, "snapshot-repo/org/apache/maven/plugins/site/its/site-attach-descriptor/1.0-SNAPSHOT");
+    File artifactsDirectory = new File( target, "snapshot-repo/org/apache/maven/plugins/site/its/site-attach-descriptor/1.0-SNAPSHOT" );
+    boolean pomSiteDescriptor = false;
     File[] files = artifactsDirectory.listFiles();
-    for (int i = 0; i < files.length; i++)
+    for ( int i = 0; i < files.length; i++ )
     {
-        //site-attach-descriptor-1.0-20090823.204852-1-site.xml
-        if (files[i].getName().startsWith( "site-attach-descriptor-1.0" ) && files[i].getName().endsWith( "-site.xml" ) )
+        String name = files[i].getName();
+        // site-attach-descriptor-1.0-20090823.204852-1-site.xml
+        if ( name.endsWith( "-site.xml" ) )
         {
-            return true;
-        }
+	        pomSiteDescriptor = pomSiteDescriptor || name.startsWith( "site-attach-descriptor-1.0" );
+	    }
+    }
+    if ( !pomSiteDescriptor )
+    {
+        System.err.println( "site descriptor not deployed for pom packaging." );
+        return false;
     }
-    System.err.println( "site descriptor not deployed." );
-    return false;
-
 
+    artifactsDirectory = new File( target, "snapshot-repo/org/apache/maven/plugins/site/its/jar-site-attach-descriptor/1.0-SNAPSHOT" );
+    boolean jarSiteDescriptor = false;
+    files = artifactsDirectory.listFiles();
+    for ( int i = 0; i < files.length; i++ )
+    {
+        String name = files[i].getName();
+        // jar-site-attach-descriptor-1.0-20090823.204852-1-site.xml
+        if ( name.endsWith( "-site.xml" ) )
+        {
+	        jarSiteDescriptor = jarSiteDescriptor || name.startsWith( "jar-site-attach-descriptor-1.0" );
+	    }
+    }
+    if ( jarSiteDescriptor )
+    {
+        System.err.println( "site descriptor deployed for jar packaging." );
+        return false;
+    }
 }
 catch ( IOException e )
 {

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java?rev=1149397&r1=1149396&r2=1149397&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java Thu Jul 21 22:43:49 2011
@@ -32,6 +32,8 @@ import org.codehaus.plexus.util.FileUtil
 
 /**
  * Adds the site descriptor (<code>site.xml</code>) to the list of files to be installed/deployed.
+ * By default, this is enabled only when the project has pom packaging since it will be used by modules inheriting,
+ * but this can be enabled for other projects packaging if needed.
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
@@ -57,9 +59,20 @@ public class SiteDescriptorAttachMojo
      */
     private MavenProjectHelper projectHelper;
 
+    /**
+     * @parameter default-value="true"
+     */
+    private boolean pomPackagingOnly;
+
     public void execute()
         throws MojoExecutionException
     {
+        if ( pomPackagingOnly && !"pom".equals( project.getPackaging() ) )
+        {
+            // http://jira.codehaus.org/browse/MSITE-597
+            return;
+        }
+
         List<Locale> localesList = siteTool.getAvailableLocales( locales );
 
         for ( Locale locale : localesList )

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/site/apt/maven-3.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/site/apt/maven-3.apt.vm?rev=1149397&r1=1149396&r2=1149397&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/site/apt/maven-3.apt.vm (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/site/apt/maven-3.apt.vm Thu Jul 21 22:43:49 2011
@@ -217,9 +217,7 @@ Maven Site Plugin with Maven 3.x
   </profiles>
 +-----+
 
-~~ Questions:
-~~ - should we promote adding this goal without profile? (ie. no conflict/duplicate with default binding when under Maven 2.2?)
-~~ - should the attach-descriptor goal activate only if pom packaging? to avoid site.xml deployment for jars, which won't be used later AFAIK
+ Notice: the profile is needed to avoid duplicate install and deploy under Maven 2.2 due to pom default lifecycle mapping
 
 * Using maven-site-plugin 2.x with Maven 2.x and maven-site-plugin 3.x with Maven 3.x