diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-23 18:28:14 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-23 18:28:14 +0000 |
commit | 13d2bfc1130208dc2723b4475744cdcfe09c0dba (patch) | |
tree | 39155bf632168f9d3c6f3d6121507a120a97a8f4 /branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca | |
parent | 3336ce7cd343c5b5ec51c1762f3133d044cff3be (diff) |
Minor fixes to the Maven bundle plugin. Fixed the algorithm determining what directories need to be excluded from the distro. Added an 'includeGroupIds' configruation property.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@707438 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java index e81169c2c2..73394ec0b0 100644 --- a/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java +++ b/branches/sca-equinox/tools/maven/maven-bundle-plugin/src/main/java/org/apache/tuscany/sca/tools/bundle/plugin/ModuleBundlesBuildMojo.java @@ -78,6 +78,13 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { private String[] excludeGroupIds; /** + * Directories containing groupids to include. + * + * @parameter + */ + private String[] includeGroupIds; + + /** * Set to true to generate a PDE target platform configuration. * * @parameter @@ -105,15 +112,23 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { } root.mkdirs(); - // Build sets of exclude directories and groupids + // Build sets of exclude directories and included/excluded/groupids Set<String> excludedFileNames = new HashSet<String>(); if (excludeDirectories != null) { for (File f: excludeDirectories) { - for (String n: f.list()) { - excludedFileNames.add(n); + if (f.isDirectory()) { + for (String n: f.list()) { + excludedFileNames.add(n); + } } } } + Set<String> includedGroupIds = new HashSet<String>(); + if (includeGroupIds != null) { + for (String g: includeGroupIds) { + includedGroupIds.add(g); + } + } Set<String> excludedGroupIds = new HashSet<String>(); if (excludeGroupIds != null) { for (String g: excludeGroupIds) { @@ -139,11 +154,17 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { continue; } - // Exclude artifact if its groupId is excluded + // Exclude artifact if its groupId is excluded or if it's not included if (excludedGroupIds.contains(artifact.getGroupId())) { log.debug("Artifact groupId is excluded: " + artifact); continue; } + if (!includedGroupIds.isEmpty()) { + if (!includedGroupIds.contains(artifact.getGroupId())) { + log.debug("Artifact groupId is not included: " + artifact); + continue; + } + } File artifactFile = artifact.getFile(); if (!artifactFile.exists()) { @@ -151,12 +172,6 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { continue; } - // Exclude artifact if its file name is excluded - if (excludedFileNames.contains(artifactFile.getName())) { - log.debug("Artifact file is excluded: " + artifact); - continue; - } - if (log.isDebugEnabled()) { log.debug("Processing artifact: " + artifact); } @@ -171,6 +186,12 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { if (bundleName != null) { + // Exclude artifact if its file name is excluded + if (excludedFileNames.contains(artifactFile.getName())) { + log.debug("Artifact file is excluded: " + artifact); + continue; + } + // Copy an OSGi bundle as is log.info("Adding OSGi bundle artifact: " + artifact); copyFile(artifactFile, root); @@ -178,6 +199,12 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { } else if ("war".equals(artifact.getType())) { + // Exclude artifact if its file name is excluded + if (excludedFileNames.contains(artifactFile.getName())) { + log.debug("Artifact file is excluded: " + artifact); + continue; + } + // Copy a WAR as is log.info("Adding WAR artifact: " + artifact); copyFile(artifactFile, root); @@ -185,6 +212,14 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { } else { + File dir = new File(root, artifactFile.getName().substring(0, artifactFile.getName().length() - 4)); + + // Exclude artifact if its file name is excluded + if (excludedFileNames.contains(dir.getName())) { + log.debug("Artifact file is excluded: " + artifact); + continue; + } + // Create a bundle directory for a non-OSGi JAR log.info("Adding JAR artifact: " + artifact); String version = BundleUtil.version(artifactFile.getPath()); @@ -193,7 +228,6 @@ public class ModuleBundlesBuildMojo extends AbstractMojo { jarFiles.add(artifactFile); String symbolicName = (artifact.getGroupId() + "." + artifact.getArtifactId()).replace('-', '.'); Manifest mf = BundleUtil.libraryManifest(jarFiles, symbolicName + "_" + version, symbolicName, version, null); - File dir = new File(root, artifactFile.getName().substring(0, artifactFile.getName().length() - 4)); File file = new File(dir, "META-INF"); file.mkdirs(); file = new File(file, "MANIFEST.MF"); |