You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2008/03/13 00:22:26 UTC

svn commit: r636572 - in /maven/plugins/trunk/maven-deploy-plugin: ./ src/it/ src/it/mdeploy-45-test/ src/it/mdeploy-45-test/src/ src/it/mdeploy-45-test/src/main/ src/it/mdeploy-45-test/src/main/java/ src/it/mdeploy-45-test/src/main/resources/ src/it/m...

Author: olamy
Date: Wed Mar 12 16:22:24 2008
New Revision: 636572

URL: http://svn.apache.org/viewvc?rev=636572&view=rev
Log:
[MDEPLOY-45] Classifier not supported by deploy:deploy
deploy plugin failed when a project doesn't primary but only attached artifacts.
Patch Submitted by Fabian Bauschulte
It submitted by Daniel Schulz

Added:
    maven/plugins/trunk/maven-deploy-plugin/src/it/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt   (with props)
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml   (with props)
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/java/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt   (with props)
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml   (with props)
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html   (with props)
    maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-deploy-plugin/pom.xml
    maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java

Modified: maven/plugins/trunk/maven-deploy-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/pom.xml?rev=636572&r1=636571&r2=636572&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-deploy-plugin/pom.xml Wed Mar 12 16:22:24 2008
@@ -84,4 +84,71 @@
       </plugin>
     </plugins>
   </build>
+  <profiles>
+    <profile>
+      <id>integration-tests</id>
+      <activation>
+        <property>
+          <name>skipTests</name>
+          <value>!true</value>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-install-plugin</artifactId>
+            <version>2.2</version>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <phase>pre-integration-test</phase>
+                <goals>
+                  <goal>install-file</goal>
+                </goals>
+                <configuration>
+                  <file>${project.build.directory}/${project.build.finalName}.jar</file>
+                  <groupId>${project.groupId}</groupId>
+                  <artifactId>${project.artifactId}</artifactId>
+                  <version>${project.version}</version>
+                  <packaging>${project.packaging}</packaging>
+                  <pomFile>${basedir}/pom.xml</pomFile>
+                  <createChecksum>true</createChecksum>
+                  <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+                  <localRepositoryId>it-local-repo</localRepositoryId>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <version>1.1</version>
+            <configuration>
+              <projectsDirectory>src/it</projectsDirectory>
+              <pomIncludes>
+                <pomInclude>**/**/pom.xml</pomInclude>
+              </pomIncludes>
+              <postBuildHookScript>verify.bsh</postBuildHookScript>
+              <localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath>
+              <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
+              <goals>
+                <goal>clean</goal>
+                <goal>package</goal>
+              </goals>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <phase>integration-test</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>  
 </project>

Added: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt?rev=636572&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt Wed Mar 12 16:22:24 2008
@@ -0,0 +1 @@
+clean deploy
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/goals.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml?rev=636572&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml Wed Mar 12 16:22:24 2008
@@ -0,0 +1,48 @@
+<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.codehaus.jira.testprojects</groupId>
+	<artifactId>mdeploy45-webui</artifactId>
+	<name>sample web project with classified artifact output</name>
+	<url>http://jira.codehaus.org/browse/MDEPLOY-45</url>
+	<version>0.1-SNAPSHOT</version>
+	<packaging>war</packaging>
+	<properties>
+	 <mdp45.artifact.classifier>mdp45</mdp45.artifact.classifier>
+	</properties>
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-deploy-plugin</artifactId>
+        <!--version>@pom.version@</version-->
+        <version>2.4-SNAPSHOT</version>
+				<configuration>
+			    <!-- because i don't know your distribution management, deployments will be written to ${basedir}/target -->
+					<altDeploymentRepository>mine::default::file://${basedir}/target</altDeploymentRepository>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-war-plugin</artifactId>
+        <!--version>2.1-alpha-2-SNAPSHOT</version-->
+        <version>2.0.2</version>
+				<configuration>
+				 <!-- this will cause an error  -->
+					<classifier>${mdp45.artifact.classifier}</classifier>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<distributionManagement>
+		<repository>
+			<id>repo1</id>
+			<name>Maven Central Repository</name>
+			<url>scp://foo.org/m2/release</url>
+		</repository>
+		<snapshotRepository>
+			<id>repo1</id>
+			<name>Maven Central Repository</name>
+			<url>scp://foo.org/m2/snapshot</url>
+		</snapshotRepository>
+	</distributionManagement>
+</project>

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt?rev=636572&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt Wed Mar 12 16:22:24 2008
@@ -0,0 +1,2 @@
+nothing to see here
+

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/resources/foo.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml?rev=636572&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml Wed Mar 12 16:22:24 2008
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+	<display-name>mdeploy-45-test</display-name>
+	<welcome-file-list>
+		<welcome-file>index.html</welcome-file>
+	</welcome-file-list>
+</web-app>

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html?rev=636572&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html Wed Mar 12 16:22:24 2008
@@ -0,0 +1,7 @@
+<html>
+<head>
+</head>
+<body>
+<span style="font-size: 72pt">MDEPLOY-45 Test Web Application</span>
+</body>
+</html>

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/verify.bsh?rev=636572&view=auto
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/verify.bsh (added)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/verify.bsh Wed Mar 12 16:22:24 2008
@@ -0,0 +1,51 @@
+
+/*
+ * 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 java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or not a directory." );
+        return false;
+    }
+    
+    File deployedFile = new File ( target, "org/codehaus/jira/testprojects/mdeploy45-webui/0.1-SNAPSHOT/mdeploy45-webui-0.1-SNAPSHOT-mdp45.war" );
+    if ( !deployedFile.exists() || deployedFile.isDirectory() )
+    {
+        System.err.println( "deployedFile file is missing or a directory." );
+        return false;
+    }    
+        
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/verify.bsh
------------------------------------------------------------------------------
    svn:executable = *

Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=636572&r1=636571&r2=636572&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java Wed Mar 12 16:22:24 2008
@@ -167,12 +167,20 @@
             else
             {
                 File file = artifact.getFile();
-                if ( file == null )
+
+                if ( file != null && !file.isDirectory() )
+                {
+                    getDeployer().deploy( file, artifact, repo, getLocalRepository() );
+                }
+                else if ( !attachedArtifacts.isEmpty() )
+                {
+                    getLog().info( "No primary artifact to deploy, deploy attached artifacts instead." );
+                }
+                else
                 {
                     throw new MojoExecutionException(
                                                       "The packaging for this project did not assign a file to the build artifact" );
                 }
-                getDeployer().deploy( file, artifact, repo, getLocalRepository() );
             }
 
             for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )