Author: veithen
Date: Sun Dec 5 12:20:59 2010
New Revision: 1042331
URL: http://svn.apache.org/viewvc?rev=1042331&view=rev
Log:
Merged the latest changes to the axis2-repo-maven-plugin to the 1.5 branch so
that we can use it later in downstream projects such as Sandesha2.
Modified:
axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/
(props changed)
axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
Propchange:
axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Dec 5 12:20:59 2010
@@ -0,0 +1,2 @@
+/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin:922914,922941,922983,935169,935174,935338,937004,944347,944915,951385,960693,960976,960978,960984,960995,961012,961964,962844,963081,963147,965032,965036,965056,965068,965074,965213,965268,965277,965302,965454,966371,966401,966428,966536,979882-979883,979886,980242,981036,981038,981055-981056,981058,981095,981188,981220-981221,981237,981262,981278,981293,981306,981311,981985,981992,982008,982387,982393,982795,982800,983101,983110,983114,983119-983120,983128,983185,983236,983270,983276,983280,983316,983363,983370,983372,985458,985464,985626,985634,985661,985715,985717,985744,985748,985752,985763,985791,985796,985851,986844,986889,987313,987712-987715,987783,987832,987873,987883,987913,987935,988689,990350,990369,990377,990384,990394,990398,990404,990434,990445,990449,1001279,1001452-1001466,1001673,1029034,1029153,1029308,1029372,1029377,1029610-1029651,1030008,1030538,1031350,1031352,1031799,1032001,1032390,103
2401,1032681,1032694,1033898,1033942,1033956,1034010,1034015,1034142,1034173,1034213,1036624,1036659,1037144,1037210,1037617,1038024,1038070,1039635,1039712-1039729
+/webservices/axis2/trunk/java/modules/tool/axis2-repo-maven-plugin:728674,731798,732539,732541,732873,732877,732924,732927,732939,733293,733295,733304,733306,733348,733354,733394,733399,733463-733464,733533,733539-733540,733676,733776,733900,733910,734227,734237,734261,738057,738067,738071,738086,738110,738113,738117,738158,740332,740357,740360,741300,741784,741873,741878,741881,748761,751958,754458,754467,754503,757151-757153,759488,759507,759878,759968,761025,761044,761068,761709,761770,761952,763148,765102,771051,777648,777882,777897,777934,778060,780546,783479,788202,795431,801630,803725,805578,805981,805999,806085,806331,807160,807487,807512,816740,816804,816812,816891,817965,821686,821689,834058,834175,889783,902271,904660,904780,905980
Modified:
axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java?rev=1042331&r1=1042330&r2=1042331&view=diff
==============================================================================
---
axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
(original)
+++
axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
Sun Dec 5 12:20:59 2010
@@ -21,8 +21,11 @@ package org.apache.axis2.maven2.repo;
import java.io.File;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -41,6 +44,7 @@ import org.apache.maven.shared.artifact.
import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
import org.apache.maven.shared.artifact.filter.collection.TypeFilter;
import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
public abstract class AbstractCreateRepositoryMojo extends AbstractMojo {
/**
@@ -150,6 +154,34 @@ public abstract class AbstractCreateRepo
*/
private boolean stripModuleVersion;
+ /**
+ * Specifies whether modules should be deployed to the repository.
+ *
+ * @parameter default-value="true"
+ */
+ private boolean includeModules;
+
+ /**
+ * Comma separated list of modules (by artifactId) to include in the
repository.
+ *
+ * @parameter
+ */
+ private String modules;
+
+ /**
+ * Specifies whether services should be deployed to the repository.
+ *
+ * @parameter default-value="true"
+ */
+ private boolean includeServices;
+
+ /**
+ * Comma separated list of services (by artifactId) to include in the
repository.
+ *
+ * @parameter
+ */
+ private String services;
+
protected abstract String getScope();
protected abstract File getOutputDirectory();
@@ -165,26 +197,37 @@ public abstract class AbstractCreateRepo
artifacts.addAll(project.getAttachedArtifacts());
}
}
- FilterArtifacts filter = new FilterArtifacts();
- filter.addFilter(new ScopeFilter(getScope(), null));
- filter.addFilter(new TypeFilter("aar,mar", null));
- try {
- artifacts = filter.filter(artifacts);
- } catch (ArtifactFilterException ex) {
- throw new MojoExecutionException(ex.getMessage(), ex);
- }
- artifacts = replaceIncompleteArtifacts(artifacts);
File outputDirectory = getOutputDirectory();
- Map<String,ArchiveDeployer> deployers = new
HashMap<String,ArchiveDeployer>();
- deployers.put("aar", new ArchiveDeployer(outputDirectory,
servicesDirectory, "services.list", generateFileLists, stripServiceVersion));
- deployers.put("mar", new ArchiveDeployer(outputDirectory,
modulesDirectory, "modules.list", generateFileLists, stripModuleVersion));
- for (Artifact artifact : artifacts) {
- String type = artifact.getType();
- ArchiveDeployer deployer = deployers.get(type);
- if (deployer == null) {
- throw new MojoExecutionException("No deployer found for
artifact type " + type);
+ if (includeModules || includeServices) {
+ FilterArtifacts filter = new FilterArtifacts();
+ filter.addFilter(new ScopeFilter(getScope(), null));
+ if (includeModules && includeServices) {
+ filter.addFilter(new TypeFilter("aar,mar", null));
+ } else if (includeModules) {
+ filter.addFilter(new TypeFilter("mar", null));
+ }
+ try {
+ artifacts = filter.filter(artifacts);
+ } catch (ArtifactFilterException ex) {
+ throw new MojoExecutionException(ex.getMessage(), ex);
+ }
+ selectArtifacts(artifacts, modules, "mar");
+ selectArtifacts(artifacts, services, "aar");
+ artifacts = replaceIncompleteArtifacts(artifacts);
+ Map<String,ArchiveDeployer> deployers = new
HashMap<String,ArchiveDeployer>();
+ deployers.put("aar", new ArchiveDeployer(outputDirectory,
servicesDirectory, "services.list", generateFileLists, stripServiceVersion));
+ deployers.put("mar", new ArchiveDeployer(outputDirectory,
modulesDirectory, "modules.list", generateFileLists, stripModuleVersion));
+ for (Artifact artifact : artifacts) {
+ String type = artifact.getType();
+ ArchiveDeployer deployer = deployers.get(type);
+ if (deployer == null) {
+ throw new MojoExecutionException("No deployer found for
artifact type " + type);
+ }
+ deployer.deploy(getLog(), artifact);
+ }
+ for (ArchiveDeployer deployer : deployers.values()) {
+ deployer.finish(getLog());
}
- deployer.deploy(getLog(), artifact);
}
if (axis2xml != null) {
getLog().info("Copying axis2.xml");
@@ -196,8 +239,20 @@ public abstract class AbstractCreateRepo
throw new MojoExecutionException("Error copying axis2.xml
file: " + ex.getMessage(), ex);
}
}
- for (ArchiveDeployer deployer : deployers.values()) {
- deployer.finish(getLog());
+ }
+
+ private void selectArtifacts(Set<Artifact> artifacts, String list, String
type) throws MojoFailureException {
+ if (list != null) {
+ Set<String> set = new
HashSet<String>(Arrays.asList(StringUtils.split(list, ",")));
+ for (Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); )
{
+ Artifact artifact = it.next();
+ if (artifact.getType().equals(type) &&
!set.remove(artifact.getArtifactId())) {
+ it.remove();
+ }
+ }
+ if (!set.isEmpty()) {
+ throw new MojoFailureException("The following " + type + "
artifacts have not been found: " + set);
+ }
}
}