Author: rfscholte
Date: Tue Jan 12 21:20:47 2016
New Revision: 1724326
URL: http://svn.apache.org/viewvc?rev=1724326&view=rev
Log:
[MDEPLOY-205] MavenProject with only attachments must have packaging "pom"
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/invoker.properties
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/verify.groovy
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/invoker.properties
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/verify.groovy
Removed:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/verify.bsh
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/verify.bsh
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/pom.xml
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
Modified: 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=1724326&r1=1724325&r2=1724326&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml
(original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/mdeploy-45-test/pom.xml Tue
Jan 12 21:20:47 2016
@@ -25,11 +25,12 @@ under the License.
<groupId>org.apache.maven.its.deploy.45</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
- <packaging>war</packaging>
+ <!-- war to pom, see MDEPLOY-205 -->
+ <packaging>pom</packaging>
<name>MDEPLOY-45</name>
<description>sample web project with classified artifact output</description>
- <url>http://jira.codehaus.org/browse/MDEPLOY-45</url>
+ <url>https://issues.apache.org/jira/browse/MDEPLOY-45</url>
<properties>
<mdp45.artifact.classifier>mdp45</mdp45.artifact.classifier>
@@ -51,21 +52,42 @@ under the License.
<build>
<plugins>
<plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>@project.version@</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>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.5</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
<!-- this will cause an error -->
<classifier>${mdp45.artifact.classifier}</classifier>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>@project.version@</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>
</plugins>
</build>
</project>
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/invoker.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/invoker.properties?rev=1724326&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/invoker.properties
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/invoker.properties
Tue Jan 12 21:20:47 2016
@@ -0,0 +1,17 @@
+# 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.buildResult=failure
\ No newline at end of file
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/pom.xml?rev=1724326&r1=1724325&r2=1724326&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/pom.xml
(original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/pom.xml
Tue Jan 12 21:20:47 2016
@@ -25,6 +25,7 @@ under the License.
<groupId>org.apache.maven.its.deploy.nma1</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
+ <!-- jar to pom, see MDEPLOY-205 -->
<packaging>jar</packaging>
<description>
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/verify.groovy
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/verify.groovy?rev=1724326&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/verify.groovy
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-1/verify.groovy
Tue Jan 12 21:20:47 2016
@@ -0,0 +1,23 @@
+/*
+ * 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 buildLog = new File ( basedir, "build.log")
+
+assert buildLog.text.contains( "The packaging plugin for this project did not
assign "
+ + "a main file to the project but it has
attachments. Change packaging to 'pom'." )
\ No newline at end of file
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/invoker.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/invoker.properties?rev=1724326&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/invoker.properties
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/invoker.properties
Tue Jan 12 21:20:47 2016
@@ -0,0 +1,17 @@
+# 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.buildResult=failure
\ No newline at end of file
Added:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/verify.groovy
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/verify.groovy?rev=1724326&view=auto
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/verify.groovy
(added)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-2/verify.groovy
Tue Jan 12 21:20:47 2016
@@ -0,0 +1,23 @@
+/*
+ * 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 buildLog = new File ( basedir, "build.log")
+
+assert buildLog.text.contains( "The packaging plugin for this project did not
assign "
+ + "a main file to the project but it has
attachments. Change packaging to 'pom'." )
\ No newline at end of file
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml?rev=1724326&r1=1724325&r2=1724326&view=diff
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
(original)
+++
maven/plugins/trunk/maven-deploy-plugin/src/it/no-main-artifact-snapshot/pom.xml
Tue Jan 12 21:20:47 2016
@@ -25,7 +25,7 @@ under the License.
<groupId>org.apache.maven.its.deploy.nmas</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
+ <packaging>pom</packaging>
<description>
Tests the deployment of a snapshot for a project that has no main artifact
file but only attached artifacts
@@ -49,6 +49,13 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -59,6 +66,13 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
<classifier>it</classifier>
</configuration>
@@ -72,11 +86,13 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java?rev=1724326&r1=1724325&r2=1724326&view=diff
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
(original)
+++
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
Tue Jan 12 21:20:47 2016
@@ -54,6 +54,7 @@ import org.apache.maven.plugins.annotati
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
+import org.apache.maven.project.ProjectBuildingHelper;
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
import org.apache.maven.shared.repository.RepositoryManager;
@@ -215,6 +216,9 @@ public class DeployFileMojo
@Component
private RepositoryManager repoManager;
+ @Component
+ private ProjectBuildingHelper projectBuildingHelper;
+
void initProperties()
throws MojoExecutionException
{
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java?rev=1724326&r1=1724325&r2=1724326&view=diff
==============================================================================
---
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
(original)
+++
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
Tue Jan 12 21:20:47 2016
@@ -235,26 +235,13 @@ public class DeployMojo
}
else if ( !attachedArtifacts.isEmpty() )
{
- getLog().info( "No primary artifact to deploy, deploying
attached artifacts instead." );
-
- Artifact pomArtifact =
- artifactFactory.createProjectArtifact(
artifact.getGroupId(), artifact.getArtifactId(),
-
artifact.getBaseVersion() );
- pomArtifact.setFile( pomFile );
- if ( request.isUpdateReleaseInfo() )
- {
- pomArtifact.setRelease( true );
- }
-
- deployableArtifacts.add( pomArtifact );
-
- // propagate the timestamped version to the main artifact
for the attached artifacts to pick it up
- artifact.setResolvedVersion( pomArtifact.getVersion() );
+ throw new MojoExecutionException( "The packaging plugin
for this project did not assign "
+ + "a main file to the project but it has
attachments. Change packaging to 'pom'." );
}
else
{
- String message = "The packaging for this project did not
assign a file to the build artifact";
- throw new MojoExecutionException( message );
+ throw new MojoExecutionException( "The packaging for this
project did not assign "
+ + "a file to the build artifact" );
}
}