MDEPLOY-202: deploy-file goal insists on deploying source file for previous deploy-file execution
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1709276 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.equinox.common.source_1.0.jar b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.equinox.common.source_1.0.jar
new file mode 100644
index 0000000..2fa3a24
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.equinox.common.source_1.0.jar
Binary files differ
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.equinox.common_1.0.jar b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.equinox.common_1.0.jar
new file mode 100644
index 0000000..2fa3a24
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.equinox.common_1.0.jar
Binary files differ
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.osgi.source_1.0.jar b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.osgi.source_1.0.jar
new file mode 100644
index 0000000..2fa3a24
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.osgi.source_1.0.jar
Binary files differ
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.osgi_1.0.jar b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.osgi_1.0.jar
new file mode 100644
index 0000000..2fa3a24
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/lib/org.eclipse.osgi_1.0.jar
Binary files differ
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/pom.xml b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/pom.xml
new file mode 100644
index 0000000..d52e448
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/pom.xml
@@ -0,0 +1,100 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mdeploy-170</groupId>
+ <artifactId>configperproject</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <description>
+ Tests file deployment with multiple execution blocks
+ </description>
+
+ <url>https://issues.apache.org/jira/browse/MDEPLOY-202</url>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+
+ <downloaded>lib</downloaded>
+ <org.eclipse.osgi>1.0</org.eclipse.osgi>
+ <org.eclipse.equinox.common>1.0</org.eclipse.equinox.common>
+ </properties>
+
+ <distributionManagement>
+ <repository>
+ <id>it</id>
+ <url>file:///${basedir}/target/repo</url>
+ <uniqueVersion>false</uniqueVersion>
+ </repository>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <url>file:target/repo</url>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>deploy-equinox-snapshots</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy-osgi</id>
+ <goals>
+ <goal>deploy-file</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <file>${downloaded}/org.eclipse.osgi_${org.eclipse.osgi}.jar</file>
+ <sources>${downloaded}/org.eclipse.osgi.source_${org.eclipse.osgi}.jar</sources>
+ <pomFile>${project.build.outputDirectory}/org.eclipse.osgi.pom</pomFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>deploy-equinox-common</id>
+ <goals>
+ <goal>deploy-file</goal>
+ </goals>
+ <phase>deploy</phase>
+ <configuration>
+ <file>${downloaded}/org.eclipse.equinox.common_${org.eclipse.equinox.common}.jar</file>
+ <sources>${downloaded}/org.eclipse.equinox.common.source_${org.eclipse.equinox.common}.jar</sources>
+ <pomFile>${project.build.outputDirectory}/org.eclipse.equinox.common.pom</pomFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/target/classes/org.eclipse.equinox.common.pom b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/target/classes/org.eclipse.equinox.common.pom
new file mode 100644
index 0000000..f3fbaf9
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/target/classes/org.eclipse.equinox.common.pom
@@ -0,0 +1,20 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.deploy.it</groupId>
+ <artifactId>org.eclipse.equinox.common</artifactId>
+ <version>1.0</version>
+</project>
\ No newline at end of file
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/target/classes/org.eclipse.osgi.pom b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/target/classes/org.eclipse.osgi.pom
new file mode 100644
index 0000000..a5054d4
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/target/classes/org.eclipse.osgi.pom
@@ -0,0 +1,20 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.deploy.it</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>1.0</version>
+</project>
\ No newline at end of file
diff --git a/src/it/MDEPLOY-202_deployfile-with-multiple-executions/verify.groovy b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/verify.groovy
new file mode 100644
index 0000000..119b938
--- /dev/null
+++ b/src/it/MDEPLOY-202_deployfile-with-multiple-executions/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * 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 1 == buildLog.text.count( 'Uploading: file:target/repo/org/apache/maven/plugins/deploy/it/org.eclipse.osgi/1.0/org.eclipse.osgi-1.0-sources.jar')
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java b/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java
index 29ca1a5..c1b93a4 100644
--- a/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java
@@ -155,7 +155,7 @@
+ retryFailedDeploymentCounter );
}
- getDeployer().deploy( session.getProjectBuildingRequest(), artifacts );
+ getDeployer().deploy( session.getProjectBuildingRequest(), deploymentRepository, artifacts );
exception = null;
break;
}
diff --git a/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java b/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
index ff3552f..2afb7ba 100644
--- a/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
@@ -373,12 +373,22 @@
if ( sources != null )
{
- projectHelper.attachArtifact( project, "jar", "sources", sources );
+ Artifact sourcesArtifact =
+ artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, "jar", "sources" );
+
+ sourcesArtifact.setFile( sources );
+
+ deployableArtifacts.add( sourcesArtifact );
}
if ( javadoc != null )
{
- projectHelper.attachArtifact( project, "jar", "javadoc", javadoc );
+ Artifact javadocArtifact =
+ artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, "jar", "javadoc" );
+
+ javadocArtifact.setFile( javadoc );
+
+ deployableArtifacts.add( javadocArtifact );
}
if ( files != null )
diff --git a/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java b/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java
index 5694b5c..32c4345 100644
--- a/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java
+++ b/src/test/java/org/apache/maven/plugin/deploy/stubs/ArtifactDeployerStub.java
@@ -22,6 +22,7 @@
import java.util.Collection;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.shared.artifact.deploy.ArtifactDeployer;
import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException;
@@ -36,4 +37,11 @@
{
// does nothing
}
+
+ @Override
+ public void deploy( ProjectBuildingRequest arg0, ArtifactRepository arg1, Collection<Artifact> arg2 )
+ throws ArtifactDeployerException
+ {
+ // does nothing
+ }
}