Author: ilgrosso
Date: Thu Jan 15 07:40:33 2015
New Revision: 1651960
URL: http://svn.apache.org/r1651960
Log:
[COCOON-2343] Applying provided patch
Modified:
cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
Modified: cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java?rev=1651960&r1=1651959&r2=1651960&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java (original)
+++ cocoon/subprojects/cocoon-maven-plugin/trunk/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java Thu Jan 15 07:40:33 2015
@@ -16,16 +16,6 @@
*/
package org.apache.cocoon.maven.deployer;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
import org.apache.cocoon.maven.deployer.monolithic.DeploymentException;
import org.apache.cocoon.maven.deployer.monolithic.RuleBasedZipExtractor;
import org.apache.cocoon.maven.deployer.monolithic.XPatchDeployer;
@@ -42,6 +32,12 @@ import org.apache.maven.plugin.war.Abstr
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.MavenMetadataSource;
+import java.io.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
/**
* Create a Cocoon web application based on a block deployment descriptor.
*
@@ -230,7 +226,7 @@ public abstract class AbstractDeployMojo
Map files = new HashMap();
for (Iterator it = project.getArtifacts().iterator(); it.hasNext();) {
Artifact artifact = (Artifact) it.next();
- String id = artifact.getArtifactId();
+ String id = retrieveId(artifact);
if (files.containsKey(id)) {
// Now search for all artifacts and print their dependency trail
StringBuffer msg = new StringBuffer("There are at least two artifacts with the ID '");
@@ -239,7 +235,7 @@ public abstract class AbstractDeployMojo
msg.append(SystemUtils.LINE_SEPARATOR);
for (Iterator ai = project.getArtifacts().iterator(); ai.hasNext();) {
final Artifact current = (Artifact) ai.next();
- if (current.getArtifactId().equals(id)) {
+ if (retrieveId(current).equals(id)) {
msg.append(artifact);
msg.append(SystemUtils.LINE_SEPARATOR);
final List l = current.getDependencyTrail();
@@ -271,4 +267,15 @@ public abstract class AbstractDeployMojo
}
return files;
}
+
+
+ /**
+ * Creates an unique ID for the given <code>org.apache.maven.artifact.Artifact</code>,
+ * taking into account the artifactId and the classifier.
+ *
+ * @return String - unique ID
+ */
+ private static String retrieveId(Artifact artifact) {
+ return artifact.getArtifactId()+"-"+artifact.getClassifier();
+ }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.