diff -Nru maven-bundle-plugin-2.5.4/changelog.txt maven-bundle-plugin-3.5.0/changelog.txt --- maven-bundle-plugin-2.5.4/changelog.txt 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/changelog.txt 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,397 @@ +Changes from 3.4.0 to 3.5.0 +--------------------------- + +** Improvement + * [FELIX-5764] - Update to bnd version 3.5 + + +Changes from 3.3.0 to 3.4.0 +--------------------------- + +** Bug + * [FELIX-5527] - Bundle plugin Embed-Dependency complains about class files in META-INF + * [FELIX-5592] - Maven bundle plugin does not support Java 9 Multi-Release jars + * [FELIX-5712] - Maven Bundle Plugin - Broken and non https links + * [FELIX-5734] - The plugin generates wrong service requirements when using a jndi name in jpa + +** Improvement + * [FELIX-5760] - Update to bnd version 3.4 + + +Changes from 3.2.0 to 3.3.0 +--------------------------- + +** Bug + * [FELIX-5579] - Bundle Plugin uses insecure maven-archiver 2.5 + * [FELIX-5582] - maven-bundle-plugin: Make sure Closeable resources are closed + +** Improvement + * [FELIX-5424] - Augment exported service metadata + * [FELIX-5581] - Update to bndlib 3.3.0 + + +Changes from 3.0.1 to 3.2.0 +--------------------------- + +** Bug + * [FELIX-5116] - Dump SCR component definitions broken + +** Improvement + * [FELIX-5149] - Update to bndlib 3.1.0 + * [FELIX-5253] - Update to bndlib 3.2.0 + +** New Feature + * [FELIX-4009] - maven bundle plugin should be integrated directly with eclipse + * [FELIX-5233] - New JPA analyser for the maven bundle plugin + * [FELIX-5258] - Add a new MOJO which verifies the bundle integrity + + +Changes from 3.0.0 to 3.0.1 +--------------------------- + +** Bug + * [FELIX-5062] - maven-bundle-plugin includes tests dependencies in package analysis + * [FELIX-5070] - Simple syntax for specifying embedded dependencies has broken + +** Improvement + * [FELIX-5073] - Option to create dependency-reduced-pom exists + + +Changes from 2.5.5 to 3.0.0 +--------------------------- + +** Improvement + * [FELIX-5047] - Disable bnd ScrPlugin by default + * [FELIX-5030] - Do not require a pom.xml when Polyglot Maven is used + * [FELIX-5029] - Update to bnd 3.0.0 + +Especially the update to bnd 3.0.0 brings many fixes and improvements, +including support for OSGi Enterprise R6 DS annotations and Metatype +annotations. + +Changes from 2.5.4 to 2.5.5 +--------------------------- + +** Bug + * [FELIX-4882] - Correctly use Maven Plugin Tools Java 5 annotations instead of javadoc tags + * [FELIX-4892] NPE in maven-bundle-plugin + * [FELIX-4874] IllegalArgumentException: Invalid syntax for version: 0.1-SNAPSHOT + * [FELIX-4956] Embed latest bndlib + * [FELIX-3565] Embed-Transitive leaks transitive dependencies of excluded artifacts + * [FELIX-4823] Filtering snapshots is failing if version qualifier contains more than "SNAPSHOT" + * [FELIX-4691] Empty string value for property causes build failure + +** Improvement + * [FELIX-4809] More flexibility for selecting the comparison artifact + * [FELIX-3994] Optional merging of duplicate manifest headers + * [FELIX-3324] Allow maven-bundle-plugin:manifest to dump SCR component definitions generated by bnd + + +Changes from 2.5.3 to 2.5.4 +--------------------------- + +** Bug + * [FELIX-4556] - Maven Bundle Plugin fails with ArrayIndexOutOfBoundsException, "Invalid Class File" errors with Java 8 features + * [FELIX-4659] - The maven bundle plugin incorrectly reports cardinality on service references in the generated generic requirements + * [FELIX-4817] - Baseline plugin is not thread safe + * [FELIX-4679] - Import package not generated for the classes used in throw clause in a private method. + +** Improvement + * [FELIX-4666] - The baseline goal should print out the resolved version used for comparison + * [FELIX-4824] - Add support for prepending instructions + + +Changes from 2.5.2 to 2.5.3 +--------------------------- + +** Bug + * [FELIX-4619] - Debug output of project properties + + +Changes from 2.5.0 to 2.5.2 +--------------------------- + +** Bug + * [FELIX-4574] - The maven-bundle-plugin only generates Provide-/Require-Capabilities for SCR if version is 1.1.0 + * [FELIX-4576] - Bad Require-Capability generation when the SCR target filter has no parentheses + +** Improvement + * [FELIX-4596] - Passing configuration values to the maven-bundle-plugin + +** New Feature + * [FELIX-4591] - add the ability to specify the classifier in the new baseline configuration of the plugin. + + +Changes from 2.4.0 to 2.5.0 +--------------------------- + +** Improvement + * [FELIX-3381] - Support for {maven-test-resources} and {maven-test-sources} placeholders + * [FELIX-4205] - "null" Bundle-Activator causes bundle to fail + * [FELIX-4518] - Provide a way to disable some plugins + * [FELIX-4539] - Update to Bndlib 2.3.0 + +** New Feature + * [FELIX-3462] - Nicer Manifest formatting + * [FELIX-4512] - Add a new Mojo to invoke the BND Baseline tool + * [FELIX-4517] - Generate generic capabilities and requirements for services from blueprint and scr descriptors + +Changes from 2.3.7 to 2.4.0 +--------------------------- + +** Bug + * [FELIX-3293] - Exception while creating empty fragment bundles with version 2.3.6 + * [FELIX-3349] - wrong bundle manifest contents in some cases + * [FELIX-3352] - Maven Bundle Plugin ignores resource properties configured inside section + * [FELIX-3407] - Imports are missed for generics + * [FELIX-3497] - Wrong artifact type attached as a secondary artifact when project packaging is set to "pom" + * [FELIX-3582] - finalName not properly populated in maven-bundle-plugin with buildnumber-maven-plugin + * [FELIX-3585] - Dependencies with classes or resources in the default package cannot be embedded + * [FELIX-3601] - Incorrect namespace in component XML for DS Annotations + * [FELIX-3619] - "IOException: Failed to delete repository.xml while trying to rename" in maven-bundle-plugin + * [FELIX-3630] - Packages exported by bundle are (re)-imported with incorrect version + * [FELIX-3638] - Missing package import for annotation default value + * [FELIX-3772] - maven-bundle-plugin does not scan blueprint in workspace outside default location + * [FELIX-3973] - Exclusion from {local-packages} doesn't work anymore + * [FELIX-4005] - Maven Bundle Plugin fails with ArrayIndexOutOfBoundsException, "Invalid Class File" errors with Java 8 features + * [FELIX-4017] - @ProviderType does not work (bnd "provide:=true" annotation?) + +** Improvement + * [FELIX-3277] - Support BND Service Component generation + * [FELIX-3602] - The bundle plugin should generate the blueprint header with the file locations + +** Wish + * [FELIX-4067] - Old BND used causes problems during annotations processing + +Changes from 2.3.6 to 2.3.7 +--------------------------- + +** Bug + * [FELIX-3347] - Upper-case environment variables end up in final manifest + * [FELIX-3310] - [patch] maven-bundle-plugin build fails with maven3 (manageArtifactSystemPath is missing) + * [FELIX-3254] - manifest goal generates wrong Export-Package when Embed-Dependency + +** Improvement + * [FELIX-3300] - Avoid warning about superfluous export-package instructions for empty directories + +** Task + * [FELIX-3299] - Fix instable tests in BundlePluginTest + +Changes from 2.3.5 to 2.3.6 +--------------------------- + +** Bug + * [FELIX-3031] - maven3 deployment fails where maven2 works + * [FELIX-3037] - Plugin does not work with Java 5 + * [FELIX-3058] - maven-bundle-plugin 2.3.5 incompatible with maven-source-plugin (regression) + * [FELIX-3073] - can't deploy snapshot bundle to remote OBR + * [FELIX-3173] - Local OBR install failes when there is a space in the full path + * [FELIX-3185] - Negative Embed-Dependency clauses aren't handled correctly + * [FELIX-3188] - [PATCH] exception org.apache.maven.project.artifact.InvalidDependencyVersionException has already been caught + * [FELIX-3206] - Restore the BND analyzer approach which creates a MANIFEST.MF based on the contents of the jar + * [FELIX-3209] - Make sure the properties passed to BND only include string values + * [FELIX-3222] - [PATCH] build fails with "unreported exception" + * [FELIX-3238] - Unable to filter out classes from identical package in a dependency + +** Improvement + * [FELIX-2872] - Provide a way to have an easier to read manifest + * [FELIX-3061] - improvements to Embed-Dependency logic to allow better m2e integration + * [FELIX-3092] - Support relative paths in "urlTemplate" parameter of "bundle:index" goal in maven bundle plugin + +** New Feature + * [FELIX-3165] - Add an option to the manifest goal that will copy any BND generated resources to the target folder + * [FELIX-3208] - Provide default value for sourcepath when using BND -sources=true + * [FELIX-3210] - Maven bundle plugin remote-clean goal without user confirmation + +Changes from 2.3.4 to 2.3.5 +--------------------------- + +** Bug + * [FELIX-1039] - Inconsistency packaging vs. type + * [FELIX-1571] - Bundle-ClassPath without "." while using maven-bundle-plugin in a war project confuses the plugin + * [FELIX-1734] - The _donotcopy is ignored + * [FELIX-1985] - Error when Include-Resource instruction contains duplicate paths. + * [FELIX-2346] - mvn bundle:clean removes all, even the existing resources + * [FELIX-2427] - maven site crashes + * [FELIX-2435] - on a WAR file will switch the project to generate jar artifacts + * [FELIX-2449] - Resource filtering does not use Maven properties specified on the mvn command line via -D command line switches + * [FELIX-2656] - Maven-bundle-plugin identified as not thread-safe in Maven 3.0 + * [FELIX-2722] - With an empty organization like this , maven bundle plugin raises a NPE. + * [FELIX-2765] - bundle plugin throw IllegalArgumentException while do the install + * [FELIX-2819] - packageinfo files in src/main/java are ignored + * [FELIX-2820] - Provide a default value when using <_wab/> + * [FELIX-2884] - The multiplicity isn't taken into account by the maven bundle plugin and bundlerepository when generating the repository xml + * [FELIX-2914] - Nullpointer exception on mvn install if the pom contains organization/url but not organization/name + * [FELIX-2934] - Bundle-ClassPath contains "." despite using _wab instruction + +** Improvement + * [FELIX-1836] - Maven resource filtering support for obr.xml + +** New Feature + * [FELIX-3011] - Add a new goal to save the bnd instructions that would be passed onto bnd, to allow people to use other toolchains such as bndtools + +** Task + * [FELIX-344] - Generate standard maven documentation for the maven-bundle-plugin + +Changes from 2.2.0 to 2.3.4 +--------------------------- + + * [2011-02-01] FELIX-2817: The maven-bundle-plugin manifest goal should honor the supportedProjectTypes configuration setting. + * [2011-01-27] FELIX-2808: maven-bundle-plugin should scan for local packages by looking for *.class files instead of *.java so that all the JVM languages can be supported. + * [2011-01-27] FELIX-2809: maven-bundle-plugin should automatically add "resolution:=optional" to imported packages that are in optional maven dependencies. + * [2011-01-29] FELIX-2811: If !* is defined the all packages should be exported by {local-packages} + * [2011-01-29] FELIX-2812: The filter can fail if your matching against multiple "*" artifact ids. + +Changes from 2.1.0 to 2.2.0 +--------------------------- + + * [2010-11-17] FELIX-2701: Add {local-packages} macro, expands to local packages in instruction + * [2010-10-25] FELIX-2176: Update to latest bndlib (1.15.0) + +Changes from 2.0.0 to 2.0.1 +--------------------------- + + * [2009-09-03] FELIX-1461: make local repository updates a bit more atomic + * [2009-09-03] Temporary local bnd patch for Include-Resource bug on Windows + * [2009-09-03] FELIX-1539: include additional source directories in local package calculation + * [2009-09-03] FELIX-1439: add project organization name/url properties + * [2009-09-03] FELIX-1501: use getProperty() instead of getProperties().getProperty() + * [2009-09-03] FELIX-1552: add bnd support for blueprint and spring-dm declarations + * [2009-09-03] FELIX-1148: apply local patch for MSHARED-101 + * [2009-09-03] FELIX-981: avoid spurious split package warnings + * [2009-09-03] FELIX-1290: warn if Embed-Dependency doesn't match any dependencies + * [2009-09-03] FELIX-1021: remove expression from classifier parameter (ie. same as jar plugin) + * [2009-09-03] FELIX-1023: apply patch to add category information to OBR + * [2009-09-03] Upgrade to bndlib 0.0.357 + * [2009-07-13] FELIX-1262: remove duplicate resource entries to avoid Bnd Tool error + * [2009-04-24] FELIX-1054: when deploying a bundle, print computed uri on the console + +Changes from 1.4.3 to 2.0.0 +--------------------------- + + * [2009-02-16] FELIX-807,FELIX-782,FELIX-660,FELIX-549,FELIX-546,FELIX-545: Use latest version of the Bnd Tool (0.0.311) + * [2009-02-16] FELIX-941: store the generated default symbolicname in $(maven-symbolicname) property + * [2009-02-16] FELIX-912: set default Export-Package based on local source files + * [2009-02-16] FELIX-684: support filters in excludeDependencies, such as *;scope=runtime + * [2009-02-16] FELIX-684: separate out dependency filtering code so we can re-use it when excluding + * [2009-01-30] FELIX-806: pickup settings in bundleplugin configuration (otherwise fall back to the jarplugin settings) and enable support of the addMavenDescriptor setting + * [2009-01-30] FELIX-850: local fix for MSHARED-86 (should use isFile instead of exists) + * [2009-01-29] FELIX-899: update to latest editions of Bnd and Bindex + * [2009-01-29] FELIX-899: first step, widen dependency resolution and pass everything except test dependencies onto BND + * [2008-12-05] Additional debug to help with problem determination + * [2008-12-03] FELIX-760: commit latest bindex code + * [2008-12-03] FELIX-831,FELIX-677: update to version 0.0.295 of the Bnd tool + * [2008-08-27] FELIX-699: set analyzer base before loading properties in manifest goal + + +Changes from 1.4.2 to 1.4.3 +--------------------------- + + * [2008-08-07] FELIX-661: maven bundle plugin does not close the accessed zip/jar streams + +Changes from 1.4.1 to 1.4.2 +--------------------------- + + * [2008-08-03] FELIX-553: allow cleaning a remote OBR + * [2008-08-03] FELIX-580: Allows maven-bunde-plugin to generate a repository file outide a maven repository with absolute url + * [2008-07-09] FELIX-556: Filtering mechanims to + * [2008-07-08] FELIX-547: OBR portion of the plugin balks on singular version range of [1.0.0,1.0.0]. + * [2008-07-07] FELIX-620: manifest goal of maven-bundle-plugin ignores _include instruction + * [2008-05-16] FELIX-560: bundle:install and bundle:deploy goals check artifact type is "bundle" instead of using the supportedProjectTypes list + * [2008-05-16] FELIX-561: Use same level of Bnd in script generated by bundle:ant as in the bundleplugin itself + +Changes from 1.4.0 to 1.4.1 +--------------------------- + + * [2008-04-30] FELIX-543: add switch to prevent classifier being appended to Bundle-Version + * [2008-04-23] FELIX-541: allow repository.xml to reference to xsl file + * [2008-04-23] FELIX-531: Allow the import package scope to be set for the bundleall goal in the maven-bundle-plugin + * [2008-04-23] FELIX-523: Update bundleplugin to use BND 0.0.255 + * [2008-04-01] FELIX-526: Allow a mechanism to give preference to local resources over the ones from embedded jars + * [2008-03-24] FELIX-519: maven-bundle-plugin should issue a WARNING for unsupported packaging types + * [2008-03-16] FELIX-517: Replacement of {maven-dependencies} in Include-Resource and Bundle-ClassPath can strip Windows path separators + * [2008-03-03] FELIX-505: maven-bundle-plugin:bundleall modifies dependencies that are already bundles + +Changes from 1.2.1 to 1.4.0 +--------------------------- + + * [2008-02-20] FELIX-499: Enhance "excludeDependencies" configuration parameter to also support comma-separated list of artifactIds + * [2008-02-20] FELIX-498: Enable javadoc deployment on OBR repository + * [2008-02-19] FELIX-497: Genearated Source url is not a valid url + * [2008-02-19] FELIX-493: maven-bundle-plugin bundle:install goal install too many artifact + * [2008-02-19] FELIX-247: Add ant goal to maven-bundle-plugin which creates a build.xml and MANIFEST.MF with bundle headers + * [2008-02-18] FELIX-492: Add support to classifier: enable bunlde:bundle goal to generate classified artifact + * [2008-02-18] FELIX-491: Merge the maven-obr-plugin and the bundleplugin into a single plugin + +Changes from 1.2.0 to 1.2.1 +--------------------------- + + * [2008-02-12] FELIX-477: BND: Versions with fourth section all numbers are truncated + * [2008-02-06] FELIX-479: add supportedProjectTypes configuration option to install goal + * [2008-02-02] FELIX-459: BND: allow customization of the "uses" clause in the generated Export-Package + * [2008-01-30] FELIX-476: Improve default Export-Package (used when no Export-Package and Private-Package is set) + * [2008-01-30] FELIX-462: Support removal of manifest headers added by the bundleplugin + * [2008-01-30] FELIX-461: Ensure manifest goal creates same manifest as bundle goal when project packaging is "bundle" + * [2008-01-29] FELIX-472: Embed-Dependency, Include-Resource and inline + * [2008-01-29] FELIX-460: Remove "." from the Bundle-ClassPath when embedding dependencies in a bundle with no local classes + * [2008-01-28] FELIX-457: remove PathFile class and use URIs instead + * [2008-01-22] FELIX-458: BND: -split-package:=merge-first behaves like merge-last + +Changes from 1.0.0 to 1.2.0 +--------------------------- + + * [2008-01-11] FELIX-455: need to use the Builder class instead of Analyzer, because it provides additional cleanup of version information + * [2008-01-10] FELIX-451: remove Include-Resource header from final bundle manifest + * [2008-01-10] FELIX-449: add 'excludeDependencies' option (disabled by default) to exclude all dependencies from the classpath passed to BND + * [2008-01-09] FELIX-442: handle custom manifest sections and external manifest files + * [2008-01-08] Update to bndlib 0.0.227 (disables spring xml parser by default) + * [2007-12-27] FELIX-442: Add manifest entries from maven-jar-plugin configuration to final bundle + * [2007-12-07] FELIX-433: add unpackBundle option that unpacks the bundle contents to the Maven output directory + * [2007-11-18] FELIX-400: add resource code to properly handle Maven includes/excludes + * [2007-11-01] Make Embed-StripGroup default to true, as it is much more useful than the current default + * [2007-10-31] FELIX-417: fix project references + * [2007-10-26] Better error messages (and detect difference between internal error and configuration error) + * [2007-10-23] FELIX 406: fix Windows path entries in Bundle-ClassPath when embedding jars + * [2007-10-22] FELIX-405: support custom obr repository filenames, such as foo.xml + * [2007-10-21] FELIX-403: replace line-breaks with spaces when using Maven project description in Bundle manifest + * [2007-10-19] FELIX-402: use correct manifest location when using reactor build + * [2007-10-19] FELIX-400: fix array out of bounds exception when the resource directory is the same as the basedir + * [2007-09-25] FELIX-360: various fixes to the bundleall goal + * [2007-09-22] FELIX-370: OBR integration work + * [2007-09-22] FELIX-306: be consistent and delegate all version mangling to BND library + * [2007-09-21] FELIX-377: support -failok directive + * [2007-09-21] FELIX-376: Support writing of manifest to the file system when using bundle goal + * [2007-09-11] FELIX-352: provide informational error message when manifest goal is run before compile phase + * [2007-08-26] FELIX-308: support embedding of artifacts with non-jar extension names + * [2007-08-24] Workaround for MNG-1682 (incorrect extension used when installing to local repository) + * [2007-08-23] FELIX-343: replace any instances of {maven-resources} in Include-Resource with the actual project's resource paths + * [2007-08-23] FELIX-308: initial implementation to support embedding dependencies + * [2007-08-22] FELIX-340: update classpath algorithm to match maven compilation classpath + * [2007-08-14] FELIX-333: remove new-lines/form-feeds from property values. + +Changes from 0.8.0-incubator to 1.0.0 +------------------------------------- + +* [2007-03-13] now supports JAR files in the class path, + not just JAR files in the project directory. +* [2007-03-15] Fixed a bug in converting Maven version numbers to OSGi version + numbers. (FELIX-256) +* [2007-03-28] Added support for using BND directives in the POM file. + (FELIX-218) +* [2007-04-10] Added a recursive "bundleall" goal to generate OSGi bundles for + all dependencies and a "manifest" goal to generate just the manifest. + (FELIX-199) +* [2007-04-27] Modified the plugin so that it does not run on POM projects. + (FELIX-269) +* [2007-05-17] Plugin now handles null property values better. (FELIX-281) +* [2007-05-20] Renamed project directory from maven-bundle-plugin to + bundleplugin. +* [2007-05-20] Changed package naming. +* [2007-05-21] Improved handling of resource copying to copy the plugin's + resources if specified or the standard Maven-specified resources. (FELIX-261) +* [2007-06-13] Factored out some common code. (FELIX-304) +* [2007-06-14] Enable output folder to be configured. (FELIX-305) +* [2007-07-05] Added support for overriding project type. (FELIX-309) +* [2007-07-09] Updated to BND version 0.0.160. +* [2007-07-11] Fix a possible NullPointerException in the manifest goal. (FELIX-326) + diff -Nru maven-bundle-plugin-2.5.4/debian/changelog maven-bundle-plugin-3.5.0/debian/changelog --- maven-bundle-plugin-2.5.4/debian/changelog 2017-08-30 15:32:37.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/changelog 2018-03-25 05:23:12.000000000 +0000 @@ -1,3 +1,20 @@ +maven-bundle-plugin (3.5.0-1) unstable; urgency=medium + + * New upstream release + * Use a simpler get-orig-source approach + * Update Standards-Version to 4.1.3 + * Update debhelper compat level to 11 + * Adjust (build-)dependencies: + * Tighten BND to >= 3.5.0 + * Add libjdom1-java + * Refresh patches: + * Remove FELIX-4882.patch + * Remove backwards-compatibility.pactch + * Adopt a patch from Fedora to fix the compatibility of maven-dependency-tree 3.x + * Remove the javadoc package + + -- Kai-Chung Yan (殷啟聰) Sun, 25 Mar 2018 13:23:12 +0800 + maven-bundle-plugin (2.5.4-6) unstable; urgency=medium * Team upload. diff -Nru maven-bundle-plugin-2.5.4/debian/compat maven-bundle-plugin-3.5.0/debian/compat --- maven-bundle-plugin-2.5.4/debian/compat 2017-08-02 10:33:24.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/compat 2018-03-09 09:46:10.000000000 +0000 @@ -1 +1 @@ -10 +11 \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/debian/control maven-bundle-plugin-3.5.0/debian/control --- maven-bundle-plugin-2.5.4/debian/control 2017-08-30 15:32:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/control 2018-03-21 05:53:15.000000000 +0000 @@ -3,17 +3,16 @@ Priority: optional Maintainer: Debian Java Maintainers Uploaders: Damien Raude-Morvan -Build-Depends: debhelper (>= 10), default-jdk, maven-debian-helper (>= 2.0~) -Build-Depends-Indep: bnd (>= 2.1.0~), - default-jdk-doc, +Build-Depends: debhelper (>= 11), default-jdk-headless, maven-debian-helper (>= 2.0~) +Build-Depends-Indep: bnd (>= 3.5.0), junit4, libfelix-bundlerepository-java, libfelix-osgi-obr-java, libfelix-utils-java, + libjdom1-java, libkxml2-java, libmaven-archiver-java, libmaven-dependency-tree-java, - libmaven-javadoc-plugin-java, libmaven-plugin-tools-java, libmaven-reporting-api-java, libmaven3-core-java, @@ -22,7 +21,7 @@ libplexus-archiver-java, libplexus-container-default1.5-java, libplexus-utils2-java -Standards-Version: 4.1.0 +Standards-Version: 4.1.3 Vcs-Git: https://anonscm.debian.org/git/pkg-java/maven-bundle-plugin.git Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/maven-bundle-plugin.git Homepage: http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html @@ -31,7 +30,6 @@ Architecture: all Depends: ${maven:Depends}, ${misc:Depends}, libmaven-deploy-plugin-java, libmaven-install-plugin-java Recommends: ${maven:OptionalDepends} -Suggests: libmaven-bundle-plugin-java-doc Description: Maven plugin to handle artifact OSGi metadata Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can @@ -42,24 +40,4 @@ (JAR, WAR). It manage a new type of packaging "bundle" in your POM. . This plugin depends on Felix Bundle Repository and BND for low-level - handling of metadata. - -Package: libmaven-bundle-plugin-java-doc -Architecture: all -Section: doc -Depends: ${maven:DocDepends}, ${misc:Depends} -Recommends: ${maven:DocOptionalDepends} -Suggests: libmaven-bundle-plugin-java -Description: Maven plugin to handle artifact OSGi metadata - documentation - Maven is a software project management and comprehension tool. - Based on the concept of a project object model (POM), Maven can - manage a project's build, reporting and documentation from a central - piece of information. - . - This plugin allow you to handle artifact OSGi metadata of your artifact - (JAR, WAR). It manage a new type of packaging "bundle" in your POM. - . - This plugin depends on Felix Bundle Repository and BND for low-level - handling of metadata. - . - This package contains the API documentation of libmaven-bundle-plugin-java. + handling of metadata. \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/debian/copyright maven-bundle-plugin-3.5.0/debian/copyright --- maven-bundle-plugin-2.5.4/debian/copyright 2017-08-30 13:52:13.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/copyright 2018-03-20 15:13:42.000000000 +0000 @@ -2,6 +2,7 @@ Upstream-Name: Apache Felix Maven Bundle Plugin Upstream-Contact: http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html Source: http://www.apache.org/dist/felix/ +Files-Excluded: *.jar *.class Files: * Copyright: 2006-2015, The Apache Software Foundation @@ -11,6 +12,10 @@ Copyright: 2011, Damien Raude-Morvan License: Apache-2.0 +Files: debian/patches/0001-Port-to-current-maven-dependency-tree.patch +Copyright: 2016, Michael Simacek +License: MIT + License: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,3 +31,22 @@ . On Debian GNU/Linux system you can find the complete text of the Apache-2.0 license in '/usr/share/common-licenses/Apache-2.0'. + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/debian/libmaven-bundle-plugin-java-doc.doc-base maven-bundle-plugin-3.5.0/debian/libmaven-bundle-plugin-java-doc.doc-base --- maven-bundle-plugin-2.5.4/debian/libmaven-bundle-plugin-java-doc.doc-base 2015-12-07 10:55:51.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/libmaven-bundle-plugin-java-doc.doc-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -Document: maven-bundle-plugin -Title: Apache Felix OSGi bundle repository service -Author: The Apache Software Foundation -Abstract: This is the API Javadoc provided for the - libmaven-bundle-plugin-java library. -Section: Programming/Java - -Format: HTML -Index: /usr/share/doc/libmaven-bundle-plugin-java/api/index.html -Files: /usr/share/doc/libmaven-bundle-plugin-java/api/*.html - diff -Nru maven-bundle-plugin-2.5.4/debian/libmaven-bundle-plugin-java-doc.install maven-bundle-plugin-3.5.0/debian/libmaven-bundle-plugin-java-doc.install --- maven-bundle-plugin-2.5.4/debian/libmaven-bundle-plugin-java-doc.install 2015-12-07 10:55:51.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/libmaven-bundle-plugin-java-doc.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -target/apidocs/* /usr/share/doc/libmaven-bundle-plugin-java/api/ -doc/apache-* /usr/share/doc/libmaven-bundle-plugin-java/ diff -Nru maven-bundle-plugin-2.5.4/debian/libmaven-bundle-plugin-java.docs maven-bundle-plugin-3.5.0/debian/libmaven-bundle-plugin-java.docs --- maven-bundle-plugin-2.5.4/debian/libmaven-bundle-plugin-java.docs 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/libmaven-bundle-plugin-java.docs 2018-03-20 08:48:46.000000000 +0000 @@ -0,0 +1 @@ +NOTICE \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/debian/maven.rules maven-bundle-plugin-3.5.0/debian/maven.rules --- maven-bundle-plugin-2.5.4/debian/maven.rules 2017-08-30 14:51:22.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/maven.rules 2018-03-20 08:24:45.000000000 +0000 @@ -3,7 +3,6 @@ org.apache.maven.shared maven-dependency-tree jar s/.*/debian/ * * org.codehaus.plexus plexus-container-default jar s/.*/1.5.5/ * * org.codehaus.plexus plexus-utils jar s/.*/2.x/ * * -biz.aQute.bnd s/biz.aQute.bndlib/bndlib/ * s/.*/debian/ * * s/org.apache.felix/org.osgi/ org.osgi.core * s/.*/debian/ * * org.apache.maven s/maven-core/maven-compat/ * s/.*/3.x/ * * org.apache.maven.reporting maven-reporting-api * s/.*/3.x/ * * diff -Nru maven-bundle-plugin-2.5.4/debian/orig-tar.sh maven-bundle-plugin-3.5.0/debian/orig-tar.sh --- maven-bundle-plugin-2.5.4/debian/orig-tar.sh 2015-12-07 10:55:51.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/orig-tar.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#!/bin/sh -e - -VERSION=$2 -TAR=../maven-bundle-plugin_$VERSION.orig.tar.xz -DIR=maven-bundle-plugin-$VERSION -TAG=$(echo "maven-bundle-plugin-$VERSION" | sed -re's/~(alpha|beta)/-\1-/') - -svn export https://svn.apache.org/repos/asf/felix/releases/${TAG}/ $DIR -XZ_OPT=--best tar -c -J -f $TAR --exclude '*.jar' --exclude '*.class' $DIR -rm -rf $DIR ../$TAG - -# move to directory 'tarballs' -if [ -r .svn/deb-layout ]; then - . .svn/deb-layout - mv $TAR $origDir && echo "moved $TAR to $origDir" -fi diff -Nru maven-bundle-plugin-2.5.4/debian/patches/0001-Port-to-current-maven-dependency-tree.patch maven-bundle-plugin-3.5.0/debian/patches/0001-Port-to-current-maven-dependency-tree.patch --- maven-bundle-plugin-2.5.4/debian/patches/0001-Port-to-current-maven-dependency-tree.patch 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/0001-Port-to-current-maven-dependency-tree.patch 2018-03-20 08:42:39.000000000 +0000 @@ -0,0 +1,253 @@ +From ac9f85cd5fdab1d51defa363b31235c45560c7f6 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Fri, 12 Feb 2016 09:45:20 +0100 +Subject: [PATCH 1/4] Port to current maven-dependency-tree + +--- + pom.xml | 2 +- + .../apache/felix/bundleplugin/BundleAllPlugin.java | 54 ++++++++++++---------- + .../apache/felix/bundleplugin/BundlePlugin.java | 30 ++++++------ + 3 files changed, 46 insertions(+), 40 deletions(-) + +--- a/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java +@@ -21,8 +21,10 @@ + + import java.io.File; + import java.io.FilenameFilter; ++import java.util.ArrayDeque; + import java.util.Arrays; + import java.util.Collection; ++import java.util.Deque; + import java.util.HashSet; + import java.util.Iterator; + import java.util.LinkedHashMap; +@@ -38,7 +40,6 @@ + import org.apache.maven.artifact.factory.ArtifactFactory; + import org.apache.maven.artifact.metadata.ArtifactMetadataSource; + import org.apache.maven.artifact.repository.ArtifactRepository; +-import org.apache.maven.artifact.resolver.ArtifactCollector; + import org.apache.maven.artifact.resolver.ArtifactNotFoundException; + import org.apache.maven.artifact.resolver.ArtifactResolutionException; + import org.apache.maven.artifact.resolver.ArtifactResolver; +@@ -49,13 +50,14 @@ + import org.apache.maven.plugins.annotations.Mojo; + import org.apache.maven.plugins.annotations.Parameter; + import org.apache.maven.plugins.annotations.ResolutionScope; ++import org.apache.maven.project.DefaultProjectBuildingRequest; + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.MavenProjectBuilder; + import org.apache.maven.project.ProjectBuildingException; ++import org.apache.maven.project.ProjectBuildingRequest; + import org.apache.maven.project.artifact.InvalidDependencyVersionException; +-import org.apache.maven.shared.dependency.tree.DependencyNode; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; ++import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; ++import org.apache.maven.shared.dependency.graph.DependencyNode; + import org.codehaus.plexus.util.FileUtils; + + import aQute.bnd.osgi.Analyzer; +@@ -92,24 +94,18 @@ + */ + @Parameter( property = "wrapImportPackage", defaultValue = "*" ) + private String wrapImportPackage; +- + @Component + private ArtifactFactory m_factory; + + @Component + private ArtifactMetadataSource m_artifactMetadataSource; + +- @Component +- private ArtifactCollector m_collector; +- + /** + * Artifact resolver, needed to download jars. + */ + @Component + private ArtifactResolver m_artifactResolver; + +- @Component +- private DependencyTreeBuilder m_dependencyTreeBuilder; + + @Component + private MavenProjectBuilder m_mavenProjectBuilder; +@@ -180,17 +176,19 @@ + + try + { +- dependencyTree = m_dependencyTreeBuilder.buildDependencyTree( project, localRepository, m_factory, +- m_artifactMetadataSource, null, m_collector ); ++ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); ++ request.setProject(getProject()); ++ request.setRepositorySession(session.getRepositorySession()); ++ dependencyTree = m_dependencyGraphBuilder.buildDependencyGraph(request, null); + } +- catch ( DependencyTreeBuilderException e ) ++ catch ( DependencyGraphBuilderException e ) + { + throw new MojoExecutionException( "Unable to build dependency tree", e ); + } + + BundleInfo bundleInfo = new BundleInfo(); + +- if ( !dependencyTree.hasChildren() ) ++ if ( dependencyTree.getChildren().isEmpty()) + { + /* no need to traverse the tree */ + return bundleRoot( project, bundleInfo ); +@@ -198,20 +196,27 @@ + + getLog().debug( "Will bundle the following dependency tree" + LS + dependencyTree ); + +- for ( Iterator it = dependencyTree.inverseIterator(); it.hasNext(); ) ++ Deque stack = new ArrayDeque(); ++ stack.push(dependencyTree); ++ Set visited = new HashSet(); ++ while (!stack.isEmpty()) + { +- DependencyNode node = ( DependencyNode ) it.next(); +- if ( !it.hasNext() ) ++ DependencyNode node = stack.pop(); ++ if (visited.contains(node)) + { +- /* this is the root, current project */ +- break; ++ continue; + } +- +- if ( node.getState() != DependencyNode.INCLUDED ) ++ visited.add(node); ++ if (node.getChildren() != null) + { +- continue; ++ stack.addAll(node.getChildren()); + } + ++ //if ( node.getState() != DependencyNode.INCLUDED ) ++ //{ ++ // continue; ++ //} ++ + if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) ) + { + getLog().debug( "Ignoring system scoped artifact " + node.getArtifact() ); +@@ -235,12 +240,11 @@ + + node.getArtifact().setFile( artifact.getFile() ); + +- int nodeDepth = node.getDepth(); +- if ( nodeDepth > maxDepth ) ++ if ( stack.size() > maxDepth ) + { + /* node is deeper than we want */ + getLog().debug( +- "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + maxDepth ); ++ "Ignoring " + node.getArtifact() + ", depth is " + stack.size() + ", bigger than " + maxDepth ); + continue; + } + +--- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +@@ -72,15 +72,15 @@ + import org.apache.maven.plugins.annotations.Mojo; + import org.apache.maven.plugins.annotations.Parameter; + import org.apache.maven.plugins.annotations.ResolutionScope; ++import org.apache.maven.project.DefaultProjectBuildingRequest; + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.MavenProjectBuilder; + import org.apache.maven.project.MavenProjectHelper; + import org.apache.maven.project.ProjectBuildingException; ++import org.apache.maven.project.ProjectBuildingRequest; + import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; + import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; + import org.apache.maven.shared.dependency.graph.DependencyNode; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; +-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; + import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; + import org.apache.maven.shared.osgi.Maven2OsgiConverter; + import org.codehaus.plexus.archiver.UnArchiver; +@@ -224,9 +224,6 @@ + @Component + protected MavenProjectBuilder mavenProjectBuilder; + +- @Component +- private DependencyTreeBuilder dependencyTreeBuilder; +- + /** + * The dependency graph builder to use. + */ +@@ -346,7 +343,10 @@ + DependencyNode dependencyGraph; + try + { +- dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( mavenProject, null ); ++ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); ++ request.setProject(mavenProject); ++ request.setRepositorySession(session.getRepositorySession()); ++ dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( request, null ); + } + catch ( DependencyGraphBuilderException e ) + { +@@ -757,7 +757,7 @@ + // We need to find the direct dependencies that have been included in the uber JAR so that we can modify the + // POM accordingly. + private void createDependencyReducedPom( Set artifactsToRemove ) +- throws IOException, DependencyTreeBuilderException, ProjectBuildingException ++ throws IOException, DependencyGraphBuilderException, ProjectBuildingException + { + Model model = project.getOriginalModel(); + List dependencies = new ArrayList(); +@@ -900,24 +900,26 @@ + } + + public boolean updateExcludesInDeps( MavenProject project, List dependencies, List transitiveDeps ) +- throws DependencyTreeBuilderException ++ throws DependencyGraphBuilderException + { +- org.apache.maven.shared.dependency.tree.DependencyNode node = dependencyTreeBuilder.buildDependencyTree(project, localRepository, artifactFactory, +- artifactMetadataSource, null, +- artifactCollector); ++ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); ++ request.setProject(project); ++ request.setRepositorySession(session.getRepositorySession()); ++ DependencyNode node = dependencyGraphBuilder.buildDependencyGraph(request, null); + boolean modified = false; + Iterator it = node.getChildren().listIterator(); + while ( it.hasNext() ) + { +- org.apache.maven.shared.dependency.tree.DependencyNode n2 = (org.apache.maven.shared.dependency.tree.DependencyNode) it.next(); ++ DependencyNode n2 = (DependencyNode) it.next(); + Iterator it2 = n2.getChildren().listIterator(); + while ( it2.hasNext() ) + { +- org.apache.maven.shared.dependency.tree.DependencyNode n3 = (org.apache.maven.shared.dependency.tree.DependencyNode) it2.next(); ++ DependencyNode n3 = (DependencyNode) it2.next(); + //anything two levels deep that is marked "included" + //is stuff that was excluded by the original poms, make sure it + //remains excluded IF promoting transitives. +- if ( n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED ) ++ //if ( n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED ) ++ if (true) + { + //check if it really isn't in the list of original dependencies. Maven + //prior to 2.0.8 may grab versions from transients instead of +--- a/pom.xml ++++ b/pom.xml +@@ -115,6 +115,15 @@ + + + ++ ++ org.apache.maven.plugins ++ maven-compiler-plugin ++ ++ ++ org/apache/maven/shared/dependency/tree/**/*.java ++ ++ ++ + + org.apache.maven.plugins + maven-plugin-plugin diff -Nru maven-bundle-plugin-2.5.4/debian/patches/backward-compatibility.patch maven-bundle-plugin-3.5.0/debian/patches/backward-compatibility.patch --- maven-bundle-plugin-2.5.4/debian/patches/backward-compatibility.patch 2015-12-07 10:57:59.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/backward-compatibility.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -Description: Fixes a regression in the version 2.3.7 causing two build - failures on javamail (#761548) and sisu-guice (#761522). - . - For javamail, checking out a clean copy of the upstream source, - upgrading maven-bundle-plugin to 2.3.7 in the pom and building directly - with Maven works fine. So the upgrade to 2.3.7 alone isn't enough to - explain the regression, something else specific to the Debian packaging - is involved. - . - The regression was caused by the fix for FELIX-3165: - https://issues.apache.org/jira/browse/FELIX-3165 - https://svn.apache.org/r1184887 - . - This patch reverts to the old behaviour only when the - debian.maven-bundle-plugin.compatibility property is set to true. - -Author: Emmanuel Bourg -Forwarded: not-needed -Bug-Debian: http://bugs.debian.org/761548 - http://bugs.debian.org/761522 ---- a/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java -+++ b/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java -@@ -67,7 +67,18 @@ - Manifest manifest; - try - { -- manifest = getManifest( project, instructions, properties, classpath ); -+ if ( "true".equals( System.getProperty("debian.maven-bundle-plugin.compatibility") ) -+ && supportedProjectTypes.contains( getProject().getArtifact().getType() ) ) -+ { -+ getLog().info("maven-bundle-plugin 2.3.5 compatibility enabled"); -+ Builder builder = buildOSGiBundle( project, instructions, properties, classpath ); -+ manifest = builder.getJar().getManifest(); -+ builder.close(); -+ } -+ else -+ { -+ manifest = getManifest( project, instructions, properties, classpath ); -+ } - } - catch ( FileNotFoundException e ) - { diff -Nru maven-bundle-plugin-2.5.4/debian/patches/FELIX-4882.patch maven-bundle-plugin-3.5.0/debian/patches/FELIX-4882.patch --- maven-bundle-plugin-2.5.4/debian/patches/FELIX-4882.patch 2015-12-14 10:01:37.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/FELIX-4882.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -Description: Backport of FELIX-4882: Correctly use Maven Plugin Tools Java 5 annotations instead of javadoc tags -Origin: backport, https://svn.apache.org/r1678868 -Bug: https://issues.apache.org/jira/browse/FELIX-4882 ---- a/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java -+++ b/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java -@@ -69,8 +69,7 @@ - * @deprecated The bundleall goal is no longer supported and may be removed in a future release - */ - @Deprecated --@Mojo( name = "bundleall", requiresDependencyResolution = ResolutionScope.TEST ) --@Execute( phase = LifecyclePhase.PACKAGE ) -+@Mojo( name = "bundleall", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.PACKAGE ) - public class BundleAllPlugin extends ManifestPlugin - { - private static final String LS = System.getProperty( "line.separator" ); ---- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java -+++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java -@@ -90,8 +90,7 @@ - * Create an OSGi bundle from Maven project - * - */ --@Mojo( name = "bundle", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) --@Execute( phase = LifecyclePhase.PACKAGE ) -+@Mojo( name = "bundle", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true, defaultPhase = LifecyclePhase.PACKAGE ) - public class BundlePlugin extends AbstractMojo - { - /** ---- a/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java -+++ b/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java -@@ -49,8 +49,7 @@ - /** - * Generate an OSGi manifest for this project - */ --@Mojo( name = "manifest", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) --@Execute( phase = LifecyclePhase.PROCESS_CLASSES ) -+@Mojo( name = "manifest", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true, defaultPhase = LifecyclePhase.PROCESS_CLASSES) - public class ManifestPlugin extends BundlePlugin - { - /** ---- a/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java -+++ b/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java -@@ -31,8 +31,7 @@ - * @deprecated The wrap goal is no longer supported and may be removed in a future release - */ - @Deprecated --@Mojo( name = "wrap", requiresDependencyResolution = ResolutionScope.TEST ) --@Execute( phase = LifecyclePhase.PACKAGE ) -+@Mojo( name = "wrap", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.PACKAGE) - public final class WrapPlugin extends BundleAllPlugin - { - public void execute() throws MojoExecutionException ---- a/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java -+++ b/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java -@@ -38,8 +38,7 @@ - * BND Baseline check between two bundles. - * @since 2.4.1 - */ --@Mojo( name = "baseline", threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST ) --@Execute( phase = LifecyclePhase.VERIFY ) -+@Mojo( name = "baseline", threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.VERIFY) - public final class BaselinePlugin - extends AbstractBaselinePlugin - { ---- a/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java -+++ b/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java -@@ -43,8 +43,7 @@ - * - * @since 2.4.1 - */ --@Mojo( name = "baseline-report", threadSafe = true ) --@Execute( phase = LifecyclePhase.SITE ) -+@Mojo( name = "baseline-report", threadSafe = true, defaultPhase = LifecyclePhase.SITE) - public final class BaselineReport - extends AbstractBaselinePlugin - implements MavenReport ---- a/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java -+++ b/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java -@@ -60,8 +60,7 @@ - * - * @author Felix Project Team - */ --@Mojo( name = "clean", requiresProject = false ) --@Execute( phase = LifecyclePhase.CLEAN ) -+@Mojo( name = "clean", requiresProject = false, defaultPhase = LifecyclePhase.CLEAN ) - public class ObrCleanRepo extends AbstractMojo - { - /** ---- a/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java -+++ b/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java -@@ -48,8 +48,7 @@ - * - * @author Felix Project Team - */ --@Mojo( name = "deploy", threadSafe = true ) --@Execute( phase = LifecyclePhase.DEPLOY ) -+@Mojo( name = "deploy", threadSafe = true, defaultPhase = LifecyclePhase.DEPLOY ) - public final class ObrDeploy extends AbstractMojo - { - /** ---- a/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java -+++ b/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java -@@ -42,8 +42,7 @@ - * - * @author Felix Project Team - */ --@Mojo( name = "deploy-file", requiresProject = false ) --@Execute( phase = LifecyclePhase.DEPLOY ) -+@Mojo( name = "deploy-file", requiresProject = false, defaultPhase = LifecyclePhase.DEPLOY ) - public final class ObrDeployFile extends AbstractFileMojo - { - /** ---- a/src/main/java/org/apache/felix/obrplugin/ObrInstall.java -+++ b/src/main/java/org/apache/felix/obrplugin/ObrInstall.java -@@ -41,8 +41,7 @@ - * - * @author Felix Project Team - */ --@Mojo( name = "install", threadSafe = true ) --@Execute( phase = LifecyclePhase.INSTALL ) -+@Mojo( name = "install", threadSafe = true, defaultPhase = LifecyclePhase.INSTALL ) - public final class ObrInstall extends AbstractMojo - { - /** ---- a/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java -+++ b/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java -@@ -38,8 +38,7 @@ - * - * @author Felix Project Team - */ --@Mojo( name = "install-file", requiresProject = false ) --@Execute( phase = LifecyclePhase.INSTALL ) -+@Mojo( name = "install-file", requiresProject = false, defaultPhase = LifecyclePhase.INSTALL ) - public final class ObrInstallFile extends AbstractFileMojo - { - /** ---- a/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java -+++ b/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java -@@ -73,8 +73,7 @@ - * - * @author Felix Project Team - */ --@Mojo( name = "remote-clean", requiresProject = false ) --@Execute( phase = LifecyclePhase.CLEAN ) -+@Mojo( name = "remote-clean", requiresProject = false, defaultPhase = LifecyclePhase.CLEAN ) - public final class ObrRemoteClean extends AbstractMojo - { - /** diff -Nru maven-bundle-plugin-2.5.4/debian/patches/maven3-compatibility.patch maven-bundle-plugin-3.5.0/debian/patches/maven3-compatibility.patch --- maven-bundle-plugin-2.5.4/debian/patches/maven3-compatibility.patch 2017-08-30 14:15:29.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/maven3-compatibility.patch 2018-03-20 08:20:36.000000000 +0000 @@ -3,8 +3,8 @@ Forwarded: no --- a/pom.xml +++ b/pom.xml -@@ -113,6 +113,11 @@ - 2.0.7 +@@ -182,6 +182,11 @@ + 2.2.0 + org.apache.maven.reporting @@ -14,4 +14,4 @@ + org.apache.maven maven-archiver - 2.5 + 2.6 diff -Nru maven-bundle-plugin-2.5.4/debian/patches/maven-archiver3-869361.patch maven-bundle-plugin-3.5.0/debian/patches/maven-archiver3-869361.patch --- maven-bundle-plugin-2.5.4/debian/patches/maven-archiver3-869361.patch 2017-08-02 10:33:24.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/maven-archiver3-869361.patch 2018-03-09 07:35:02.000000000 +0000 @@ -4,7 +4,7 @@ --- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java -@@ -757,7 +757,7 @@ +@@ -1098,7 +1098,7 @@ * Grab customized manifest entries from the maven-jar-plugin configuration */ MavenArchiveConfiguration archiveConfig = JarPluginConfiguration.getArchiveConfiguration( currentProject ); diff -Nru maven-bundle-plugin-2.5.4/debian/patches/remove_bndlib_spring_support.diff maven-bundle-plugin-3.5.0/debian/patches/remove_bndlib_spring_support.diff --- maven-bundle-plugin-2.5.4/debian/patches/remove_bndlib_spring_support.diff 2015-12-07 10:57:52.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/remove_bndlib_spring_support.diff 2018-03-09 07:25:20.000000000 +0000 @@ -6,23 +6,22 @@ --- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java -@@ -84,7 +84,6 @@ - import aQute.bnd.osgi.Jar; +@@ -107,7 +107,6 @@ import aQute.bnd.osgi.Packages; import aQute.bnd.osgi.Processor; + import aQute.lib.collections.ExtList; -import aQute.lib.spring.SpringXMLType; + import aQute.libg.generics.Create; - /** -@@ -1304,11 +1303,6 @@ +@@ -1839,10 +1838,6 @@ properties.put( "classifier", classifier == null ? "" : classifier ); - // Add default plugins -- header( properties, Analyzer.PLUGIN, ScrPlugin.class.getName() + "," -- + BlueprintPlugin.class.getName() + "," -- + SpringXMLType.class.getName() ); -- +- header( properties, Analyzer.PLUGIN, BlueprintPlugin.class.getName() + "," +- + SpringXMLType.class.getName() + "," +- + JpaPlugin.class.getName() ); + return properties; } - diff -Nru maven-bundle-plugin-2.5.4/debian/patches/series maven-bundle-plugin-3.5.0/debian/patches/series --- maven-bundle-plugin-2.5.4/debian/patches/series 2017-08-30 14:14:02.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/series 2018-03-20 08:19:23.000000000 +0000 @@ -1,7 +1,6 @@ remove_bndlib_spring_support.diff support_plexus_utils_1_5.diff -backward-compatibility.patch use-changelog-date-as-pom.properties-timestamp.patch -FELIX-4882.patch maven-archiver3-869361.patch maven3-compatibility.patch +0001-Port-to-current-maven-dependency-tree.patch diff -Nru maven-bundle-plugin-2.5.4/debian/patches/support_plexus_utils_1_5.diff maven-bundle-plugin-3.5.0/debian/patches/support_plexus_utils_1_5.diff --- maven-bundle-plugin-2.5.4/debian/patches/support_plexus_utils_1_5.diff 2015-12-07 10:57:56.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/support_plexus_utils_1_5.diff 2018-03-09 07:26:11.000000000 +0000 @@ -5,7 +5,7 @@ --- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java -@@ -603,7 +603,7 @@ +@@ -734,7 +734,7 @@ { getLog().info( "Writing BND instructions to " + dumpInstructions ); dumpInstructions.getParentFile().mkdirs(); @@ -14,7 +14,7 @@ } } -@@ -615,7 +615,7 @@ +@@ -748,7 +748,7 @@ { getLog().info( "Writing BND classpath to " + dumpClasspath ); dumpClasspath.getParentFile().mkdirs(); diff -Nru maven-bundle-plugin-2.5.4/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch maven-bundle-plugin-3.5.0/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch --- maven-bundle-plugin-2.5.4/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch 2015-12-07 10:58:01.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch 2018-03-09 07:32:08.000000000 +0000 @@ -82,9 +82,9 @@ +} --- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java -@@ -1072,7 +1072,8 @@ - File pomFile = new File( currentProject.getBasedir(), "pom.xml" ); - jar.putResource( path + "/pom.xml", new FileResource( pomFile ) ); +@@ -1610,7 +1610,8 @@ + jar.putResource( path + "/pom.xml", new FileResource( pomFile ) ); + } - Properties p = new Properties(); + java.util.Date buildDate = DebianUtils.getDebianBuildDate(); diff -Nru maven-bundle-plugin-2.5.4/debian/rules maven-bundle-plugin-3.5.0/debian/rules --- maven-bundle-plugin-2.5.4/debian/rules 2015-12-07 10:55:51.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/rules 2018-03-20 08:11:09.000000000 +0000 @@ -6,4 +6,4 @@ dh $@ --buildsystem=maven get-orig-source: - uscan --download-current-version --force-download --rename + uscan --download-current-version --force-download --repack --compression xz diff -Nru maven-bundle-plugin-2.5.4/debian/watch maven-bundle-plugin-3.5.0/debian/watch --- maven-bundle-plugin-2.5.4/debian/watch 2015-12-07 10:55:51.000000000 +0000 +++ maven-bundle-plugin-3.5.0/debian/watch 2018-03-08 15:01:56.000000000 +0000 @@ -1,4 +1,2 @@ -version=3 -opts="uversionmangle=s/-(alpha|beta)-/~$1/" \ - https://svn.apache.org/repos/asf/felix/releases/ \ - maven-bundle-plugin-(\d.*)/ debian debian/orig-tar.sh +version=4 +https://archive.apache.org/dist/felix maven-bundle-plugin@ANY_VERSION@-source-release@ARCHIVE_EXT@ \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/DEPENDENCIES maven-bundle-plugin-3.5.0/DEPENDENCIES --- maven-bundle-plugin-2.5.4/DEPENDENCIES 2014-06-20 12:08:48.000000000 +0000 +++ maven-bundle-plugin-3.5.0/DEPENDENCIES 2018-01-03 12:49:20.000000000 +0000 @@ -1,5 +1,5 @@ Apache Felix Bundle Maven Plugin -Copyright 2006-2014 The Apache Software Foundation +Copyright 2006-2017 The Apache Software Foundation This software was developed at the Apache Software Foundation (http://www.apache.org) and may have dependencies on other @@ -11,8 +11,8 @@ II. Used Third-Party Software This product uses software developed by Peter Kriens -(http://www.aqute.biz/Code/Bnd) -Copyright 2006-2014 aQute, All rights reserved +(http://bnd.bndtools.org/) +Copyright 2006-2016 aQute, All rights reserved Licensed under the Apache License 2.0. This product uses software developed at Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/apache.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/apache.png differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/button_data/2013-na-125x125.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/button_data/2013-na-125x125.png differ diff -Nru maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/button.html maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/button.html --- maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/button.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/button.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/check.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/check.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/information.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/information.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/logo.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/logo.png differ diff -Nru maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/site.css maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/site.css --- maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd_files/site.css 2011-11-28 15:58:52.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd_files/site.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* @override http://felix.apache.org/site/media.data/site.css */ - -body { background-color: #ffffff; color: #3b3b3b; font-family: Tahoma, Arial, sans-serif; font-size: 10pt; line-height: 140% } -h1, h2, h3, h4, h5, h6 { font-weight: bold; color: #000000; line-height: 100% } -h1 { font-size: 200% } -h2 { font-size: 175% } -h3 { font-size: 150% } -h4 { font-size: 140%; font-weight: normal } -h5 { font-size: 130%; font-weight: normal } -h6 { font-size: 120%; font-weight: normal } -a { color: #1980af } -a:visited { color: #1980af } -a:hover { color: #1faae9 } -.title { position: absolute; left: 1px; right: 1px; top:25px; height: 81px; background: url(http://felix.apache.org/site/media.data/gradient.png) repeat-x; background-position: bottom; } -.logo { position: absolute; width: 15em; height: 81px; text-align: center; } -.header { text-align: right; margin-right: 20pt; margin-top: 30pt;} -.menu { border-top: 10px solid #f9bb00; position: absolute; top: 107px; left: 1px; width: 15em; bottom: 0px; padding: 0px; background-color: #fcfcfc } -.menu ul { background-color: #fdf5d9; list-style: none; padding-left: 4em; margin-top: 0px; padding-top: 2em; padding-bottom: 2em; margin-left: 0px; color: #4a4a43} -.menu a { text-decoration: none; color: #4a4a43 } -.main { position: absolute; border-top: 10px solid #cde0ea; top: 107px; left: 15em; right: 1px; margin-left: 2px; padding-right: 4em; padding-left: 1em; padding-top: 1em;} -.code { background-color: #eeeeee; border: solid 1px black; padding: 0.5em } -.code-keyword { color: #880000 } -.code-quote { color: #008800 } -.code-object { color: #0000dd } -.code-java { margin: 0em } -.code-xml { margin: 0em } -table.confluenceTable { border-collapse: collapse; margin: 10px 0 10px 0 } -td.confluenceTd { border:1px solid #CCCCCC; padding:5px; vertical-align:top; } - -/** Last modification information at the botton of each page */ -.timestamp { - margin-top: 30px; - font-size: 80%; - text-align: right; -} - -/** Trademark text at the bottom of each page */ -.trademarkFooter { - font-size: 80%; - font-style: italic; - margin-top: 10px; - text-align: left; -} diff -Nru maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd.html maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd.html --- maven-bundle-plugin-2.5.4/doc/apache-felix-maven-bundle-plugin-bnd.html 2014-06-20 12:07:06.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/apache-felix-maven-bundle-plugin-bnd.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,1090 +0,0 @@ - - - - Apache Felix - Apache Felix Maven Bundle Plugin (BND) - - - - -
Apache
- -
-

Bundle Plugin for Maven

- -

This plugin for Maven 2 is based on the BND tool from Peter Kriens. The way BND works is by treating your project as a big collection of classes (e.g., project code, dependencies, and the class path). The way you create a bundle with BND is to tell it the content of the bundle's JAR file as a subset of the available classes. This plugin wraps BND to make it work specifically with the Maven 2 project structure and to provide it with reasonable default behavior for Maven 2 projects.

- -
If you have questions about the maven-bundle-plugin please read the FAQ first. If you still have questions you can ask them on the Felix user list.
- -

NOTE: test scoped dependencies are not included in the classpath seen by BND.

- -

Since the 1.4.0 release, this plugin also aims to automate OBR (OSGi Bundle Repository) management. It helps manage a local OBR for your local Maven repository, and also supports remote OBRs for bundle distribution. The plug-in automatically computes bundle capabilities and requirements, using a combination of Bindex and Maven metadata.

- - - - - -

- -

Simple Example

- -

Rather than going straight to a detailed list of plugin features, we will first look at a simple example of how to use the plugin to give an immediate flavor. A detailed "how to" will follow.

- -

Assume that we have a simple bundle project that has a pubic API package an several implementation packages, such as:

- -
-
org.foo.myproject.api
-org.foo.myproject.impl1
-org.foo.myproject.impl2
-...
-
-
- -

If we also assume that we have a bundle activator in one of the implementation packages, then the <plugins> section of the POM file for this bundle project would look like this:

- -
-
...
-<plugins>
-  <plugin>
-    <groupId>org.apache.felix</groupId>
-    <artifactId>maven-bundle-plugin</artifactId>
-    <extensions>true</extensions>
-    <configuration>
-      <instructions>
-        <Export-Package>org.foo.myproject.api</Export-Package>
-        <Private-Package>org.foo.myproject.*</Private-Package>
-        <Bundle-Activator>org.foo.myproject.impl1.Activator</Bundle-Activator>
-      </instructions>
-    </configuration>
-  </plugin>
-</plugins>
-...
-
-
- -

The <Export-Package> and <Private-Package> instructions tell the plugin about the contents of the resulting bundle JAR file. The <Export-Package> instruction tells the plugin which of the available packages to copy into the bundle and export, while the <Private-Package> instruction indicates which of the available packages to copy into the bundle but not export. If the two sets overlap, as they do in the case, then the export takes precedence. Since we did not specify any values for any other bundle manifest headers, they will assume default values which are described below. One specific behavior to highlight is that the plugin generates the Import-Package bundle manifest header based on the contents of the bundle, which means that you generally do not ever need to explicitly specify it yourself. That's it.

- -

Features

- -

The BND library underlying the plugin defines instructions to direct its behavior. For this Maven plugin, these instructions are issued in the plugin configuration section of the POM file, as was illustrated above. BND recognizes three types of instructions:

- -
    -
  1. Manifest headers - Any instruction that starts with a capital letter will appear in the resulting bundle's manifest file; the value for the header will either be copied, augmented, or generated by BND depending on the instruction.
  2. -
  3. Variables - Any instruction starting with a lowercase letter is assumed to be a variable in the form of a name-value pair, such as version=3.0, that can be used for property substitution, but is not copied to the manifest.
  4. -
  5. Directives - Any instruction starting with a '-' character is considered to be a directive that informs BND to perform some special processing and is not copied to the manifest.
  6. -
- - -

The remainder of this section covers the most important aspects of BND's instructions; for complete details refer to the BND documentation.

- -

- -

Instructions

- -

<Export-Package>

- -

The <Export-Package> instruction is a list of packages for the bundle to export. These packages are copied into the resulting bundle JAR file from the available classes (i.e., project classes, dependencies, and class path); thus, it is possible to include classes into your bundle that are not associated with source files in your project. <Export-Package> can be specified with package patterns using the '*' wildcard. Also, it is possible to exclude packages using negation by starting the package pattern with '!'. Thus, non-negated patterns indicate which of the available packages to include in the bundle, whereas negated patterns indicate which should not be included in the bundle.

- -

The list of package patterns is ordered and earlier patterns are applied before later patterns. For example, if you specify "org.foo.*,!org.foo.impl" the second pattern has no effect since all org.foo packages have already been selected by the first pattern. Instead, you should specify "!org.foo.impl,org.foo.*", which will export all org.foo packages except org.foo.impl.

- -

Following standard OSGi R4 syntax, package patterns can include both directives and attributes, which will be copied appropriately into the generated Export-Package manifest header. Besides explicitly listing package version attributes, BND will also determine package versions by examining the source JAR file or from packageinfo files in the package directory.

- -

<Private-Package>

- -

The <Private-Package> instruction is similar in every way to the <Export-Package> instruction, except for the fact that these packages will not be exported by the bundle. If a package is selected by both the export and private package headers, then the export takes precedence.

- -

<Include-Resource>

- -

The <Include-Resource> instruction is a list of arbitrary resources that should be copied into the bundle JAR file. The specified resources are declared as clauses that can have the following forms:

- -
-
clause ::= assignment | inline | simple
-assignment ::= PATH '=' PATH
-simple ::= PATH
-inline ::= '@' PATH
-
-
- -

For the <Include-Resource> instruction, actual file paths are relative to the pom.xml, while file copy destinations are relative to the root of the resulting bundle JAR file. In the case of assignment or simple forms, the PATH parameter can point to a file or directory. The simple form will place the resource in the bundle JAR with only the file name, i.e., without any path component. For example, including src/main/resources/a/b.c will result in a resource b.c in the root of the bundle JAR. If the PATH points to a directory, the entire directory hierarchy is copied into the resulting bundle JAR file relative to the specified directory. If a specific resource must be placed into a subdirectory of the bundle jar, then use the assignment form, where the first path is the the destination path (including file name if the resource is a file) and the second path is the resource to copy. The inline form requires a ZIP or JAR file, which will be completely expanded in the bundle JAR.

- -

If a resource clause is specified inside of "{ ... }" brackets, then variable substitution will be performed on the resource, where variables in the resources are denoted with "${ ... }" syntax.

- -

By default the bundle plugin converts the project's Maven resource directories into a single <Include-Resource> instruction. If you specify your own <Include-Resource> instruction, this will replace the generated one. To include the generated list of Maven resources in your own <Include-Resource> instruction just add {maven-resources} to the list and it will be expanded automatically.

- -

<Import-Package>

- -

The <Import-Package> instruction is a list of packages that are required by the bundle's contained packages. The default for this header is "*", resulting in importing all referred packages. This header rarely has to be explicitly specified. However, in certain cases when there is an unwanted import, such an import can be removed by using a negation package pattern. The package patterns work in the same way as for <Export-Package>, which means they are ordered. For example, if you wanted to import all packages except org.foo.impl you would specify "!org.foo.impl,*"

- -

- -

Default Behavior

- -

To use this plugin, very little information is required by BND. As part of the Maven integration, the plugin tries to set reasonable defaults for various instructions. For example:

- -
    -
  • <Bundle-SymbolicName> is computed using the shared Maven2OsgiConverter component, which uses the following algorithm:
    -Get the symbolic name as groupId + "." + artifactId, with the following exceptions: -
      -
    • if artifact.getFile is not null and the jar contains a OSGi Manifest with Bundle-SymbolicName property then that value is returned
    • -
    • if groupId has only one section (no dots) and artifact.getFile is not null then the first package name with classes is returned. eg. commons-logging:commons-logging -> org.apache.commons.logging
    • -
    • if artifactId is equal to last section of groupId then groupId is returned. eg. org.apache.maven:maven -> org.apache.maven
    • -
    • if artifactId starts with last section of groupId that portion is removed. eg. org.apache.maven:maven-core -> org.apache.maven.core
      -The computed symbolic name is also stored in the $(maven-symbolicname) property in case you want to add attributes or directives to it.
    • -
    -
  • -
  • <Export-Package> is now assumed to be the set of packages in your local Java sources, excluding the default package '.' and any packages containing 'impl' or 'internal'.
    -(before version 2 of the bundleplugin it was based on the symbolic name)
  • -
  • Since 2.2.0 you can also use {local-packages} inside <Export-Package> and it will be expanded to the set of local packages.
  • -
  • <Private-Package> is now assumed to be the set of packages in your local Java sources (note that any packages in both <Export-Package> and <Private-Package> will be exported).
    -(before version 2 of the bundleplugin it was assumed to be empty by default)
  • -
  • <Import-Package> is assumed to be "*", which imports everything referred to by the bundle content, but not contained in the bundle.
    -Any exported packages are also imported by default, to ensure a consistent class space.
  • -
  • <Include-Resource> is generated from the project's Maven resources, typically "src/main/resources/", which will copy the specified project directory hierarchy into the resulting bundle JAR file, mirroring standard Maven behavior.
  • -
  • <Bundle-Version> is assumed to be "${pom.version}" but is normalized to the OSGi version format of "MAJOR.MINOR.MICRO.QUALIFIER", for example "2.1-SNAPSHOT" would become "2.1.0.SNAPSHOT".
  • -
  • <Bundle-Name> is assumed to be "${pom.name}".
  • -
  • <Bundle-Description> is assumed to be "${pom.description}".
  • -
  • <Bundle-License> is assumed to be "${pom.licenses}".
  • -
  • <Bundle-Vendor> is assumed to be "${pom.organization.name}".
  • -
  • <Bundle-DocURL> is assumed to be "${pom.organization.url}".
  • -
- - -

Since the plugin creates bundles for OSGi R4, it hard-codes Bundle-ManifestVersion to be '2'. Additionally, it generates imports for every export to ensure package substitutability, which is very important when working with collaborating services. It is possible to override any of these values (except Bundle-ManifestVersion) just by specifying the desired value in the plugin configuration section of the POM file.

- -

- -

Detailed "How To"

- -

Get Maven2

- -

The first step in the process of using the plugin is downloading and installing the latest version of the Maven2 runtime. The latest Maven2 release and instuctions for getting started with Maven2 can be found at the Maven website.

- -

Using the Plugin

- -

To use the maven-bundle-plugin, you first need to add the plugin and some appropriate plugin configuration to your bundle project's POM. Below is an example of a simple OSGi bundle POM for Maven2:

- -
-
<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>my-osgi-bundles</groupId>
-  <artifactId>examplebundle</artifactId>
-  <packaging>bundle</packaging>    <!-- (1) -->
-  <version>1.0</version>
-  <name>Example Bundle</name>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>1.0.0</version>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <plugin>    <!-- (2) START -->
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Export-Package>com.my.company.api</Export-Package>
-            <Private-Package>com.my.company.*</Private-Package>
-            <Bundle-Activator>com.my.company.Activator</Bundle-Activator>
-          </instructions>
-        </configuration>
-      </plugin>    <!-- (2) END -->
-    </plugins>
-  </build>
-</project>
-
-
- -

There are two main things to note: (1) the <packaging> specifier must be "bundle" and (2) the plugin and configuration must be specified (the configuration section is where you will issue instructions to the plugin).

- -

Real-World Example

- -

Consider this more real-world example using Felix' Log Service implementation. The Log Service project is comprised of a single package: org.apache.felix.log.impl. It has a dependency on the core OSGi interfaces as well as a dependency on the compendium OSGi interfaces for the specific log service interfaces. The following is its POM file:

- -
-
<project>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>org.apache.felix.log</artifactId>
-  <packaging>bundle</packaging>
-  <name>Apache Felix Log Service</name>
-  <version>0.8.0-SNAPSHOT</version>
-  <description>
-    This bundle provides an implementation of the OSGi R4 Log service.
-  </description>
-  <dependencies>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>0.8.0-incubator</version>
-    </dependency>
-    <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <version>0.9.0-incubator-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Export-Package>org.osgi.service.log</Export-Package>
-            <Private-Package>org.apache.felix.log.impl</Private-Package>
-            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-            <Bundle-Activator>${pom.artifactId}.impl.Activator</Bundle-Activator>
-            <Export-Service>org.osgi.service.log.LogService,org.osgi.service.log.LogReaderService</Export-Service>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
-
-
- -

Notice that the <Export-Package> instruction specifies that the bundle exports the Log Service package, even though this package is not contained in the bundle project. By declaring this, the plugin will copy the Log Service package into the resulting bundle JAR file. This is useful in this case because now the bundle can resolve without having to download the entire compendium bundle. The resulting manifest for the Log Service bundle looks like this (notice how the imports/exports automatically have version information associated with them, which was obtained from packageinfo files in the source packages):

- -
-
Manifest-Version: 1
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Activator: org.apache.felix.log.impl.Activator
-Import-Package: org.osgi.framework;version=1.3, org.osgi.service.log;v
- ersion=1.3
-Include-Resource: src/main/resources
-Export-Package: org.osgi.service.log;uses:=org.osgi.framework;version=
- 1.3
-Bundle-Version: 0.8.0.SNAPSHOT
-Bundle-Name: Apache Felix Log Service
-Bundle-Description: This bundle provides an implementation of the OSGi
-  R4 Log service.
-Private-Package: org.apache.felix.log.impl
-Bundle-ManifestVersion: 2
-Export-Service: org.osgi.service.log.LogService,org.osgi.service.log.L
- ogReaderService
-Bundle-SymbolicName: org.apache.felix.log
-
-
- -

The resulting bundle JAR file has the following content (notice how the LICENSE and NOTICE files were automatically copied from the src/main/resources/ directory of the project):

- -
-
META-INF/MANIFEST.MF
-LICENSE
-META-INF/
-META-INF/maven/
-META-INF/maven/org.apache.felix/
-META-INF/maven/org.apache.felix/org.apache.felix.log/
-META-INF/maven/org.apache.felix/org.apache.felix.log/pom.properties
-META-INF/maven/org.apache.felix/org.apache.felix.log/pom.xml
-NOTICE
-org/
-org/apache/
-org/apache/felix/
-org/apache/felix/log/
-org/apache/felix/log/impl/
-org/apache/felix/log/impl/Activator.class
-org/apache/felix/log/impl/Log.class
-org/apache/felix/log/impl/LogEntryImpl.class
-org/apache/felix/log/impl/LogException.class
-org/apache/felix/log/impl/LogListenerThread.class
-org/apache/felix/log/impl/LogNode.class
-org/apache/felix/log/impl/LogNodeEnumeration.class
-org/apache/felix/log/impl/LogReaderServiceFactory.class
-org/apache/felix/log/impl/LogReaderServiceImpl.class
-org/apache/felix/log/impl/LogServiceFactory.class
-org/apache/felix/log/impl/LogServiceImpl.class
-org/osgi/
-org/osgi/service/
-org/osgi/service/log/
-org/osgi/service/log/LogEntry.class
-org/osgi/service/log/LogListener.class
-org/osgi/service/log/LogReaderService.class
-org/osgi/service/log/LogService.class
-org/osgi/service/log/package.html
-org/osgi/service/log/packageinfo
-
-
- -

Adding OSGi metadata to existing projects without changing the packaging type

- -

If you want to keep your project packaging type (for example "jar") but would like to add OSGi metadata
-you can use the manifest goal to generate a bundle manifest. The maven-jar-plugin can then be used to
-add this manifest to the final artifact. For example:

- -
-
<plugin>
-  <artifactId>maven-jar-plugin</artifactId>
-  <configuration>
-    <archive>  
-      <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
-    </archive> 
-  </configuration>
-</plugin>  
-<plugin>   
-  <groupId>org.apache.felix</groupId>
-  <artifactId>maven-bundle-plugin</artifactId>
-  <executions>
-    <execution>
-      <id>bundle-manifest</id>
-      <phase>process-classes</phase>
-      <goals>    
-        <goal>manifest</goal>
-      </goals>   
-    </execution>
-  </executions>
-</plugin>
-
-
- -

If you want to use packaging types other than "jar" and "bundle" then you also need to enable support
-for them in the bundleplugin configuration, for example if you want to use the plugin with WAR files:

- -
-
<plugin>
-  <groupId>org.apache.felix</groupId>
-  <artifactId>maven-bundle-plugin</artifactId>
-  <executions>
-    <execution>
-      <id>bundle-manifest</id>
-      <phase>process-classes</phase>
-      <goals>
-        <goal>manifest</goal>
-      </goals>
-    </execution>
-  </executions>
-  <configuration>
-    <supportedProjectTypes>
-      <supportedProjectType>jar</supportedProjectType>
-      <supportedProjectType>bundle</supportedProjectType>
-      <supportedProjectType>war</supportedProjectType>
-    </supportedProjectTypes>
-    <instructions>
-      <!-- ...etc... -->
-    </instructions>
-  </configuration>
-</plugin>
-
-
- -

You'll also need to configure the other plugin to pick up and use the generated manifest, which is written to ${project.build.outputDirectory}/META-INF/MANIFEST.MF by default (unless you choose a different manifestLocation in the maven-bundle-plugin configuration). Continuing with our WAR example:

- -
-
<plugin>
-  <groupId>org.apache.maven.plugins</groupId>
-  <artifactId>maven-war-plugin</artifactId>
-  <configuration>
-    <archive>
-      <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
-    </archive>
-  </configuration>
-</plugin>
-
-
- -

Building the Plugin

- -

The plugin is hosted at the Apache Felix project. The following steps describe how to build and install the plugin into your local Maven2 repository.

- -

Using the SVN client of your choice, checkout the maven-bundle-plugin project.

- -
-
$ svn co http://svn.apache.org/repos/asf/felix/trunk/bundleplugin
-
-
- -

Using Maven2, build and install the maven-bundle-plugin by issuing the following Maven2 command in the project directory that was created as a result of the previous step.

- -
-
$ mvn install
-
-
- -

Goals

- -

The maven-bundle-plugin also provides additional functionality via some Maven goals. Command-line execution of a goal is performed as follows:

- -
-
mvn org.apache.felix:maven-bundle-plugin:GOAL
-
-
- -

Where GOAL is one of the following:

- -
    -
  • bundle - build an OSGi bundle jar for the current project
    -configuration options: -
      -
    • manifestLocation defaults to ${project.build.outputDirectory}/META-INF
    • -
    • unpackBundle unpack bundle contents to output directory, defaults to false
    • -
    • excludeDependencies comma-separated list of dependency artifactIds to exclude from the classpath passed to Bnd, use "true" to exclude everything.
      -Version 2 of the bundleplugin now supports the same style of filter clauses in excludeDependencies as Embed-Dependency.
    • -
    • classifier attach bundle to the project using the given classifier
    • -
    • supportedProjectTypes defaults to "jar","bundle"
    • -
    -
  • -
- - -
    -
  • bundleall - build OSGi bundle jars for all transitive dependencies
    -configuration options: -
      -
    • wrapImportPackage defaults to "*"
    • -
    • supportedProjectTypes defaults to "jar","bundle"
    • -
    -
  • -
- - -
    -
  • wrap - as above, but limited to the first level of dependencies
    -configuration options: -
      -
    • wrapImportPackage defaults to "*"
    • -
    • supportedProjectTypes defaults to "jar","bundle"
    • -
    -
  • -
- - -
    -
  • manifest - create an OSGi manifest for the current project
    -configuration options: -
      -
    • manifestLocation defaults to ${project.build.outputDirectory}/META-INF
    • -
    • supportedProjectTypes defaults to "jar","bundle"
    • -
    -
  • -
- - -
    -
  • install - adds the current bundle project to the local OBR
    -configuration options: -
      -
    • obrRepository path to local OBR, defaults to <local-maven-repository>/repository.xml
    • -
    • supportedProjectTypes defaults to "jar","bundle"
    • -
    -
  • -
- - -

More GOALs are available in the 1.4.0 release:

- -
    -
  • ant - create an Ant build script to rebuild the bundle
  • -
- - -
    -
  • install-file - adds a local bundle file to the local OBR
    -configuration options: -
      -
    • obrRepository path to local OBR, defaults to <local-maven-repository>/repository.xml
    • -
    • groupId Maven groupId for the bundle, taken from pomFile if given
    • -
    • artifactId Maven artifactId for the bundle, taken from pomFile if given
    • -
    • version Maven version for the bundle, taken from pomFile if given
    • -
    • packaging Maven packaging type for the bundle, taken from pomFile if given
    • -
    • classifier Maven classifier type, defaults to none
    • -
    • pomFile optional Pom file describing the bundle
    • -
    • file bundle file, defaults to the bundle from the local Maven repository
    • -
    • obrXml optional additional properties for the bundle
    • -
    -
  • -
- - -
    -
  • deploy - adds the current bundle project to a remote OBR
    -configuration options: -
      -
    • remoteOBR name of remote OBR, defaults to NONE (which means no remote OBR deployment)
    • -
    • obrRepository used when the remoteOBR name is blank, defaults to repository.xml
    • -
    • prefixUrl optional public URL prefix for the remote repository
    • -
    • bundleUrl optional public URL where the bundle has been deployed
    • -
    • altDeploymentRepository alternative remote repository, id::layout::url
    • -
    • obrDeploymentRepository optional OBR specific deployment repository.
    • -
    • ignoreLock ignore remote locking when updating the OBR
    • -
    • supportedProjectTypes defaults to "jar","bundle"
    • -
    -
  • -
- - -
    -
  • deploy-file - adds a local bundle file to a remote OBR
    -configuration options: -
      -
    • remoteOBR name of remote OBR, defaults to an empty string
    • -
    • obrRepository used when the remoteOBR name is blank, defaults to repository.xml
    • -
    • repositoryId optional repository id, used to lookup authentication settings
    • -
    • url remote repository transport URL, like -
      -
      scpexe://host/path/to/obr
      -
      -
    • -
    • bundleUrl public URL of deployed bundle, like -
      -
      http://www.foo.org/bundles/foo.jar
      -
      -
    • -
    • groupId Maven groupId for the bundle, taken from pomFile if given
    • -
    • artifactId Maven artifactId for the bundle, taken from pomFile if given
    • -
    • version Maven version for the bundle, taken from pomFile if given
    • -
    • packaging Maven packaging type for the bundle, taken from pomFile if given
    • -
    • classifier Maven classifier type, defaults to none
    • -
    • pomFile optional Pom file describing the bundle
    • -
    • file bundle file, defaults to the bundle from the local Maven repository
    • -
    • obrXml optional additional properties for the bundle
    • -
    • ignoreLock ignore remote locking when updating the OBR
    • -
    -
  • -
- - -
    -
  • clean - cleans the local OBR, removing missing bundles
    -configuration options: -
      -
    • obrRepository path to local OBR, defaults to <local-maven-repository>/repository.xml
    • -
    -
  • -
- - -
    -
  • remote-clean - cleans a remote OBR, removing missing bundles
    -configuration options: -
      -
    • remoteOBR name of remote OBR, defaults to NONE (which means no remote cleaning)
    • -
    • obrRepository used when the remoteOBR name is blank, defaults to repository.xml
    • -
    • prefixUrl optional public URL prefix for the remote repository
    • -
    • altDeploymentRepository alternative remote repository, id::layout::url
    • -
    • obrDeploymentRepository optional OBR specific deployment repository.
    • -
    • ignoreLock ignore remote locking when updating the OBR
    • -
    -
  • -
- - -

There are also new instructions available from the underlying BND tool, which continues to be improved independently; for the latest see BND documentation.

- -

The default goal bundle will be initialized by setting the <packaging> entry to "bundle".

- -

The following features are only available from version 1.2.0 onwards

- -

Embedding dependencies

- -

The Maven Bundle Plugin supports embedding of selected project dependencies inside the bundle by using the <Embed-Dependency> instruction:

- -
-
<Embed-Dependency>dependencies</Embed-Dependency>
-
-
- -

where:

- -
-
dependencies ::= clause ( ',' clause ) *
-clause ::= MATCH ( ';' attr '=' MATCH | ';inline=' inline )
-attr ::= 'groupId' | 'artifactId' | 'version' | 'scope' | 'type' | 'classifier' | 'optional'
-inline ::= 'true' | 'false' | PATH ( '|' PATH ) *
-MATCH ::= <globbed regular expression>
-PATH ::= <Ant-style path expression>
-
-
- -

The plugin uses the <Embed-Dependency> instruction to transform the project dependencies into <Include-Resource> and <Bundle-ClassPath> clauses, which are then appended to the current set of instructions and passed onto BND. If you want the embedded dependencies to be at the start or middle of <Include-Resource> or <Bundle-ClassPath> then you can use {maven-dependencies}, which will automatically expand to the relevant clauses.

- -

The MATCH section accepts alternatives, separated by |, and can be negated by using ! at the beginning of the MATCH. Use * to represent zero or more unknown characters and ? to represent zero or one character. You can also use standard Java regexp constructs. There is no need to escape the . character inside MATCH. The first MATCH in a clause will filter against the artifactId.

- -

some examples:

- -
-
<!-- embed all compile and runtime scope dependencies -->
-<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
-
-<!-- embed any dependencies with artifactId junit and scope runtime -->
-<Embed-Dependency>junit;scope=runtime</Embed-Dependency>
-
-<!-- inline all non-pom dependencies, except those with scope runtime -->
-<Embed-Dependency>*;scope=!runtime;type=!pom;inline=true</Embed-Dependency>
-
-<!-- embed all compile and runtime scope dependencies, except those with artifactIds in the given list -->
-<Embed-Dependency>*;scope=compile|runtime;inline=false;artifactId=!cli|lang|runtime|tidy|jsch</Embed-Dependency>
-
-<!-- inline contents of selected folders from all dependencies -->
-<Embed-Dependency>*;inline=images/**|icons/**</Embed-Dependency>
-
-
- -

examples of using {maven-dependencies}:

- -
-
<Include-Resource>
-  {maven-resources}, {maven-dependencies},
-  org/foo/Example.class=target/classes/org/foo/Example.class
-</Include-Resource>
-
-<Bundle-ClassPath>.,{maven-dependencies},some.jar</Bundle-ClassPath>
-
-
- -

By default matched dependencies are embedded in the bundle as artifactId-version.jar. This behaviour can be modified using the following instructions:

- -
    -
  • <Embed-StripVersion>true</Embed-StripVersion> - removes the version from the file (ie. artifactId.jar)
  • -
  • <Embed-StripGroup>false</Embed-StripGroup> - adds the groupId as a subdirectory (ie. groupId/artifactId-version.jar)
  • -
  • <Embed-Directory>directory</Embed-Directory> - adds a subdirectory (ie. directory/artifactId-version.jar)
  • -
- - -

Normally the plugin only checks direct dependencies, but this can be changed to include the complete set of transitive dependencies with the following option:

- -
-
<Embed-Transitive>true</Embed-Transitive>
-
-
- -

If you want a dependency inlined instead of embedded add the inline=true. For example to inline all compile and runtime scoped dependencies use:

- -
-
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
-
-
- -

Embed-Dependency and Export-Package

- -

If you embed a dependency with <Embed-Dependency>, and your <Export-Package> or <Private-Package> instructions match packages inside the embedded jar, you will see some duplication inside the bundle. This is because the <Export-Package> and <Private-Package> instructions will result in classes being inlined in the bundle, even though they also exist inside the embedded jar. If you want to export packages from an embedded dependency without such duplication then you can either inline the dependency, or use a new BND instruction called <_exportcontents>.

- -

<_exportcontents> behaves just like Export-Package, except it doesn't change the content of the bundle, just what content should be exported.

- -

OBR integration

- -

The latest Maven Bundle Plugin automatically updates the local OBR repository.xml file during the install phase, using a default location of:

- -
-
<LOCAL-MAVEN-REPOSITORY>/repository.xml
-
-
- -

You can configure the location of the OBR repository by using the command line:

- -
-
mvn clean install -DobrRepository=<PATH_TO_OBR>
-
-
- -

or in the configuration section for the maven-bundle-plugin in your Maven POM:

- -
-
<groupId>org.apache.felix</groupId>
-<artifactId>maven-bundle-plugin</artifactId>
-<extensions>true</extensions>
-<configuration>
-  <obrRepository>PATH_TO_OBR</obrRepository>
-  <instructions>
-    <!-- bnd instructions -->
-  </instructions>
-</configuration>
-
-
- -

to disable OBR installation set the obrRepository to NONE, for example:

- -
-
<groupId>org.apache.felix</groupId>
-<artifactId>maven-bundle-plugin</artifactId>
-<extensions>true</extensions>
-<configuration>
-  <obrRepository>NONE</obrRepository>
-  <instructions>
-    <!-- bnd instructions -->
-  </instructions>
-</configuration>
-
-
- -

Eclipse/PDE integration

- -

It is possible to configure the Maven Bundle Plugin to put the bundle manifest where Eclipse/PDE expects it, and use the Maven Dependency Plugin to arrange for any embedded dependencies to appear in a local directory that matches the Bundle-ClassPath entries. Here is an example POM that does this:

- -
-
<project>
-
-  <properties>
-    <bundle.symbolicName>org.example</bundle.symbolicName>
-    <bundle.namespace>org.example</bundle.namespace>
-  </properties>
-
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>examples</groupId>
-  <artifactId>org.example</artifactId>
-  <version>1.0-SNAPSHOT</version>
-
-  <name>${bundle.symbolicName} [${bundle.namespace}]</name>
-
-  <packaging>bundle</packaging>
-
-  <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-      </resource>
-      <resource>
-        <directory>.</directory>
-        <includes>
-          <include>plugin.xml</include>
-        </includes>
-      </resource>
-    </resources>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>1.2.1</version>
-        <extensions>true</extensions>
-        <!--
-          the following instructions build a simple set of public/private classes into an OSGi bundle
-        -->
-        <configuration>
-          <manifestLocation>META-INF</manifestLocation>
-          <instructions>
-            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
-            <Bundle-Version>${pom.version}</Bundle-Version>
-            <!--
-              assume public classes are in the top package, and private classes are under ".internal"
-            -->
-            <Export-Package>!${bundle.namespace}.internal.*,${bundle.namespace}.*;version="${pom.version}"</Export-Package>
-            <Private-Package>${bundle.namespace}.internal.*</Private-Package>
-            <Bundle-Activator>${bundle.namespace}.internal.ExampleActivator</Bundle-Activator>
-            <!--
-              embed compile/runtime dependencies using path that matches the copied dependency folder
-            -->
-            <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
-            <Embed-Directory>target/dependency</Embed-Directory>
-            <Embed-StripGroup>true</Embed-StripGroup>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy-dependencies</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>osgi_R4_core</artifactId>
-      <version>1.0</version>
-      <scope>provided</scope>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>osgi_R4_compendium</artifactId>
-      <version>1.0</version>
-      <scope>provided</scope>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>compile</scope>
-      <optional>true</optional>
-    </dependency>
-  </dependencies>
-
-</project>
-
-
- -

To generate the Eclipse metadata use:

- -
-
mvn clean package eclipse:eclipse -Declipse.pde install
-
-
- -

and you should now be able to import this as an existing Eclipse project.

- -

FYI: the above POM was generated using the pax-create-bundle command from Pax-Construct and then tweaked to demonstrate using the Maven Dependency Plugin to handle embedded jars in Eclipse.

- -

With the original Pax-Construct generated POM you would simply use:

- -
-
mvn clean package pax:eclipse
-
-
- -

to create the appropriate Eclipse files and manifest, and also handle any embedded entries. The pax:eclipse goal extends eclipse:eclipse, and supports the same parameters.

- -

Unpacking bundle contents to 'target/classes'

- -

Once in a while you may create a bundle which contains additional classes to the ones compiled from src/main/java, for example when you embed the classes from another jar. This can sometimes cause unforeseen problems in Maven, as it will use the output directory (target/classes) rather than the final bundle, when compiling against projects in the same reactor (ie. the same build).

- -

The easiest way to get around this Maven 'feature' is to unpack the contents of the bundle to the output directory after the packaging step, so the additional classes will be found where Maven expects them. Thankfully there is now an easy option to do this in the bundle-plugin:

- -
-
<groupId>org.apache.felix</groupId>
-<artifactId>maven-bundle-plugin</artifactId>
-<extensions>true</extensions>
-<configuration>
-  <unpackBundle>true</unpackBundle>
-  <instructions>
-    <!-- bnd instructions -->
-  </instructions>
-</configuration>
-
-
- -

Using an existing MANIFEST.MF file

- -

If you have an existing manifest, you can add this to the Bnd instructions, like so:

- -
-
<_include>src/main/resources/META-INF/MANIFEST.MF</_include>
-<Export-Package>org.example.*</Export-Package>
-
-
- -

Bnd will use it when calculating the bundle contents, and will also copy across all manifest attributes starting with a capital letter.
-As shown in the above example, you could use this to include a non-OSGi manifest which you then customize with extra OSGi attributes.

- -

The following features are only available from version 1.4.0 onwards

- -

bundle:ant

- -

The ant goal creates a customized build.xml Ant script along with a collection of BND instructions and properties, taken from the current project and stored in maven-build.bnd. You also need to run ant:ant to create the standard Ant support tasks to download Maven dependencies and perform compilation, etc.

- -

The customized Ant script uses the BND tool to rebuild the bundle, so any source changes should be reflected in the (re)generated manifest.

- -

Example:

-
-
mvn ant:ant bundle:ant
-
-ant clean package
-
-
- -

bundle:install-file

- -

The install-file goal updates the local OBR with the details of a bundle from the local filesystem.

- -

configuration:

-
    -
  • obrRepository path to local OBR, defaults to <local-maven-repository>/repository.xml
  • -
  • groupId Maven groupId for the bundle, taken from pomFile if given
  • -
  • artifactId Maven artifactId for the bundle, taken from pomFile if given
  • -
  • version Maven version for the bundle, taken from pomFile if given
  • -
  • packaging Maven packaging type for the bundle, taken from pomFile if given
  • -
  • classifier Maven classifier type, defaults to none
  • -
  • pomFile optional Pom file describing the bundle
  • -
  • file bundle file, defaults to the bundle from the local Maven repository
  • -
  • obrXml optional additional properties for the bundle
  • -
- - -

Example:

-
-
mvn org.apache.felix:maven-bundle-plugin:1.4.0:install-file \
-  -DpomFile=myPom.xml -Dfile=foo-1.0.jar
-
-
- -

bundle:deploy

- -

The deploy goal updates the remote OBR with the details of the deployed bundle from the local Maven repository. The remote OBR is found by querying the <distributionManagement> section of the project, unless -DaltDeploymentRepository is set. See http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html for more details about these particular settings.

- -

(If the project has an obr.xml file somewhere in its resources, then it will be automatically detected and applied.)

- -

configuration:

-
    -
  • remoteOBR name of remote OBR, defaults to NONE (which means no remote OBR deployment)
  • -
  • obrRepository used when the remoteOBR name is blank, defaults to repository.xml
  • -
  • altDeploymentRepository alternative remote repository, id::layout::url
  • -
  • ignoreLock ignore remote locking when updating the OBR
  • -
- - -

This goal is part of the "bundle" packaging lifecycle, but is disabled by default - to enable just set the remoteOBR parameter.

- -

bundle:deploy-file

- -

The deploy-file goal updates the remote OBR with the details of a deployed bundle from the local filesystem. The remote OBR is found using the -DrepositoryId and -Durl parameters. See http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html for more details about these particular settings.

- -

You can use the -DbundleUrl parameter to give the public location of the deployed bundle, which may differ from the remote OBR location.

- -

configuration:

-
    -
  • remoteOBR name of remote OBR, defaults to an empty string
  • -
  • obrRepository used when the remoteOBR name is blank, defaults to repository.xml
  • -
  • repositoryId optional repository id, used to lookup authentication settings
  • -
  • url remote repository transport URL, like -
    -
    scpexe://host/path/to/obr
    -
    -
  • -
  • bundleUrl public URL of deployed bundle, like -
    -
    http://www.foo.org/bundles/foo.jar
    -
    -
  • -
  • groupId Maven groupId for the bundle, taken from pomFile if given
  • -
  • artifactId Maven artifactId for the bundle, taken from pomFile if given
  • -
  • version Maven version for the bundle, taken from pomFile if given
  • -
  • packaging Maven packaging type for the bundle, taken from pomFile if given
  • -
  • classifier Maven classifier type, defaults to none
  • -
  • pomFile optional Pom file describing the bundle
  • -
  • file bundle file, defaults to the bundle from the local Maven repository
  • -
  • obrXml optional additional properties for the bundle
  • -
  • ignoreLock ignore remote locking when updating the OBR
  • -
- - - -

Example:

-
-
mvn org.apache.felix:maven-bundle-plugin:1.4.0:deploy-file \
-  -DpomFile=myPom.xml -Dfile=foo-1.0.jar -Durl=file:/tmp/example/OBR \
-  -DbundleUrl=http://www.foo.org/bundles/foo.jar
-
-
- -

bundle:clean

- -

Sometimes you would like to clean your local OBR because it contains bundles that are no longer in your local Maven repository. This case often occurs when artifacts were deleted manually. The maven-bundle-plugin provides a simple goal to check for missing bundles, and remove them from the local OBR.

- -

configuration:

-
    -
  • obrRepository path to local OBR, defaults to <local-maven-repository>/repository.xml
  • -
- - -

Example:

-
-
mvn bundle:clean
-
-
- -

bundle:index

- -

The index goal allows the creation of an OBR repository based on a set of jars in a maven repository.

- -

Configuration:

-
    -
  • obrRepository path to local OBR, defaults to <local-maven-repository>/repository.xml
  • -
  • urlTemplate template for generating urls for OBR resources
  • -
  • mavenRepository path to the maven repository, defaults to <local-maven-repository>
  • -
- - -

Possible values for the urlTemplate are:

-
    -
  • maven this will create a maven based url such as mvn:groupid/artifactid/version
  • -
  • pattern with the following placeholders: -
      -
    • %v bundle version
    • -
    • %s bundle symbolic name
    • -
    • %f file name
    • -
    • %p file path
    • -
    -
  • -
- - -

Concurrent updates

- -

With a remote OBR, several uploads may occur at the same time. However, the remote OBR is centralized in one file, so concurrent modification must be avoided. To achieve this, the plug-in implements a locking system. Each time the plug-in tries to modify the file it sets a file based lock. If it can't take the lock, it will wait and retry. After 3 attempts the upload process fails. To bypass this lock add -DignoreLock to the command-line (or add <ignoreLock>true<ignoreLock> to the configuration section of your Pom).

- -

FTP protocol

- -

Not all protocols are supported by Maven out of the box. For example the ftp protocol requires the wagon-ftp component. To enable the ftp protocol add this to your Pom:

-
-
<build>
-  <extensions>
-    <extension>
-      <groupId>org.apache.maven.wagon</groupId>
-      <artifactId>wagon-ftp</artifactId>
-      <version>1.0-alpha-6</version>
-    </extension>
-  </extensions>
-</build>
-
-
- -

How the plug-in computes the description of the bundle

- -

The description of the bundle comes from three different sources:

-
    -
  • Bindex : Bindex is a tool that analyzes a bundle manifest to generate OBR description
  • -
  • pom.xml : by analyzing the pom file, various information is collected (symbolic name ...)
  • -
  • obr.xml : this file contains customized description and capabilities for the bundle
  • -
- - -

These sources are merged together using the following precedence:

-
-
Bindex
-| (overrides)
-pom.xml
-| (overrides)
-obr.xml
-
-
-

A warning message is displayed when existing information is overridden.

- -

Known issues & limitations

- -
    -
  1. obr.xml (file given by the user to add properties not found by Bindex) must be correct, because the plug-in does not check its syntax.
  2. -
- - -

Feedback

- -

Subscribe to the Felix users mailing list by sending a message to users-subscribe@felix.apache.org; after subscribing, email questions or feedback to users@felix.apache.org.

-
-Last modified by mcculls on Wed Nov 21 20:06:53 EST 2012 -
-
-Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. -
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/changelog.txt maven-bundle-plugin-3.5.0/doc/changelog.txt --- maven-bundle-plugin-2.5.4/doc/changelog.txt 2015-04-17 12:07:25.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/changelog.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,307 +0,0 @@ -Changes from 2.5.3 to 2.5.4 ---------------------------- - -** Bug - * [FELIX-4556] - Maven Bundle Plugin fails with ArrayIndexOutOfBoundsException, "Invalid Class File" errors with Java 8 features - * [FELIX-4659] - The maven bundle plugin incorrectly reports cardinality on service references in the generated generic requirements - * [FELIX-4817] - Baseline plugin is not thread safe - -** Improvement - * [FELIX-4666] - The baseline goal should print out the resolved version used for comparison - * [FELIX-4824] - Add support for prepending instructions - - -Changes from 2.5.2 to 2.5.3 ---------------------------- - -** Bug - * [FELIX-4619] - Debug output of project properties - - -Changes from 2.5.0 to 2.5.2 ---------------------------- - -** Bug - * [FELIX-4574] - The maven-bundle-plugin only generates Provide-/Require-Capabilities for SCR if version is 1.1.0 - * [FELIX-4576] - Bad Require-Capability generation when the SCR target filter has no parentheses - -** Improvement - * [FELIX-4596] - Passing configuration values to the maven-bundle-plugin - -** New Feature - * [FELIX-4591] - add the ability to specify the classifier in the new baseline configuration of the plugin. - - -Changes from 2.4.0 to 2.5.0 ---------------------------- - -** Improvement - * [FELIX-3381] - Support for {maven-test-resources} and {maven-test-sources} placeholders - * [FELIX-4205] - "null" Bundle-Activator causes bundle to fail - * [FELIX-4518] - Provide a way to disable some plugins - * [FELIX-4539] - Update to Bndlib 2.3.0 - -** New Feature - * [FELIX-3462] - Nicer Manifest formatting - * [FELIX-4512] - Add a new Mojo to invoke the BND Baseline tool - * [FELIX-4517] - Generate generic capabilities and requirements for services from blueprint and scr descriptors - -Changes from 2.3.7 to 2.4.0 ---------------------------- - -** Bug - * [FELIX-3293] - Exception while creating empty fragment bundles with version 2.3.6 - * [FELIX-3349] - wrong bundle manifest contents in some cases - * [FELIX-3352] - Maven Bundle Plugin ignores resource properties configured inside section - * [FELIX-3407] - Imports are missed for generics - * [FELIX-3497] - Wrong artifact type attached as a secondary artifact when project packaging is set to "pom" - * [FELIX-3582] - finalName not properly populated in maven-bundle-plugin with buildnumber-maven-plugin - * [FELIX-3585] - Dependencies with classes or resources in the default package cannot be embedded - * [FELIX-3601] - Incorrect namespace in component XML for DS Annotations - * [FELIX-3619] - "IOException: Failed to delete repository.xml while trying to rename" in maven-bundle-plugin - * [FELIX-3630] - Packages exported by bundle are (re)-imported with incorrect version - * [FELIX-3638] - Missing package import for annotation default value - * [FELIX-3772] - maven-bundle-plugin does not scan blueprint in workspace outside default location - * [FELIX-3973] - Exclusion from {local-packages} doesn't work anymore - * [FELIX-4005] - Maven Bundle Plugin fails with ArrayIndexOutOfBoundsException, "Invalid Class File" errors with Java 8 features - * [FELIX-4017] - @ProviderType does not work (bnd "provide:=true" annotation?) - -** Improvement - * [FELIX-3277] - Support BND Service Component generation - * [FELIX-3602] - The bundle plugin should generate the blueprint header with the file locations - -** Wish - * [FELIX-4067] - Old BND used causes problems during annotations processing - -Changes from 2.3.6 to 2.3.7 ---------------------------- - -** Bug - * [FELIX-3347] - Upper-case environment variables end up in final manifest - * [FELIX-3310] - [patch] maven-bundle-plugin build fails with maven3 (manageArtifactSystemPath is missing) - * [FELIX-3254] - manifest goal generates wrong Export-Package when Embed-Dependency - -** Improvement - * [FELIX-3300] - Avoid warning about superfluous export-package instructions for empty directories - -** Task - * [FELIX-3299] - Fix instable tests in BundlePluginTest - -Changes from 2.3.5 to 2.3.6 ---------------------------- - -** Bug - * [FELIX-3031] - maven3 deployment fails where maven2 works - * [FELIX-3037] - Plugin does not work with Java 5 - * [FELIX-3058] - maven-bundle-plugin 2.3.5 incompatible with maven-source-plugin (regression) - * [FELIX-3073] - can't deploy snapshot bundle to remote OBR - * [FELIX-3173] - Local OBR install failes when there is a space in the full path - * [FELIX-3185] - Negative Embed-Dependency clauses aren't handled correctly - * [FELIX-3188] - [PATCH] exception org.apache.maven.project.artifact.InvalidDependencyVersionException has already been caught - * [FELIX-3206] - Restore the BND analyzer approach which creates a MANIFEST.MF based on the contents of the jar - * [FELIX-3209] - Make sure the properties passed to BND only include string values - * [FELIX-3222] - [PATCH] build fails with "unreported exception" - * [FELIX-3238] - Unable to filter out classes from identical package in a dependency - -** Improvement - * [FELIX-2872] - Provide a way to have an easier to read manifest - * [FELIX-3061] - improvements to Embed-Dependency logic to allow better m2e integration - * [FELIX-3092] - Support relative paths in "urlTemplate" parameter of "bundle:index" goal in maven bundle plugin - -** New Feature - * [FELIX-3165] - Add an option to the manifest goal that will copy any BND generated resources to the target folder - * [FELIX-3208] - Provide default value for sourcepath when using BND -sources=true - * [FELIX-3210] - Maven bundle plugin remote-clean goal without user confirmation - -Changes from 2.3.4 to 2.3.5 ---------------------------- - -** Bug - * [FELIX-1039] - Inconsistency packaging vs. type - * [FELIX-1571] - Bundle-ClassPath without "." while using maven-bundle-plugin in a war project confuses the plugin - * [FELIX-1734] - The _donotcopy is ignored - * [FELIX-1985] - Error when Include-Resource instruction contains duplicate paths. - * [FELIX-2346] - mvn bundle:clean removes all, even the existing resources - * [FELIX-2427] - maven site crashes - * [FELIX-2435] - on a WAR file will switch the project to generate jar artifacts - * [FELIX-2449] - Resource filtering does not use Maven properties specified on the mvn command line via -D command line switches - * [FELIX-2656] - Maven-bundle-plugin identified as not thread-safe in Maven 3.0 - * [FELIX-2722] - With an empty organization like this , maven bundle plugin raises a NPE. - * [FELIX-2765] - bundle plugin throw IllegalArgumentException while do the install - * [FELIX-2819] - packageinfo files in src/main/java are ignored - * [FELIX-2820] - Provide a default value when using <_wab/> - * [FELIX-2884] - The multiplicity isn't taken into account by the maven bundle plugin and bundlerepository when generating the repository xml - * [FELIX-2914] - Nullpointer exception on mvn install if the pom contains organization/url but not organization/name - * [FELIX-2934] - Bundle-ClassPath contains "." despite using _wab instruction - -** Improvement - * [FELIX-1836] - Maven resource filtering support for obr.xml - -** New Feature - * [FELIX-3011] - Add a new goal to save the bnd instructions that would be passed onto bnd, to allow people to use other toolchains such as bndtools - -** Task - * [FELIX-344] - Generate standard maven documentation for the maven-bundle-plugin - -Changes from 2.2.0 to 2.3.4 ---------------------------- - - * [2011-02-01] FELIX-2817: The maven-bundle-plugin manifest goal should honor the supportedProjectTypes configuration setting. - * [2011-01-27] FELIX-2808: maven-bundle-plugin should scan for local packages by looking for *.class files instead of *.java so that all the JVM languages can be supported. - * [2011-01-27] FELIX-2809: maven-bundle-plugin should automatically add "resolution:=optional" to imported packages that are in optional maven dependencies. - * [2011-01-29] FELIX-2811: If !* is defined the all packages should be exported by {local-packages} - * [2011-01-29] FELIX-2812: The filter can fail if your matching against multiple "*" artifact ids. - -Changes from 2.1.0 to 2.2.0 ---------------------------- - - * [2010-11-17] FELIX-2701: Add {local-packages} macro, expands to local packages in instruction - * [2010-10-25] FELIX-2176: Update to latest bndlib (1.15.0) - -Changes from 2.0.0 to 2.0.1 ---------------------------- - - * [2009-09-03] FELIX-1461: make local repository updates a bit more atomic - * [2009-09-03] Temporary local bnd patch for Include-Resource bug on Windows - * [2009-09-03] FELIX-1539: include additional source directories in local package calculation - * [2009-09-03] FELIX-1439: add project organization name/url properties - * [2009-09-03] FELIX-1501: use getProperty() instead of getProperties().getProperty() - * [2009-09-03] FELIX-1552: add bnd support for blueprint and spring-dm declarations - * [2009-09-03] FELIX-1148: apply local patch for MSHARED-101 - * [2009-09-03] FELIX-981: avoid spurious split package warnings - * [2009-09-03] FELIX-1290: warn if Embed-Dependency doesn't match any dependencies - * [2009-09-03] FELIX-1021: remove expression from classifier parameter (ie. same as jar plugin) - * [2009-09-03] FELIX-1023: apply patch to add category information to OBR - * [2009-09-03] Upgrade to bndlib 0.0.357 - * [2009-07-13] FELIX-1262: remove duplicate resource entries to avoid Bnd Tool error - * [2009-04-24] FELIX-1054: when deploying a bundle, print computed uri on the console - -Changes from 1.4.3 to 2.0.0 ---------------------------- - - * [2009-02-16] FELIX-807,FELIX-782,FELIX-660,FELIX-549,FELIX-546,FELIX-545: Use latest version of the Bnd Tool (0.0.311) - * [2009-02-16] FELIX-941: store the generated default symbolicname in $(maven-symbolicname) property - * [2009-02-16] FELIX-912: set default Export-Package based on local source files - * [2009-02-16] FELIX-684: support filters in excludeDependencies, such as *;scope=runtime - * [2009-02-16] FELIX-684: separate out dependency filtering code so we can re-use it when excluding - * [2009-01-30] FELIX-806: pickup settings in bundleplugin configuration (otherwise fall back to the jarplugin settings) and enable support of the addMavenDescriptor setting - * [2009-01-30] FELIX-850: local fix for MSHARED-86 (should use isFile instead of exists) - * [2009-01-29] FELIX-899: update to latest editions of Bnd and Bindex - * [2009-01-29] FELIX-899: first step, widen dependency resolution and pass everything except test dependencies onto BND - * [2008-12-05] Additional debug to help with problem determination - * [2008-12-03] FELIX-760: commit latest bindex code - * [2008-12-03] FELIX-831,FELIX-677: update to version 0.0.295 of the Bnd tool - * [2008-08-27] FELIX-699: set analyzer base before loading properties in manifest goal - - -Changes from 1.4.2 to 1.4.3 ---------------------------- - - * [2008-08-07] FELIX-661: maven bundle plugin does not close the accessed zip/jar streams - -Changes from 1.4.1 to 1.4.2 ---------------------------- - - * [2008-08-03] FELIX-553: allow cleaning a remote OBR - * [2008-08-03] FELIX-580: Allows maven-bunde-plugin to generate a repository file outide a maven repository with absolute url - * [2008-07-09] FELIX-556: Filtering mechanims to - * [2008-07-08] FELIX-547: OBR portion of the plugin balks on singular version range of [1.0.0,1.0.0]. - * [2008-07-07] FELIX-620: manifest goal of maven-bundle-plugin ignores _include instruction - * [2008-05-16] FELIX-560: bundle:install and bundle:deploy goals check artifact type is "bundle" instead of using the supportedProjectTypes list - * [2008-05-16] FELIX-561: Use same level of Bnd in script generated by bundle:ant as in the bundleplugin itself - -Changes from 1.4.0 to 1.4.1 ---------------------------- - - * [2008-04-30] FELIX-543: add switch to prevent classifier being appended to Bundle-Version - * [2008-04-23] FELIX-541: allow repository.xml to reference to xsl file - * [2008-04-23] FELIX-531: Allow the import package scope to be set for the bundleall goal in the maven-bundle-plugin - * [2008-04-23] FELIX-523: Update bundleplugin to use BND 0.0.255 - * [2008-04-01] FELIX-526: Allow a mechanism to give preference to local resources over the ones from embedded jars - * [2008-03-24] FELIX-519: maven-bundle-plugin should issue a WARNING for unsupported packaging types - * [2008-03-16] FELIX-517: Replacement of {maven-dependencies} in Include-Resource and Bundle-ClassPath can strip Windows path separators - * [2008-03-03] FELIX-505: maven-bundle-plugin:bundleall modifies dependencies that are already bundles - -Changes from 1.2.1 to 1.4.0 ---------------------------- - - * [2008-02-20] FELIX-499: Enhance "excludeDependencies" configuration parameter to also support comma-separated list of artifactIds - * [2008-02-20] FELIX-498: Enable javadoc deployment on OBR repository - * [2008-02-19] FELIX-497: Genearated Source url is not a valid url - * [2008-02-19] FELIX-493: maven-bundle-plugin bundle:install goal install too many artifact - * [2008-02-19] FELIX-247: Add ant goal to maven-bundle-plugin which creates a build.xml and MANIFEST.MF with bundle headers - * [2008-02-18] FELIX-492: Add support to classifier: enable bunlde:bundle goal to generate classified artifact - * [2008-02-18] FELIX-491: Merge the maven-obr-plugin and the bundleplugin into a single plugin - -Changes from 1.2.0 to 1.2.1 ---------------------------- - - * [2008-02-12] FELIX-477: BND: Versions with fourth section all numbers are truncated - * [2008-02-06] FELIX-479: add supportedProjectTypes configuration option to install goal - * [2008-02-02] FELIX-459: BND: allow customization of the "uses" clause in the generated Export-Package - * [2008-01-30] FELIX-476: Improve default Export-Package (used when no Export-Package and Private-Package is set) - * [2008-01-30] FELIX-462: Support removal of manifest headers added by the bundleplugin - * [2008-01-30] FELIX-461: Ensure manifest goal creates same manifest as bundle goal when project packaging is "bundle" - * [2008-01-29] FELIX-472: Embed-Dependency, Include-Resource and inline - * [2008-01-29] FELIX-460: Remove "." from the Bundle-ClassPath when embedding dependencies in a bundle with no local classes - * [2008-01-28] FELIX-457: remove PathFile class and use URIs instead - * [2008-01-22] FELIX-458: BND: -split-package:=merge-first behaves like merge-last - -Changes from 1.0.0 to 1.2.0 ---------------------------- - - * [2008-01-11] FELIX-455: need to use the Builder class instead of Analyzer, because it provides additional cleanup of version information - * [2008-01-10] FELIX-451: remove Include-Resource header from final bundle manifest - * [2008-01-10] FELIX-449: add 'excludeDependencies' option (disabled by default) to exclude all dependencies from the classpath passed to BND - * [2008-01-09] FELIX-442: handle custom manifest sections and external manifest files - * [2008-01-08] Update to bndlib 0.0.227 (disables spring xml parser by default) - * [2007-12-27] FELIX-442: Add manifest entries from maven-jar-plugin configuration to final bundle - * [2007-12-07] FELIX-433: add unpackBundle option that unpacks the bundle contents to the Maven output directory - * [2007-11-18] FELIX-400: add resource code to properly handle Maven includes/excludes - * [2007-11-01] Make Embed-StripGroup default to true, as it is much more useful than the current default - * [2007-10-31] FELIX-417: fix project references - * [2007-10-26] Better error messages (and detect difference between internal error and configuration error) - * [2007-10-23] FELIX 406: fix Windows path entries in Bundle-ClassPath when embedding jars - * [2007-10-22] FELIX-405: support custom obr repository filenames, such as foo.xml - * [2007-10-21] FELIX-403: replace line-breaks with spaces when using Maven project description in Bundle manifest - * [2007-10-19] FELIX-402: use correct manifest location when using reactor build - * [2007-10-19] FELIX-400: fix array out of bounds exception when the resource directory is the same as the basedir - * [2007-09-25] FELIX-360: various fixes to the bundleall goal - * [2007-09-22] FELIX-370: OBR integration work - * [2007-09-22] FELIX-306: be consistent and delegate all version mangling to BND library - * [2007-09-21] FELIX-377: support -failok directive - * [2007-09-21] FELIX-376: Support writing of manifest to the file system when using bundle goal - * [2007-09-11] FELIX-352: provide informational error message when manifest goal is run before compile phase - * [2007-08-26] FELIX-308: support embedding of artifacts with non-jar extension names - * [2007-08-24] Workaround for MNG-1682 (incorrect extension used when installing to local repository) - * [2007-08-23] FELIX-343: replace any instances of {maven-resources} in Include-Resource with the actual project's resource paths - * [2007-08-23] FELIX-308: initial implementation to support embedding dependencies - * [2007-08-22] FELIX-340: update classpath algorithm to match maven compilation classpath - * [2007-08-14] FELIX-333: remove new-lines/form-feeds from property values. - -Changes from 0.8.0-incubator to 1.0.0 -------------------------------------- - -* [2007-03-13] now supports JAR files in the class path, - not just JAR files in the project directory. -* [2007-03-15] Fixed a bug in converting Maven version numbers to OSGi version - numbers. (FELIX-256) -* [2007-03-28] Added support for using BND directives in the POM file. - (FELIX-218) -* [2007-04-10] Added a recursive "bundleall" goal to generate OSGi bundles for - all dependencies and a "manifest" goal to generate just the manifest. - (FELIX-199) -* [2007-04-27] Modified the plugin so that it does not run on POM projects. - (FELIX-269) -* [2007-05-17] Plugin now handles null property values better. (FELIX-281) -* [2007-05-20] Renamed project directory from maven-bundle-plugin to - bundleplugin. -* [2007-05-20] Changed package naming. -* [2007-05-21] Improved handling of resource copying to copy the plugin's - resources if specified or the standard Maven-specified resources. (FELIX-261) -* [2007-06-13] Factored out some common code. (FELIX-304) -* [2007-06-14] Enable output folder to be configured. (FELIX-305) -* [2007-07-05] Added support for overriding project type. (FELIX-309) -* [2007-07-09] Updated to BND version 0.0.160. -* [2007-07-11] Fix a possible NullPointerException in the manifest goal. (FELIX-326) - diff -Nru maven-bundle-plugin-2.5.4/doc/site/ant-mojo.html maven-bundle-plugin-3.5.0/doc/site/ant-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/ant-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/ant-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,311 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:ant - - - - - - - - - -
- -
-
-
- - -

bundle:ant

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:ant

-

Description:

-
Generate Ant script to create the bundle (you should run ant:ant -first).
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • Requires dependency resolution of artifacts in scope: test.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: package.
  • -
-

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
buildDirectoryString-The directory for the generated JAR.
User property is: project.build.directory.
outputDirectoryFile-The directory for the generated bundles.
User property is: project.build.outputDirectory.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
archiveMavenArchiveConfiguration-The archive configuration to use.
classifierString-Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
dumpClasspathFile-File where the BND class-path will be dumped
User property is: dumpClasspath.
dumpInstructionsFile-File where the BND instructions will be dumped
User property is: dumpInstructions.
excludeDependenciesString-Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
User property is: excludeDependencies.
finalNameString-Final name of the bundle (without classifier or extension)
User property is: project.build.finalName.
instructionsMap-The BND instructions for the bundle.
manifestLocationFile-Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
User property is: manifestLocation.
niceManifestboolean-Output a nicely formatted manifest that still respects the 72 -character line limit.
packagingString-Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
supportedProjectTypesList-Project types which this plugin supports.
unpackBundleboolean-When true, unpack the bundle contents to the outputDirectory
User property is: unpackBundle.
-
-

Parameter Details

-

archive:

-
The archive configuration to use.
-
    -
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • -
  • Required: No
  • -

buildDirectory:

-
The directory for the generated JAR.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: project.build.directory
  • -

classifier:

-
Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

dumpClasspath:

-
File where the BND class-path will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpClasspath
  • -

dumpInstructions:

-
File where the BND instructions will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpInstructions
  • -

excludeDependencies:

-
Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: excludeDependencies
  • -

finalName:

-
Final name of the bundle (without classifier or extension)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: project.build.finalName
  • -

instructions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -

manifestLocation:

-
Directory where the manifest will be written
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: manifestLocation
  • -
  • Default: ${project.build.outputDirectory}/META-INF
  • -

niceManifest:

-
Output a nicely formatted manifest that still respects the 72 -character line limit.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

outputDirectory:

-
The directory for the generated bundles.
-
    -
  • Type: java.io.File
  • -
  • Required: Yes
  • -
  • User Property: project.build.outputDirectory
  • -

packaging:

-
Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

unpackBundle:

-
When true, unpack the bundle contents to the outputDirectory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: unpackBundle
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/baseline-mojo.html maven-bundle-plugin-3.5.0/doc/site/baseline-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/baseline-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/baseline-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,226 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:baseline - - - - - - - - - -
- -
-
-
- - -

bundle:baseline

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:baseline

-

Description:

-
BND Baseline check between two bundles.
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Since version: 2.4.1.
  • -
  • Binds by default to the lifecycle phase: verify.
  • -
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
failOnErrorboolean2.4.1Whether to fail on errors.
Default value is: true.
User property is: baseline.failOnError.
failOnWarningboolean2.4.1Whether to fail on warnings.
Default value is: false.
User property is: baseline.failOnWarning.
filtersString[]2.4.1A list of packages filter, if empty the whole bundle will be -traversed. Values are specified in OSGi package instructions -notation, e.g. !org.apache.felix.bundleplugin.
logResultsboolean2.4.1Whether to log the results to the console or not, true by default.
Default value is: true.
User property is: logResults.
skipboolean2.4.1Flag to easily skip execution.
Default value is: false.
User property is: baseline.skip.
supportedProjectTypesList2.4.1Project types which this plugin supports.
xmlOutputFileFile2.4.1An XML output file to render to -${project.build.directory}/baseline.xml.
-
-

Parameter Details

-

failOnError:

-
Whether to fail on errors.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: baseline.failOnError
  • -
  • Default: true
  • -

failOnWarning:

-
Whether to fail on warnings.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: baseline.failOnWarning
  • -
  • Default: false
  • -

filters:

-
A list of packages filter, if empty the whole bundle will be -traversed. Values are specified in OSGi package instructions -notation, e.g. !org.apache.felix.bundleplugin.
-
    -
  • Type: java.lang.String[]
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -

logResults:

-
Whether to log the results to the console or not, true by default.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: logResults
  • -
  • Default: true
  • -

skip:

-
Flag to easily skip execution.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: baseline.skip
  • -
  • Default: false
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -

xmlOutputFile:

-
An XML output file to render to -${project.build.directory}/baseline.xml.
-
    -
  • Type: java.io.File
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • Expression: ${project.build.directory}/baseline.xml
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/baseline-report-mojo.html maven-bundle-plugin-3.5.0/doc/site/baseline-report-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/baseline-report-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/baseline-report-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:baseline-report - - - - - - - - - -
- -
-
-
- - -

bundle:baseline-report

-

Note:This goal should be used as a Maven report.

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:baseline-report

-

Description:

-
BND Baseline report.
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Since version: 2.4.1.
  • -
  • Binds by default to the lifecycle phase: site.
  • -
-

Required Parameters

- - - - - - - - - - - - - -
NameTypeSinceDescription
outputDirectoryFile2.4.1Specifies the directory where the report will be generated.
Default value is: ${project.reporting.outputDirectory}.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
failOnErrorboolean2.4.1Whether to fail on errors.
Default value is: true.
User property is: baseline.failOnError.
failOnWarningboolean2.4.1Whether to fail on warnings.
Default value is: false.
User property is: baseline.failOnWarning.
filtersString[]2.4.1A list of packages filter, if empty the whole bundle will be -traversed. Values are specified in OSGi package instructions -notation, e.g. !org.apache.felix.bundleplugin.
skipboolean2.4.1Flag to easily skip execution.
Default value is: false.
User property is: baseline.skip.
supportedProjectTypesList2.4.1Project types which this plugin supports.
-
-

Parameter Details

-

failOnError:

-
Whether to fail on errors.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: baseline.failOnError
  • -
  • Default: true
  • -

failOnWarning:

-
Whether to fail on warnings.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: baseline.failOnWarning
  • -
  • Default: false
  • -

filters:

-
A list of packages filter, if empty the whole bundle will be -traversed. Values are specified in OSGi package instructions -notation, e.g. !org.apache.felix.bundleplugin.
-
    -
  • Type: java.lang.String[]
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -

outputDirectory:

-
Specifies the directory where the report will be generated.
-
    -
  • Type: java.io.File
  • -
  • Since: 2.4.1
  • -
  • Required: Yes
  • -
  • Default: ${project.reporting.outputDirectory}
  • -

skip:

-
Flag to easily skip execution.
-
    -
  • Type: boolean
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
  • User Property: baseline.skip
  • -
  • Default: false
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Since: 2.4.1
  • -
  • Required: No
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/bundleall-mojo.html maven-bundle-plugin-3.5.0/doc/site/bundleall-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/bundleall-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/bundleall-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,364 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:bundleall - - - - - - - - - -
- -
-
-
- - -

bundle:bundleall

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:bundleall

-

This plugin goal has been deprecated:

-
The bundleall goal is no longer supported and may be removed in a -future release
-

Description:

-
Create OSGi bundles from all dependencies in the Maven project
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • Requires dependency resolution of artifacts in scope: test.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: package.
  • -
-

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
buildDirectoryString-The directory for the generated JAR.
User property is: project.build.directory.
outputDirectoryFile-The directory for the generated bundles.
User property is: project.build.outputDirectory.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
archiveMavenArchiveConfiguration-The archive configuration to use.
classifierString-Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
depthint-Process up to some depth
dumpClasspathFile-File where the BND class-path will be dumped
User property is: dumpClasspath.
dumpInstructionsFile-File where the BND instructions will be dumped
User property is: dumpInstructions.
excludeDependenciesString-Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
User property is: excludeDependencies.
finalNameString-Final name of the bundle (without classifier or extension)
User property is: project.build.finalName.
ignoreMissingArtifactsboolean-Ignore missing artifacts that are not required by current project -but are required by the transitive dependencies.
instructionsMap-The BND instructions for the bundle.
manifestLocationFile-Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
User property is: manifestLocation.
niceManifestboolean-Output a nicely formatted manifest that still respects the 72 -character line limit.
packagingString-Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
rebuildBundleboolean-When true, generate the manifest by rebuilding the full bundle in -memory
User property is: rebuildBundle.
supportedProjectTypesList-Project types which this plugin supports.
unpackBundleboolean-When true, unpack the bundle contents to the outputDirectory
User property is: unpackBundle.
wrapImportPackageString-Import-Package to be used when wrapping dependencies.
Default value is: *.
User property is: wrapImportPackage.
-
-

Parameter Details

-

archive:

-
The archive configuration to use.
-
    -
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • -
  • Required: No
  • -

buildDirectory:

-
The directory for the generated JAR.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: project.build.directory
  • -

classifier:

-
Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

depth:

-
Process up to some depth
-
    -
  • Type: int
  • -
  • Required: No
  • -

dumpClasspath:

-
File where the BND class-path will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpClasspath
  • -

dumpInstructions:

-
File where the BND instructions will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpInstructions
  • -

excludeDependencies:

-
Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: excludeDependencies
  • -

finalName:

-
Final name of the bundle (without classifier or extension)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: project.build.finalName
  • -

ignoreMissingArtifacts:

-
Ignore missing artifacts that are not required by current project -but are required by the transitive dependencies.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

instructions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -

manifestLocation:

-
Directory where the manifest will be written
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: manifestLocation
  • -
  • Default: ${project.build.outputDirectory}/META-INF
  • -

niceManifest:

-
Output a nicely formatted manifest that still respects the 72 -character line limit.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

outputDirectory:

-
The directory for the generated bundles.
-
    -
  • Type: java.io.File
  • -
  • Required: Yes
  • -
  • User Property: project.build.outputDirectory
  • -

packaging:

-
Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

rebuildBundle:

-
When true, generate the manifest by rebuilding the full bundle in -memory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: rebuildBundle
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

unpackBundle:

-
When true, unpack the bundle contents to the outputDirectory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: unpackBundle
  • -

wrapImportPackage:

-
Import-Package to be used when wrapping dependencies.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: wrapImportPackage
  • -
  • Default: *
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/bundle-mojo.html maven-bundle-plugin-3.5.0/doc/site/bundle-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/bundle-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/bundle-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,310 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:bundle - - - - - - - - - -
- -
-
-
- - -

bundle:bundle

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:bundle

-

Description:

-
Create an OSGi bundle from Maven project
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • Requires dependency resolution of artifacts in scope: test.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: package.
  • -
-

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
buildDirectoryString-The directory for the generated JAR.
User property is: project.build.directory.
outputDirectoryFile-The directory for the generated bundles.
User property is: project.build.outputDirectory.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
archiveMavenArchiveConfiguration-The archive configuration to use.
classifierString-Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
dumpClasspathFile-File where the BND class-path will be dumped
User property is: dumpClasspath.
dumpInstructionsFile-File where the BND instructions will be dumped
User property is: dumpInstructions.
excludeDependenciesString-Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
User property is: excludeDependencies.
finalNameString-Final name of the bundle (without classifier or extension)
User property is: project.build.finalName.
instructionsMap-The BND instructions for the bundle.
manifestLocationFile-Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
User property is: manifestLocation.
niceManifestboolean-Output a nicely formatted manifest that still respects the 72 -character line limit.
packagingString-Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
supportedProjectTypesList-Project types which this plugin supports.
unpackBundleboolean-When true, unpack the bundle contents to the outputDirectory
User property is: unpackBundle.
-
-

Parameter Details

-

archive:

-
The archive configuration to use.
-
    -
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • -
  • Required: No
  • -

buildDirectory:

-
The directory for the generated JAR.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: project.build.directory
  • -

classifier:

-
Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

dumpClasspath:

-
File where the BND class-path will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpClasspath
  • -

dumpInstructions:

-
File where the BND instructions will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpInstructions
  • -

excludeDependencies:

-
Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: excludeDependencies
  • -

finalName:

-
Final name of the bundle (without classifier or extension)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: project.build.finalName
  • -

instructions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -

manifestLocation:

-
Directory where the manifest will be written
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: manifestLocation
  • -
  • Default: ${project.build.outputDirectory}/META-INF
  • -

niceManifest:

-
Output a nicely formatted manifest that still respects the 72 -character line limit.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

outputDirectory:

-
The directory for the generated bundles.
-
    -
  • Type: java.io.File
  • -
  • Required: Yes
  • -
  • User Property: project.build.outputDirectory
  • -

packaging:

-
Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

unpackBundle:

-
When true, unpack the bundle contents to the outputDirectory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: unpackBundle
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/clean-mojo.html maven-bundle-plugin-3.5.0/doc/site/clean-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/clean-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/clean-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:clean - - - - - - - - - -
- -
-
-
- - -

bundle:clean

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:clean

-

Description:

-
Clean an OBR repository by finding and removing missing resources.
-

Attributes:

- -

Optional Parameters

- - - - - - - - - - - - - -
NameTypeSinceDescription
obrRepositoryString-OBR Repository.
User property is: obrRepository.
-
-

Parameter Details

-

obrRepository:

-
OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/cleanVersions-mojo.html maven-bundle-plugin-3.5.0/doc/site/cleanVersions-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/cleanVersions-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/cleanVersions-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:cleanVersions - - - - - - - - - -
- -
-
-
- - -

bundle:cleanVersions

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:cleanVersions

-

Description:

-
Convert a group of versions to OSGi format.
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
-

Optional Parameters

- - - - - - - - - - - - - -
NameTypeSinceDescription
versionsMap-The BND instructions for the bundle.
-
-

Parameter Details

-

versions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/css/maven-base.css maven-bundle-plugin-3.5.0/doc/site/css/maven-base.css --- maven-bundle-plugin-2.5.4/doc/site/css/maven-base.css 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/css/maven-base.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -body { - margin: 0px; - padding: 0px; -} -img { - border:none; -} -table { - padding:0px; - width: 100%; - margin-left: -2px; - margin-right: -2px; -} -acronym { - cursor: help; - border-bottom: 1px dotted #feb; -} -table.bodyTable th, table.bodyTable td { - padding: 2px 4px 2px 4px; - vertical-align: top; -} -div.clear{ - clear:both; - visibility: hidden; -} -div.clear hr{ - display: none; -} -#bannerLeft, #bannerRight { - font-size: xx-large; - font-weight: bold; -} -#bannerLeft img, #bannerRight img { - margin: 0px; -} -.xleft, #bannerLeft img { - float:left; -} -.xright, #bannerRight { - float:right; -} -#banner { - padding: 0px; -} -#banner img { - border: none; -} -#breadcrumbs { - padding: 3px 10px 3px 10px; -} -#leftColumn { - width: 170px; - float:left; - overflow: auto; -} -#bodyColumn { - margin-right: 1.5em; - margin-left: 197px; -} -#legend { - padding: 8px 0 8px 0; -} -#navcolumn { - padding: 8px 4px 0 8px; -} -#navcolumn h5 { - margin: 0; - padding: 0; - font-size: small; -} -#navcolumn ul { - margin: 0; - padding: 0; - font-size: small; -} -#navcolumn li { - list-style-type: none; - background-image: none; - background-repeat: no-repeat; - background-position: 0 0.4em; - padding-left: 16px; - list-style-position: outside; - line-height: 1.2em; - font-size: smaller; -} -#navcolumn li.expanded { - background-image: url(../images/expanded.gif); -} -#navcolumn li.collapsed { - background-image: url(../images/collapsed.gif); -} -#poweredBy { - text-align: center; -} -#navcolumn img { - margin-top: 10px; - margin-bottom: 3px; -} -#poweredBy img { - display:block; - margin: 20px 0 20px 17px; -} -#search img { - margin: 0px; - display: block; -} -#search #q, #search #btnG { - border: 1px solid #999; - margin-bottom:10px; -} -#search form { - margin: 0px; -} -#lastPublished { - font-size: x-small; -} -.navSection { - margin-bottom: 2px; - padding: 8px; -} -.navSectionHead { - font-weight: bold; - font-size: x-small; -} -.section { - padding: 4px; -} -#footer { - padding: 3px 10px 3px 10px; - font-size: x-small; -} -#breadcrumbs { - font-size: x-small; - margin: 0pt; -} -.source { - padding: 12px; - margin: 1em 7px 1em 7px; -} -.source pre { - margin: 0px; - padding: 0px; -} -#navcolumn img.imageLink, .imageLink { - padding-left: 0px; - padding-bottom: 0px; - padding-top: 0px; - padding-right: 2px; - border: 0px; - margin: 0px; -} diff -Nru maven-bundle-plugin-2.5.4/doc/site/css/maven-theme.css maven-bundle-plugin-3.5.0/doc/site/css/maven-theme.css --- maven-bundle-plugin-2.5.4/doc/site/css/maven-theme.css 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/css/maven-theme.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/* - * 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. - */ - -body { - padding: 0px 0px 10px 0px; -} -body, td, select, input, li{ - font-family: Verdana, Helvetica, Arial, sans-serif; - font-size: 13px; -} -code{ - font-family: Courier, monospace; - font-size: 13px; -} -a { - text-decoration: none; -} -a:link { - color:#36a; -} -a:visited { - color:#47a; -} -a:active, a:hover { - color:#69c; -} -#legend li.externalLink { - background: url(../images/external.png) left top no-repeat; - padding-left: 18px; -} -a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover { - background: url(../images/external.png) right center no-repeat; - padding-right: 18px; -} -#legend li.newWindow { - background: url(../images/newwindow.png) left top no-repeat; - padding-left: 18px; -} -a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover { - background: url(../images/newwindow.png) right center no-repeat; - padding-right: 18px; -} -h2 { - padding: 4px 4px 4px 6px; - border: 1px solid #999; - color: #900; - background-color: #ddd; - font-weight:900; - font-size: x-large; -} -h3 { - padding: 4px 4px 4px 6px; - border: 1px solid #aaa; - color: #900; - background-color: #eee; - font-weight: normal; - font-size: large; -} -h4 { - padding: 4px 4px 4px 6px; - border: 1px solid #bbb; - color: #900; - background-color: #fff; - font-weight: normal; - font-size: large; -} -h5 { - padding: 4px 4px 4px 6px; - color: #900; - font-size: medium; -} -p { - line-height: 1.3em; - font-size: small; -} -#breadcrumbs { - border-top: 1px solid #aaa; - border-bottom: 1px solid #aaa; - background-color: #ccc; -} -#leftColumn { - margin: 10px 0 0 5px; - border: 1px solid #999; - background-color: #eee; - padding-bottom: 3px; /* IE-9 scrollbar-fix */ -} -#navcolumn h5 { - font-size: smaller; - border-bottom: 1px solid #aaaaaa; - padding-top: 2px; - color: #000; -} - -table.bodyTable th { - color: white; - background-color: #bbb; - text-align: left; - font-weight: bold; -} - -table.bodyTable th, table.bodyTable td { - font-size: 1em; -} - -table.bodyTable tr.a { - background-color: #ddd; -} - -table.bodyTable tr.b { - background-color: #eee; -} - -.source { - border: 1px solid #999; -} -dl { - padding: 4px 4px 4px 6px; - border: 1px solid #aaa; - background-color: #ffc; -} -dt { - color: #900; -} -#organizationLogo img, #projectLogo img, #projectLogo span{ - margin: 8px; -} -#banner { - border-bottom: 1px solid #fff; -} -.errormark, .warningmark, .donemark, .infomark { - background: url(../images/icon_error_sml.gif) no-repeat; -} - -.warningmark { - background-image: url(../images/icon_warning_sml.gif); -} - -.donemark { - background-image: url(../images/icon_success_sml.gif); -} - -.infomark { - background-image: url(../images/icon_info_sml.gif); -} - diff -Nru maven-bundle-plugin-2.5.4/doc/site/css/print.css maven-bundle-plugin-3.5.0/doc/site/css/print.css --- maven-bundle-plugin-2.5.4/doc/site/css/print.css 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/css/print.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn { - display: none !important; -} -#bodyColumn, body.docs div.docs { - margin: 0 !important; - border: none !important -} diff -Nru maven-bundle-plugin-2.5.4/doc/site/css/site.css maven-bundle-plugin-3.5.0/doc/site/css/site.css --- maven-bundle-plugin-2.5.4/doc/site/css/site.css 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/css/site.css 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -/* You can override this file with your own styles */ \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/dependencies.html maven-bundle-plugin-3.5.0/doc/site/dependencies.html --- maven-bundle-plugin-2.5.4/doc/site/dependencies.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/dependencies.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,156 +0,0 @@ - - - - - - Maven Bundle Plugin - Project Dependencies - - - - - - - - - -
- -
-
-
-

Project Dependencies

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupIdArtifactIdVersionTypeLicense
biz.aQute.bndbndlib2.3.0jarApache Software License 2.0
org.apache.felixorg.apache.felix.bundlerepository1.6.6jarThe Apache Software License, Version 2.0
org.apache.felixorg.apache.felix.utils1.6.0jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-archiver2.5jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-core2.0.7jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-sink-api1.0jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-site-renderer1.0jarThe Apache Software License, Version 2.0
org.apache.maven.sharedmaven-dependency-tree2.1jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-utils3.0.10jarThe Apache Software License, Version 2.0

test

The following is a list of test dependencies for this project. These dependencies are only required to compile and run unit tests for the application:

GroupIdArtifactIdVersionTypeLicense
junitjunit4.0jar-
org.apache.maven.sharedmaven-plugin-testing-harness1.1jarThe Apache Software License, Version 2.0
org.easymockeasymock2.4jarMIT License
org.mockitomockito-all1.7jarThe MIT License

Project Transitive Dependencies

The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.

compile

The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:

GroupIdArtifactIdVersionTypeLicense
classworldsclassworlds1.1jar-
commons-clicommons-cli1.0jar-
commons-collectionscommons-collections3.2jar/LICENSE.txt
commons-langcommons-lang2.1jar/LICENSE.txt
org.apache.mavenmaven-artifact2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-artifact-manager2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-error-diagnostics2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-model2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-monitor2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-plugin-api2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-plugin-descriptor2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-plugin-parameter-documenter2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-plugin-registry2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-profile2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-project2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-repository-metadata2.0.7jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-settings2.0.7jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-core1.0jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-decoration-model1.0jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-module-apt1.0jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-module-fml1.0jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-module-xdoc1.0jarThe Apache Software License, Version 2.0
org.apache.maven.doxiadoxia-module-xhtml1.0jarThe Apache Software License, Version 2.0
org.apache.maven.reportingmaven-reporting-api2.0.7jarThe Apache Software License, Version 2.0
org.apache.maven.wagonwagon-provider-api1.0-beta-2jarThe Apache Software License, Version 2.0
org.apache.velocityvelocity1.5jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-archiver2.1jarApache License, Version 2.0
org.codehaus.plexusplexus-component-annotations1.5.5jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-container-default1.0-alpha-9-stable-1jar-
org.codehaus.plexusplexus-i18n1.0-beta-7jar-
org.codehaus.plexusplexus-interactivity-api1.0-alpha-4jar-
org.codehaus.plexusplexus-interpolation1.15jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-io2.0.2jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-velocity1.1.7jar-
org.eclipse.aetheraether-util0.9.0.M2jarEclipse Public License, Version 1.0
org.osgiorg.osgi.compendium4.2.0jar-
org.osgiorg.osgi.core4.3.1jarApache License, Version 2.0
orooro2.0.8jar-

runtime

The following is a list of runtime dependencies for this project. These dependencies are required to run the application:

GroupIdArtifactIdVersionTypeLicense
com.jcraftjsch0.1.27jarBSD
jtidyjtidy4aug2000r7-devjarJava HTML Tidy License
org.apache.maven.wagonwagon-file1.0-beta-2jarThe Apache Software License, Version 2.0
org.apache.maven.wagonwagon-http-lightweight1.0-beta-2jarThe Apache Software License, Version 2.0
org.apache.maven.wagonwagon-http-shared1.0-beta-2jarThe Apache Software License, Version 2.0
org.apache.maven.wagonwagon-ssh1.0-beta-2jarThe Apache Software License, Version 2.0
org.apache.maven.wagonwagon-ssh-common1.0-beta-2jarThe Apache Software License, Version 2.0
org.apache.maven.wagonwagon-ssh-external1.0-beta-2jarThe Apache Software License, Version 2.0
xml-apisxml-apis1.0.b2jarThe Apache Software License, Version 2.0

Project Dependency Graph

-

Dependency Tree

Licenses

Apache Software License 2.0: A Swiss Army Knife for OSGi

Java HTML Tidy License: JTidy

Unknown: CLI, Default Plexus Container, Plexus Default Interactivity Handler, Plexus I18N Component, Plexus Velocity Component, classworlds, junit, org.osgi.compendium, oro

BSD: JSch

Apache License, Version 2.0: Plexus Archiver Component, osgi.core

Eclipse Public License, Version 1.0: Aether Utilities

MIT License: EasyMock

The Apache Software License, Version 2.0: Apache Felix Bundle Repository, Apache Felix Utils, Apache Velocity, Collections, Doxia :: APT Module, Doxia :: Core, Doxia :: FML Module, Doxia :: Sink API, Doxia :: XDoc Module, Doxia :: XHTML Module, Doxia Sitetools :: Decoration Model, Doxia Sitetools :: Site Renderer Component, Lang, Maven Archiver, Maven Artifact, Maven Artifact Manager, Maven Bundle Plugin, Maven Core, Maven Dependency Tree, Maven Error Diagnostics, Maven Local Settings Model, Maven Model, Maven Monitor, Maven Plugin API, Maven Plugin Descriptor Model, Maven Plugin Parameter Documenter API, Maven Plugin Registry Model, Maven Plugin Testing Mechanism, Maven Profile Model, Maven Project Builder, Maven Reporting API, Maven Repository Metadata Model, Maven Wagon API, Maven Wagon File Provider, Maven Wagon HTTP Shared Library, Maven Wagon Lightweight HTTP Provider, Maven Wagon SSH Common Library, Maven Wagon SSH External Provider, Maven Wagon SSH Provider, Plexus :: Component Annotations, Plexus Common Utilities, Plexus IO Components, Plexus Interpolation API, XML Commons External Components XML APIs

The MIT License: Mockito

Dependency File Details

FilenameSizeEntriesClassesPackagesJDK RevDebug
bndlib-2.3.0.jar1.70 MB1,412621961.5debug
classworlds-1.1.jar36.97 kB332331.3debug
jsch-0.1.27.jar119.15 kB979431.2release
commons-cli-1.0.jar29.41 kB272011.1debug
commons-collections-3.2.jar557.87 kB477458121.1debug
commons-lang-2.1.jar202.85 kB12511081.1debug
jtidy-4aug2000r7-dev.jar134.60 kB12911931.1release
junit-4.0.jar103.13 kB11992111.5debug
org.apache.felix.bundlerepository-1.6.6.jar164.33 kB11284111.4debug
org.apache.felix.utils-1.6.0.jar66.04 kB583681.5debug
maven-archiver-2.5.jar21.30 kB19511.5debug
maven-artifact-2.0.7.jar85.80 kB10677151.1debug
maven-artifact-manager-2.0.7.jar55.18 kB462471.1debug
maven-core-2.0.7.jar149.30 kB10867131.1debug
maven-error-diagnostics-2.0.7.jar13.29 kB22611.1debug
maven-model-2.0.7.jar84.41 kB604521.1debug
maven-monitor-2.0.7.jar10.00 kB19511.1debug
maven-plugin-api-2.0.7.jar12.56 kB23921.1debug
maven-plugin-descriptor-2.0.7.jar36.01 kB321531.1debug
maven-plugin-parameter-documenter-2.0.7.jar20.27 kB20421.1debug
maven-plugin-registry-2.0.7.jar28.25 kB281021.1debug
maven-profile-2.0.7.jar34.42 kB331621.1debug
maven-project-2.0.7.jar113.81 kB7651101.1debug
maven-repository-metadata-2.0.7.jar23.90 kB23621.1debug
maven-settings-2.0.7.jar47.96 kB382121.1debug
doxia-core-1.0.jar53.66 kB7748131.4debug
doxia-decoration-model-1.0.jar47.84 kB391831.4debug
doxia-module-apt-1.0.jar45.97 kB452711.4debug
doxia-module-fml-1.0.jar18.11 kB24521.4debug
doxia-module-xdoc-1.0.jar27.15 kB311311.4debug
doxia-module-xhtml-1.0.jar21.29 kB27721.4debug
doxia-sink-api-1.0.jar9.84 kB22421.4debug
doxia-site-renderer-1.0.jar45.43 kB50921.4debug
maven-reporting-api-2.0.7.jar9.71 kB18411.1debug
maven-dependency-tree-2.1.jar58.55 kB633971.5debug
maven-plugin-testing-harness-1.1.jar31.73 kB281121.1debug
wagon-file-1.0-beta-2.jar9.71 kB18111.1debug
wagon-http-lightweight-1.0-beta-2.jar12.03 kB19211.1debug
wagon-http-shared-1.0-beta-2.jar9.34 kB17211.1debug
wagon-provider-api-1.0-beta-2.jar45.24 kB573781.1debug
wagon-ssh-1.0-beta-2.jar23.05 kB26721.1debug
wagon-ssh-common-1.0-beta-2.jar24.61 kB371831.1debug
wagon-ssh-external-1.0-beta-2.jar12.27 kB19111.1debug
velocity-1.5.jar382.93 kB282246251.2debug
plexus-archiver-2.1.jar180.12 kB137112121.5debug
plexus-component-annotations-1.5.5.jar4.11 kB15311.5release
plexus-container-default-1.0-alpha-9-stable-1.jar189.63 kB215175281.1debug
plexus-i18n-1.0-beta-7.jar10.26 kB19611.4debug
plexus-interactivity-api-1.0-alpha-4.jar13.09 kB251111.1debug
plexus-interpolation-1.15.jar59.06 kB604461.5debug
plexus-io-2.0.2.jar56.90 kB624351.5debug
plexus-utils-3.0.10.jar225.47 kB12710291.5debug
plexus-velocity-1.1.7.jar7.49 kB18511.4debug
easymock-2.4.jar79.23 kB837131.5debug
aether-util-0.9.0.M2.jar130.46 kB11893131.5debug
mockito-all-1.7.jar943.04 kB846469481.5debug
org.osgi.compendium-4.2.0.jar599.76 kB584189331.2debug
org.osgi.core-4.3.1.jar341.78 kB254106131.5debug
oro-2.0.8.jar63.73 kB746261.2release
xml-apis-1.0.b2.jar106.76 kB217184171.2release
TotalSizeEntriesClassesPackagesJDK RevDebug
607.61 MB6,9954,1924961.555
compile: 47compile: 6.04 MBcompile: 5,340compile: 3,121compile: 400-compile: 45
test: 4test: 1.13 MBtest: 1,076test: 643test: 64-test: 4
runtime: 9runtime: 451.54 kBruntime: 579runtime: 428runtime: 32-runtime: 6

Dependency Repository Locations

Repo IDURLReleaseSnapshotBlacklisted
codehaus.snapshotshttp://snapshots.repository.codehaus.org-Yes-
apache.snapshotshttp://repository.apache.org/snapshots-YesYes
snapshotshttp://snapshots.maven.codehaus.org/maven2-YesYes
centralhttp://repo.maven.apache.org/maven2Yes--

Repository locations for each of the Dependencies.

Artifactcodehaus.snapshotscentral
biz.aQute.bnd:bndlib:jar:2.3.0-Found at http://repo.maven.apache.org/maven2
classworlds:classworlds:jar:1.1-Found at http://repo.maven.apache.org/maven2
com.jcraft:jsch:jar:0.1.27-Found at http://repo.maven.apache.org/maven2
commons-cli:commons-cli:jar:1.0-Found at http://repo.maven.apache.org/maven2
commons-collections:commons-collections:jar:3.2-Found at http://repo.maven.apache.org/maven2
commons-lang:commons-lang:jar:2.1-Found at http://repo.maven.apache.org/maven2
jtidy:jtidy:jar:4aug2000r7-dev-Found at http://repo.maven.apache.org/maven2
junit:junit:jar:4.0-Found at http://repo.maven.apache.org/maven2
org.apache.felix:org.apache.felix.bundlerepository:jar:1.6.6-Found at http://repo.maven.apache.org/maven2
org.apache.felix:org.apache.felix.utils:jar:1.6.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-archiver:jar:2.5-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-artifact:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-artifact-manager:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-core:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-error-diagnostics:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-model:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-monitor:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-plugin-api:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-plugin-descriptor:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-plugin-registry:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-profile:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-project:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-repository-metadata:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven:maven-settings:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-core:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-decoration-model:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-module-apt:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-module-fml:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-module-xdoc:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-module-xhtml:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-sink-api:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.doxia:doxia-site-renderer:jar:1.0-Found at http://repo.maven.apache.org/maven2
org.apache.maven.reporting:maven-reporting-api:jar:2.0.7-Found at http://repo.maven.apache.org/maven2
org.apache.maven.shared:maven-dependency-tree:jar:2.1-Found at http://repo.maven.apache.org/maven2
org.apache.maven.shared:maven-plugin-testing-harness:jar:1.1-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-file:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-http-shared:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-ssh-common:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.maven.wagon:wagon-ssh-external:jar:1.0-beta-2-Found at http://repo.maven.apache.org/maven2
org.apache.velocity:velocity:jar:1.5-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-archiver:jar:2.1-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-component-annotations:jar:1.5.5-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-interpolation:jar:1.15-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-io:jar:2.0.2-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-utils:jar:3.0.10-Found at http://repo.maven.apache.org/maven2
org.codehaus.plexus:plexus-velocity:jar:1.1.7-Found at http://repo.maven.apache.org/maven2
org.easymock:easymock:jar:2.4-Found at http://repo.maven.apache.org/maven2
org.eclipse.aether:aether-util:jar:0.9.0.M2-Found at http://repo.maven.apache.org/maven2
org.mockito:mockito-all:jar:1.7-Found at http://repo.maven.apache.org/maven2
org.osgi:org.osgi.compendium:jar:4.2.0-Found at http://repo.maven.apache.org/maven2
org.osgi:org.osgi.core:jar:4.3.1-Found at http://repo.maven.apache.org/maven2
oro:oro:jar:2.0.8-Found at http://repo.maven.apache.org/maven2
xml-apis:xml-apis:jar:1.0.b2-Found at http://repo.maven.apache.org/maven2
Totalcodehaus.snapshotscentral
60 (compile: 47, test: 4, runtime: 9)060
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/deploy-file-mojo.html maven-bundle-plugin-3.5.0/doc/site/deploy-file-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/deploy-file-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/deploy-file-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,321 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:deploy-file - - - - - - - - - -
- -
-
-
- - -

bundle:deploy-file

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:deploy-file

-

Description:

-
Deploys bundle details to a remote OBR repository (command-line -goal)
-

Attributes:

- -

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
repositoryIdString-Remote repository id, used to lookup authentication settings.
Default value is: remote-repository.
User property is: repositoryId.
urlString-Remote OBR repository URL, where the bundle details are to be -uploaded.
User property is: url.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
artifactIdString-ArtifactId of the bundle. Retrieved from POM file if specified.
User property is: artifactId.
bundleUrlString-Optional public URL where the bundle has been deployed.
User property is: bundleUrl.
classifierString-Classifier type of the bundle. Defaults to none.
User property is: classifier.
fileFile-Bundle file, defaults to the artifact in the local Maven -repository.
User property is: file.
groupIdString-GroupId of the bundle. Retrieved from POM file if specified.
User property is: groupId.
ignoreLockboolean-When true, ignore remote locking.
User property is: ignoreLock.
obrRepositoryString-Local OBR Repository.
User property is: obrRepository.
obrXmlString-Optional XML file describing additional requirements and -capabilities.
User property is: obrXml.
packagingString-Packaging type of the bundle. Retrieved from POM file if specified.
User property is: packaging.
pomFileFile-Location of an existing POM file.
User property is: pomFile.
remoteOBRString-Remote OBR Repository.
User property is: remoteOBR.
supportedProjectTypesList-Project types which this plugin supports.
versionString-Version of the bundle. Retrieved from POM file if specified.
User property is: version.
-
-

Parameter Details

-

artifactId:

-
ArtifactId of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: artifactId
  • -

bundleUrl:

-
Optional public URL where the bundle has been deployed.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: bundleUrl
  • -

classifier:

-
Classifier type of the bundle. Defaults to none.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: classifier
  • -

file:

-
Bundle file, defaults to the artifact in the local Maven -repository.
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: file
  • -

groupId:

-
GroupId of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: groupId
  • -

ignoreLock:

-
When true, ignore remote locking.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: ignoreLock
  • -

obrRepository:

-
Local OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -

obrXml:

-
Optional XML file describing additional requirements and -capabilities.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrXml
  • -

packaging:

-
Packaging type of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: packaging
  • -

pomFile:

-
Location of an existing POM file.
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: pomFile
  • -

remoteOBR:

-
Remote OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: remoteOBR
  • -

repositoryId:

-
Remote repository id, used to lookup authentication settings.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: repositoryId
  • -
  • Default: remote-repository
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

url:

-
Remote OBR repository URL, where the bundle details are to be -uploaded.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: url
  • -

version:

-
Version of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: version
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/deploy-mojo.html maven-bundle-plugin-3.5.0/doc/site/deploy-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/deploy-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/deploy-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,222 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:deploy - - - - - - - - - -
- -
-
-
- - -

bundle:deploy

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:deploy

-

Description:

-
Deploys bundle details to a remote OBR repository (life-cycle goal)
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: deploy.
  • -
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
altDeploymentRepositoryString-Alternative deployment repository. Format: id::layout::url
User property is: altDeploymentRepository.
bundleUrlString-Optional public URL where the bundle has been deployed.
User property is: bundleUrl.
ignoreLockboolean-When true, ignore remote locking.
User property is: ignoreLock.
obrDeploymentRepositoryString-OBR specific deployment repository. Format: id::layout::url
User property is: obrDeploymentRepository.
obrRepositoryString-Local OBR Repository.
User property is: obrRepository.
prefixUrlString-Optional public URL prefix for the remote repository.
User property is: prefixUrl.
remoteOBRString-Remote OBR Repository.
Default value is: NONE.
User property is: remoteOBR.
supportedProjectTypesList-Project types which this plugin supports.
-
-

Parameter Details

-

altDeploymentRepository:

-
Alternative deployment repository. Format: id::layout::url
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: altDeploymentRepository
  • -

bundleUrl:

-
Optional public URL where the bundle has been deployed.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: bundleUrl
  • -

ignoreLock:

-
When true, ignore remote locking.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: ignoreLock
  • -

obrDeploymentRepository:

-
OBR specific deployment repository. Format: id::layout::url
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrDeploymentRepository
  • -

obrRepository:

-
Local OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -

prefixUrl:

-
Optional public URL prefix for the remote repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: prefixUrl
  • -

remoteOBR:

-
Remote OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: remoteOBR
  • -
  • Default: NONE
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -
-
-
- - -
-
-
-
-
- - - Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/close.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/close.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/collapsed.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/collapsed.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/expanded.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/expanded.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/external.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/external.png differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/icon_error_sml.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/icon_error_sml.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/icon_info_sml.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/icon_info_sml.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/icon_success_sml.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/icon_success_sml.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/icon_warning_sml.gif and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/icon_warning_sml.gif differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/logos/build-by-maven-black.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/logos/build-by-maven-black.png differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/logos/build-by-maven-white.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/logos/build-by-maven-white.png differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/logos/maven-feather.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/logos/maven-feather.png differ Binary files /tmp/tmp39hSpc/rHNMp2K3Hl/maven-bundle-plugin-2.5.4/doc/site/images/newwindow.png and /tmp/tmp39hSpc/Gb6W9uPxPQ/maven-bundle-plugin-3.5.0/doc/site/images/newwindow.png differ diff -Nru maven-bundle-plugin-2.5.4/doc/site/index.html maven-bundle-plugin-3.5.0/doc/site/index.html --- maven-bundle-plugin-2.5.4/doc/site/index.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/index.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ - - - - - - Maven Bundle Plugin - Introduction - - - - - - - - - - - -
- -
-
-
-

Maven Bundle Plugin

This Maven 2 plugin is based on the BND tool from Peter Kriens. The way BND works is by treating your project as a big collection of classes (e.g., project code, dependencies, and the class path). The way you create a bundle with BND is to tell it the content of the bundle's JAR file as a subset of the available classes. This plugin wraps BND to make it work specifically with the Maven 2 project structure and to provide it with reasonable default behavior for Maven 2 projects.

Goals Overview

General Information about the goals.

  • bundle:bundle Create an OSGi bundle from Maven project. (life-cycle goal)
  • bundle:manifest Generate an OSGi manifest for this project.
  • bundle:cleanVersions Convert a group of versions to OSGi format.
  • bundle:instructions Generate BND instructions for this project.
  • bundle:install Installs bundle details in the local OBR repository. (life-cycle goal)
  • bundle:deploy Deploys bundle details to a remote OBR repository. (life-cycle goal)
  • bundle:index Index the content of a maven repository using OBR.
  • bundle:install-file Installs bundle details in the local OBR repository. (command-line goal)
  • bundle:deploy-file Deploys bundle details to a remote OBR repository. (command-line goal)
  • bundle:clean Clean a local OBR repository by finding and removing missing resources.
  • bundle:remote-clean Clean a remote OBR repository by finding and removing missing resources.
  • bundle:ant Generate Ant script to create the bundle. (you should run ant:ant first)

Usage

General instructions on how to use the Maven Bundle Plugin can be found on the wiki page. Some more specific use cases are described in the examples given below.

In case you still have questions regarding the plugin's usage, please have a look at the FAQ and feel free to contact the user mailing list. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.

If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our source repository and will find supplementary information in the Apache Felix developers guide.

Examples

To provide you with better understanding on some usages of the Maven Bundle Plugin, you can take a look into the following examples:

  • Examples coming soon!
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/index-mojo.html maven-bundle-plugin-3.5.0/doc/site/index-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/index-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/index-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:index - - - - - - - - - -
- -
-
-
- - -

bundle:index

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:index

-

Description:

-
Index the content of a maven repository using OBR
-

Attributes:

-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
mavenRepositoryString-The repository to index
User property is: mavenRepository.
obrRepositoryString-OBR Repository.
User property is: obrRepository.
urlTemplateString-Template for urls
User property is: urlTemplate.
-
-

Parameter Details

-

mavenRepository:

-
The repository to index
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: mavenRepository
  • -

obrRepository:

-
OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -

urlTemplate:

-
Template for urls
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: urlTemplate
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/install-file-mojo.html maven-bundle-plugin-3.5.0/doc/site/install-file-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/install-file-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/install-file-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,248 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:install-file - - - - - - - - - -
- -
-
-
- - -

bundle:install-file

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:install-file

-

Description:

-
Installs bundle details in the local OBR repository (command-line -goal)
-

Attributes:

- -

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
artifactIdString-ArtifactId of the bundle. Retrieved from POM file if specified.
User property is: artifactId.
classifierString-Classifier type of the bundle. Defaults to none.
User property is: classifier.
fileFile-Bundle file, defaults to the artifact in the local Maven -repository.
User property is: file.
groupIdString-GroupId of the bundle. Retrieved from POM file if specified.
User property is: groupId.
obrRepositoryString-OBR Repository.
User property is: obrRepository.
obrXmlString-Optional XML file describing additional requirements and -capabilities.
User property is: obrXml.
packagingString-Packaging type of the bundle. Retrieved from POM file if specified.
User property is: packaging.
pomFileFile-Location of an existing POM file.
User property is: pomFile.
supportedProjectTypesList-Project types which this plugin supports.
versionString-Version of the bundle. Retrieved from POM file if specified.
User property is: version.
-
-

Parameter Details

-

artifactId:

-
ArtifactId of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: artifactId
  • -

classifier:

-
Classifier type of the bundle. Defaults to none.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: classifier
  • -

file:

-
Bundle file, defaults to the artifact in the local Maven -repository.
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: file
  • -

groupId:

-
GroupId of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: groupId
  • -

obrRepository:

-
OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -

obrXml:

-
Optional XML file describing additional requirements and -capabilities.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrXml
  • -

packaging:

-
Packaging type of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: packaging
  • -

pomFile:

-
Location of an existing POM file.
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: pomFile
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

version:

-
Version of the bundle. Retrieved from POM file if specified.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: version
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/install-mojo.html maven-bundle-plugin-3.5.0/doc/site/install-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/install-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/install-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:install - - - - - - - - - -
- -
-
-
- - -

bundle:install

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:install

-

Description:

-
Installs bundle details in the local OBR repository (life-cycle -goal)
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: install.
  • -
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
obrRepositoryString-OBR Repository.
User property is: obrRepository.
supportedProjectTypesList-Project types which this plugin supports.
-
-

Parameter Details

-

obrRepository:

-
OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/instructions-mojo.html maven-bundle-plugin-3.5.0/doc/site/instructions-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/instructions-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/instructions-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,310 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:instructions - - - - - - - - - -
- -
-
-
- - -

bundle:instructions

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:instructions

-

Description:

-
Generate BND instructions for this project
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • Requires dependency resolution of artifacts in scope: test.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: package.
  • -
-

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
buildDirectoryString-The directory for the generated JAR.
User property is: project.build.directory.
outputDirectoryFile-The directory for the generated bundles.
User property is: project.build.outputDirectory.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
archiveMavenArchiveConfiguration-The archive configuration to use.
classifierString-Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
dumpClasspathFile-File where the BND class-path will be dumped
User property is: dumpClasspath.
dumpInstructionsFile-File where the BND instructions will be dumped
User property is: dumpInstructions.
excludeDependenciesString-Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
User property is: excludeDependencies.
finalNameString-Final name of the bundle (without classifier or extension)
User property is: project.build.finalName.
instructionsMap-The BND instructions for the bundle.
manifestLocationFile-Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
User property is: manifestLocation.
niceManifestboolean-Output a nicely formatted manifest that still respects the 72 -character line limit.
packagingString-Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
supportedProjectTypesList-Project types which this plugin supports.
unpackBundleboolean-When true, unpack the bundle contents to the outputDirectory
User property is: unpackBundle.
-
-

Parameter Details

-

archive:

-
The archive configuration to use.
-
    -
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • -
  • Required: No
  • -

buildDirectory:

-
The directory for the generated JAR.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: project.build.directory
  • -

classifier:

-
Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

dumpClasspath:

-
File where the BND class-path will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpClasspath
  • -

dumpInstructions:

-
File where the BND instructions will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpInstructions
  • -

excludeDependencies:

-
Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: excludeDependencies
  • -

finalName:

-
Final name of the bundle (without classifier or extension)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: project.build.finalName
  • -

instructions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -

manifestLocation:

-
Directory where the manifest will be written
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: manifestLocation
  • -
  • Default: ${project.build.outputDirectory}/META-INF
  • -

niceManifest:

-
Output a nicely formatted manifest that still respects the 72 -character line limit.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

outputDirectory:

-
The directory for the generated bundles.
-
    -
  • Type: java.io.File
  • -
  • Required: Yes
  • -
  • User Property: project.build.outputDirectory
  • -

packaging:

-
Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

unpackBundle:

-
When true, unpack the bundle contents to the outputDirectory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: unpackBundle
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/issue-tracking.html maven-bundle-plugin-3.5.0/doc/site/issue-tracking.html --- maven-bundle-plugin-2.5.4/doc/site/issue-tracking.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/issue-tracking.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ - - - - - - Maven Bundle Plugin - Issue Tracking - - - - - - - - - -
- -
-
-
-

Overview

This project uses JIRA a J2EE-based, issue tracking and project management application.

Issue Tracking

Issues, bugs, and feature requests should be submitted to the following issue tracking system for this project.

-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/jira-report.html maven-bundle-plugin-3.5.0/doc/site/jira-report.html --- maven-bundle-plugin-2.5.4/doc/site/jira-report.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/jira-report.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ - - - - - - Maven Bundle Plugin - JIRA Report - - - - - - - - - -
- -
-
-
-

JIRA Report

KeySummaryStatusResolutionBy
FELIX-4005Maven Bundle Plugin fails with ArrayIndexOutOfBoundsException, "Invalid Class File" errors with Java 8 featuresClosedFixed 
FELIX-3347Upper-case environment variables end up in final manifestClosedFixedStuart McCulloch
FELIX-2765bundle plugin throw IllegalArgumentException while do the installClosedFixed 
FELIX-661maven bundle plugin does not close the accessed fie /jar streamsClosedFixedStuart McCulloch
FELIX-4067Old BND used causes problems during annotations processingClosedFixed 
FELIX-3585Dependencies with classes or resources in the default package cannot be embeddedClosedFixed 
FELIX-2934Bundle-ClassPath contains "." despite using _wab instructionClosedFixedStuart McCulloch
FELIX-4539Update to Bndlib 2.3.0ResolvedFixedStuart McCulloch
FELIX-4518Provide a way to disable some pluginsResolvedFixedGuillaume Nodet
FELIX-4517Generate generic capabilities and requirements for services from blueprint and scr descriptorsResolvedFixedGuillaume Nodet
FELIX-4512Add a new Mojo to invoke the BND Baseline toolClosedFixedCarsten Ziegeler
FELIX-4017@ProviderType does not work (bnd "provide:=true" annotation?)ClosedFixed 
FELIX-3973Exclusion from {local-packages} doesn't work anymoreClosedFixed 
FELIX-3638Missing package import for annotation default valueClosedFixed 
FELIX-3630Packages exported by bundle are (re)-imported with incorrect versionClosedFixed 
FELIX-3602The bundle plugin should generate the blueprint header with the file locationsClosedFixedGuillaume Nodet
FELIX-3601Incorrect namespace in component XML for DS AnnotationsClosedFixed 
FELIX-3497Wrong artifact type attached as a secondary artifact when project packaging is set to "pom"ClosedFixed 
FELIX-3462Nicer Manifest formattingResolvedFixedGuillaume Nodet
FELIX-3407Imports are missed for genericsClosedFixed 
FELIX-3352Maven Bundle Plugin ignores resource properties configured inside <filters> sectionClosedFixed 
FELIX-3349wrong bundle manifest contents in some casesClosedFixed 
FELIX-3310[patch] maven-bundle-plugin build fails with maven3 (manageArtifactSystemPath is missing)ClosedFixedStuart McCulloch
FELIX-3293Exception while creating empty fragment bundles with version 2.3.6ClosedFixed 
FELIX-3254manifest goal generates wrong Export-Package when Embed-DependencyClosedFixedStuart McCulloch
FELIX-3222[PATCH] build fails with "unreported exception"ClosedFixedStuart McCulloch
FELIX-3210Maven bundle plugin remote-clean goal without user confirmationClosedFixedStuart McCulloch
FELIX-3209Make sure the properties passed to BND only include string valuesClosedFixedStuart McCulloch
FELIX-3208Provide default value for sourcepath when using BND -sources=trueClosedFixedStuart McCulloch
FELIX-3206Restore the BND analyzer approach which creates a MANIFEST.MF based on the contents of the jarClosedFixedStuart McCulloch
FELIX-3188[PATCH] exception org.apache.maven.project.artifact.InvalidDependencyVersionException has already been caughtClosedFixedStuart McCulloch
FELIX-3185Negative Embed-Dependency clauses aren't handled correctlyClosedFixedStuart McCulloch
FELIX-3165Add an option to the manifest goal that will copy any BND generated resources to the target folderClosedFixedStuart McCulloch
FELIX-3092Support relative paths in "urlTemplate" parameter of "bundle:index" goal in maven bundle pluginClosedFixedStuart McCulloch
FELIX-3061improvements to Embed-Dependency logic to allow better m2e integrationClosedFixedStuart McCulloch
FELIX-3058maven-bundle-plugin 2.3.5 incompatible with maven-source-plugin (regression)ClosedFixedStuart McCulloch
FELIX-3037Plugin does not work with Java 5ClosedFixedStuart McCulloch
FELIX-3031maven3 deployment fails where maven2 worksClosedFixedStuart McCulloch
FELIX-3011Add a new goal to save the bnd instructions that would be passed onto bnd, to allow people to use other toolchains such as bndtoolsClosedFixedStuart McCulloch
FELIX-2884The multiplicity isn't taken into account by the maven bundle plugin and bundlerepository when generating the repository xmlClosedFixedGuillaume Nodet
FELIX-2872Provide a way to have an easier to read manifestClosedFixedStuart McCulloch
FELIX-2820Provide a default value when using <_wab/>ClosedFixedStuart McCulloch
FELIX-2819packageinfo files in src/main/java are ignoredClosedFixedStuart McCulloch
FELIX-2812The <Embed-Dependency> filter can fail if your matching against multiple "*" artifact ids.ClosedFixedHiram Chirino
FELIX-2811If <Private-Package>!*</Private-Package> is defined the all packages should be exported by {local-packages}ClosedFixedHiram Chirino
FELIX-2808maven-bundle-plugin should scan for local packages by looking for *.class files instead of *.java so that all the JVM languages can be supported.ClosedFixedHiram Chirino
FELIX-2701Add a {local-packages} macro for automatically expanding local packages in the <Export-Package> instructionClosedFixedGuillaume Nodet
FELIX-2692Support maven type 'wab' for web bundlesClosedFixedStuart McCulloch
FELIX-2449Resource filtering does not use Maven properties specified on the mvn command line via -D command line switchesClosedFixedStuart McCulloch
FELIX-2435<supportedProjectType> on a WAR file will switch the project to generate jar artifactsClosedFixedStuart McCulloch
FELIX-2427maven site crashesClosedFixedStuart McCulloch
FELIX-2346mvn bundle:clean removes all, even the existing resourcesClosedFixedStuart McCulloch
FELIX-2215Refactor bundlerepository and maven bundle plugin obr data modelClosedFixedGuillaume Nodet
FELIX-2210Bogus import entriesClosedFixedStuart McCulloch
FELIX-2194The manifest and bundle goals seem to generate different manifest informationsClosedFixedStuart McCulloch
FELIX-2176Upgrade maven-bundle-plugin to up to date bndClosedFixedRichard S. Hall
FELIX-2175Improve the Blueprint component to parse / introspect blueprint configuration files and generate OBR service requirements / capabilities accordinglyClosedFixedGuillaume Nodet
FELIX-2173Fix inconsistent maven->osgi version conversion between maven-bundle-plugin and DefaultMaven2OsgiConverterClosedFixedGuillaume Nodet
FELIX-2155The maven bundle plugin generates wrong capabilities for packages with directivesClosedFixedGuillaume Nodet
FELIX-2112Carriage returns are removed from instructions, but the lines should be trimmed alltogetherClosedFixedGuillaume Nodet
FELIX-2048Service-Component property doesn't allow to use wildcards for filenamesClosedFixedStuart McCulloch
FELIX-1951The SchemaObr.xsd in bundleplugin is incompleteClosedFixedGuillaume Nodet
FELIX-1936Create Output Directory for Resource-Only WARsClosedFixedStuart McCulloch
FELIX-1820Fragment-Host version not convertedClosedFixedStuart McCulloch
FELIX-1734The _donotcopy is ignoredClosedFixedStuart McCulloch
FELIX-1634Maven Bundle Plugin disables transitive dependenciesClosedFixedStuart McCulloch
FELIX-1571Bundle-ClassPath without "." while using maven-bundle-plugin in a war project confuses the pluginClosedFixedStuart McCulloch
FELIX-1568Goal to transform a maven version into an OSGi versionClosedFixedGuillaume Nodet
FELIX-1552Add support for blueprint and spring-dm declarations to import the discovered packagesClosedFixedGuillaume Nodet
FELIX-1539generated-classes not included in bundleClosedFixedStuart McCulloch
FELIX-1501Using a macro in Bundle-Version with the manifest goal causes garbage in the Export-Package and Private-Package headers.ClosedFixedStuart McCulloch
FELIX-1461Corrupted repository.xml when maven is run in parallelClosedFixedStuart McCulloch
FELIX-1439maven-bundle-plugin resource filtering does not substitute project.organization.*ClosedFixedStuart McCulloch
FELIX-1262[regression] shared archive resources cannot be foundClosedFixedStuart McCulloch
FELIX-1148NPE during bundleall goalClosedFixedStuart McCulloch
FELIX-1054The deploy and deploy-file plugin should write the computed bundle uriClosedFixedClement Escoffier
FELIX-1039Inconsistency packaging vs. typeClosedFixedStuart McCulloch
FELIX-1023Category Information not exported to obr fileClosedFixedStuart McCulloch
FELIX-1021Classifier always used even if not explicitly set in the configurationClosedFixedStuart McCulloch
FELIX-1017Generic types ignored when generating MANIFEST.MFClosedFixedStuart McCulloch
FELIX-954Import-Package should include packages from optional Maven dependencies with resolution=optionalClosedFixed 
FELIX-941Support singleton & fragment-attachment directive generationClosedFixedStuart McCulloch
FELIX-907Regression in latest BND code: negated exports are applied to private packagesClosedFixedPeter Kriens
FELIX-899Version attribute missing from Import-Package on provided dependenciesClosedFixedStuart McCulloch
FELIX-843Regression: BND 0.0.295 does not augment Ignore-Package with excluded import packagesClosedFixedPeter Kriens
FELIX-831bndlib unnecessary modifies valid OSGi Bundle-Version numbers (update to bndlib 0.0.293)ClosedFixedStuart McCulloch
FELIX-806changing the internal configuration of the archive plugin doesn't seem to be possibleClosedFixedStuart McCulloch
FELIX-782Manifest goal ignores version attribute specified in _exportcontentsClosedFixedStuart McCulloch
FELIX-759Version range in import declaration creates a filter using invalid operators (<,>)ClosedFixedStuart McCulloch
FELIX-699manifest goal does not interprete _include instruction correctlyClosedFixedStuart McCulloch
FELIX-677Parser throws error when DynamicImport-Package contains attributesClosedFixedStuart McCulloch
FELIX-660"Class in different directory than declared" error when bundle classes in a directory other than bundle rootClosedFixedPeter Kriens
FELIX-636Bundle-SymbolicName is generated incorrectlyClosedFixedStuart McCulloch
FELIX-620manifest goal of maven-bundle-plugin ignores _include instructionClosedFixedStuart McCulloch
FELIX-580Allows maven-bunde-plugin to generate a repository file outide a maven repository with absolute urlClosedFixedStuart McCulloch
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/license.html maven-bundle-plugin-3.5.0/doc/site/license.html --- maven-bundle-plugin-2.5.4/doc/site/license.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/license.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,322 +0,0 @@ - - - - - - Maven Bundle Plugin - Project License - - - - - - - - - -
- -
-
-
-

Overview

Typically the licenses listed for the project are that of the project itself, and not of dependencies.

Project License

The Apache Software License, Version 2.0

-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
-
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/mail-lists.html maven-bundle-plugin-3.5.0/doc/site/mail-lists.html --- maven-bundle-plugin-2.5.4/doc/site/mail-lists.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/mail-lists.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ - - - - - - Maven Bundle Plugin - Project Mailing Lists - - - - - - - - - -
- -
-
-
-

Project Mailing Lists

These are the mailing lists that have been established for this project. For each list, there is a subscribe, unsubscribe, and an archive link.

NameSubscribeUnsubscribePostArchive
Felix DevSubscribeUnsubscribe-www.mail-archive.com
Felix CommitsSubscribeUnsubscribe-www.mail-archive.com
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/manifest-mojo.html maven-bundle-plugin-3.5.0/doc/site/manifest-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/manifest-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/manifest-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,324 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:manifest - - - - - - - - - -
- -
-
-
- - -

bundle:manifest

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:manifest

-

Description:

-
Generate an OSGi manifest for this project
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • Requires dependency resolution of artifacts in scope: test.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: process-classes.
  • -
-

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
buildDirectoryString-The directory for the generated JAR.
User property is: project.build.directory.
outputDirectoryFile-The directory for the generated bundles.
User property is: project.build.outputDirectory.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
archiveMavenArchiveConfiguration-The archive configuration to use.
classifierString-Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
dumpClasspathFile-File where the BND class-path will be dumped
User property is: dumpClasspath.
dumpInstructionsFile-File where the BND instructions will be dumped
User property is: dumpInstructions.
excludeDependenciesString-Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
User property is: excludeDependencies.
finalNameString-Final name of the bundle (without classifier or extension)
User property is: project.build.finalName.
instructionsMap-The BND instructions for the bundle.
manifestLocationFile-Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
User property is: manifestLocation.
niceManifestboolean-Output a nicely formatted manifest that still respects the 72 -character line limit.
packagingString-Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
rebuildBundleboolean-When true, generate the manifest by rebuilding the full bundle in -memory
User property is: rebuildBundle.
supportedProjectTypesList-Project types which this plugin supports.
unpackBundleboolean-When true, unpack the bundle contents to the outputDirectory
User property is: unpackBundle.
-
-

Parameter Details

-

archive:

-
The archive configuration to use.
-
    -
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • -
  • Required: No
  • -

buildDirectory:

-
The directory for the generated JAR.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: project.build.directory
  • -

classifier:

-
Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

dumpClasspath:

-
File where the BND class-path will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpClasspath
  • -

dumpInstructions:

-
File where the BND instructions will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpInstructions
  • -

excludeDependencies:

-
Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: excludeDependencies
  • -

finalName:

-
Final name of the bundle (without classifier or extension)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: project.build.finalName
  • -

instructions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -

manifestLocation:

-
Directory where the manifest will be written
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: manifestLocation
  • -
  • Default: ${project.build.outputDirectory}/META-INF
  • -

niceManifest:

-
Output a nicely formatted manifest that still respects the 72 -character line limit.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

outputDirectory:

-
The directory for the generated bundles.
-
    -
  • Type: java.io.File
  • -
  • Required: Yes
  • -
  • User Property: project.build.outputDirectory
  • -

packaging:

-
Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

rebuildBundle:

-
When true, generate the manifest by rebuilding the full bundle in -memory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: rebuildBundle
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

unpackBundle:

-
When true, unpack the bundle contents to the outputDirectory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: unpackBundle
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/plugin-info.html maven-bundle-plugin-3.5.0/doc/site/plugin-info.html --- maven-bundle-plugin-2.5.4/doc/site/plugin-info.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/plugin-info.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,159 +0,0 @@ - - - - - - Maven Bundle Plugin - Plugin Documentation - - - - - - - - - -
- -
-
-
-

Plugin Documentation

Goals available for this plugin:

GoalReport?Description
bundle:antNoGenerate Ant script to create the bundle (you should run ant:ant -first).
bundle:baselineNoBND Baseline check between two bundles.
bundle:baseline-reportYesBND Baseline report.
bundle:bundleNoCreate an OSGi bundle from Maven project
bundle:bundleallNoDeprecated. The bundleall goal is no longer supported and may be removed in a -future release
bundle:cleanNoClean an OBR repository by finding and removing missing resources.
bundle:cleanVersionsNoConvert a group of versions to OSGi format.
bundle:deployNoDeploys bundle details to a remote OBR repository (life-cycle goal)
bundle:deploy-fileNoDeploys bundle details to a remote OBR repository (command-line -goal)
bundle:indexNoIndex the content of a maven repository using OBR
bundle:installNoInstalls bundle details in the local OBR repository (life-cycle -goal)
bundle:install-fileNoInstalls bundle details in the local OBR repository (command-line -goal)
bundle:instructionsNoGenerate BND instructions for this project
bundle:manifestNoGenerate an OSGi manifest for this project
bundle:remote-cleanNoClean a remote repository file. It just looks for every resources -and check that pointed file exists.
bundle:wrapNoDeprecated. The wrap goal is no longer supported and may be removed in a future -release

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven2.0
JDK1.5
MemoryNo minimum requirement.
Disk SpaceNo minimum requirement.

Usage

You should specify the version in your project's plugin configuration:

<project>
-  ...
-  <build>
-    <!-- To define the plugin version in your parent POM -->
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>maven-bundle-plugin</artifactId>
-          <version>2.5.0</version>
-        </plugin>
-        ...
-      </plugins>
-    </pluginManagement>
-    <!-- To use the plugin goals in your POM or parent POM -->
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>2.5.0</version>
-      </plugin>
-      ...
-    </plugins>
-  </build>
-  ...
-  <!-- To use the report goals in your POM or parent POM -->
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>2.5.0</version>
-      </plugin>
-      ...
-    </plugins>
-  </reporting>
-  ...
-</project>
-

For more information, see "Guide to Configuring Plug-ins"

-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/project-info.html maven-bundle-plugin-3.5.0/doc/site/project-info.html --- maven-bundle-plugin-2.5.4/doc/site/project-info.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/project-info.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ - - - - - - Maven Bundle Plugin - Project Information - - - - - - - - - -
- -
-
-
-

Project Information

This document provides an overview of the various documents and links that are part of this project's general information. All of this content is automatically generated by Maven on behalf of the project.

Overview

DocumentDescription
AboutProvides a maven plugin that supports creating an OSGi bundle - from the contents of the compilation classpath along with its - resources and dependencies. Plus a zillion other features. - The plugin uses the Bnd tool (http://www.aqute.biz/Code/Bnd)
DependenciesThis document lists the project's dependencies and provides information on each dependency.
Issue TrackingThis is a link to the issue management system for this project. Issues (bugs, features, change requests) can be created and queried using this link.
Mailing ListsThis document provides subscription and archive information for this project's mailing lists.
Project LicenseThis is a link to the definitions of project licenses.
Project TeamThis document provides information on the members of this project. These are the individuals who have contributed to the project in one form or another.
Source RepositoryThis is a link to the online source repository that can be viewed via a web browser.
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/project-reports.html maven-bundle-plugin-3.5.0/doc/site/project-reports.html --- maven-bundle-plugin-2.5.4/doc/site/project-reports.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/project-reports.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ - - - - - - Maven Bundle Plugin - Generated Reports - - - - - - - - - -
- -
-
-
-

Generated Reports

This document provides an overview of the various reports that are automatically generated by Maven . Each report is briefly described below.

Overview

DocumentDescription
JIRA ReportReport on Issues from the JIRA Issue Tracking System.
Plugin DocumentationThis report provides goals and parameters documentation of a plugin.
Source XrefHTML based, cross-reference version of Java source code.
Surefire ReportReport on the test results of the project.
Test Source XrefHTML based, cross-reference version of Java test source code.
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/remote-clean-mojo.html maven-bundle-plugin-3.5.0/doc/site/remote-clean-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/remote-clean-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/remote-clean-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:remote-clean - - - - - - - - - -
- -
-
-
- - -

bundle:remote-clean

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:remote-clean

-

Description:

-
Clean a remote repository file. It just looks for every resources -and check that pointed file exists.
-

Attributes:

- -

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
altDeploymentRepositoryString-Alternative deployment repository. Format: id::layout::url
User property is: altDeploymentRepository.
ignoreLockboolean-When true, ignore remote locking.
User property is: ignoreLock.
obrDeploymentRepositoryString-OBR specific deployment repository. Format: id::layout::url
User property is: obrDeploymentRepository.
obrRepositoryString-Local OBR Repository.
User property is: obrRepository.
prefixUrlString-Optional public URL prefix for the remote repository.
User property is: prefixUrl.
remoteOBRString-Remote OBR Repository.
Default value is: NONE.
User property is: remoteOBR.
supportedProjectTypesList-Project types which this plugin supports.
-
-

Parameter Details

-

altDeploymentRepository:

-
Alternative deployment repository. Format: id::layout::url
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: altDeploymentRepository
  • -

ignoreLock:

-
When true, ignore remote locking.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: ignoreLock
  • -

obrDeploymentRepository:

-
OBR specific deployment repository. Format: id::layout::url
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrDeploymentRepository
  • -

obrRepository:

-
Local OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: obrRepository
  • -

prefixUrl:

-
Optional public URL prefix for the remote repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: prefixUrl
  • -

remoteOBR:

-
Remote OBR Repository.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: remoteOBR
  • -
  • Default: NONE
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/source-repository.html maven-bundle-plugin-3.5.0/doc/site/source-repository.html --- maven-bundle-plugin-2.5.4/doc/site/source-repository.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/source-repository.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ - - - - - - Maven Bundle Plugin - Source Repository - - - - - - - - - -
- -
-
-
-

Overview

This project uses Subversion to manage its source code. Instructions on Subversion use can be found at http://svnbook.red-bean.com/.

Web Access

The following is a link to the online source repository.

Anonymous access

The source can be checked out anonymously from SVN with this command:

$ svn checkout http://svn.apache.org/repos/asf/felix/trunk/bundleplugin maven-bundle-plugin

Developer access

Everyone can access the Subversion repository via HTTP, but Committers must checkout the Subversion repository via HTTPS.

$ svn checkout https://svn.apache.org/repos/asf/felix/trunk/bundleplugin maven-bundle-plugin

To commit changes to the repository, execute the following command to commit your changes (svn will prompt you for your password)

$ svn commit --username your-username -m "A message"

Access from behind a firewall

For those users who are stuck behind a corporate firewall which is blocking HTTP access to the Subversion repository, you can try to access it via the developer connection:

$ svn checkout https://svn.apache.org/repos/asf/felix/trunk/bundleplugin maven-bundle-plugin

Access through a proxy

The Subversion client can go through a proxy, if you configure it to do so. First, edit your "servers" configuration file to indicate which proxy to use. The file's location depends on your operating system. On Linux or Unix it is located in the directory "~/.subversion". On Windows it is in "%APPDATA%\Subversion". (Try "echo %APPDATA%", note this is a hidden directory.)

There are comments in the file explaining what to do. If you don't have that file, get the latest Subversion client and run any command; this will cause the configuration directory and template files to be created.

Example: Edit the 'servers' file and add something like:

[global]
-http-proxy-host = your.proxy.name
-http-proxy-port = 3128
-
-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/surefire-report.html maven-bundle-plugin-3.5.0/doc/site/surefire-report.html --- maven-bundle-plugin-2.5.4/doc/site/surefire-report.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/surefire-report.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ - - - - - - Maven Bundle Plugin - Surefire Report - - - - - - - - - -
- -
-
-
-

Surefire Report

Summary


TestsErrors FailuresSkippedSuccess RateTime
22000100%3.818

Note: failures are anticipated and checked for with assertions while errors are unanticipated.

Package List


PackageTestsErrors FailuresSkippedSuccess RateTime
org.apache.maven.shared.osgi4000100%0.201
org.apache.felix.bundleplugin18000100%3.617

Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.

org.apache.maven.shared.osgi

ClassTestsErrors FailuresSkippedSuccess RateTime
Maven2OsgiConverterTest4000100%0.201

org.apache.felix.bundleplugin

ClassTestsErrors FailuresSkippedSuccess RateTime
BlueprintComponentTest3000100%1.05
BundleAllPluginTest2000100%0.839
BundlePluginTest12000100%1.721
ManifestWriterTest1000100%0.007

Test Cases

BlueprintComponentTest

testBlueprintServices0.664
testBlueprintGeneric0.284
testAnalyzer0.048

BundleAllPluginTest

testSnapshotMatch0.402
testNoReBundling0.428

BundlePluginTest

testConvertVersionToOsgi0.379
testReadExportedModules0.267
testTransformDirectives0.039
testDefaultPropertiesIncludeOrganization0.053
testVersion0.045
testPackageInfoDetection0.056
testEmbedDependencyPositiveClauses0.167
testEmbedDependencyNegativeClauses0.166
testEmbedDependencyDuplicateKeys0.145
testEmbedDependencyMissingPositiveKey0.157
testEmbedDependencyMissingNegativeKey0.201
testPropertySanitizing0.039

ManifestWriterTest

testNiceManifest0.005

Maven2OsgiConverterTest

testConvertVersionToOsgi0.037
testGetBundleSymbolicName0.06
testGetBundleFileName0.044
testGetVersion0.058


-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/team-list.html maven-bundle-plugin-3.5.0/doc/site/team-list.html --- maven-bundle-plugin-2.5.4/doc/site/team-list.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/team-list.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ - - - - - - Maven Bundle Plugin - Team list - - - - - - - - - -
- -
-
-
-

The Team

A successful project requires many people to play many roles. Some members write code or documentation, while others are valuable as testers, submitting patches and suggestions.

The team is comprised of Members and Contributors. Members have direct access to the source of a project and actively evolve the code-base. Contributors improve the project through submission of patches and suggestions to the Members. The number of Contributors to the project is unbounded. Get involved today. All contributions to the project are greatly appreciated.

Members

There are no developers working on this project.

Contributors

There are no contributors listed for this project. Please check back again later.

-
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/wrap-mojo.html maven-bundle-plugin-3.5.0/doc/site/wrap-mojo.html --- maven-bundle-plugin-2.5.4/doc/site/wrap-mojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/wrap-mojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,365 +0,0 @@ - - - - - - Maven Bundle Plugin - - bundle:wrap - - - - - - - - - -
- -
-
-
- - -

bundle:wrap

-

Full name:

-

org.apache.felix:maven-bundle-plugin:2.5.0:wrap

-

This plugin goal has been deprecated:

-
The wrap goal is no longer supported and may be removed in a future -release
-

Description:

-
Create OSGi bundles from the direct dependencies of the Maven -project.
-

Attributes:

-
    -
  • Requires a Maven project to be executed.
  • -
  • Requires dependency resolution of artifacts in scope: test.
  • -
  • The goal is thread-safe and supports parallel builds.
  • -
  • Binds by default to the lifecycle phase: package.
  • -
-

Required Parameters

- - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
buildDirectoryString-The directory for the generated JAR.
User property is: project.build.directory.
outputDirectoryFile-The directory for the generated bundles.
User property is: project.build.outputDirectory.
-
-

Optional Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeSinceDescription
archiveMavenArchiveConfiguration-The archive configuration to use.
classifierString-Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
depthint-Process up to some depth
dumpClasspathFile-File where the BND class-path will be dumped
User property is: dumpClasspath.
dumpInstructionsFile-File where the BND instructions will be dumped
User property is: dumpInstructions.
excludeDependenciesString-Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
User property is: excludeDependencies.
finalNameString-Final name of the bundle (without classifier or extension)
User property is: project.build.finalName.
ignoreMissingArtifactsboolean-Ignore missing artifacts that are not required by current project -but are required by the transitive dependencies.
instructionsMap-The BND instructions for the bundle.
manifestLocationFile-Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
User property is: manifestLocation.
niceManifestboolean-Output a nicely formatted manifest that still respects the 72 -character line limit.
packagingString-Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
rebuildBundleboolean-When true, generate the manifest by rebuilding the full bundle in -memory
User property is: rebuildBundle.
supportedProjectTypesList-Project types which this plugin supports.
unpackBundleboolean-When true, unpack the bundle contents to the outputDirectory
User property is: unpackBundle.
wrapImportPackageString-Import-Package to be used when wrapping dependencies.
Default value is: *.
User property is: wrapImportPackage.
-
-

Parameter Details

-

archive:

-
The archive configuration to use.
-
    -
  • Type: org.apache.maven.archiver.MavenArchiveConfiguration
  • -
  • Required: No
  • -

buildDirectory:

-
The directory for the generated JAR.
-
    -
  • Type: java.lang.String
  • -
  • Required: Yes
  • -
  • User Property: project.build.directory
  • -

classifier:

-
Classifier type of the bundle to be installed. For example, -"jdk14". Defaults to none which means this is the project's main -bundle.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

depth:

-
Process up to some depth
-
    -
  • Type: int
  • -
  • Required: No
  • -

dumpClasspath:

-
File where the BND class-path will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpClasspath
  • -

dumpInstructions:

-
File where the BND instructions will be dumped
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: dumpInstructions
  • -

excludeDependencies:

-
Comma separated list of artifactIds to exclude from the dependency -classpath passed to BND (use "true" to exclude everything)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: excludeDependencies
  • -

finalName:

-
Final name of the bundle (without classifier or extension)
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: project.build.finalName
  • -

ignoreMissingArtifacts:

-
Ignore missing artifacts that are not required by current project -but are required by the transitive dependencies.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

instructions:

-
The BND instructions for the bundle.
-
    -
  • Type: java.util.Map
  • -
  • Required: No
  • -

manifestLocation:

-
Directory where the manifest will be written
-
    -
  • Type: java.io.File
  • -
  • Required: No
  • -
  • User Property: manifestLocation
  • -
  • Default: ${project.build.outputDirectory}/META-INF
  • -

niceManifest:

-
Output a nicely formatted manifest that still respects the 72 -character line limit.
-
    -
  • Type: boolean
  • -
  • Required: No
  • -

outputDirectory:

-
The directory for the generated bundles.
-
    -
  • Type: java.io.File
  • -
  • Required: Yes
  • -
  • User Property: project.build.outputDirectory
  • -

packaging:

-
Packaging type of the bundle to be installed. For example, "jar". -Defaults to none which means use the same packaging as the project.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -

rebuildBundle:

-
When true, generate the manifest by rebuilding the full bundle in -memory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: rebuildBundle
  • -

supportedProjectTypes:

-
Project types which this plugin supports.
-
    -
  • Type: java.util.List
  • -
  • Required: No
  • -

unpackBundle:

-
When true, unpack the bundle contents to the outputDirectory
-
    -
  • Type: boolean
  • -
  • Required: No
  • -
  • User Property: unpackBundle
  • -

wrapImportPackage:

-
Import-Package to be used when wrapping dependencies.
-
    -
  • Type: java.lang.String
  • -
  • Required: No
  • -
  • User Property: wrapImportPackage
  • -
  • Default: *
  • -
-
-
- - -
-
-
-
-
- - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/allclasses-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/allclasses-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/allclasses-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/allclasses-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ - - - - - - All Classes - - - - -

All Classes

- - - - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/index.html maven-bundle-plugin-3.5.0/doc/site/xref/index.html --- maven-bundle-plugin-2.5.4/doc/site/xref/index.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/index.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference - - - - - - - - - <body> - <h1>Frame Alert</h1> - <p> - You don't have frames. Go <a href="overview-summary.html">here</a> - </p> - </body> - - - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/AbstractDependencyFilter.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/AbstractDependencyFilter.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/AbstractDependencyFilter.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/AbstractDependencyFilter.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,273 +0,0 @@ - - - - -AbstractDependencyFilter xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.util.Collection;
-23  import java.util.Iterator;
-24  import java.util.LinkedHashSet;
-25  import java.util.Map;
-26  import java.util.regex.Pattern;
-27  
-28  import org.apache.maven.artifact.Artifact;
-29  import org.apache.maven.plugin.MojoExecutionException;
-30  
-31  import aQute.bnd.osgi.Instruction;
-32  import aQute.bnd.header.OSGiHeader;
-33  
-34  
-35  /**
-36   * Apply clause-based filter over given dependencies
-37   * 
-38   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-39   */
-40  public abstract class AbstractDependencyFilter
-41  {
-42      private static final Pattern MISSING_KEY_PATTERN = Pattern.compile( "(^|,)\\p{Blank}*(!)?\\p{Blank}*([a-zA-Z]+=)" );
-43  
-44      /**
-45       * Dependency artifacts.
-46       */
-47      private final Collection m_dependencyArtifacts;
-48  
-49  
-50      public AbstractDependencyFilter( Collection dependencyArtifacts )
-51      {
-52          m_dependencyArtifacts = dependencyArtifacts;
-53      }
-54  
-55      private static abstract class DependencyFilter
-56      {
-57          private final Instruction m_instruction;
-58          private final String m_defaultValue;
-59  
-60  
-61          public DependencyFilter( String expression )
-62          {
-63              this( expression, "" );
-64          }
-65  
-66  
-67          public DependencyFilter( String expression, String defaultValue )
-68          {
-69              m_instruction = new Instruction( expression );
-70              m_defaultValue = defaultValue;
-71          }
-72  
-73  
-74          public void filter( Collection dependencies )
-75          {
-76              for ( Iterator i = dependencies.iterator(); i.hasNext(); )
-77              {
-78                  if ( false == matches( ( Artifact ) i.next() ) )
-79                  {
-80                      i.remove();
-81                  }
-82              }
-83          }
-84  
-85  
-86          abstract boolean matches( Artifact dependency );
-87  
-88  
-89          boolean matches( String text )
-90          {
-91              boolean result;
-92  
-93              if ( null == text )
-94              {
-95                  result = m_instruction.matches( m_defaultValue );
-96              }
-97              else
-98              {
-99                  result = m_instruction.matches( text );
-100             }
-101 
-102             return m_instruction.isNegated() ? !result : result;
-103         }
-104     }
-105 
-106 
-107     protected final void processInstructions( String header ) throws MojoExecutionException
-108     {
-109         Map instructions = OSGiHeader.parseHeader( MISSING_KEY_PATTERN.matcher( header ).replaceAll( "$1$2*;$3" ) );
-110 
-111         Collection availableDependencies = new LinkedHashSet( m_dependencyArtifacts );
-112 
-113         DependencyFilter filter;
-114         for ( Iterator clauseIterator = instructions.entrySet().iterator(); clauseIterator.hasNext(); )
-115         {
-116             String inline = "false";
-117 
-118             // always start with a fresh *modifiable* collection for each unique clause
-119             Collection filteredDependencies = new LinkedHashSet( availableDependencies );
-120 
-121             // CLAUSE: REGEXP --> { ATTRIBUTE MAP }
-122             Map.Entry clause = ( Map.Entry ) clauseIterator.next();
-123             String primaryKey = ( ( String ) clause.getKey() ).replaceFirst( "~+$", "" );
-124             boolean isNegative = primaryKey.startsWith( "!" );
-125             if ( isNegative )
-126             {
-127                 primaryKey = primaryKey.substring( 1 );
-128             }
-129 
-130             if ( !"*".equals( primaryKey ) )
-131             {
-132                 filter = new DependencyFilter( primaryKey )
-133                 {
-134                     boolean matches( Artifact dependency )
-135                     {
-136                         return super.matches( dependency.getArtifactId() );
-137                     }
-138                 };
-139                 // FILTER ON MAIN CLAUSE
-140                 filter.filter( filteredDependencies );
-141             }
-142 
-143             for ( Iterator attrIterator = ( ( Map ) clause.getValue() ).entrySet().iterator(); attrIterator.hasNext(); )
-144             {
-145                 // ATTRIBUTE: KEY --> REGEXP
-146                 Map.Entry attr = ( Map.Entry ) attrIterator.next();
-147                 if ( "groupId".equals( attr.getKey() ) )
-148                 {
-149                     filter = new DependencyFilter( ( String ) attr.getValue() )
-150                     {
-151                         boolean matches( Artifact dependency )
-152                         {
-153                             return super.matches( dependency.getGroupId() );
-154                         }
-155                     };
-156                 }
-157                 else if ( "artifactId".equals( attr.getKey() ) )
-158                 {
-159                     filter = new DependencyFilter( ( String ) attr.getValue() )
-160                     {
-161                         boolean matches( Artifact dependency )
-162                         {
-163                             return super.matches( dependency.getArtifactId() );
-164                         }
-165                     };
-166                 }
-167                 else if ( "version".equals( attr.getKey() ) )
-168                 {
-169                     filter = new DependencyFilter( ( String ) attr.getValue() )
-170                     {
-171                         boolean matches( Artifact dependency )
-172                         {
-173                             try
-174                             {
-175                                 // use the symbolic version if available (ie. 1.0.0-SNAPSHOT)
-176                                 return super.matches( dependency.getSelectedVersion().toString() );
-177                             }
-178                             catch ( Exception e )
-179                             {
-180                                 return super.matches( dependency.getVersion() );
-181                             }
-182                         }
-183                     };
-184                 }
-185                 else if ( "scope".equals( attr.getKey() ) )
-186                 {
-187                     filter = new DependencyFilter( ( String ) attr.getValue(), "compile" )
-188                     {
-189                         boolean matches( Artifact dependency )
-190                         {
-191                             return super.matches( dependency.getScope() );
-192                         }
-193                     };
-194                 }
-195                 else if ( "type".equals( attr.getKey() ) )
-196                 {
-197                     filter = new DependencyFilter( ( String ) attr.getValue(), "jar" )
-198                     {
-199                         boolean matches( Artifact dependency )
-200                         {
-201                             return super.matches( dependency.getType() );
-202                         }
-203                     };
-204                 }
-205                 else if ( "classifier".equals( attr.getKey() ) )
-206                 {
-207                     filter = new DependencyFilter( ( String ) attr.getValue() )
-208                     {
-209                         boolean matches( Artifact dependency )
-210                         {
-211                             return super.matches( dependency.getClassifier() );
-212                         }
-213                     };
-214                 }
-215                 else if ( "optional".equals( attr.getKey() ) )
-216                 {
-217                     filter = new DependencyFilter( ( String ) attr.getValue(), "false" )
-218                     {
-219                         boolean matches( Artifact dependency )
-220                         {
-221                             return super.matches( "" + dependency.isOptional() );
-222                         }
-223                     };
-224                 }
-225                 else if ( "inline".equals( attr.getKey() ) )
-226                 {
-227                     inline = ( String ) attr.getValue();
-228                     continue;
-229                 }
-230                 else
-231                 {
-232                     throw new MojoExecutionException( "Unexpected attribute " + attr.getKey() );
-233                 }
-234 
-235                 // FILTER ON EACH ATTRIBUTE
-236                 filter.filter( filteredDependencies );
-237             }
-238 
-239             if ( isNegative )
-240             {
-241                 // negative clauses reduce the set of available artifacts
-242                 availableDependencies.removeAll( filteredDependencies );
-243                 if ( !clauseIterator.hasNext() )
-244                 {
-245                     // assume there's an implicit * missing at the end
-246                     processDependencies( availableDependencies, inline );
-247                 }
-248             }
-249             else
-250             {
-251                 // positive clause; doesn't alter the available artifacts
-252                 processDependencies( filteredDependencies, inline );
-253             }
-254         }
-255     }
-256 
-257 
-258     protected abstract void processDependencies( Collection dependencies, String inline );
-259 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/AntPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/AntPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/AntPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/AntPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ - - - - -AntPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.FileOutputStream;
-23  import java.io.OutputStream;
-24  import java.util.Iterator;
-25  import java.util.Map;
-26  import java.util.Properties;
-27  
-28  import org.apache.maven.plugin.MojoExecutionException;
-29  import org.apache.maven.project.MavenProject;
-30  import org.codehaus.plexus.util.FileUtils;
-31  import org.codehaus.plexus.util.IOUtil;
-32  import org.codehaus.plexus.util.StringUtils;
-33  
-34  import aQute.bnd.osgi.Builder;
-35  import aQute.bnd.osgi.Jar;
-36  
-37  
-38  /**
-39   * Generate Ant script to create the bundle (you should run ant:ant first).
-40   *
-41   * @goal ant
-42   * @requiresDependencyResolution test
-43   * @description generate Ant script to create the bundle
-44   */
-45  public class AntPlugin extends BundlePlugin
-46  {
-47      static final String BUILD_XML = "/build.xml";
-48      static final String BUILD_BND = "/maven-build.bnd";
-49  
-50  
-51      protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties,
-52          Jar[] classpath ) throws MojoExecutionException
-53      {
-54          final String artifactId = getProject().getArtifactId();
-55          final String baseDir = getProject().getBasedir().getPath();
-56  
-57          try
-58          {
-59              // assemble bundle as usual, but don't save it - this way we have all the instructions we need
-60              Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties, classpath );
-61              Properties bndProperties = builder.getProperties();
-62  
-63              // cleanup and remove all non-strings from the builder properties
-64              for ( Iterator i = bndProperties.values().iterator(); i.hasNext(); )
-65              {
-66                  if ( !( i.next() instanceof String ) )
-67                  {
-68                      i.remove();
-69                  }
-70              }
-71  
-72              // save the BND generated bundle to the same output directory that maven uses
-73              bndProperties.setProperty( "-output", "${maven.build.dir}/${maven.build.finalName}.jar" );
-74  
-75              OutputStream out = new FileOutputStream( baseDir + BUILD_BND );
-76              bndProperties.store( out, " Merged BND Instructions" );
-77              IOUtil.close( out );
-78  
-79              // modify build template
-80              String buildXml = IOUtil.toString( getClass().getResourceAsStream( BUILD_XML ) );
-81              buildXml = StringUtils.replace( buildXml, "BND_VERSION", builder.getVersion() );
-82              buildXml = StringUtils.replace( buildXml, "ARTIFACT_ID", artifactId );
-83  
-84              FileUtils.fileWrite( baseDir + BUILD_XML, buildXml );
-85  
-86              // cleanup...
-87              builder.close();
-88          }
-89          catch ( Exception e )
-90          {
-91              throw new MojoExecutionException( "Problem creating Ant script", e );
-92          }
-93  
-94          getLog().info( "Wrote Ant bundle project for " + artifactId + " to " + baseDir );
-95      }
-96  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,607 +0,0 @@ - - - - -AbstractBaselinePlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin.baseline;
-20  
-21  import java.io.File;
-22  import java.io.IOException;
-23  import java.text.SimpleDateFormat;
-24  import java.util.Arrays;
-25  import java.util.Date;
-26  import java.util.Iterator;
-27  import java.util.List;
-28  import java.util.Map;
-29  import java.util.Set;
-30  
-31  import org.apache.maven.artifact.Artifact;
-32  import org.apache.maven.artifact.factory.ArtifactFactory;
-33  import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-34  import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-35  import org.apache.maven.artifact.repository.ArtifactRepository;
-36  import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-37  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-38  import org.apache.maven.artifact.resolver.ArtifactResolver;
-39  import org.apache.maven.artifact.versioning.ArtifactVersion;
-40  import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-41  import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-42  import org.apache.maven.artifact.versioning.VersionRange;
-43  import org.apache.maven.plugin.AbstractMojo;
-44  import org.apache.maven.plugin.MojoExecutionException;
-45  import org.apache.maven.plugin.MojoFailureException;
-46  import org.apache.maven.project.MavenProject;
-47  import org.codehaus.plexus.util.StringUtils;
-48  
-49  import aQute.bnd.differ.Baseline;
-50  import aQute.bnd.differ.Baseline.Info;
-51  import aQute.bnd.differ.DiffPluginImpl;
-52  import aQute.bnd.osgi.Instructions;
-53  import aQute.bnd.osgi.Jar;
-54  import aQute.bnd.osgi.Processor;
-55  import aQute.bnd.service.diff.Delta;
-56  import aQute.bnd.service.diff.Diff;
-57  import aQute.bnd.version.Version;
-58  import aQute.service.reporter.Reporter;
-59  
-60  /**
-61   * Abstract BND Baseline check between two bundles.
-62   */
-63  abstract class AbstractBaselinePlugin
-64      extends AbstractMojo
-65  {
-66  
-67      /**
-68       * Flag to easily skip execution.
-69       *
-70       * @parameter expression="${baseline.skip}" default-value="false"
-71       */
-72      protected boolean skip;
-73  
-74      /**
-75       * Whether to fail on errors.
-76       *
-77       * @parameter expression="${baseline.failOnError}" default-value="true"
-78       */
-79      protected boolean failOnError;
-80  
-81      /**
-82       * Whether to fail on warnings.
-83       *
-84       * @parameter expression="${baseline.failOnWarning}" default-value="false"
-85       */
-86      protected boolean failOnWarning;
-87  
-88      /**
-89       * @parameter expression="${project}"
-90       * @required
-91       * @readonly
-92       */
-93      protected MavenProject project;
-94  
-95      /**
-96       * @parameter expression="${project.build.directory}"
-97       * @required
-98       * @readonly
-99       */
-100     private File buildDirectory;
-101 
-102     /**
-103      * @parameter expression="${project.build.finalName}"
-104      * @required
-105      * @readonly
-106      */
-107     private String finalName;
-108 
-109     /**
-110      * @component
-111      */
-112     protected ArtifactResolver resolver;
-113 
-114     /**
-115      * @component
-116      */
-117     protected ArtifactFactory factory;
-118 
-119     /**
-120      * @parameter default-value="${localRepository}"
-121      * @required
-122      * @readonly
-123      */
-124     protected ArtifactRepository localRepository;
-125 
-126     /**
-127      * @component
-128      */
-129     private ArtifactMetadataSource metadataSource;
-130 
-131     /**
-132      * Version to compare the current code against.
-133      *
-134      * @parameter expression="${comparisonVersion}" default-value="(,${project.version})"
-135      * @required
-136      * @readonly
-137      */
-138     protected String comparisonVersion;
-139 
-140     /**
-141      * A list of packages filter, if empty the whole bundle will be traversed. Values are specified in OSGi package
-142      * instructions notation, e.g. <code>!org.apache.felix.bundleplugin</code>.
-143      *
-144      * @parameter
-145      */
-146     private String[] filters;
-147 
-148     /**
-149      * Project types which this plugin supports.
-150      *
-151      * @parameter
-152      */
-153     protected List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } );
-154 
-155     public final void execute()
-156         throws MojoExecutionException, MojoFailureException
-157     {
-158         if ( skip )
-159         {
-160             getLog().info( "Skipping Baseline execution" );
-161             return;
-162         }
-163 
-164         if ( !supportedProjectTypes.contains( project.getArtifact().getType() ) )
-165         {
-166             getLog().info("Skipping Baseline (project type " + project.getArtifact().getType() + " not supported)");
-167             return;
-168         }
-169 
-170         // get the bundles that have to be compared
-171 
-172         final Jar currentBundle = getCurrentBundle();
-173         if ( currentBundle == null )
-174         {
-175             getLog().info( "Not generating Baseline report as there is no bundle generated by the project" );
-176             return;
-177         }
-178 
-179         final Jar previousBundle = getPreviousBundle();
-180         if ( previousBundle == null )
-181         {
-182             getLog().info( "Not generating Baseline report as there is no previous version of the library to compare against" );
-183             return;
-184         }
-185 
-186         // preparing the filters
-187 
-188         final Instructions packageFilters;
-189         if ( filters == null || filters.length == 0 )
-190         {
-191             packageFilters = new Instructions();
-192         }
-193         else
-194         {
-195             packageFilters = new Instructions( Arrays.asList( filters ) );
-196         }
-197 
-198         // go!
-199 
-200         init();
-201 
-202         String generationDate = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm'Z'" ).format( new Date() );
-203         Reporter reporter = new Processor();
-204 
-205         try
-206         {
-207             Set<Info> infoSet = new Baseline( reporter, new DiffPluginImpl() )
-208                                 .baseline( currentBundle, previousBundle, packageFilters );
-209 
-210             startBaseline( generationDate, project.getArtifactId(), project.getVersion(), comparisonVersion );
-211 
-212             final Info[] infos = infoSet.toArray( new Info[infoSet.size()] );
-213             Arrays.sort( infos, new InfoComparator() );
-214 
-215             for ( Info info : infos )
-216             {
-217                 DiffMessage diffMessage = null;
-218                 Version newerVersion = info.newerVersion;
-219                 Version suggestedVersion = info.suggestedVersion;
-220 
-221                 if ( suggestedVersion != null )
-222                 {
-223                     if ( newerVersion.compareTo( suggestedVersion ) > 0 )
-224                     {
-225                         diffMessage = new DiffMessage( "Excessive version increase", DiffMessage.Type.warning );
-226                         reporter.warning( "%s: %s; detected %s, suggested %s",
-227                                           info.packageName, diffMessage, info.newerVersion, info.suggestedVersion );
-228                     }
-229                     else if ( newerVersion.compareTo( suggestedVersion ) < 0 )
-230                     {
-231                         diffMessage = new DiffMessage( "Version increase required", DiffMessage.Type.error );
-232                         reporter.error( "%s: %s; detected %s, suggested %s",
-233                                         info.packageName, diffMessage, info.newerVersion, info.suggestedVersion );
-234                     }
-235                 }
-236 
-237                 Diff packageDiff = info.packageDiff;
-238 
-239                 Delta delta = packageDiff.getDelta();
-240 
-241                 switch ( delta )
-242                 {
-243                     case UNCHANGED:
-244                         if ( ( suggestedVersion.getMajor() != newerVersion.getMajor() )
-245                             || ( suggestedVersion.getMicro() != newerVersion.getMicro() )
-246                             || ( suggestedVersion.getMinor() != newerVersion.getMinor() ) )
-247                         {
-248                             diffMessage = new DiffMessage( "Version has been increased but analysis detected no changes", DiffMessage.Type.warning );
-249                             reporter.warning( "%s: %s; detected %s, suggested %s",
-250                                               info.packageName, diffMessage, info.newerVersion, info.suggestedVersion );
-251                         }
-252                         break;
-253 
-254                     case REMOVED:
-255                         diffMessage = new DiffMessage( "Package removed", DiffMessage.Type.info );
-256                         reporter.trace( "%s: %s ", info.packageName, diffMessage );
-257                         break;
-258 
-259                     case CHANGED:
-260                     case MICRO:
-261                     case MINOR:
-262                     case MAJOR:
-263                     case ADDED:
-264                     default:
-265                         // ok
-266                         break;
-267                 }
-268 
-269                 boolean mismatch = info.mismatch;
-270                 String packageName = info.packageName;
-271                 String shortDelta = getShortDelta( info.packageDiff.getDelta() );
-272                 String deltaString = StringUtils.lowerCase( String.valueOf( info.packageDiff.getDelta() ) );
-273                 String newerVersionString = String.valueOf( info.newerVersion );
-274                 String olderVersionString = String.valueOf( info.olderVersion );
-275                 String suggestedVersionString = String.valueOf( ( info.suggestedVersion == null ) ? "-" : info.suggestedVersion );
-276                 Map<String,String> attributes = info.attributes;
-277 
-278                 startPackage( mismatch,
-279                               packageName,
-280                               shortDelta,
-281                               deltaString,
-282                               newerVersionString,
-283                               olderVersionString,
-284                               suggestedVersionString,
-285                               diffMessage,
-286                               attributes );
-287 
-288                 if ( Delta.REMOVED != delta )
-289                 {
-290                     doPackageDiff( packageDiff );
-291                 }
-292 
-293                 endPackage();
-294             }
-295 
-296             endBaseline();
-297         }
-298         catch ( Exception e )
-299         {
-300             throw new MojoExecutionException( "Impossible to calculate the baseline", e );
-301         }
-302         finally
-303         {
-304             closeJars( currentBundle, previousBundle );
-305         }
-306 
-307         // check if it has to fail if some error has been detected
-308 
-309         boolean fail = false;
-310 
-311         if ( !reporter.isOk() )
-312         {
-313             for ( String errorMessage : reporter.getErrors() )
-314             {
-315                 getLog().error( errorMessage );
-316             }
-317 
-318             if ( failOnError )
-319             {
-320                 fail = true;
-321             }
-322         }
-323 
-324         // check if it has to fail if some warning has been detected
-325 
-326         if ( !reporter.getWarnings().isEmpty() )
-327         {
-328             for ( String warningMessage : reporter.getWarnings() )
-329             {
-330                 getLog().warn( warningMessage );
-331             }
-332 
-333             if ( failOnWarning )
-334             {
-335                 fail = true;
-336             }
-337         }
-338 
-339         getLog().info( String.format( "Baseline analisys complete, %s error(s), %s warning(s)",
-340                                       reporter.getErrors().size(),
-341                                       reporter.getWarnings().size() ) );
-342 
-343         if ( fail )
-344         {
-345             throw new MojoFailureException( "Baseline failed, see generated report" );
-346         }
-347     }
-348 
-349     private void doPackageDiff( Diff diff )
-350     {
-351         int depth = 1;
-352 
-353         for ( Diff curDiff : diff.getChildren() )
-354         {
-355             if ( Delta.UNCHANGED != curDiff.getDelta() )
-356             {
-357                 doDiff( curDiff, depth );
-358             }
-359         }
-360     }
-361 
-362     private void doDiff( Diff diff, int depth )
-363     {
-364         String type = StringUtils.lowerCase( String.valueOf( diff.getType() ) );
-365         String shortDelta = getShortDelta( diff.getDelta() );
-366         String delta = StringUtils.lowerCase( String.valueOf( diff.getDelta() ) );
-367         String name = diff.getName();
-368 
-369         startDiff( depth, type, name, delta, shortDelta );
-370 
-371         for ( Diff curDiff : diff.getChildren() )
-372         {
-373             if ( Delta.UNCHANGED != curDiff.getDelta() )
-374             {
-375                 doDiff( curDiff, depth + 1 );
-376             }
-377         }
-378 
-379         endDiff( depth );
-380     }
-381 
-382     // extensions APIs
-383 
-384     protected abstract void init();
-385 
-386     protected abstract void startBaseline( String generationDate, String bundleName, String currentVersion, String previousVersion );
-387 
-388     protected abstract void startPackage( boolean mismatch,
-389                                           String name,
-390                                           String shortDelta,
-391                                           String delta,
-392                                           String newerVersion,
-393                                           String olderVersion,
-394                                           String suggestedVersion,
-395                                           DiffMessage diffMessage,
-396                                           Map<String,String> attributes );
-397 
-398     protected abstract void startDiff( int depth,
-399                                        String type,
-400                                        String name,
-401                                        String delta,
-402                                        String shortDelta );
-403 
-404     protected abstract void endDiff( int depth );
-405 
-406     protected abstract void endPackage();
-407 
-408     protected abstract void endBaseline();
-409 
-410     // internals
-411 
-412     private Jar getCurrentBundle()
-413         throws MojoExecutionException
-414     {
-415         /*
-416          * Resolving the aQute.bnd.osgi.Jar via the produced artifact rather than what is produced in the target/classes
-417          * directory would make the Mojo working also in projects where the bundle-plugin is used just to generate the
-418          * manifest file and the final jar is assembled via the jar-plugin
-419          */
-420         File currentBundle = new File( buildDirectory, getBundleName() );
-421         if ( !currentBundle.exists() )
-422         {
-423             getLog().debug( "Produced bundle not found: " + currentBundle );
-424             return null;
-425         }
-426 
-427         return openJar( currentBundle );
-428     }
-429 
-430     private Jar getPreviousBundle()
-431         throws MojoFailureException, MojoExecutionException
-432     {
-433         // Find the previous version JAR and resolve it, and it's dependencies
-434         final VersionRange range;
-435         try
-436         {
-437             range = VersionRange.createFromVersionSpec( comparisonVersion );
-438         }
-439         catch ( InvalidVersionSpecificationException e )
-440         {
-441             throw new MojoFailureException( "Invalid comparison version: " + e.getMessage() );
-442         }
-443 
-444         final Artifact previousArtifact;
-445         try
-446         {
-447             previousArtifact =
-448                 factory.createDependencyArtifact( project.getGroupId(),
-449                                                   project.getArtifactId(),
-450                                                   range,
-451                                                   project.getPackaging(),
-452                                                   null,
-453                                                   Artifact.SCOPE_COMPILE );
-454 
-455             if ( !previousArtifact.getVersionRange().isSelectedVersionKnown( previousArtifact ) )
-456             {
-457                 getLog().debug( "Searching for versions in range: " + previousArtifact.getVersionRange() );
-458                 @SuppressWarnings( "unchecked" )
-459                 // type is konwn
-460                 List<ArtifactVersion> availableVersions =
-461                     metadataSource.retrieveAvailableVersions( previousArtifact, localRepository,
-462                                                               project.getRemoteArtifactRepositories() );
-463                 filterSnapshots( availableVersions );
-464                 ArtifactVersion version = range.matchVersion( availableVersions );
-465                 if ( version != null )
-466                 {
-467                     previousArtifact.selectVersion( version.toString() );
-468                 }
-469             }
-470         }
-471         catch ( OverConstrainedVersionException ocve )
-472         {
-473             throw new MojoFailureException( "Invalid comparison version: " + ocve.getMessage() );
-474         }
-475         catch ( ArtifactMetadataRetrievalException amre )
-476         {
-477             throw new MojoExecutionException( "Error determining previous version: " + amre.getMessage(), amre );
-478         }
-479 
-480         if ( previousArtifact.getVersion() == null )
-481         {
-482             getLog().info( "Unable to find a previous version of the project in the repository" );
-483             return null;
-484         }
-485 
-486         try
-487         {
-488             resolver.resolve( previousArtifact, project.getRemoteArtifactRepositories(), localRepository );
-489         }
-490         catch ( ArtifactResolutionException are )
-491         {
-492             throw new MojoExecutionException( "Artifact " + previousArtifact + " cannot be resolved", are );
-493         }
-494         catch ( ArtifactNotFoundException anfe )
-495         {
-496             throw new MojoExecutionException( "Artifact " + previousArtifact
-497                 + " does not exist on local/remote repositories", anfe );
-498         }
-499 
-500         return openJar( previousArtifact.getFile() );
-501     }
-502 
-503     private void filterSnapshots( List<ArtifactVersion> versions )
-504     {
-505         for ( Iterator<ArtifactVersion> versionIterator = versions.iterator(); versionIterator.hasNext(); )
-506         {
-507             ArtifactVersion version = versionIterator.next();
-508             if ( "SNAPSHOT".equals( version.getQualifier() ) )
-509             {
-510                 versionIterator.remove();
-511             }
-512         }
-513     }
-514 
-515     private static Jar openJar( File file )
-516         throws MojoExecutionException
-517     {
-518         try
-519         {
-520             return new Jar( file );
-521         }
-522         catch ( IOException e )
-523         {
-524             throw new MojoExecutionException( "An error occurred while opening JAR directory: " + file, e );
-525         }
-526     }
-527 
-528     private static void closeJars( Jar...jars )
-529     {
-530         for ( Jar jar : jars )
-531         {
-532             jar.close();
-533         }
-534     }
-535 
-536     private String getBundleName()
-537     {
-538         String extension;
-539         try
-540         {
-541             extension = project.getArtifact().getArtifactHandler().getExtension();
-542         }
-543         catch ( Throwable e )
-544         {
-545             extension = project.getArtifact().getType();
-546         }
-547 
-548         if ( StringUtils.isEmpty( extension ) || "bundle".equals( extension ) || "pom".equals( extension ) )
-549         {
-550             extension = "jar"; // just in case maven gets confused
-551         }
-552 
-553         String classifier = project.getArtifact().getClassifier();
-554         if ( null != classifier && classifier.trim().length() > 0 )
-555         {
-556             return finalName + '-' + classifier + '.' + extension;
-557         }
-558 
-559         return finalName + '.' + extension;
-560     }
-561 
-562     private static String getShortDelta( Delta delta )
-563     {
-564         switch ( delta )
-565         {
-566             case ADDED:
-567                 return "+";
-568 
-569             case CHANGED:
-570                 return "~";
-571 
-572             case MAJOR:
-573                 return ">";
-574 
-575             case MICRO:
-576                 return "0xB5";
-577 
-578             case MINOR:
-579                 return "<";
-580 
-581             case REMOVED:
-582                 return "-";
-583 
-584             case UNCHANGED:
-585                 return " ";
-586 
-587             default:
-588                 String deltaString = delta.toString();
-589                 return String.valueOf( deltaString.charAt( 0 ) );
-590         }
-591     }
-592 
-593 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselinePlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselinePlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselinePlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselinePlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,271 +0,0 @@ - - - - -BaselinePlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin.baseline;
-20  
-21  import java.io.File;
-22  import java.io.FileWriter;
-23  import java.io.IOException;
-24  import java.util.Map;
-25  import java.util.Map.Entry;
-26  
-27  import org.codehaus.plexus.util.IOUtil;
-28  import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
-29  
-30  /**
-31   * BND Baseline check between two bundles.
-32   *
-33   * @goal baseline
-34   * @phase verify
-35   * @threadSafe true
-36   * @since 2.4.1
-37   */
-38  public final class BaselinePlugin
-39      extends AbstractBaselinePlugin
-40  {
-41  
-42      private static final String TABLE_PATTERN = "%s %-50s %-10s %-10s %-10s %-10s %-10s";
-43  
-44      /**
-45       * An XML output file to render to <code>${project.build.directory}/baseline.xml</code>.
-46       *
-47       * @parameter expression="${project.build.directory}/baseline.xml"
-48       */
-49      private File xmlOutputFile;
-50  
-51      /**
-52       * Whether to log the results to the console or not, true by default.
-53       *
-54       * @parameter expression="${logResults}" default-value="true"
-55       */
-56      private boolean logResults;
-57  
-58      private FileWriter xmlFileWriter;
-59  
-60      private PrettyPrintXMLWriter xmlWriter;
-61  
-62      protected void init()
-63      {
-64          if ( xmlOutputFile != null )
-65          {
-66              xmlOutputFile.getParentFile().mkdirs();
-67              try
-68              {
-69                  xmlFileWriter = new FileWriter( xmlOutputFile );
-70                  xmlWriter = new PrettyPrintXMLWriter( xmlFileWriter );
-71              }
-72              catch ( IOException e )
-73              {
-74                  getLog().warn( "No XML report will be produced, cannot write data to " + xmlOutputFile, e );
-75              }
-76          }
-77      }
-78  
-79      protected void startBaseline( String generationDate,
-80                                    String bundleName,
-81                                    String currentVersion,
-82                                    String previousVersion )
-83      {
-84          if ( isLoggingResults() )
-85          {
-86              log( "Baseline Report - Generated by Apache Felix Maven Bundle Plugin on %s based on Bnd - see http://www.aqute.biz/Bnd/Bnd",
-87                   generationDate );
-88              log( "Comparing bundle %s version %s to version %s", bundleName, currentVersion, previousVersion );
-89              log( "" );
-90              log( TABLE_PATTERN,
-91                   " ",
-92                   "PACKAGE_NAME",
-93                   "DELTA",
-94                   "CUR_VER",
-95                   "BASE_VER",
-96                   "REC_VER",
-97                   "WARNINGS",
-98                   "ATTRIBUTES" );
-99              log( TABLE_PATTERN,
-100                  "=",
-101                  "==================================================",
-102                  "==========",
-103                  "==========",
-104                  "==========",
-105                  "==========",
-106                  "==========",
-107                  "==========" );
-108         }
-109 
-110         if ( isProducingXml() )
-111         {
-112             xmlWriter.startElement( "baseline" );
-113             xmlWriter.addAttribute( "version", "1.0.0" );
-114             xmlWriter.addAttribute( "vendor", "The Apache Software Foundation" );
-115             xmlWriter.addAttribute( "vendorURL", "http://www.apache.org/" );
-116             xmlWriter.addAttribute( "generator", "Apache Felix Maven Bundle Plugin" );
-117             xmlWriter.addAttribute( "generatorURL", "http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html" );
-118             xmlWriter.addAttribute( "analyzer", "Bnd" );
-119             xmlWriter.addAttribute( "analyzerURL", "http://www.aqute.biz/Bnd/Bnd" );
-120             xmlWriter.addAttribute( "generatedOn", generationDate );
-121             xmlWriter.addAttribute( "bundleName", bundleName );
-122             xmlWriter.addAttribute( "currentVersion", currentVersion );
-123             xmlWriter.addAttribute( "previousVersion", previousVersion );
-124         }
-125     }
-126 
-127     protected void startPackage( boolean mismatch,
-128                                  String name,
-129                                  String shortDelta,
-130                                  String delta,
-131                                  String newerVersion,
-132                                  String olderVersion,
-133                                  String suggestedVersion,
-134                                  DiffMessage diffMessage,
-135                                  Map<String,String> attributes )
-136     {
-137         if ( isLoggingResults() )
-138         {
-139             log( TABLE_PATTERN,
-140                  mismatch ? '*' : shortDelta,
-141                  name,
-142                  delta,
-143                  newerVersion,
-144                  olderVersion,
-145                  suggestedVersion,
-146                  diffMessage != null ? diffMessage : '-',
-147                  attributes );
-148         }
-149 
-150         if ( isProducingXml() )
-151         {
-152             xmlWriter.startElement( "package" );
-153             xmlWriter.addAttribute( "name", name );
-154             xmlWriter.addAttribute( "delta", delta );
-155             simpleElement( "mismatch", String.valueOf( mismatch ) );
-156             simpleElement( "newerVersion", newerVersion );
-157             simpleElement( "olderVersion", olderVersion );
-158             simpleElement( "suggestedVersion", suggestedVersion );
-159 
-160             if ( diffMessage != null )
-161             {
-162                 simpleElement( diffMessage.getType().name(), diffMessage.getMessage() );
-163             }
-164 
-165             xmlWriter.startElement( "attributes" );
-166             if (attributes != null)
-167             {
-168                 for (Entry<String, String> attribute : attributes.entrySet())
-169                 {
-170                     String attributeName = attribute.getKey();
-171                     if (':' == attributeName.charAt(attributeName.length() - 1))
-172                     {
-173                         attributeName = attributeName.substring(0, attributeName.length() - 1);
-174                     }
-175                     String attributeValue = attribute.getValue();
-176 
-177                     xmlWriter.startElement(attributeName);
-178                     xmlWriter.writeText(attributeValue);
-179                     xmlWriter.endElement();
-180                 }
-181             }
-182             xmlWriter.endElement();
-183         }
-184     }
-185 
-186     protected void startDiff( int depth, String type, String name, String delta, String shortDelta )
-187     {
-188         if ( isLoggingResults() )
-189         {
-190             log( "%-" + (depth * 4) + "s %s %s %s",
-191                  "",
-192                  shortDelta,
-193                  type,
-194                  name );
-195         }
-196 
-197         if ( isProducingXml() )
-198         {
-199             xmlWriter.startElement( type );
-200             xmlWriter.addAttribute( "name", name );
-201             xmlWriter.addAttribute( "delta", delta );
-202         }
-203     }
-204 
-205     protected void endDiff( int depth )
-206     {
-207         if ( isProducingXml() )
-208         {
-209             xmlWriter.endElement();
-210         }
-211     }
-212 
-213     protected void endPackage()
-214     {
-215         if ( isLoggingResults() )
-216         {
-217             log( "-----------------------------------------------------------------------------------------------------------" );
-218         }
-219 
-220         if ( isProducingXml() )
-221         {
-222             xmlWriter.endElement();
-223         }
-224     }
-225 
-226     protected void endBaseline()
-227     {
-228         if ( xmlWriter != null )
-229         {
-230             xmlWriter.endElement();
-231             IOUtil.close( xmlFileWriter );
-232         }
-233     }
-234 
-235     private boolean isProducingXml()
-236     {
-237         return xmlFileWriter!= null && xmlWriter != null;
-238     }
-239 
-240     private boolean isLoggingResults()
-241     {
-242         return logResults && getLog().isInfoEnabled();
-243     }
-244 
-245     private void log( String format, Object...args )
-246     {
-247         getLog().info( String.format( format, args ) );
-248     }
-249 
-250     private void simpleElement( String name, String value )
-251     {
-252         xmlWriter.startElement( name );
-253         xmlWriter.writeText( value );
-254         xmlWriter.endElement();
-255     }
-256 
-257 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselineReport.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselineReport.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselineReport.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/BaselineReport.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,360 +0,0 @@ - - - - -BaselineReport xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin.baseline;
-20  
-21  import java.io.File;
-22  import java.io.FileOutputStream;
-23  import java.io.IOException;
-24  import java.io.InputStream;
-25  import java.io.OutputStream;
-26  import java.util.Locale;
-27  import java.util.Map;
-28  import java.util.ResourceBundle;
-29  
-30  import org.apache.maven.doxia.sink.Sink;
-31  import org.apache.maven.reporting.MavenReport;
-32  import org.apache.maven.reporting.MavenReportException;
-33  import org.codehaus.plexus.util.IOUtil;
-34  
-35  /**
-36   * BND Baseline report.
-37   *
-38   * @goal baseline-report
-39   * @phase site
-40   * @threadSafe true
-41   * @since 2.4.1
-42   */
-43  public final class BaselineReport
-44      extends AbstractBaselinePlugin
-45      implements MavenReport
-46  {
-47  
-48      /**
-49       * Specifies the directory where the report will be generated.
-50       *
-51       * @parameter default-value="${project.reporting.outputDirectory}"
-52       * @required
-53       */
-54      private File outputDirectory;
-55  
-56      private Sink sink;
-57  
-58      private Locale locale;
-59  
-60      private int currentDepth = 0;
-61  
-62      // AbstractBaselinePlugin events
-63  
-64      @Override
-65      protected void init()
-66      {
-67          failOnError = false;
-68          failOnWarning = false;
-69  
-70          final File baselineImagesDirectory = new File( outputDirectory, "images/baseline" );
-71          baselineImagesDirectory.mkdirs();
-72  
-73          for ( String resourceName : new String[]{ "access.gif",
-74                                                    "annotated.gif",
-75                                                    "annotation.gif",
-76                                                    "bundle.gif",
-77                                                    "class.gif",
-78                                                    "constant.gif",
-79                                                    "enum.gif",
-80                                                    "error.gif",
-81                                                    "extends.gif",
-82                                                    "field.gif",
-83                                                    "implements.gif",
-84                                                    "info.gif",
-85                                                    "interface.gif",
-86                                                    "method.gif",
-87                                                    "package.gif",
-88                                                    "resource.gif",
-89                                                    "return.gif",
-90                                                    "version.gif",
-91                                                    "warning.gif" } )
-92          {
-93              InputStream source = getClass().getResourceAsStream( resourceName );
-94              OutputStream target = null;
-95              File targetFile = new File( baselineImagesDirectory, resourceName );
-96  
-97              try
-98              {
-99                  target = new FileOutputStream( targetFile );
-100                 IOUtil.copy( source, target );
-101             }
-102             catch ( IOException e )
-103             {
-104                 getLog().warn( "Impossible to copy " + resourceName + " image, maybe the site won't be properly rendered." );
-105             }
-106             finally
-107             {
-108                 IOUtil.close( source );
-109                 IOUtil.close( target );
-110             }
-111         }
-112     }
-113 
-114     protected void startBaseline( String generationDate, String bundleName, String currentVersion, String previousVersion )
-115     {
-116         sink.head();
-117         sink.title();
-118 
-119         String title = getBundle( locale ).getString( "report.baseline.title" );
-120         sink.text( title );
-121         sink.title_();
-122         sink.head_();
-123 
-124         sink.body();
-125 
-126         sink.section1();
-127         sink.sectionTitle1();
-128         sink.text( title );
-129         sink.sectionTitle1_();
-130 
-131         sink.paragraph();
-132         sink.text( getBundle( locale ).getString( "report.baseline.bndlink" ) + " " );
-133         sink.link( "http://www.aqute.biz/Bnd/Bnd" );
-134         sink.text( "Bnd" );
-135         sink.link_();
-136         sink.text( "." );
-137         sink.paragraph_();
-138 
-139         sink.paragraph();
-140         sink.text( getBundle( locale ).getString( "report.baseline.bundle" ) + " " );
-141         sink.figure();
-142         sink.figureGraphics( "images/baseline/bundle.gif" );
-143         sink.figure_();
-144         sink.text( " " );
-145         sink.bold();
-146         sink.text( bundleName );
-147         sink.bold_();
-148         sink.listItem_();
-149 
-150         sink.paragraph();
-151         sink.text( getBundle( locale ).getString( "report.baseline.version.current" ) + " " );
-152         sink.bold();
-153         sink.text( currentVersion );
-154         sink.bold_();
-155         sink.paragraph_();
-156 
-157         sink.paragraph();
-158         sink.text( getBundle( locale ).getString( "report.baseline.version.comparison" ) + " " );
-159         sink.bold();
-160         sink.text( comparisonVersion );
-161         sink.bold_();
-162         sink.paragraph_();
-163 
-164         sink.paragraph();
-165         sink.text( getBundle( locale ).getString( "report.baseline.generationdate" ) + " " );
-166         sink.bold();
-167         sink.text( generationDate );
-168         sink.bold_();
-169         sink.paragraph_();
-170 
-171         sink.section1_();
-172     }
-173 
-174     protected void startPackage( boolean mismatch,
-175                                  String packageName,
-176                                  String shortDelta,
-177                                  String delta,
-178                                  String newerVersion,
-179                                  String olderVersion,
-180                                  String suggestedVersion,
-181                                  DiffMessage diffMessage,
-182                                  Map<String,String> attributes )
-183     {
-184         sink.list();
-185 
-186         sink.listItem();
-187 
-188         sink.figure();
-189         sink.figureGraphics( "./images/baseline/package.gif" );
-190         sink.figure_();
-191         sink.text( " " );
-192         sink.monospaced();
-193         sink.text( packageName );
-194         sink.monospaced_();
-195 
-196         if ( diffMessage != null )
-197         {
-198             sink.text( " " );
-199             sink.figure();
-200             sink.figureGraphics( "./images/baseline/" + diffMessage.getType().name() + ".gif" );
-201             sink.figure_();
-202             sink.text( " " );
-203             sink.italic();
-204             sink.text( diffMessage.getMessage() );
-205             sink.italic_();
-206             sink.text( " (newer version: " );
-207             sink.monospaced();
-208             sink.text( newerVersion );
-209             sink.monospaced_();
-210             sink.text( ", older version: " );
-211             sink.monospaced();
-212             sink.text( olderVersion );
-213             sink.monospaced_();
-214             sink.text( ", suggested version: " );
-215             sink.monospaced();
-216             sink.text( suggestedVersion );
-217             sink.monospaced_();
-218             sink.text( ")" );
-219         }
-220     }
-221 
-222     protected void startDiff( int depth,
-223                               String type,
-224                               String name,
-225                               String delta,
-226                               String shortDelta )
-227     {
-228         if ( currentDepth < depth )
-229         {
-230             sink.list();
-231         }
-232 
-233         currentDepth = depth;
-234 
-235         sink.listItem();
-236         sink.figure();
-237         sink.figureGraphics( "images/baseline/" + type + ".gif" );
-238         sink.figure_();
-239         sink.text( " " );
-240 
-241         sink.monospaced();
-242         sink.text( name );
-243         sink.monospaced_();
-244 
-245         sink.text( " " );
-246 
-247         sink.italic();
-248         sink.text( delta );
-249         sink.italic_();
-250     }
-251 
-252     protected void endDiff( int depth )
-253     {
-254         sink.listItem_();
-255 
-256         if ( currentDepth > depth )
-257         {
-258             sink.list_();
-259         }
-260 
-261         currentDepth = depth;
-262     }
-263 
-264     protected void endPackage()
-265     {
-266         if ( currentDepth > 0 )
-267         {
-268             sink.list_();
-269             currentDepth = 0;
-270         }
-271 
-272         sink.listItem_();
-273         sink.list_();
-274     }
-275 
-276     protected void endBaseline()
-277     {
-278         sink.body_();
-279         sink.flush();
-280         sink.close();
-281     }
-282 
-283     // MavenReport methods
-284 
-285     public boolean canGenerateReport()
-286     {
-287         return !skip && outputDirectory != null;
-288     }
-289 
-290     public void generate( @SuppressWarnings( "deprecation" ) org.codehaus.doxia.sink.Sink sink, Locale locale )
-291         throws MavenReportException
-292     {
-293         this.sink = sink;
-294         this.locale = locale;
-295 
-296         try
-297         {
-298             execute();
-299         }
-300         catch ( Exception e )
-301         {
-302             getLog().warn( "An error occurred while producing the report page, see nested exceptions", e );
-303         }
-304     }
-305 
-306     public String getCategoryName()
-307     {
-308         return MavenReport.CATEGORY_PROJECT_REPORTS;
-309     }
-310 
-311     public String getDescription( Locale locale )
-312     {
-313         return getBundle( locale ).getString( "report.baseline.description" );
-314     }
-315 
-316     public String getName( Locale locale )
-317     {
-318         return getBundle( locale ).getString( "report.baseline.name" );
-319     }
-320 
-321     private ResourceBundle getBundle( Locale locale )
-322     {
-323         return ResourceBundle.getBundle( "baseline-report", locale, getClass().getClassLoader() );
-324     }
-325 
-326     public String getOutputName()
-327     {
-328         return "baseline-report";
-329     }
-330 
-331     public File getReportOutputDirectory()
-332     {
-333         return outputDirectory;
-334     }
-335 
-336     public boolean isExternalReport()
-337     {
-338         return false;
-339     }
-340 
-341     public void setReportOutputDirectory( File outputDirectory )
-342     {
-343         this.outputDirectory = outputDirectory;
-344     }
-345 
-346 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/DiffMessage.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/DiffMessage.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/DiffMessage.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/DiffMessage.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ - - - - -DiffMessage xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin.baseline;
-20  
-21  final class DiffMessage
-22  {
-23  
-24      public enum Type { error, warning, info };
-25  
-26      private final String message;
-27  
-28      private final Type type;
-29  
-30      public DiffMessage( String message, Type type )
-31      {
-32          this.message = message;
-33          this.type = type;
-34      }
-35  
-36      public String getMessage()
-37      {
-38          return message;
-39      }
-40  
-41      public Type getType()
-42      {
-43          return type;
-44      }
-45  
-46      @Override
-47      public String toString()
-48      {
-49          return message;
-50      }
-51  
-52  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/InfoComparator.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/InfoComparator.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/InfoComparator.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/InfoComparator.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ - - - - -InfoComparator xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin.baseline;
-20  
-21  import java.util.Comparator;
-22  
-23  import aQute.bnd.differ.Baseline.Info;
-24  
-25  final class InfoComparator
-26      implements Comparator<Info>
-27  {
-28  
-29      public int compare( Info info1, Info info2 )
-30      {
-31          return info1.packageName.compareTo( info2.packageName );
-32      }
-33  
-34  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.bundleplugin.baseline - - - - -

- org.apache.felix.bundleplugin.baseline -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/baseline/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.bundleplugin.baseline - - - -
- -
-
- -
- -

Package org.apache.felix.bundleplugin.baseline

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class Summary
- AbstractBaselinePlugin -
- BaselinePlugin -
- BaselineReport -
- DiffMessage -
- InfoComparator -
- Type -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BlueprintPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BlueprintPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BlueprintPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BlueprintPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,410 +0,0 @@ - - - - -BlueprintPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.BufferedReader;
-23  import java.io.ByteArrayInputStream;
-24  import java.io.ByteArrayOutputStream;
-25  import java.io.IOException;
-26  import java.io.InputStream;
-27  import java.io.InputStreamReader;
-28  import java.net.URL;
-29  import java.util.ArrayList;
-30  import java.util.Arrays;
-31  import java.util.HashSet;
-32  import java.util.Iterator;
-33  import java.util.LinkedHashMap;
-34  import java.util.List;
-35  import java.util.Map;
-36  import java.util.Set;
-37  import java.util.TreeSet;
-38  import java.util.regex.Pattern;
-39  
-40  import javax.xml.transform.Transformer;
-41  import javax.xml.transform.TransformerFactory;
-42  import javax.xml.transform.stream.StreamResult;
-43  import javax.xml.transform.stream.StreamSource;
-44  
-45  import aQute.bnd.header.Attrs;
-46  import aQute.bnd.service.AnalyzerPlugin;
-47  import aQute.bnd.osgi.Analyzer;
-48  import aQute.bnd.osgi.Descriptors.PackageRef;
-49  import aQute.bnd.osgi.Jar;
-50  import aQute.bnd.osgi.Processor;
-51  import aQute.bnd.osgi.Resource;
-52  import aQute.libg.generics.Create;
-53  import aQute.libg.qtokens.QuotedTokenizer;
-54  import aQute.service.reporter.Reporter;
-55  import org.apache.felix.utils.manifest.Attribute;
-56  import org.apache.felix.utils.manifest.Clause;
-57  import org.apache.felix.utils.manifest.Directive;
-58  import org.osgi.framework.Constants;
-59  
-60  import static org.apache.felix.utils.manifest.Parser.parseHeader;
-61  
-62  
-63  public class BlueprintPlugin implements AnalyzerPlugin
-64  {
-65  
-66      static Pattern QN = Pattern.compile( "[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*" );
-67      static Pattern PATHS = Pattern.compile( ".*\\.xml" );
-68  
-69      Transformer transformer;
-70  
-71  
-72      public BlueprintPlugin() throws Exception
-73      {
-74          transformer = getTransformer( getClass().getResource( "blueprint.xsl" ) );
-75      }
-76  
-77  
-78      public boolean analyzeJar( Analyzer analyzer ) throws Exception
-79      {
-80          String mode = analyzer.getProperty("service_mode");
-81          if (mode == null) {
-82              mode = "service";
-83          }
-84  
-85          transformer.setParameter( "nsh_interface",
-86              analyzer.getProperty( "nsh_interface" ) != null ? analyzer.getProperty( "nsh_interface" ) : "" );
-87          transformer.setParameter( "nsh_namespace",
-88              analyzer.getProperty( "nsh_namespace" ) != null ? analyzer.getProperty( "nsh_namespace" ) : "" );
-89  
-90          Set<String> headers = Create.set();
-91  
-92          String bpHeader = analyzer.getProperty( "Bundle-Blueprint", "OSGI-INF/blueprint" );
-93          Map<String, ? extends Map<String, String>> map = Processor.parseHeader( bpHeader, null );
-94  		bpHeader = "";
-95          for ( String root : map.keySet() )
-96          {
-97              Jar jar = analyzer.getJar();
-98              Map<String, Resource> dir = jar.getDirectories().get( root );
-99              if ( dir == null || dir.isEmpty() )
-100             {
-101                 Resource resource = jar.getResource( root );
-102                 if ( resource != null ) 
-103 				{
-104                     process( analyzer, root, resource, headers );
-105 					if (bpHeader.length() > 0) {
-106 						bpHeader += ",";
-107 					}
-108 					bpHeader += root;
-109 				}
-110                 continue;
-111             }
-112             for ( Map.Entry<String, Resource> entry : dir.entrySet() )
-113             {
-114                 String path = entry.getKey();
-115                 Resource resource = entry.getValue();
-116                 if ( PATHS.matcher( path ).matches() ) 
-117 				{
-118                     process( analyzer, path, resource, headers );
-119 					if (bpHeader.length() > 0) {
-120 						bpHeader += ",";
-121 					}
-122 					bpHeader += path;
-123 				}
-124             }
-125         }
-126 		if( !map.isEmpty() ) 
-127 		{
-128 			analyzer.setProperty("Bundle-Blueprint", bpHeader);
-129 		}
-130 
-131         // Group and analyze
-132         Set<String> caps = Create.set();
-133         Set<String> reqs = Create.set();
-134         Map<String, Set<Clause>> hdrs = Create.map();
-135         for ( String str : headers )
-136         {
-137             int idx = str.indexOf( ':' );
-138             if ( idx < 0 )
-139             {
-140                 analyzer.warning( ( new StringBuilder( "Error analyzing services in blueprint resource: " ) ).append(
-141                     str ).toString() );
-142                 continue;
-143             }
-144             String h = str.substring( 0, idx ).trim();
-145             String v = str.substring( idx + 1 ).trim();
-146             Clause[] hc = parseHeader(v);
-147             // Convert generic caps/reqs
-148             if ("Import-Service".equals(h))
-149             {
-150                 if (!"service".equals(mode))
-151                 {
-152                     Clause clause = hc[0];
-153                     String multiple = clause.getDirective("multiple");
-154                     String avail = clause.getDirective("availability");
-155                     String filter = clause.getAttribute("filter");
-156 
-157                     StringBuilder sb = new StringBuilder();
-158                     sb.append("osgi.service;effective:=active;");
-159                     if ("optional".equals(avail)) {
-160                         sb.append("resolution:=optional;");
-161                     }
-162                     if ("true".equals(multiple)) {
-163                         sb.append("cardinality:=multiple;");
-164                     }
-165                     if (filter == null) {
-166                         filter = "(" + Constants.OBJECTCLASS + "=" + clause.getName() + ")";
-167                     } else if (!filter.startsWith("(") && !filter.endsWith(")")) {
-168                         filter = "(&(" + Constants.OBJECTCLASS + "=" + clause.getName() + ")(" + filter + "))";
-169                     } else {
-170                         filter = "(&(" + Constants.OBJECTCLASS + "=" + clause.getName() + ")" + filter + ")";
-171                     }
-172                     sb.append("filter:=\"").append(filter).append("\"");
-173                     reqs.add(sb.toString());
-174                 }
-175                 else if (!"generic".equals(mode))
-176                 {
-177                     Set<Clause> clauses = hdrs.get(h);
-178                     if (clauses == null) {
-179                         clauses = new HashSet<Clause>();
-180                         hdrs.put(h, clauses);
-181                     }
-182                     clauses.addAll(Arrays.asList(hc));
-183                 }
-184             }
-185             else if ("Export-Service".equals(h))
-186             {
-187                 if (!"service".equals(mode))
-188                 {
-189                     StringBuilder sb = new StringBuilder();
-190                     sb.append("osgi.service;effective:=active;objectClass");
-191                     if (hc.length > 1) {
-192                         sb.append(":List<String>=\"");
-193                     } else {
-194                         sb.append("=\"");
-195                     }
-196                     for (int i = 0; i < hc.length; i++)
-197                     {
-198                         if (i > 0)
-199                         {
-200                             sb.append(",");
-201                         }
-202                         sb.append(hc[i].getName());
-203                     }
-204                     sb.append("\"");
-205                     for (int i = 0; i < hc[0].getAttributes().length; i++)
-206                     {
-207                         sb.append(";");
-208                         sb.append(hc[0].getAttributes()[i].getName());
-209                         sb.append("=\"");
-210                         sb.append(hc[0].getAttributes()[i].getValue());
-211                         sb.append("\"");
-212                     }
-213                     caps.add(sb.toString());
-214                 }
-215                 else if (!"generic".equals(mode))
-216                 {
-217                     Set<Clause> clauses = hdrs.get(h);
-218                     if (clauses == null) {
-219                         clauses = new HashSet<Clause>();
-220                         hdrs.put(h, clauses);
-221                     }
-222                     clauses.addAll(Arrays.asList(hc));
-223                 }
-224             }
-225             else
-226             {
-227                 Set<Clause> clauses = hdrs.get(h);
-228                 if (clauses == null)
-229                 {
-230                     clauses = new HashSet<Clause>();
-231                     hdrs.put(h, clauses);
-232                 }
-233                 clauses.addAll(Arrays.asList( hc ) );
-234             }
-235         }
-236         if (!caps.isEmpty())
-237         {
-238             StringBuilder sb = new StringBuilder();
-239             String header = analyzer.getProperty("Provide-Capability");
-240             if (header != null)
-241             {
-242                 sb.append(header);
-243             }
-244             for (String cap : caps) {
-245                 if (sb.length() > 0) {
-246                     sb.append(",");
-247                 }
-248                 sb.append(cap);
-249             }
-250             analyzer.setProperty("Provide-Capability", sb.toString());
-251         }
-252         if (!reqs.isEmpty())
-253         {
-254             StringBuilder sb = new StringBuilder();
-255             String header = analyzer.getProperty("Require-Capability");
-256             if (header != null)
-257             {
-258                 sb.append(header);
-259             }
-260             for (String req : reqs) {
-261                 if (sb.length() > 0) {
-262                     sb.append(",");
-263                 }
-264                 sb.append(req);
-265             }
-266             analyzer.setProperty("Require-Capability", sb.toString());
-267         }
-268         // Merge
-269         for ( String header : hdrs.keySet() )
-270         {
-271             if ( "Import-Class".equals( header ) || "Import-Package".equals( header ) )
-272             {
-273                 Set<Clause> newAttr = hdrs.get(header);
-274                 for ( Clause a : newAttr )
-275                 {
-276                     String pkg = a.getName();
-277                     if ( "Import-Class".equals( header ) )
-278                     {
-279                         int n = a.getName().lastIndexOf( '.' );
-280                         if ( n > 0 )
-281                         {
-282                             pkg = pkg.subSequence( 0, n ).toString();
-283                         }
-284                         else
-285                         {
-286                             continue;
-287                         }
-288                     }
-289                     PackageRef pkgRef = analyzer.getPackageRef( pkg );
-290                     if ( !analyzer.getReferred().containsKey( pkgRef ) )
-291                     {
-292                         Attrs attrs = analyzer.getReferred().put(pkgRef);
-293                         for (Attribute attribute : a.getAttributes())
-294                         {
-295                             attrs.put(attribute.getName(), attribute.getValue());
-296                         }
-297                     }
-298                 }
-299             }
-300             else
-301             {
-302                 Set<String> merge = Create.set();
-303                 String org = analyzer.getProperty(header);
-304                 if (org != null && !org.isEmpty())
-305                 {
-306                     for (Clause clause : parseHeader(org))
-307                     {
-308                         merge.add(clause.toString());
-309                     }
-310                 }
-311                 for (Clause clause : hdrs.get(header))
-312                 {
-313                     merge.add(clause.toString());
-314                 }
-315                 StringBuilder sb = new StringBuilder();
-316                 for (String clause : merge)
-317                 {
-318                     if ( sb.length() > 0 )
-319                     {
-320                         sb.append( "," );
-321                     }
-322                     sb.append(clause);
-323 
-324                 }
-325                 analyzer.setProperty( header, sb.toString() );
-326             }
-327         }
-328         return false;
-329     }
-330 
-331 
-332     private void process( Analyzer analyzer, String path, Resource resource, Set<String> headers )
-333     {
-334         InputStream in = null;
-335         try
-336         {
-337             in = resource.openInputStream();
-338 
-339             // Retrieve headers
-340             Set<String> set = analyze( in );
-341             headers.addAll( set );
-342         }
-343         catch ( Exception e )
-344         {
-345             analyzer.error( ( new StringBuilder( "Unexpected exception in processing spring resources(" ) )
-346                 .append( path ).append( "): " ).append( e ).toString() );
-347         }
-348         finally
-349         {
-350             try
-351             {
-352                 if ( in != null )
-353                 {
-354                     in.close();
-355                 }
-356             }
-357             catch ( IOException e )
-358             {
-359             }
-360         }
-361     }
-362 
-363 
-364     public Set<String> analyze( InputStream in ) throws Exception
-365     {
-366         Set<String> refers = new HashSet<String>();
-367         ByteArrayOutputStream bout = new ByteArrayOutputStream();
-368         javax.xml.transform.Result r = new StreamResult( bout );
-369         javax.xml.transform.Source s = new StreamSource( in );
-370         transformer.transform( s, r );
-371         ByteArrayInputStream bin = new ByteArrayInputStream( bout.toByteArray() );
-372         bout.close();
-373         BufferedReader br = new BufferedReader( new InputStreamReader( bin ) );
-374         for ( String line = br.readLine(); line != null; line = br.readLine() )
-375         {
-376             line = line.trim();
-377             line = line.replace( ";availability:=mandatory", "" );
-378             if ( line.length() > 0 )
-379             {
-380                 refers.add( line );
-381             }
-382         }
-383 
-384         br.close();
-385         return refers;
-386     }
-387 
-388 
-389     protected Transformer getTransformer( URL url ) throws Exception
-390     {
-391         TransformerFactory tf = TransformerFactory.newInstance();
-392         javax.xml.transform.Source source = new StreamSource( url.openStream() );
-393         return tf.newTransformer( source );
-394     }
-395 
-396 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BundleAllPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BundleAllPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BundleAllPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BundleAllPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,616 +0,0 @@ - - - - -BundleAllPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FilenameFilter;
-24  import java.util.Arrays;
-25  import java.util.Collection;
-26  import java.util.HashSet;
-27  import java.util.Iterator;
-28  import java.util.LinkedHashMap;
-29  import java.util.List;
-30  import java.util.Map;
-31  import java.util.Properties;
-32  import java.util.Set;
-33  import java.util.jar.Manifest;
-34  import java.util.regex.Matcher;
-35  import java.util.regex.Pattern;
-36  
-37  import org.apache.maven.artifact.Artifact;
-38  import org.apache.maven.artifact.factory.ArtifactFactory;
-39  import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-40  import org.apache.maven.artifact.repository.ArtifactRepository;
-41  import org.apache.maven.artifact.resolver.ArtifactCollector;
-42  import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-43  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-44  import org.apache.maven.artifact.resolver.ArtifactResolver;
-45  import org.apache.maven.artifact.versioning.VersionRange;
-46  import org.apache.maven.plugin.MojoExecutionException;
-47  import org.apache.maven.project.MavenProject;
-48  import org.apache.maven.project.MavenProjectBuilder;
-49  import org.apache.maven.project.ProjectBuildingException;
-50  import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-51  import org.apache.maven.shared.dependency.tree.DependencyNode;
-52  import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
-53  import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
-54  import org.codehaus.plexus.util.FileUtils;
-55  
-56  import aQute.bnd.osgi.Analyzer;
-57  import aQute.bnd.osgi.Jar;
-58  
-59  
-60  /**
-61   * Create OSGi bundles from all dependencies in the Maven project
-62   * 
-63   * @goal bundleall
-64   * @phase package
-65   * @requiresDependencyResolution test
-66   * @description build an OSGi bundle jar for all transitive dependencies
-67   * @deprecated The bundleall goal is no longer supported and may be removed in a future release
-68   */
-69  @Deprecated
-70  public class BundleAllPlugin extends ManifestPlugin
-71  {
-72      private static final String LS = System.getProperty( "line.separator" );
-73  
-74      private static final Pattern SNAPSHOT_VERSION_PATTERN = Pattern.compile( "[0-9]{8}_[0-9]{6}_[0-9]+" );
-75  
-76      /**
-77       * Local repository.
-78       *
-79       * @parameter expression="${localRepository}"
-80       * @required
-81       * @readonly
-82       */
-83      private ArtifactRepository localRepository;
-84  
-85      /**
-86       * Remote repositories.
-87       * 
-88       * @parameter expression="${project.remoteArtifactRepositories}"
-89       * @required
-90       * @readonly
-91       */
-92      private List remoteRepositories;
-93  
-94      /**
-95       * Import-Package to be used when wrapping dependencies.
-96       *
-97       * @parameter expression="${wrapImportPackage}" default-value="*"
-98       */
-99      private String wrapImportPackage;
-100 
-101     /**
-102      * @component
-103      */
-104     private ArtifactFactory m_factory;
-105 
-106     /**
-107      * @component
-108      */
-109     private ArtifactMetadataSource m_artifactMetadataSource;
-110 
-111     /**
-112      * @component
-113      */
-114     private ArtifactCollector m_collector;
-115 
-116     /**
-117      * Artifact resolver, needed to download jars.
-118      * 
-119      * @component
-120      */
-121     private ArtifactResolver m_artifactResolver;
-122 
-123     /**
-124      * @component
-125      */
-126     private DependencyTreeBuilder m_dependencyTreeBuilder;
-127 
-128     /**
-129      * @component
-130      */
-131     private MavenProjectBuilder m_mavenProjectBuilder;
-132 
-133     /**
-134      * Ignore missing artifacts that are not required by current project but are required by the
-135      * transitive dependencies.
-136      * 
-137      * @parameter
-138      */
-139     private boolean ignoreMissingArtifacts;
-140 
-141     private Set m_artifactsBeingProcessed = new HashSet();
-142 
-143     /**
-144      * Process up to some depth 
-145      * 
-146      * @parameter
-147      */
-148     private int depth = Integer.MAX_VALUE;
-149 
-150 
-151     public void execute() throws MojoExecutionException
-152     {
-153         getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
-154         getLog().warn( "! The bundleall goal is no longer supported and may be removed in a future release !" );
-155         getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
-156 
-157         BundleInfo bundleInfo = bundleAll( getProject() );
-158         logDuplicatedPackages( bundleInfo );
-159     }
-160 
-161 
-162     /**
-163      * Bundle a project and all its dependencies
-164      * 
-165      * @param project
-166      * @throws MojoExecutionException
-167      */
-168     private BundleInfo bundleAll( MavenProject project ) throws MojoExecutionException
-169     {
-170         return bundleAll( project, depth );
-171     }
-172 
-173 
-174     /**
-175      * Bundle a project and its transitive dependencies up to some depth level
-176      * 
-177      * @param project
-178      * @param maxDepth how deep to process the dependency tree
-179      * @throws MojoExecutionException
-180      */
-181     protected BundleInfo bundleAll( MavenProject project, int maxDepth ) throws MojoExecutionException
-182     {
-183         if ( alreadyBundled( project.getArtifact() ) )
-184         {
-185             getLog().debug( "Ignoring project already processed " + project.getArtifact() );
-186             return null;
-187         }
-188 
-189         if ( m_artifactsBeingProcessed.contains( project.getArtifact() ) )
-190         {
-191             getLog().warn( "Ignoring artifact due to dependency cycle " + project.getArtifact() );
-192             return null;
-193         }
-194         m_artifactsBeingProcessed.add( project.getArtifact() );
-195 
-196         DependencyNode dependencyTree;
-197 
-198         try
-199         {
-200             dependencyTree = m_dependencyTreeBuilder.buildDependencyTree( project, localRepository, m_factory,
-201                 m_artifactMetadataSource, null, m_collector );
-202         }
-203         catch ( DependencyTreeBuilderException e )
-204         {
-205             throw new MojoExecutionException( "Unable to build dependency tree", e );
-206         }
-207 
-208         BundleInfo bundleInfo = new BundleInfo();
-209 
-210         if ( !dependencyTree.hasChildren() )
-211         {
-212             /* no need to traverse the tree */
-213             return bundleRoot( project, bundleInfo );
-214         }
-215 
-216         getLog().debug( "Will bundle the following dependency tree" + LS + dependencyTree );
-217 
-218         for ( Iterator it = dependencyTree.inverseIterator(); it.hasNext(); )
-219         {
-220             DependencyNode node = ( DependencyNode ) it.next();
-221             if ( !it.hasNext() )
-222             {
-223                 /* this is the root, current project */
-224                 break;
-225             }
-226 
-227             if ( node.getState() != DependencyNode.INCLUDED )
-228             {
-229                 continue;
-230             }
-231 
-232             if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) )
-233             {
-234                 getLog().debug( "Ignoring system scoped artifact " + node.getArtifact() );
-235                 continue;
-236             }
-237 
-238             Artifact artifact;
-239             try
-240             {
-241                 artifact = resolveArtifact( node.getArtifact() );
-242             }
-243             catch ( ArtifactNotFoundException e )
-244             {
-245                 if ( ignoreMissingArtifacts )
-246                 {
-247                     continue;
-248                 }
-249 
-250                 throw new MojoExecutionException( "Artifact was not found in the repo" + node.getArtifact(), e );
-251             }
-252 
-253             node.getArtifact().setFile( artifact.getFile() );
-254 
-255             int nodeDepth = node.getDepth();
-256             if ( nodeDepth > maxDepth )
-257             {
-258                 /* node is deeper than we want */
-259                 getLog().debug(
-260                     "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + maxDepth );
-261                 continue;
-262             }
-263 
-264             MavenProject childProject;
-265             try
-266             {
-267                 childProject = m_mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
-268                     localRepository, true );
-269                 if ( childProject.getDependencyArtifacts() == null )
-270                 {
-271                     childProject.setDependencyArtifacts( childProject.createArtifacts( m_factory, null, null ) );
-272                 }
-273             }
-274             catch ( InvalidDependencyVersionException e )
-275             {
-276                 throw new MojoExecutionException( "Invalid dependency version for artifact " + artifact );
-277             }
-278             catch ( ProjectBuildingException e )
-279             {
-280                 throw new MojoExecutionException( "Unable to build project object for artifact " + artifact, e );
-281             }
-282 
-283             childProject.setArtifact( artifact );
-284             getLog().debug( "Child project artifact location: " + childProject.getArtifact().getFile() );
-285 
-286             if ( ( Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
-287                 || ( Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) ) )
-288             {
-289                 BundleInfo subBundleInfo = bundleAll( childProject, maxDepth - 1 );
-290                 if ( subBundleInfo != null )
-291                 {
-292                     bundleInfo.merge( subBundleInfo );
-293                 }
-294             }
-295             else
-296             {
-297                 getLog().debug(
-298                     "Not processing due to scope (" + childProject.getArtifact().getScope() + "): "
-299                         + childProject.getArtifact() );
-300             }
-301         }
-302 
-303         return bundleRoot( project, bundleInfo );
-304     }
-305 
-306 
-307     /**
-308      * Bundle the root of a dependency tree after all its children have been bundled
-309      * 
-310      * @param project
-311      * @param bundleInfo
-312      * @return
-313      * @throws MojoExecutionException
-314      */
-315     private BundleInfo bundleRoot( MavenProject project, BundleInfo bundleInfo ) throws MojoExecutionException
-316     {
-317         /* do not bundle the project the mojo was called on */
-318         if ( getProject() != project )
-319         {
-320             getLog().debug( "Project artifact location: " + project.getArtifact().getFile() );
-321 
-322             BundleInfo subBundleInfo = bundle( project );
-323             if ( subBundleInfo != null )
-324             {
-325                 bundleInfo.merge( subBundleInfo );
-326             }
-327         }
-328         return bundleInfo;
-329     }
-330 
-331 
-332     /**
-333      * Bundle one project only without building its childre
-334      * 
-335      * @param project
-336      * @throws MojoExecutionException
-337      */
-338     protected BundleInfo bundle( MavenProject project ) throws MojoExecutionException
-339     {
-340         Artifact artifact = project.getArtifact();
-341         getLog().info( "Bundling " + artifact );
-342 
-343         try
-344         {
-345             Map instructions = new LinkedHashMap();
-346             instructions.put( Analyzer.IMPORT_PACKAGE, wrapImportPackage );
-347 
-348             project.getArtifact().setFile( getFile( artifact ) );
-349             File outputFile = getOutputFile( artifact );
-350 
-351             if ( project.getArtifact().getFile().equals( outputFile ) )
-352             {
-353                 /* TODO find the cause why it's getting here */
-354                 return null;
-355                 //                getLog().error(
-356                 //                                "Trying to read and write " + artifact + " to the same file, try cleaning: "
-357                 //                                    + outputFile );
-358                 //                throw new IllegalStateException( "Trying to read and write " + artifact
-359                 //                    + " to the same file, try cleaning: " + outputFile );
-360             }
-361 
-362             Analyzer analyzer = getAnalyzer( project, instructions, new Properties(), getClasspath( project ) );
-363 
-364             Jar osgiJar = new Jar( project.getArtifactId(), project.getArtifact().getFile() );
-365 
-366             outputFile.getAbsoluteFile().getParentFile().mkdirs();
-367 
-368             Collection exportedPackages;
-369             if ( isOsgi( osgiJar ) )
-370             {
-371                 /* if it is already an OSGi jar copy it as is */
-372                 getLog().info(
-373                     "Using existing OSGi bundle for " + project.getGroupId() + ":" + project.getArtifactId() + ":"
-374                         + project.getVersion() );
-375                 String exportHeader = osgiJar.getManifest().getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE );
-376                 exportedPackages = analyzer.parseHeader( exportHeader ).keySet();
-377                 FileUtils.copyFile( project.getArtifact().getFile(), outputFile );
-378             }
-379             else
-380             {
-381                 /* else generate the manifest from the packages */
-382                 exportedPackages = analyzer.getExports().keySet();
-383                 Manifest manifest = analyzer.getJar().getManifest();
-384                 osgiJar.setManifest( manifest );
-385                 osgiJar.write( outputFile );
-386             }
-387 
-388             BundleInfo bundleInfo = addExportedPackages( project, exportedPackages );
-389 
-390             // cleanup...
-391             analyzer.close();
-392             osgiJar.close();
-393 
-394             return bundleInfo;
-395         }
-396         /* too bad Jar.write throws Exception */
-397         catch ( Exception e )
-398         {
-399             throw new MojoExecutionException( "Error generating OSGi bundle for project "
-400                 + getArtifactKey( project.getArtifact() ), e );
-401         }
-402     }
-403 
-404 
-405     private boolean isOsgi( Jar jar ) throws Exception
-406     {
-407         if ( jar.getManifest() != null )
-408         {
-409             return jar.getManifest().getMainAttributes().getValue( Analyzer.BUNDLE_NAME ) != null;
-410         }
-411         return false;
-412     }
-413 
-414 
-415     private BundleInfo addExportedPackages( MavenProject project, Collection packages )
-416     {
-417         BundleInfo bundleInfo = new BundleInfo();
-418         for ( Iterator it = packages.iterator(); it.hasNext(); )
-419         {
-420             String packageName = ( String ) it.next();
-421             bundleInfo.addExportedPackage( packageName, project.getArtifact() );
-422         }
-423         return bundleInfo;
-424     }
-425 
-426 
-427     private String getArtifactKey( Artifact artifact )
-428     {
-429         return artifact.getGroupId() + ":" + artifact.getArtifactId();
-430     }
-431 
-432 
-433     private String getBundleName( Artifact artifact )
-434     {
-435         return getMaven2OsgiConverter().getBundleFileName( artifact );
-436     }
-437 
-438 
-439     private boolean alreadyBundled( Artifact artifact )
-440     {
-441         return getBuiltFile( artifact ) != null;
-442     }
-443 
-444 
-445     /**
-446      * Use previously built bundles when available.
-447      * 
-448      * @param artifact
-449      */
-450     protected File getFile( final Artifact artifact )
-451     {
-452         File bundle = getBuiltFile( artifact );
-453 
-454         if ( bundle != null )
-455         {
-456             getLog().debug( "Using previously built OSGi bundle for " + artifact + " in " + bundle );
-457             return bundle;
-458         }
-459         return super.getFile( artifact );
-460     }
-461 
-462 
-463     private File getBuiltFile( final Artifact artifact )
-464     {
-465         File bundle = null;
-466 
-467         /* if bundle was already built use it instead of jar from repo */
-468         File outputFile = getOutputFile( artifact );
-469         if ( outputFile.exists() )
-470         {
-471             bundle = outputFile;
-472         }
-473 
-474         /*
-475          * Find snapshots in output folder, eg. 2.1-SNAPSHOT will match 2.1.0.20070207_193904_2
-476          * TODO there has to be another way to do this using Maven libs 
-477          */
-478         if ( ( bundle == null ) && artifact.isSnapshot() )
-479         {
-480             final File buildDirectory = new File( getBuildDirectory() );
-481             if ( !buildDirectory.exists() )
-482             {
-483                 buildDirectory.mkdirs();
-484             }
-485             File[] files = buildDirectory.listFiles( new FilenameFilter()
-486             {
-487                 public boolean accept( File dir, String name )
-488                 {
-489                     if ( dir.equals( buildDirectory ) && snapshotMatch( artifact, name ) )
-490                     {
-491                         return true;
-492                     }
-493                     return false;
-494                 }
-495             } );
-496             if ( files.length > 1 )
-497             {
-498                 throw new RuntimeException( "More than one previously built bundle matches for artifact " + artifact
-499                     + " : " + Arrays.asList( files ) );
-500             }
-501             if ( files.length == 1 )
-502             {
-503                 bundle = files[0];
-504             }
-505         }
-506 
-507         return bundle;
-508     }
-509 
-510 
-511     /**
-512      * Check that the bundleName provided correspond to the artifact provided.
-513      * Used to determine when the bundle name is a timestamped snapshot and the artifact is a snapshot not timestamped.
-514      * 
-515      * @param artifact artifact with snapshot version
-516      * @param bundleName bundle file name 
-517      * @return if both represent the same artifact and version, forgetting about the snapshot timestamp
-518      */
-519     protected boolean snapshotMatch( Artifact artifact, String bundleName )
-520     {
-521         String artifactBundleName = getBundleName( artifact );
-522         int i = artifactBundleName.indexOf( "SNAPSHOT" );
-523         if ( i < 0 )
-524         {
-525             return false;
-526         }
-527         artifactBundleName = artifactBundleName.substring( 0, i );
-528 
-529         if ( bundleName.startsWith( artifactBundleName ) )
-530         {
-531             /* it's the same artifact groupId and artifactId */
-532             String timestamp = bundleName.substring( artifactBundleName.length(), bundleName.lastIndexOf( ".jar" ) );
-533             Matcher m = SNAPSHOT_VERSION_PATTERN.matcher( timestamp );
-534             return m.matches();
-535         }
-536         return false;
-537     }
-538 
-539 
-540     protected File getOutputFile( Artifact artifact )
-541     {
-542         return new File( getOutputDirectory(), getBundleName( artifact ) );
-543     }
-544 
-545 
-546     private Artifact resolveArtifact( Artifact artifact ) throws MojoExecutionException, ArtifactNotFoundException
-547     {
-548         VersionRange versionRange;
-549         if ( artifact.getVersion() != null )
-550         {
-551             versionRange = VersionRange.createFromVersion( artifact.getVersion() );
-552         }
-553         else
-554         {
-555             versionRange = artifact.getVersionRange();
-556         }
-557 
-558         /*
-559          * there's a bug with ArtifactFactory#createDependencyArtifact(String, String, VersionRange,
-560          * String, String, String) that ignores the scope parameter, that's why we use the one with
-561          * the extra null parameter
-562          */
-563         Artifact resolvedArtifact = m_factory.createDependencyArtifact( artifact.getGroupId(),
-564             artifact.getArtifactId(), versionRange, artifact.getType(), artifact.getClassifier(), artifact.getScope(),
-565             null );
-566 
-567         try
-568         {
-569             m_artifactResolver.resolve( resolvedArtifact, remoteRepositories, localRepository );
-570         }
-571         catch ( ArtifactResolutionException e )
-572         {
-573             throw new MojoExecutionException( "Error resolving artifact " + resolvedArtifact, e );
-574         }
-575 
-576         return resolvedArtifact;
-577     }
-578 
-579 
-580     /**
-581      * Log what packages are exported in more than one bundle
-582      */
-583     protected void logDuplicatedPackages( BundleInfo bundleInfo )
-584     {
-585         Map duplicatedExports = bundleInfo.getDuplicatedExports();
-586 
-587         for ( Iterator it = duplicatedExports.entrySet().iterator(); it.hasNext(); )
-588         {
-589             Map.Entry entry = ( Map.Entry ) it.next();
-590             String packageName = ( String ) entry.getKey();
-591             Collection artifacts = ( Collection ) entry.getValue();
-592 
-593             getLog().warn( "Package " + packageName + " is exported in more than a bundle: " );
-594             for ( Iterator it2 = artifacts.iterator(); it2.hasNext(); )
-595             {
-596                 Artifact artifact = ( Artifact ) it2.next();
-597                 getLog().warn( "  " + artifact );
-598             }
-599 
-600         }
-601     }
-602 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BundleInfo.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BundleInfo.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BundleInfo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BundleInfo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ - - - - -BundleInfo xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
-3    * agreements. See the NOTICE file distributed with this work for additional information regarding
-4    * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
-5    * "License"); you may not use this file except in compliance with the License. You may obtain a
-6    * copy of the License at
-7    * 
-8    * http://www.apache.org/licenses/LICENSE-2.0
-9    * 
-10   * Unless required by applicable law or agreed to in writing, software distributed under the License
-11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-12   * or implied. See the License for the specific language governing permissions and limitations under
-13   * the License.
-14   */
-15  package org.apache.felix.bundleplugin;
-16  
-17  
-18  import java.util.Collection;
-19  import java.util.HashMap;
-20  import java.util.HashSet;
-21  import java.util.Iterator;
-22  import java.util.Map;
-23  import java.util.Set;
-24  
-25  import org.apache.maven.artifact.Artifact;
-26  
-27  
-28  /**
-29   * Information result of the bundling process 
-30   * 
-31   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
-32   * @version $Id: BundleInfo.java 616192 2008-01-29 07:45:57Z mcculls $
-33   */
-34  public class BundleInfo
-35  {
-36      /**
-37       * {@link Map} &lt; {@link String}, {@link Set} &lt; {@link Artifact} > >
-38       * Used to check for duplicated exports. Key is package name and value list of artifacts where it's exported.
-39       */
-40      private Map m_exportedPackages = new HashMap();
-41  
-42  
-43      public void addExportedPackage( String packageName, Artifact artifact )
-44      {
-45          Set artifacts = ( Set ) getExportedPackages().get( packageName );
-46          if ( artifacts == null )
-47          {
-48              artifacts = new HashSet();
-49              m_exportedPackages.put( packageName, artifacts );
-50          }
-51          artifacts.add( artifact );
-52      }
-53  
-54  
-55      protected Map getExportedPackages()
-56      {
-57          return m_exportedPackages;
-58      }
-59  
-60  
-61      /**
-62       * Get a list of packages that are exported in more than one bundle.
-63       * Key is package name and value list of artifacts where it's exported.
-64       * @return {@link Map} &lt; {@link String}, {@link Set} &lt; {@link Artifact} > >
-65       */
-66      public Map getDuplicatedExports()
-67      {
-68          Map duplicatedExports = new HashMap();
-69  
-70          for ( Iterator it = getExportedPackages().entrySet().iterator(); it.hasNext(); )
-71          {
-72              Map.Entry entry = ( Map.Entry ) it.next();
-73              Set artifacts = ( Set ) entry.getValue();
-74              if ( artifacts.size() > 1 )
-75              {
-76                  /* remove warnings caused by different versions of same artifact */
-77                  Set artifactKeys = new HashSet();
-78  
-79                  String packageName = ( String ) entry.getKey();
-80                  for ( Iterator it2 = artifacts.iterator(); it2.hasNext(); )
-81                  {
-82                      Artifact artifact = ( Artifact ) it2.next();
-83                      artifactKeys.add( artifact.getGroupId() + "." + artifact.getArtifactId() );
-84                  }
-85  
-86                  if ( artifactKeys.size() > 1 )
-87                  {
-88                      duplicatedExports.put( packageName, artifacts );
-89                  }
-90              }
-91          }
-92  
-93          return duplicatedExports;
-94      }
-95  
-96  
-97      public void merge( BundleInfo bundleInfo )
-98      {
-99          for ( Iterator it = bundleInfo.getExportedPackages().entrySet().iterator(); it.hasNext(); )
-100         {
-101             Map.Entry entry = ( Map.Entry ) it.next();
-102             String packageName = ( String ) entry.getKey();
-103             Collection artifacts = ( Collection ) entry.getValue();
-104 
-105             Collection artifactsWithPackage = ( Collection ) getExportedPackages().get( packageName );
-106             if ( artifactsWithPackage == null )
-107             {
-108                 artifactsWithPackage = new HashSet();
-109                 getExportedPackages().put( packageName, artifactsWithPackage );
-110             }
-111             artifactsWithPackage.addAll( artifacts );
-112         }
-113     }
-114 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BundlePlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BundlePlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/BundlePlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/BundlePlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,1628 +0,0 @@ - - - - -BundlePlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.ByteArrayInputStream;
-23  import java.io.ByteArrayOutputStream;
-24  import java.io.File;
-25  import java.io.FileInputStream;
-26  import java.io.FileOutputStream;
-27  import java.io.IOException;
-28  import java.io.InputStream;
-29  import java.lang.reflect.Array;
-30  import java.lang.reflect.Method;
-31  import java.util.ArrayList;
-32  import java.util.Arrays;
-33  import java.util.Collection;
-34  import java.util.Collections;
-35  import java.util.Enumeration;
-36  import java.util.HashMap;
-37  import java.util.HashSet;
-38  import java.util.Iterator;
-39  import java.util.LinkedHashMap;
-40  import java.util.LinkedHashSet;
-41  import java.util.List;
-42  import java.util.Map;
-43  import java.util.Properties;
-44  import java.util.Set;
-45  import java.util.jar.Attributes;
-46  import java.util.jar.Manifest;
-47  
-48  import org.apache.maven.archiver.ManifestSection;
-49  import org.apache.maven.archiver.MavenArchiveConfiguration;
-50  import org.apache.maven.archiver.MavenArchiver;
-51  import org.apache.maven.artifact.Artifact;
-52  import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-53  import org.apache.maven.execution.MavenSession;
-54  import org.apache.maven.model.License;
-55  import org.apache.maven.model.Model;
-56  import org.apache.maven.model.Resource;
-57  import org.apache.maven.plugin.AbstractMojo;
-58  import org.apache.maven.plugin.MojoExecutionException;
-59  import org.apache.maven.plugin.MojoFailureException;
-60  import org.apache.maven.plugin.logging.Log;
-61  import org.apache.maven.project.MavenProject;
-62  import org.apache.maven.project.MavenProjectHelper;
-63  import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-64  import org.apache.maven.shared.osgi.Maven2OsgiConverter;
-65  import org.codehaus.plexus.archiver.UnArchiver;
-66  import org.codehaus.plexus.archiver.manager.ArchiverManager;
-67  import org.codehaus.plexus.util.DirectoryScanner;
-68  import org.codehaus.plexus.util.FileUtils;
-69  import org.codehaus.plexus.util.PropertyUtils;
-70  import org.codehaus.plexus.util.StringUtils;
-71  
-72  import aQute.bnd.header.Attrs;
-73  import aQute.bnd.osgi.Analyzer;
-74  import aQute.bnd.osgi.Builder;
-75  import aQute.bnd.osgi.Constants;
-76  import aQute.bnd.osgi.Descriptors.PackageRef;
-77  import aQute.bnd.osgi.EmbeddedResource;
-78  import aQute.bnd.osgi.FileResource;
-79  import aQute.bnd.osgi.Jar;
-80  import aQute.bnd.osgi.Packages;
-81  import aQute.bnd.osgi.Processor;
-82  import aQute.lib.spring.SpringXMLType;
-83  
-84  
-85  /**
-86   * Create an OSGi bundle from Maven project
-87   *
-88   * @goal bundle
-89   * @phase package
-90   * @requiresDependencyResolution test
-91   * @description build an OSGi bundle jar
-92   * @threadSafe
-93   */
-94  public class BundlePlugin extends AbstractMojo
-95  {
-96      /**
-97       * Directory where the manifest will be written
-98       *
-99       * @parameter expression="${manifestLocation}" default-value="${project.build.outputDirectory}/META-INF"
-100      */
-101     protected File manifestLocation;
-102 
-103     /**
-104      * File where the BND instructions will be dumped
-105      *
-106      * @parameter expression="${dumpInstructions}"
-107      */
-108     protected File dumpInstructions;
-109 
-110     /**
-111      * File where the BND class-path will be dumped
-112      *
-113      * @parameter expression="${dumpClasspath}"
-114      */
-115     protected File dumpClasspath;
-116 
-117     /**
-118      * When true, unpack the bundle contents to the outputDirectory
-119      *
-120      * @parameter expression="${unpackBundle}"
-121      */
-122     protected boolean unpackBundle;
-123 
-124     /**
-125      * Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
-126      *
-127      * @parameter expression="${excludeDependencies}"
-128      */
-129     protected String excludeDependencies;
-130 
-131     /**
-132      * Final name of the bundle (without classifier or extension)
-133      * 
-134      * @parameter expression="${project.build.finalName}"
-135      */ 
-136     private String finalName; 
-137 
-138     /**
-139      * Classifier type of the bundle to be installed.  For example, "jdk14".
-140      * Defaults to none which means this is the project's main bundle.
-141      *
-142      * @parameter
-143      */
-144     protected String classifier;
-145 
-146     /**
-147      * Packaging type of the bundle to be installed.  For example, "jar".
-148      * Defaults to none which means use the same packaging as the project.
-149      *
-150      * @parameter
-151      */
-152     protected String packaging;
-153 
-154     /**
-155      * @component
-156      */
-157     private MavenProjectHelper m_projectHelper;
-158 
-159     /**
-160      * @component
-161      */
-162     private ArchiverManager m_archiverManager;
-163 
-164     /**
-165      * @component
-166      */
-167     private ArtifactHandlerManager m_artifactHandlerManager;
-168 
-169     /**
-170      * Project types which this plugin supports.
-171      *
-172      * @parameter
-173      */
-174     protected List supportedProjectTypes = Arrays.asList( new String[]
-175         { "jar", "bundle" } );
-176 
-177     /**
-178      * The directory for the generated bundles.
-179      *
-180      * @parameter expression="${project.build.outputDirectory}"
-181      * @required
-182      */
-183     private File outputDirectory;
-184 
-185     /**
-186      * The directory for the generated JAR.
-187      *
-188      * @parameter expression="${project.build.directory}"
-189      * @required
-190      */
-191     private String buildDirectory;
-192 
-193     /**
-194      * The Maven project.
-195      *
-196      * @parameter expression="${project}"
-197      * @required
-198      * @readonly
-199      */
-200     private MavenProject project;
-201 
-202     /**
-203      * The BND instructions for the bundle.
-204      *
-205      * @parameter
-206      */
-207     private Map instructions = new LinkedHashMap();
-208 
-209     /**
-210      * Use locally patched version for now.
-211      */
-212     private Maven2OsgiConverter m_maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-213 
-214     /**
-215      * The archive configuration to use.
-216      *
-217      * @parameter
-218      */
-219     private MavenArchiveConfiguration archive; // accessed indirectly in JarPluginConfiguration
-220 
-221     /**
-222      * @parameter default-value="${session}"
-223      * @required
-224      * @readonly
-225      */
-226     private MavenSession m_mavenSession;
-227 
-228     /**
-229      * Output a nicely formatted manifest that still respects the 72 character line limit.
-230      *
-231      * @parameter
-232      */
-233     private boolean niceManifest = false;
-234 
-235     private static final String MAVEN_SYMBOLICNAME = "maven-symbolicname";
-236     private static final String MAVEN_RESOURCES = "{maven-resources}";
-237     private static final String MAVEN_TEST_RESOURCES = "{maven-test-resources}";
-238     private static final String LOCAL_PACKAGES = "{local-packages}";
-239     private static final String MAVEN_SOURCES = "{maven-sources}";
-240     private static final String MAVEN_TEST_SOURCES = "{maven-test-sources}";
-241 
-242     private static final String[] EMPTY_STRING_ARRAY =
-243         {};
-244     private static final String[] DEFAULT_INCLUDES =
-245         { "**/**" };
-246 
-247     private static final String NL = System.getProperty( "line.separator" );
-248 
-249 
-250     protected Maven2OsgiConverter getMaven2OsgiConverter()
-251     {
-252         return m_maven2OsgiConverter;
-253     }
-254 
-255 
-256     protected void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter )
-257     {
-258         m_maven2OsgiConverter = maven2OsgiConverter;
-259     }
-260 
-261 
-262     protected MavenProject getProject()
-263     {
-264         return project;
-265     }
-266 
-267 
-268     /**
-269      * @see org.apache.maven.plugin.AbstractMojo#execute()
-270      */
-271     public void execute() throws MojoExecutionException
-272     {
-273         Properties properties = new Properties();
-274         String projectType = getProject().getArtifact().getType();
-275 
-276         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
-277         if ( !supportedProjectTypes.contains( projectType ) )
-278         {
-279             getLog().warn(
-280                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
-281             return;
-282         }
-283 
-284         execute( getProject(), instructions, properties );
-285     }
-286 
-287 
-288     protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties )
-289         throws MojoExecutionException
-290     {
-291         try
-292         {
-293             execute( currentProject, originalInstructions, properties, getClasspath( currentProject ) );
-294         }
-295         catch ( IOException e )
-296         {
-297             throw new MojoExecutionException( "Error calculating classpath for project " + currentProject, e );
-298         }
-299     }
-300 
-301 
-302     /* transform directives from their XML form to the expected BND syntax (eg. _include becomes -include) */
-303     protected static Map transformDirectives( Map originalInstructions )
-304     {
-305         Map transformedInstructions = new LinkedHashMap();
-306         for ( Iterator i = originalInstructions.entrySet().iterator(); i.hasNext(); )
-307         {
-308             Map.Entry e = ( Map.Entry ) i.next();
-309 
-310             String key = ( String ) e.getKey();
-311             if ( key.startsWith( "_" ) )
-312             {
-313                 key = "-" + key.substring( 1 );
-314             }
-315 
-316             String value = ( String ) e.getValue();
-317             if ( null == value )
-318             {
-319                 value = "";
-320             }
-321             else
-322             {
-323                 value = value.replaceAll( "\\p{Blank}*[\r\n]\\p{Blank}*", "" );
-324             }
-325 
-326             if ( Analyzer.WAB.equals( key ) && value.length() == 0 )
-327             {
-328                 // provide useful default
-329                 value = "src/main/webapp/";
-330             }
-331 
-332             transformedInstructions.put( key, value );
-333         }
-334         return transformedInstructions;
-335     }
-336 
-337 
-338     protected boolean reportErrors( String prefix, Analyzer analyzer )
-339     {
-340         List errors = analyzer.getErrors();
-341         List warnings = analyzer.getWarnings();
-342 
-343         for ( Iterator w = warnings.iterator(); w.hasNext(); )
-344         {
-345             String msg = ( String ) w.next();
-346             getLog().warn( prefix + " : " + msg );
-347         }
-348 
-349         boolean hasErrors = false;
-350         String fileNotFound = "Input file does not exist: ";
-351         for ( Iterator e = errors.iterator(); e.hasNext(); )
-352         {
-353             String msg = ( String ) e.next();
-354             if ( msg.startsWith( fileNotFound ) && msg.endsWith( "~" ) )
-355             {
-356                 // treat as warning; this error happens when you have duplicate entries in Include-Resource
-357                 String duplicate = Processor.removeDuplicateMarker( msg.substring( fileNotFound.length() ) );
-358                 getLog().warn( prefix + " : Duplicate path '" + duplicate + "' in Include-Resource" );
-359             }
-360             else
-361             {
-362                 getLog().error( prefix + " : " + msg );
-363                 hasErrors = true;
-364             }
-365         }
-366         return hasErrors;
-367     }
-368 
-369 
-370     protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties,
-371         Jar[] classpath ) throws MojoExecutionException
-372     {
-373         try
-374         {
-375             File jarFile = new File( getBuildDirectory(), getBundleName( currentProject ) );
-376             Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties, classpath );
-377             boolean hasErrors = reportErrors( "Bundle " + currentProject.getArtifact(), builder );
-378             if ( hasErrors )
-379             {
-380                 String failok = builder.getProperty( "-failok" );
-381                 if ( null == failok || "false".equalsIgnoreCase( failok ) )
-382                 {
-383                     jarFile.delete();
-384 
-385                     throw new MojoFailureException( "Error(s) found in bundle configuration" );
-386                 }
-387             }
-388 
-389             // attach bundle to maven project
-390             jarFile.getParentFile().mkdirs();
-391             builder.getJar().write( jarFile );
-392 
-393             Artifact mainArtifact = currentProject.getArtifact();
-394 
-395             if ( "bundle".equals( mainArtifact.getType() ) )
-396             {
-397                 // workaround for MNG-1682: force maven to install artifact using the "jar" handler
-398                 mainArtifact.setArtifactHandler( m_artifactHandlerManager.getArtifactHandler( "jar" ) );
-399             }
-400 
-401             boolean customClassifier = null != classifier && classifier.trim().length() > 0;
-402             boolean customPackaging = null != packaging && packaging.trim().length() > 0;
-403 
-404             if ( customClassifier && customPackaging )
-405             {
-406                 m_projectHelper.attachArtifact( currentProject, packaging, classifier, jarFile );
-407             }
-408             else if ( customClassifier )
-409             {
-410                 m_projectHelper.attachArtifact( currentProject, jarFile, classifier );
-411             }
-412             else if ( customPackaging )
-413             {
-414                 m_projectHelper.attachArtifact( currentProject, packaging, jarFile );
-415             }
-416             else
-417             {
-418                 mainArtifact.setFile( jarFile );
-419             }
-420 
-421             if ( unpackBundle )
-422             {
-423                 unpackBundle( jarFile );
-424             }
-425 
-426             if ( manifestLocation != null )
-427             {
-428                 File outputFile = new File( manifestLocation, "MANIFEST.MF" );
-429 
-430                 try
-431                 {
-432                     Manifest manifest = builder.getJar().getManifest();
-433                     FileOutputStream fos = new FileOutputStream( outputFile );
-434                     try
-435                     {
-436                         ManifestWriter.outputManifest( manifest, fos, niceManifest );
-437                     }
-438                     finally
-439                     {
-440                         fos.close();
-441                     }
-442                 }
-443                 catch ( IOException e )
-444                 {
-445                     getLog().error( "Error trying to write Manifest to file " + outputFile, e );
-446                 }
-447             }
-448 
-449             // cleanup...
-450             builder.close();
-451         }
-452         catch ( MojoFailureException e )
-453         {
-454             getLog().error( e.getLocalizedMessage() );
-455             throw new MojoExecutionException( "Error(s) found in bundle configuration", e );
-456         }
-457         catch ( Exception e )
-458         {
-459             getLog().error( "An internal error occurred", e );
-460             throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
-461         }
-462     }
-463 
-464 
-465     protected Builder getOSGiBuilder( MavenProject currentProject, Map originalInstructions, Properties properties,
-466         Jar[] classpath ) throws Exception
-467     {
-468         properties.putAll( getDefaultProperties( currentProject ) );
-469         properties.putAll( transformDirectives( originalInstructions ) );
-470         if (properties.getProperty("Bundle-Activator") != null
-471                 && properties.getProperty("Bundle-Activator").isEmpty())
-472         {
-473             properties.remove("Bundle-Activator");
-474         }
-475         if (properties.containsKey("-disable-plugin"))
-476         {
-477             String[] disabled = properties.remove("-disable-plugin").toString().replaceAll(" ", "").split(",");
-478             String[] enabled = properties.getProperty(Analyzer.PLUGIN, "").replaceAll(" ", "").split(",");
-479             Set<String> plugin = new LinkedHashSet<String>();
-480             plugin.addAll(Arrays.asList(enabled));
-481             plugin.removeAll(Arrays.asList(disabled));
-482             StringBuilder sb = new StringBuilder();
-483             for (String s : plugin)
-484             {
-485                 if (sb.length() > 0)
-486                 {
-487                     sb.append(",");
-488                 }
-489                 sb.append(sb);
-490             }
-491             properties.setProperty(Analyzer.PLUGIN, sb.toString());
-492         }
-493 
-494         Builder builder = new Builder();
-495         synchronized ( BundlePlugin.class ) // protect setBase...getBndLastModified which uses static DateFormat 
-496         {
-497             builder.setBase( getBase( currentProject ) );
-498         }
-499         builder.setProperties( sanitize( properties ) );
-500         if ( classpath != null )
-501         {
-502             builder.setClasspath( classpath );
-503         }
-504 
-505         return builder;
-506     }
-507 
-508 
-509     protected static Properties sanitize( Properties properties )
-510     {
-511         // convert any non-String keys/values to Strings
-512         Properties sanitizedEntries = new Properties();
-513         for ( Iterator itr = properties.entrySet().iterator(); itr.hasNext(); )
-514         {
-515             Map.Entry entry = ( Map.Entry ) itr.next();
-516             if ( entry.getKey() instanceof String == false )
-517             {
-518                 String key = sanitize( entry.getKey() );
-519                 if ( !properties.containsKey( key ) )
-520                 {
-521                     sanitizedEntries.setProperty( key, sanitize( entry.getValue() ) );
-522                 }
-523                 itr.remove();
-524             }
-525             else if ( entry.getValue() instanceof String == false )
-526             {
-527                 entry.setValue( sanitize( entry.getValue() ) );
-528             }
-529         }
-530         properties.putAll( sanitizedEntries );
-531         return properties;
-532     }
-533 
-534 
-535     protected static String sanitize( Object value )
-536     {
-537         if ( value instanceof String )
-538         {
-539             return ( String ) value;
-540         }
-541         else if ( value instanceof Iterable )
-542         {
-543             String delim = "";
-544             StringBuilder buf = new StringBuilder();
-545             for ( Object i : ( Iterable<?> ) value )
-546             {
-547                 buf.append( delim ).append( i );
-548                 delim = ", ";
-549             }
-550             return buf.toString();
-551         }
-552         else if ( value.getClass().isArray() )
-553         {
-554             String delim = "";
-555             StringBuilder buf = new StringBuilder();
-556             for ( int i = 0, len = Array.getLength( value ); i < len; i++ )
-557             {
-558                 buf.append( delim ).append( Array.get( value, i ) );
-559                 delim = ", ";
-560             }
-561             return buf.toString();
-562         }
-563         else
-564         {
-565             return String.valueOf( value );
-566         }
-567     }
-568 
-569 
-570     protected void addMavenInstructions( MavenProject currentProject, Builder builder ) throws Exception
-571     {
-572         if ( currentProject.getBasedir() != null )
-573         {
-574             // update BND instructions to add included Maven resources
-575             includeMavenResources( currentProject, builder, getLog() );
-576 
-577             // calculate default export/private settings based on sources
-578             addLocalPackages( outputDirectory, builder );
-579 
-580             // tell BND where the current project source resides
-581             addMavenSourcePath( currentProject, builder, getLog() );
-582         }
-583 
-584         // update BND instructions to embed selected Maven dependencies
-585         Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, builder );
-586         new DependencyEmbedder( getLog(), embeddableArtifacts ).processHeaders( builder );
-587 
-588         if ( dumpInstructions != null || getLog().isDebugEnabled() )
-589         {
-590             StringBuilder buf = new StringBuilder();
-591             getLog().debug( "BND Instructions:" + NL + dumpInstructions( builder.getProperties(), buf ) );
-592             if ( dumpInstructions != null )
-593             {
-594                 getLog().info( "Writing BND instructions to " + dumpInstructions );
-595                 dumpInstructions.getParentFile().mkdirs();
-596                 FileUtils.fileWrite( dumpInstructions, "# BND instructions" + NL + buf );
-597             }
-598         }
-599 
-600         if ( dumpClasspath != null || getLog().isDebugEnabled() )
-601         {
-602             StringBuilder buf = new StringBuilder();
-603             getLog().debug( "BND Classpath:" + NL + dumpClasspath( builder.getClasspath(), buf ) );
-604             if ( dumpClasspath != null )
-605             {
-606                 getLog().info( "Writing BND classpath to " + dumpClasspath );
-607                 dumpClasspath.getParentFile().mkdirs();
-608                 FileUtils.fileWrite( dumpClasspath, "# BND classpath" + NL + buf );
-609             }
-610         }
-611     }
-612 
-613 
-614     protected Builder buildOSGiBundle( MavenProject currentProject, Map originalInstructions, Properties properties,
-615         Jar[] classpath ) throws Exception
-616     {
-617         Builder builder = getOSGiBuilder( currentProject, originalInstructions, properties, classpath );
-618 
-619         addMavenInstructions( currentProject, builder );
-620 
-621         builder.build();
-622 
-623         mergeMavenManifest( currentProject, builder );
-624 
-625         return builder;
-626     }
-627 
-628 
-629     protected static StringBuilder dumpInstructions( Properties properties, StringBuilder buf )
-630     {
-631         try
-632         {
-633             buf.append( "#-----------------------------------------------------------------------" + NL );
-634             Properties stringProperties = new Properties();
-635             for ( Enumeration e = properties.propertyNames(); e.hasMoreElements(); )
-636             {
-637                 // we can only store String properties
-638                 String key = ( String ) e.nextElement();
-639                 String value = properties.getProperty( key );
-640                 if ( value != null )
-641                 {
-642                     stringProperties.setProperty( key, value );
-643                 }
-644             }
-645             ByteArrayOutputStream out = new ByteArrayOutputStream();
-646             stringProperties.store( out, null ); // properties encoding is 8859_1
-647             buf.append( out.toString( "8859_1" ) );
-648             buf.append( "#-----------------------------------------------------------------------" + NL );
-649         }
-650         catch ( Throwable e )
-651         {
-652             // ignore...
-653         }
-654         return buf;
-655     }
-656 
-657 
-658     protected static StringBuilder dumpClasspath( List classpath, StringBuilder buf )
-659     {
-660         try
-661         {
-662             buf.append( "#-----------------------------------------------------------------------" + NL );
-663             buf.append( "-classpath:\\" + NL );
-664             for ( Iterator i = classpath.iterator(); i.hasNext(); )
-665             {
-666                 File path = ( ( Jar ) i.next() ).getSource();
-667                 if ( path != null )
-668                 {
-669                     buf.append( ' ' + path.toString() + ( i.hasNext() ? ",\\" : "" ) + NL );
-670                 }
-671             }
-672             buf.append( "#-----------------------------------------------------------------------" + NL );
-673         }
-674         catch ( Throwable e )
-675         {
-676             // ignore...
-677         }
-678         return buf;
-679     }
-680 
-681 
-682     protected StringBuilder dumpManifest( Manifest manifest, StringBuilder buf )
-683     {
-684         try
-685         {
-686             buf.append( "#-----------------------------------------------------------------------" + NL );
-687             ByteArrayOutputStream out = new ByteArrayOutputStream();
-688             ManifestWriter.outputManifest( manifest, out, false ); // manifest encoding is UTF8
-689             buf.append( out.toString( "UTF8" ) );
-690             buf.append( "#-----------------------------------------------------------------------" + NL );
-691         }
-692         catch ( Throwable e )
-693         {
-694             // ignore...
-695         }
-696         return buf;
-697     }
-698 
-699 
-700     protected static void includeMavenResources( MavenProject currentProject, Analyzer analyzer, Log log )
-701     {
-702         // pass maven resource paths onto BND analyzer
-703         final String mavenResourcePaths = getMavenResourcePaths( currentProject, false );
-704         final String mavenTestResourcePaths = getMavenResourcePaths( currentProject, true );
-705         final String includeResource = analyzer.getProperty( Analyzer.INCLUDE_RESOURCE );
-706         if ( includeResource != null )
-707         {
-708             if ( includeResource.contains( MAVEN_RESOURCES ) || includeResource.contains( MAVEN_TEST_RESOURCES ) )
-709             {
-710                 String combinedResource = StringUtils.replace( includeResource, MAVEN_RESOURCES, mavenResourcePaths );
-711                 combinedResource = StringUtils.replace( combinedResource, MAVEN_TEST_RESOURCES, mavenTestResourcePaths );
-712                 if ( combinedResource.length() > 0 )
-713                 {
-714                     analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, combinedResource );
-715                 }
-716                 else
-717                 {
-718                     analyzer.unsetProperty( Analyzer.INCLUDE_RESOURCE );
-719                 }
-720             }
-721             else if ( mavenResourcePaths.length() > 0 )
-722             {
-723                 log.warn( Analyzer.INCLUDE_RESOURCE + ": overriding " + mavenResourcePaths + " with " + includeResource
-724                         + " (add " + MAVEN_RESOURCES + " if you want to include the maven resources)" );
-725             }
-726         }
-727         else if ( mavenResourcePaths.length() > 0 )
-728         {
-729             analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths );
-730         }
-731     }
-732 
-733 
-734     protected void mergeMavenManifest( MavenProject currentProject, Builder builder ) throws Exception
-735     {
-736         Jar jar = builder.getJar();
-737 
-738         if ( getLog().isDebugEnabled() )
-739         {
-740             getLog().debug( "BND Manifest:" + NL + dumpManifest( jar.getManifest(), new StringBuilder() ) );
-741         }
-742 
-743         boolean addMavenDescriptor = currentProject.getBasedir() != null;
-744 
-745         try
-746         {
-747             /*
-748              * Grab customized manifest entries from the maven-jar-plugin configuration
-749              */
-750             MavenArchiveConfiguration archiveConfig = JarPluginConfiguration.getArchiveConfiguration( currentProject );
-751             String mavenManifestText = new MavenArchiver().getManifest( currentProject, archiveConfig ).toString();
-752             addMavenDescriptor = addMavenDescriptor && archiveConfig.isAddMavenDescriptor();
-753 
-754             Manifest mavenManifest = new Manifest();
-755 
-756             // First grab the external manifest file (if specified and different to target location)
-757             File externalManifestFile = archiveConfig.getManifestFile();
-758             if ( null != externalManifestFile )
-759             {
-760                 if ( !externalManifestFile.isAbsolute() )
-761                 {
-762                     externalManifestFile = new File( currentProject.getBasedir(), externalManifestFile.getPath() );
-763                 }
-764                 if ( externalManifestFile.exists() && !externalManifestFile.equals( new File( manifestLocation, "MANIFEST.MF" ) ) )
-765                 {
-766                     InputStream mis = new FileInputStream( externalManifestFile );
-767                     mavenManifest.read( mis );
-768                     mis.close();
-769                 }
-770             }
-771 
-772             // Then apply customized entries from the jar plugin; note: manifest encoding is UTF8
-773             mavenManifest.read( new ByteArrayInputStream( mavenManifestText.getBytes( "UTF8" ) ) );
-774 
-775             if ( !archiveConfig.isManifestSectionsEmpty() )
-776             {
-777                 /*
-778                  * Add customized manifest sections (for some reason MavenArchiver doesn't do this for us)
-779                  */
-780                 List sections = archiveConfig.getManifestSections();
-781                 for ( Iterator i = sections.iterator(); i.hasNext(); )
-782                 {
-783                     ManifestSection section = ( ManifestSection ) i.next();
-784                     Attributes attributes = new Attributes();
-785 
-786                     if ( !section.isManifestEntriesEmpty() )
-787                     {
-788                         Map entries = section.getManifestEntries();
-789                         for ( Iterator j = entries.entrySet().iterator(); j.hasNext(); )
-790                         {
-791                             Map.Entry entry = ( Map.Entry ) j.next();
-792                             attributes.putValue( ( String ) entry.getKey(), ( String ) entry.getValue() );
-793                         }
-794                     }
-795 
-796                     mavenManifest.getEntries().put( section.getName(), attributes );
-797                 }
-798             }
-799 
-800             Attributes mainMavenAttributes = mavenManifest.getMainAttributes();
-801             mainMavenAttributes.putValue( "Created-By", "Apache Maven Bundle Plugin" );
-802 
-803             String[] removeHeaders = builder.getProperty( Constants.REMOVEHEADERS, "" ).split( "," );
-804 
-805             // apply -removeheaders to the custom manifest
-806             for ( int i = 0; i < removeHeaders.length; i++ )
-807             {
-808                 for ( Iterator j = mainMavenAttributes.keySet().iterator(); j.hasNext(); )
-809                 {
-810                     if ( j.next().toString().matches( removeHeaders[i].trim() ) )
-811                     {
-812                         j.remove();
-813                     }
-814                 }
-815             }
-816 
-817             /*
-818              * Overlay generated bundle manifest with customized entries
-819              */
-820             Manifest bundleManifest = jar.getManifest();
-821             bundleManifest.getMainAttributes().putAll( mainMavenAttributes );
-822             bundleManifest.getEntries().putAll( mavenManifest.getEntries() );
-823 
-824             // adjust the import package attributes so that optional dependencies use
-825             // optional resolution.
-826             String importPackages = bundleManifest.getMainAttributes().getValue( "Import-Package" );
-827             if ( importPackages != null )
-828             {
-829                 Set optionalPackages = getOptionalPackages( currentProject );
-830 
-831                 Map<String, ? extends Map<String, String>> values = new Analyzer().parseHeader( importPackages );
-832                 for ( Map.Entry<String, ? extends Map<String, String>> entry : values.entrySet() )
-833                 {
-834                     String pkg = entry.getKey();
-835                     Map<String, String> options = entry.getValue();
-836                     if ( !options.containsKey( "resolution:" ) && optionalPackages.contains( pkg ) )
-837                     {
-838                         options.put( "resolution:", "optional" );
-839                     }
-840                 }
-841                 String result = Processor.printClauses( values );
-842                 bundleManifest.getMainAttributes().putValue( "Import-Package", result );
-843             }
-844 
-845             jar.setManifest( bundleManifest );
-846         }
-847         catch ( Exception e )
-848         {
-849             getLog().warn( "Unable to merge Maven manifest: " + e.getLocalizedMessage() );
-850         }
-851 
-852         if ( addMavenDescriptor )
-853         {
-854             doMavenMetadata( currentProject, jar );
-855         }
-856 
-857         if ( getLog().isDebugEnabled() )
-858         {
-859             getLog().debug( "Final Manifest:" + NL + dumpManifest( jar.getManifest(), new StringBuilder() ) );
-860         }
-861 
-862         builder.setJar( jar );
-863     }
-864 
-865 
-866     protected Set getOptionalPackages( MavenProject currentProject ) throws IOException, MojoExecutionException
-867     {
-868         ArrayList inscope = new ArrayList();
-869         final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() );
-870         for ( Iterator it = artifacts.iterator(); it.hasNext(); )
-871         {
-872             Artifact artifact = ( Artifact ) it.next();
-873             if ( artifact.getArtifactHandler().isAddedToClasspath() )
-874             {
-875                 if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
-876                 {
-877                     inscope.add( artifact );
-878                 }
-879             }
-880         }
-881 
-882         HashSet optionalArtifactIds = new HashSet();
-883         for ( Iterator it = inscope.iterator(); it.hasNext(); )
-884         {
-885             Artifact artifact = ( Artifact ) it.next();
-886             if ( artifact.isOptional() )
-887             {
-888                 String id = artifact.toString();
-889                 if ( artifact.getScope() != null )
-890                 {
-891                     // strip the scope...
-892                     id = id.replaceFirst( ":[^:]*$", "" );
-893                 }
-894                 optionalArtifactIds.add( id );
-895             }
-896 
-897         }
-898 
-899         HashSet required = new HashSet();
-900         HashSet optional = new HashSet();
-901         for ( Iterator it = inscope.iterator(); it.hasNext(); )
-902         {
-903             Artifact artifact = ( Artifact ) it.next();
-904             File file = getFile( artifact );
-905             if ( file == null )
-906             {
-907                 continue;
-908             }
-909 
-910             Jar jar = new Jar( artifact.getArtifactId(), file );
-911             if ( isTransitivelyOptional( optionalArtifactIds, artifact ) )
-912             {
-913                 optional.addAll( jar.getPackages() );
-914             }
-915             else
-916             {
-917                 required.addAll( jar.getPackages() );
-918             }
-919             jar.close();
-920         }
-921 
-922         optional.removeAll( required );
-923         return optional;
-924     }
-925 
-926 
-927     /**
-928      * Check to see if any dependency along the dependency trail of
-929      * the artifact is optional.
-930      *
-931      * @param artifact
-932      */
-933     protected boolean isTransitivelyOptional( HashSet optionalArtifactIds, Artifact artifact )
-934     {
-935         List trail = artifact.getDependencyTrail();
-936         for ( Iterator iterator = trail.iterator(); iterator.hasNext(); )
-937         {
-938             String next = ( String ) iterator.next();
-939             if ( optionalArtifactIds.contains( next ) )
-940             {
-941                 return true;
-942             }
-943         }
-944         return false;
-945     }
-946 
-947 
-948     private void unpackBundle( File jarFile )
-949     {
-950         File outputDir = getOutputDirectory();
-951         if ( null == outputDir )
-952         {
-953             outputDir = new File( getBuildDirectory(), "classes" );
-954         }
-955 
-956         try
-957         {
-958             /*
-959              * this directory must exist before unpacking, otherwise the plexus
-960              * unarchiver decides to use the current working directory instead!
-961              */
-962             if ( !outputDir.exists() )
-963             {
-964                 outputDir.mkdirs();
-965             }
-966 
-967             UnArchiver unArchiver = m_archiverManager.getUnArchiver( "jar" );
-968             unArchiver.setDestDirectory( outputDir );
-969             unArchiver.setSourceFile( jarFile );
-970             unArchiver.extract();
-971         }
-972         catch ( Exception e )
-973         {
-974             getLog().error( "Problem unpacking " + jarFile + " to " + outputDir, e );
-975         }
-976     }
-977 
-978 
-979     protected static String removeTagFromInstruction( String instruction, String tag )
-980     {
-981         StringBuffer buf = new StringBuffer();
-982 
-983         String[] clauses = instruction.split( "," );
-984         for ( int i = 0; i < clauses.length; i++ )
-985         {
-986             String clause = clauses[i].trim();
-987             if ( !tag.equals( clause ) )
-988             {
-989                 if ( buf.length() > 0 )
-990                 {
-991                     buf.append( ',' );
-992                 }
-993                 buf.append( clause );
-994             }
-995         }
-996 
-997         return buf.toString();
-998     }
-999 
-1000 
-1001     private static Map getProperties( Model projectModel, String prefix )
-1002     {
-1003         Map properties = new LinkedHashMap();
-1004         Method methods[] = Model.class.getDeclaredMethods();
-1005         for ( int i = 0; i < methods.length; i++ )
-1006         {
-1007             String name = methods[i].getName();
-1008             if ( name.startsWith( "get" ) )
-1009             {
-1010                 try
-1011                 {
-1012                     Object v = methods[i].invoke( projectModel, null );
-1013                     if ( v != null )
-1014                     {
-1015                         name = prefix + Character.toLowerCase( name.charAt( 3 ) ) + name.substring( 4 );
-1016                         if ( v.getClass().isArray() )
-1017                             properties.put( name, Arrays.asList( ( Object[] ) v ).toString() );
-1018                         else
-1019                             properties.put( name, v );
-1020 
-1021                     }
-1022                 }
-1023                 catch ( Exception e )
-1024                 {
-1025                     // too bad
-1026                 }
-1027             }
-1028         }
-1029         return properties;
-1030     }
-1031 
-1032 
-1033     private static StringBuffer printLicenses( List licenses )
-1034     {
-1035         if ( licenses == null || licenses.size() == 0 )
-1036             return null;
-1037         StringBuffer sb = new StringBuffer();
-1038         String del = "";
-1039         for ( Iterator i = licenses.iterator(); i.hasNext(); )
-1040         {
-1041             License l = ( License ) i.next();
-1042             String url = l.getUrl();
-1043             if ( url == null )
-1044                 continue;
-1045             sb.append( del );
-1046             sb.append( url );
-1047             del = ", ";
-1048         }
-1049         if ( sb.length() == 0 )
-1050             return null;
-1051         return sb;
-1052     }
-1053 
-1054 
-1055     /**
-1056      * @param jar
-1057      * @throws IOException
-1058      */
-1059     private void doMavenMetadata( MavenProject currentProject, Jar jar ) throws IOException
-1060     {
-1061         String path = "META-INF/maven/" + currentProject.getGroupId() + "/" + currentProject.getArtifactId();
-1062         File pomFile = new File( currentProject.getBasedir(), "pom.xml" );
-1063         jar.putResource( path + "/pom.xml", new FileResource( pomFile ) );
-1064 
-1065         Properties p = new Properties();
-1066         p.put( "version", currentProject.getVersion() );
-1067         p.put( "groupId", currentProject.getGroupId() );
-1068         p.put( "artifactId", currentProject.getArtifactId() );
-1069         ByteArrayOutputStream out = new ByteArrayOutputStream();
-1070         p.store( out, "Generated by org.apache.felix.bundleplugin" );
-1071         jar.putResource( path + "/pom.properties", new EmbeddedResource( out.toByteArray(), System.currentTimeMillis() ) );
-1072     }
-1073 
-1074 
-1075     protected Jar[] getClasspath( MavenProject currentProject ) throws IOException, MojoExecutionException
-1076     {
-1077         List list = new ArrayList();
-1078 
-1079         if ( getOutputDirectory() != null && getOutputDirectory().exists() )
-1080         {
-1081             list.add( new Jar( ".", getOutputDirectory() ) );
-1082         }
-1083 
-1084         final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() );
-1085         for ( Iterator it = artifacts.iterator(); it.hasNext(); )
-1086         {
-1087             Artifact artifact = ( Artifact ) it.next();
-1088             if ( artifact.getArtifactHandler().isAddedToClasspath() )
-1089             {
-1090                 if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
-1091                 {
-1092                     File file = getFile( artifact );
-1093                     if ( file == null )
-1094                     {
-1095                         getLog().warn(
-1096                             "File is not available for artifact " + artifact + " in project "
-1097                                 + currentProject.getArtifact() );
-1098                         continue;
-1099                     }
-1100                     Jar jar = new Jar( artifact.getArtifactId(), file );
-1101                     list.add( jar );
-1102                 }
-1103             }
-1104         }
-1105         Jar[] cp = new Jar[list.size()];
-1106         list.toArray( cp );
-1107         return cp;
-1108     }
-1109 
-1110 
-1111     private Collection getSelectedDependencies( Collection artifacts ) throws MojoExecutionException
-1112     {
-1113         if ( null == excludeDependencies || excludeDependencies.length() == 0 )
-1114         {
-1115             return artifacts;
-1116         }
-1117         else if ( "true".equalsIgnoreCase( excludeDependencies ) )
-1118         {
-1119             return Collections.EMPTY_LIST;
-1120         }
-1121 
-1122         Collection selectedDependencies = new LinkedHashSet( artifacts );
-1123         DependencyExcluder excluder = new DependencyExcluder( artifacts );
-1124         excluder.processHeaders( excludeDependencies );
-1125         selectedDependencies.removeAll( excluder.getExcludedArtifacts() );
-1126 
-1127         return selectedDependencies;
-1128     }
-1129 
-1130 
-1131     /**
-1132      * Get the file for an Artifact
-1133      *
-1134      * @param artifact
-1135      */
-1136     protected File getFile( Artifact artifact )
-1137     {
-1138         return artifact.getFile();
-1139     }
-1140 
-1141 
-1142     private static void header( Properties properties, String key, Object value )
-1143     {
-1144         if ( value == null )
-1145             return;
-1146 
-1147         if ( value instanceof Collection && ( ( Collection ) value ).isEmpty() )
-1148             return;
-1149 
-1150         properties.put( key, value.toString().replaceAll( "[\r\n]", "" ) );
-1151     }
-1152 
-1153 
-1154     /**
-1155      * Convert a Maven version into an OSGi compliant version
-1156      *
-1157      * @param version Maven version
-1158      * @return the OSGi version
-1159      */
-1160     protected String convertVersionToOsgi( String version )
-1161     {
-1162         return getMaven2OsgiConverter().getVersion( version );
-1163     }
-1164 
-1165 
-1166     /**
-1167      * TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )
-1168      */
-1169     protected String getBundleName( MavenProject currentProject )
-1170     {
-1171         String extension;
-1172         try
-1173         {
-1174             extension = currentProject.getArtifact().getArtifactHandler().getExtension();
-1175         }
-1176         catch ( Throwable e )
-1177         {
-1178             extension = currentProject.getArtifact().getType();
-1179         }
-1180         if ( StringUtils.isEmpty( extension ) || "bundle".equals( extension ) || "pom".equals( extension ) )
-1181         {
-1182             extension = "jar"; // just in case maven gets confused
-1183         }
-1184         if ( null != classifier && classifier.trim().length() > 0 )
-1185         {
-1186             return finalName + '-' + classifier + '.' + extension;
-1187         }
-1188         return finalName + '.' + extension;
-1189     }
-1190 
-1191 
-1192     protected String getBuildDirectory()
-1193     {
-1194         return buildDirectory;
-1195     }
-1196 
-1197 
-1198     protected void setBuildDirectory( String _buildirectory )
-1199     {
-1200         buildDirectory = _buildirectory;
-1201     }
-1202 
-1203 
-1204     protected Properties getDefaultProperties( MavenProject currentProject )
-1205     {
-1206         Properties properties = new Properties();
-1207 
-1208         String bsn;
-1209         try
-1210         {
-1211             bsn = getMaven2OsgiConverter().getBundleSymbolicName( currentProject.getArtifact() );
-1212         }
-1213         catch ( Exception e )
-1214         {
-1215             bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
-1216         }
-1217 
-1218         // Setup defaults
-1219         properties.put( MAVEN_SYMBOLICNAME, bsn );
-1220         properties.put( Analyzer.BUNDLE_SYMBOLICNAME, bsn );
-1221         properties.put( Analyzer.IMPORT_PACKAGE, "*" );
-1222         properties.put( Analyzer.BUNDLE_VERSION, getMaven2OsgiConverter().getVersion( currentProject.getVersion() ) );
-1223 
-1224         // remove the extraneous Include-Resource and Private-Package entries from generated manifest
-1225         properties.put( Constants.REMOVEHEADERS, Analyzer.INCLUDE_RESOURCE + ',' + Analyzer.PRIVATE_PACKAGE );
-1226 
-1227         header( properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription() );
-1228         StringBuffer licenseText = printLicenses( currentProject.getLicenses() );
-1229         if ( licenseText != null )
-1230         {
-1231             header( properties, Analyzer.BUNDLE_LICENSE, licenseText );
-1232         }
-1233         header( properties, Analyzer.BUNDLE_NAME, currentProject.getName() );
-1234 
-1235         if ( currentProject.getOrganization() != null )
-1236         {
-1237             if ( currentProject.getOrganization().getName() != null )
-1238             {
-1239                 String organizationName = currentProject.getOrganization().getName();
-1240                 header( properties, Analyzer.BUNDLE_VENDOR, organizationName );
-1241                 properties.put( "project.organization.name", organizationName );
-1242                 properties.put( "pom.organization.name", organizationName );
-1243             }
-1244             if ( currentProject.getOrganization().getUrl() != null )
-1245             {
-1246                 String organizationUrl = currentProject.getOrganization().getUrl();
-1247                 header( properties, Analyzer.BUNDLE_DOCURL, organizationUrl );
-1248                 properties.put( "project.organization.url", organizationUrl );
-1249                 properties.put( "pom.organization.url", organizationUrl );
-1250             }
-1251         }
-1252 
-1253         properties.putAll( currentProject.getProperties() );
-1254         properties.putAll( currentProject.getModel().getProperties() );
-1255 
-1256         for ( Iterator i = currentProject.getFilters().iterator(); i.hasNext(); )
-1257         {
-1258             File filterFile = new File( ( String ) i.next() );
-1259             if ( filterFile.isFile() )
-1260             {
-1261                 properties.putAll( PropertyUtils.loadProperties( filterFile ) );
-1262             }
-1263         }
-1264 
-1265         if ( m_mavenSession != null )
-1266         {
-1267             try
-1268             {
-1269                 // don't pass upper-case session settings to bnd as they end up in the manifest
-1270                 Properties sessionProperties = m_mavenSession.getExecutionProperties();
-1271                 for ( Enumeration e = sessionProperties.propertyNames(); e.hasMoreElements(); )
-1272                 {
-1273                     String key = ( String ) e.nextElement();
-1274                     if ( key.length() > 0 && !Character.isUpperCase( key.charAt( 0 ) ) )
-1275                     {
-1276                         properties.put( key, sessionProperties.getProperty( key ) );
-1277                     }
-1278                 }
-1279             }
-1280             catch ( Exception e )
-1281             {
-1282                 getLog().warn( "Problem with Maven session properties: " + e.getLocalizedMessage() );
-1283             }
-1284         }
-1285 
-1286         properties.putAll( getProperties( currentProject.getModel(), "project.build." ) );
-1287         properties.putAll( getProperties( currentProject.getModel(), "pom." ) );
-1288         properties.putAll( getProperties( currentProject.getModel(), "project." ) );
-1289 
-1290         properties.put( "project.baseDir", getBase( currentProject ) );
-1291         properties.put( "project.build.directory", getBuildDirectory() );
-1292         properties.put( "project.build.outputdirectory", getOutputDirectory() );
-1293 
-1294         properties.put( "classifier", classifier == null ? "" : classifier );
-1295 
-1296         // Add default plugins
-1297         header( properties, Analyzer.PLUGIN, ScrPlugin.class.getName() + ","
-1298                                            + BlueprintPlugin.class.getName() + ","
-1299                                            + SpringXMLType.class.getName() );
-1300 
-1301         return properties;
-1302     }
-1303 
-1304 
-1305     protected static File getBase( MavenProject currentProject )
-1306     {
-1307         return currentProject.getBasedir() != null ? currentProject.getBasedir() : new File( "" );
-1308     }
-1309 
-1310 
-1311     protected File getOutputDirectory()
-1312     {
-1313         return outputDirectory;
-1314     }
-1315 
-1316 
-1317     protected void setOutputDirectory( File _outputDirectory )
-1318     {
-1319         outputDirectory = _outputDirectory;
-1320     }
-1321 
-1322 
-1323     private static void addLocalPackages( File outputDirectory, Analyzer analyzer ) throws IOException
-1324     {
-1325         Packages packages = new Packages();
-1326 
-1327         if ( outputDirectory != null && outputDirectory.isDirectory() )
-1328         {
-1329             // scan classes directory for potential packages
-1330             DirectoryScanner scanner = new DirectoryScanner();
-1331             scanner.setBasedir( outputDirectory );
-1332             scanner.setIncludes( new String[]
-1333                 { "**/*.class" } );
-1334 
-1335             scanner.addDefaultExcludes();
-1336             scanner.scan();
-1337 
-1338             String[] paths = scanner.getIncludedFiles();
-1339             for ( int i = 0; i < paths.length; i++ )
-1340             {
-1341                 packages.put( analyzer.getPackageRef( getPackageName( paths[i] ) ) );
-1342             }
-1343         }
-1344 
-1345         Packages exportedPkgs = new Packages();
-1346         Packages privatePkgs = new Packages();
-1347 
-1348         boolean noprivatePackages = "!*".equals( analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) );
-1349 
-1350         for ( PackageRef pkg : packages.keySet() )
-1351         {
-1352             // mark all source packages as private by default (can be overridden by export list)
-1353             privatePkgs.put( pkg );
-1354 
-1355             // we can't export the default package (".") and we shouldn't export internal packages 
-1356             String fqn = pkg.getFQN();
-1357             if ( noprivatePackages || !( ".".equals( fqn ) || fqn.contains( ".internal" ) || fqn.contains( ".impl" ) ) )
-1358             {
-1359                 exportedPkgs.put( pkg );
-1360             }
-1361         }
-1362 
-1363         Properties properties = analyzer.getProperties();
-1364         String exported = properties.getProperty( Analyzer.EXPORT_PACKAGE );
-1365         if ( exported == null )
-1366         {
-1367             if ( !properties.containsKey( Analyzer.EXPORT_CONTENTS ) )
-1368             {
-1369                 // no -exportcontents overriding the exports, so use our computed list
-1370                 for ( Attrs attrs : exportedPkgs.values() )
-1371                 {
-1372                     attrs.put( Constants.SPLIT_PACKAGE_DIRECTIVE, "merge-first" );
-1373                 }
-1374                 properties.setProperty( Analyzer.EXPORT_PACKAGE, Processor.printClauses( exportedPkgs ) );
-1375             }
-1376             else
-1377             {
-1378                 // leave Export-Package empty (but non-null) as we have -exportcontents
-1379                 properties.setProperty( Analyzer.EXPORT_PACKAGE, "" );
-1380             }
-1381         }
-1382         else if ( exported.indexOf( LOCAL_PACKAGES ) >= 0 )
-1383         {
-1384             String newExported = StringUtils.replace( exported, LOCAL_PACKAGES, Processor.printClauses( exportedPkgs ) );
-1385             properties.setProperty( Analyzer.EXPORT_PACKAGE, newExported );
-1386         }
-1387 
-1388         String internal = properties.getProperty( Analyzer.PRIVATE_PACKAGE );
-1389         if ( internal == null )
-1390         {
-1391             if ( !privatePkgs.isEmpty() )
-1392             {
-1393                 for ( Attrs attrs : privatePkgs.values() )
-1394                 {
-1395                     attrs.put( Constants.SPLIT_PACKAGE_DIRECTIVE, "merge-first" );
-1396                 }
-1397                 properties.setProperty( Analyzer.PRIVATE_PACKAGE, Processor.printClauses( privatePkgs ) );
-1398             }
-1399             else
-1400             {
-1401                 // if there are really no private packages then use "!*" as this will keep the Bnd Tool happy
-1402                 properties.setProperty( Analyzer.PRIVATE_PACKAGE, "!*" );
-1403             }
-1404         }
-1405         else if ( internal.indexOf( LOCAL_PACKAGES ) >= 0 )
-1406         {
-1407             String newInternal = StringUtils.replace( internal, LOCAL_PACKAGES, Processor.printClauses( privatePkgs ) );
-1408             properties.setProperty( Analyzer.PRIVATE_PACKAGE, newInternal );
-1409         }
-1410     }
-1411 
-1412 
-1413     private static String getPackageName( String filename )
-1414     {
-1415         int n = filename.lastIndexOf( File.separatorChar );
-1416         return n < 0 ? "." : filename.substring( 0, n ).replace( File.separatorChar, '.' );
-1417     }
-1418 
-1419 
-1420     private static List getMavenResources( MavenProject currentProject, boolean test )
-1421     {
-1422         List resources = new ArrayList( test ? currentProject.getTestResources() : currentProject.getResources() );
-1423 
-1424         if ( currentProject.getCompileSourceRoots() != null )
-1425         {
-1426             // also scan for any "packageinfo" files lurking in the source folders
-1427             List packageInfoIncludes = Collections.singletonList( "**/packageinfo" );
-1428             for ( Iterator i = currentProject.getCompileSourceRoots().iterator(); i.hasNext(); )
-1429             {
-1430                 String sourceRoot = ( String ) i.next();
-1431                 Resource packageInfoResource = new Resource();
-1432                 packageInfoResource.setDirectory( sourceRoot );
-1433                 packageInfoResource.setIncludes( packageInfoIncludes );
-1434                 resources.add( packageInfoResource );
-1435             }
-1436         }
-1437 
-1438         return resources;
-1439     }
-1440 
-1441 
-1442     protected static String getMavenResourcePaths( MavenProject currentProject, boolean test )
-1443     {
-1444         final String basePath = currentProject.getBasedir().getAbsolutePath();
-1445 
-1446         Set pathSet = new LinkedHashSet();
-1447         for ( Iterator i = getMavenResources( currentProject, test ).iterator(); i.hasNext(); )
-1448         {
-1449             Resource resource = ( Resource ) i.next();
-1450 
-1451             final String sourcePath = resource.getDirectory();
-1452             final String targetPath = resource.getTargetPath();
-1453 
-1454             // ignore empty or non-local resources
-1455             if ( new File( sourcePath ).exists() && ( ( targetPath == null ) || ( targetPath.indexOf( ".." ) < 0 ) ) )
-1456             {
-1457                 DirectoryScanner scanner = new DirectoryScanner();
-1458 
-1459                 scanner.setBasedir( sourcePath );
-1460                 if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
-1461                 {
-1462                     scanner.setIncludes( ( String[] ) resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) );
-1463                 }
-1464                 else
-1465                 {
-1466                     scanner.setIncludes( DEFAULT_INCLUDES );
-1467                 }
-1468 
-1469                 if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
-1470                 {
-1471                     scanner.setExcludes( ( String[] ) resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) );
-1472                 }
-1473 
-1474                 scanner.addDefaultExcludes();
-1475                 scanner.scan();
-1476 
-1477                 List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
-1478 
-1479                 for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
-1480                 {
-1481                     String name = ( String ) j.next();
-1482                     String path = sourcePath + '/' + name;
-1483 
-1484                     // make relative to project
-1485                     if ( path.startsWith( basePath ) )
-1486                     {
-1487                         if ( path.length() == basePath.length() )
-1488                         {
-1489                             path = ".";
-1490                         }
-1491                         else
-1492                         {
-1493                             path = path.substring( basePath.length() + 1 );
-1494                         }
-1495                     }
-1496 
-1497                     // replace windows backslash with a slash
-1498                     // this is a workaround for a problem with bnd 0.0.189
-1499                     if ( File.separatorChar != '/' )
-1500                     {
-1501                         name = name.replace( File.separatorChar, '/' );
-1502                         path = path.replace( File.separatorChar, '/' );
-1503                     }
-1504 
-1505                     // copy to correct place
-1506                     path = name + '=' + path;
-1507                     if ( targetPath != null )
-1508                     {
-1509                         path = targetPath + '/' + path;
-1510                     }
-1511 
-1512                     // use Bnd filtering?
-1513                     if ( resource.isFiltering() )
-1514                     {
-1515                         path = '{' + path + '}';
-1516                     }
-1517 
-1518                     pathSet.add( path );
-1519                 }
-1520             }
-1521         }
-1522 
-1523         StringBuffer resourcePaths = new StringBuffer();
-1524         for ( Iterator i = pathSet.iterator(); i.hasNext(); )
-1525         {
-1526             resourcePaths.append( i.next() );
-1527             if ( i.hasNext() )
-1528             {
-1529                 resourcePaths.append( ',' );
-1530             }
-1531         }
-1532 
-1533         return resourcePaths.toString();
-1534     }
-1535 
-1536 
-1537     protected Collection getEmbeddableArtifacts( MavenProject currentProject, Analyzer analyzer )
-1538         throws MojoExecutionException
-1539     {
-1540         final Collection artifacts;
-1541 
-1542         String embedTransitive = analyzer.getProperty( DependencyEmbedder.EMBED_TRANSITIVE );
-1543         if ( Boolean.valueOf( embedTransitive ).booleanValue() )
-1544         {
-1545             // includes transitive dependencies
-1546             artifacts = currentProject.getArtifacts();
-1547         }
-1548         else
-1549         {
-1550             // only includes direct dependencies
-1551             artifacts = currentProject.getDependencyArtifacts();
-1552         }
-1553 
-1554         return getSelectedDependencies( artifacts );
-1555     }
-1556 
-1557 
-1558     protected static void addMavenSourcePath( MavenProject currentProject, Analyzer analyzer, Log log )
-1559     {
-1560         // pass maven source paths onto BND analyzer
-1561         StringBuilder mavenSourcePaths = new StringBuilder();
-1562         StringBuilder mavenTestSourcePaths = new StringBuilder();
-1563         Map<StringBuilder, List<?>> map = new HashMap<StringBuilder, List<?>>(2);
-1564         map.put(mavenSourcePaths, currentProject.getCompileSourceRoots() );
-1565         map.put(mavenTestSourcePaths, currentProject.getTestCompileSourceRoots() );
-1566         for ( Map.Entry<StringBuilder, List<?>> entry : map.entrySet() )
-1567         {
-1568             List<?> compileSourceRoots = entry.getValue();
-1569             if ( compileSourceRoots != null )
-1570             {
-1571                 StringBuilder sourcePaths = entry.getKey();
-1572                 for ( Iterator i = compileSourceRoots.iterator(); i.hasNext(); )
-1573                 {
-1574                     if ( sourcePaths.length() > 0 )
-1575                     {
-1576                         sourcePaths.append( ',' );
-1577                     }
-1578                     sourcePaths.append( ( String ) i.next() );
-1579                 }
-1580             }
-1581         }
-1582         final String sourcePath = analyzer.getProperty( Analyzer.SOURCEPATH );
-1583         if ( sourcePath != null )
-1584         {
-1585             if ( sourcePath.contains(MAVEN_SOURCES) || sourcePath.contains(MAVEN_TEST_RESOURCES) )
-1586             {
-1587                 String combinedSource = StringUtils.replace( sourcePath, MAVEN_SOURCES, mavenSourcePaths.toString() );
-1588                 combinedSource = StringUtils.replace( combinedSource, MAVEN_TEST_SOURCES, mavenTestSourcePaths.toString() );
-1589                 if ( combinedSource.length() > 0 )
-1590                 {
-1591                     analyzer.setProperty( Analyzer.SOURCEPATH, combinedSource );
-1592                 }
-1593                 else
-1594                 {
-1595                     analyzer.unsetProperty( Analyzer.SOURCEPATH );
-1596                 }
-1597             }
-1598             else if ( mavenSourcePaths.length() > 0 )
-1599             {
-1600                 log.warn( Analyzer.SOURCEPATH + ": overriding " + mavenSourcePaths + " with " + sourcePath + " (add "
-1601                     + MAVEN_SOURCES + " if you want to include the maven sources)" );
-1602             }
-1603             else if ( mavenTestSourcePaths.length() > 0 )
-1604             {
-1605                 log.warn( Analyzer.SOURCEPATH + ": overriding " + mavenTestSourcePaths + " with " + sourcePath + " (add "
-1606                         + MAVEN_TEST_SOURCES + " if you want to include the maven sources)" );
-1607             }
-1608         }
-1609         else if ( mavenSourcePaths.length() > 0 )
-1610         {
-1611             analyzer.setProperty( Analyzer.SOURCEPATH, mavenSourcePaths.toString() );
-1612         }
-1613     }
-1614 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,326 +0,0 @@ - - - - -DependencyEmbedder xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.util.Collection;
-24  import java.util.Iterator;
-25  import java.util.LinkedHashSet;
-26  
-27  import org.apache.maven.artifact.Artifact;
-28  import org.apache.maven.plugin.MojoExecutionException;
-29  import org.apache.maven.plugin.logging.Log;
-30  import org.codehaus.plexus.util.StringUtils;
-31  
-32  import aQute.bnd.osgi.Analyzer;
-33  
-34  
-35  /**
-36   * Add BND directives to embed selected dependencies inside a bundle
-37   * 
-38   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-39   */
-40  public final class DependencyEmbedder extends AbstractDependencyFilter
-41  {
-42      public static final String EMBED_DEPENDENCY = "Embed-Dependency";
-43      public static final String EMBED_DIRECTORY = "Embed-Directory";
-44      public static final String EMBED_STRIP_GROUP = "Embed-StripGroup";
-45      public static final String EMBED_STRIP_VERSION = "Embed-StripVersion";
-46      public static final String EMBED_TRANSITIVE = "Embed-Transitive";
-47  
-48      public static final String EMBEDDED_ARTIFACTS = "Embedded-Artifacts";
-49  
-50      private static final String MAVEN_DEPENDENCIES = "{maven-dependencies}";
-51  
-52      private String m_embedDirectory;
-53      private String m_embedStripGroup;
-54      private String m_embedStripVersion;
-55  
-56      /**
-57       * Maven logger.
-58       */
-59      private final Log m_log;
-60  
-61      /**
-62       * Inlined paths.
-63       */
-64      private final Collection m_inlinedPaths;
-65  
-66      /**
-67       * Embedded artifacts.
-68       */
-69      private final Collection m_embeddedArtifacts;
-70  
-71  
-72      public DependencyEmbedder( Log log, Collection dependencyArtifacts )
-73      {
-74          super( dependencyArtifacts );
-75  
-76          m_log = log;
-77  
-78          m_inlinedPaths = new LinkedHashSet();
-79          m_embeddedArtifacts = new LinkedHashSet();
-80      }
-81  
-82  
-83      public void processHeaders( Analyzer analyzer ) throws MojoExecutionException
-84      {
-85          StringBuffer includeResource = new StringBuffer();
-86          StringBuffer bundleClassPath = new StringBuffer();
-87          StringBuffer embeddedArtifacts = new StringBuffer();
-88  
-89          m_inlinedPaths.clear();
-90          m_embeddedArtifacts.clear();
-91  
-92          String embedDependencyHeader = analyzer.getProperty( EMBED_DEPENDENCY );
-93          if ( StringUtils.isNotEmpty( embedDependencyHeader ) )
-94          {
-95              m_embedDirectory = analyzer.getProperty( EMBED_DIRECTORY );
-96              m_embedStripGroup = analyzer.getProperty( EMBED_STRIP_GROUP, "true" );
-97              m_embedStripVersion = analyzer.getProperty( EMBED_STRIP_VERSION );
-98  
-99              processInstructions( embedDependencyHeader );
-100 
-101             for ( Iterator i = m_inlinedPaths.iterator(); i.hasNext(); )
-102             {
-103                 inlineDependency( ( String ) i.next(), includeResource );
-104             }
-105             for ( Iterator i = m_embeddedArtifacts.iterator(); i.hasNext(); )
-106             {
-107                 embedDependency( ( Artifact ) i.next(), includeResource, bundleClassPath, embeddedArtifacts );
-108             }
-109         }
-110 
-111         if ( analyzer.getProperty( Analyzer.WAB ) == null && bundleClassPath.length() > 0 )
-112         {
-113             // set explicit default before merging dependency classpath
-114             if ( analyzer.getProperty( Analyzer.BUNDLE_CLASSPATH ) == null )
-115             {
-116                 analyzer.setProperty( Analyzer.BUNDLE_CLASSPATH, "." );
-117             }
-118         }
-119 
-120         appendDependencies( analyzer, Analyzer.INCLUDE_RESOURCE, includeResource.toString() );
-121         appendDependencies( analyzer, Analyzer.BUNDLE_CLASSPATH, bundleClassPath.toString() );
-122         appendDependencies( analyzer, EMBEDDED_ARTIFACTS, embeddedArtifacts.toString() );
-123     }
-124 
-125 
-126     @Override
-127     protected void processDependencies( Collection dependencies, String inline )
-128     {
-129         if ( null == inline || "false".equalsIgnoreCase( inline ) )
-130         {
-131             m_embeddedArtifacts.addAll( dependencies );
-132         }
-133         else
-134         {
-135             for ( Iterator i = dependencies.iterator(); i.hasNext(); )
-136             {
-137                 addInlinedPaths( ( Artifact ) i.next(), inline, m_inlinedPaths );
-138             }
-139         }
-140     }
-141 
-142 
-143     private static void addInlinedPaths( Artifact dependency, String inline, Collection inlinedPaths )
-144     {
-145         File path = dependency.getFile();
-146         if ( null != path && path.exists() )
-147         {
-148             if ( "true".equalsIgnoreCase( inline ) || inline.length() == 0 )
-149             {
-150                 inlinedPaths.add( path.getPath() );
-151             }
-152             else
-153             {
-154                 String[] filters = inline.split( "\\|" );
-155                 for ( int i = 0; i < filters.length; i++ )
-156                 {
-157                     if ( filters[i].length() > 0 )
-158                     {
-159                         inlinedPaths.add( path + "!/" + filters[i] );
-160                     }
-161                 }
-162             }
-163         }
-164     }
-165 
-166 
-167     private void embedDependency( Artifact dependency, StringBuffer includeResource, StringBuffer bundleClassPath,
-168         StringBuffer embeddedArtifacts )
-169     {
-170         File sourceFile = dependency.getFile();
-171         if ( null != sourceFile && sourceFile.exists() )
-172         {
-173             String embedDirectory = m_embedDirectory;
-174             if ( "".equals( embedDirectory ) || ".".equals( embedDirectory ) )
-175             {
-176                 embedDirectory = null;
-177             }
-178 
-179             if ( false == Boolean.valueOf( m_embedStripGroup ).booleanValue() )
-180             {
-181                 embedDirectory = new File( embedDirectory, dependency.getGroupId() ).getPath();
-182             }
-183 
-184             StringBuffer targetFileName = new StringBuffer();
-185             targetFileName.append( dependency.getArtifactId() );
-186             if ( false == Boolean.valueOf( m_embedStripVersion ).booleanValue() )
-187             {
-188                 targetFileName.append( '-' ).append( dependency.getVersion() );
-189                 if ( StringUtils.isNotEmpty( dependency.getClassifier() ) )
-190                 {
-191                     targetFileName.append( '-' ).append( dependency.getClassifier() );
-192                 }
-193             }
-194             String extension = dependency.getArtifactHandler().getExtension();
-195             if ( StringUtils.isNotEmpty( extension ) )
-196             {
-197                 targetFileName.append( '.' ).append( extension );
-198             }
-199 
-200             File targetFile = new File( embedDirectory, targetFileName.toString() );
-201 
-202             String targetFilePath = targetFile.getPath();
-203 
-204             // replace windows backslash with a slash
-205             if ( File.separatorChar != '/' )
-206             {
-207                 targetFilePath = targetFilePath.replace( File.separatorChar, '/' );
-208             }
-209 
-210             if ( includeResource.length() > 0 )
-211             {
-212                 includeResource.append( ',' );
-213             }
-214 
-215             includeResource.append( targetFilePath );
-216             includeResource.append( '=' );
-217             includeResource.append( sourceFile );
-218 
-219             if ( bundleClassPath.length() > 0 )
-220             {
-221                 bundleClassPath.append( ',' );
-222             }
-223 
-224             bundleClassPath.append( targetFilePath );
-225 
-226             if ( embeddedArtifacts.length() > 0 )
-227             {
-228                 embeddedArtifacts.append( ',' );
-229             }
-230 
-231             embeddedArtifacts.append( targetFilePath ).append( ';' );
-232             embeddedArtifacts.append( "g=\"" ).append( dependency.getGroupId() ).append( '"' );
-233             embeddedArtifacts.append( ";a=\"" ).append( dependency.getArtifactId() ).append( '"' );
-234             embeddedArtifacts.append( ";v=\"" ).append( dependency.getBaseVersion() ).append( '"' );
-235             if ( StringUtils.isNotEmpty( dependency.getClassifier() ) )
-236             {
-237                 embeddedArtifacts.append( ";c=\"" ).append( dependency.getClassifier() ).append( '"' );
-238             }
-239         }
-240     }
-241 
-242 
-243     private static void inlineDependency( String path, StringBuffer includeResource )
-244     {
-245         if ( includeResource.length() > 0 )
-246         {
-247             includeResource.append( ',' );
-248         }
-249 
-250         includeResource.append( '@' );
-251         includeResource.append( path );
-252     }
-253 
-254 
-255     public Collection getInlinedPaths()
-256     {
-257         return m_inlinedPaths;
-258     }
-259 
-260 
-261     public Collection getEmbeddedArtifacts()
-262     {
-263         return m_embeddedArtifacts;
-264     }
-265 
-266 
-267     private static void appendDependencies( Analyzer analyzer, String directiveName, String mavenDependencies )
-268     {
-269         /*
-270          * similar algorithm to {maven-resources} but default behaviour here is to append rather than override
-271          */
-272         final String instruction = analyzer.getProperty( directiveName );
-273         if ( StringUtils.isNotEmpty( instruction ) )
-274         {
-275             if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 )
-276             {
-277                 // if there are no embeddded dependencies, we do a special treatment and replace
-278                 // every occurance of MAVEN_DEPENDENCIES and a following comma with an empty string
-279                 if ( mavenDependencies.length() == 0 )
-280                 {
-281                     String cleanInstruction = BundlePlugin.removeTagFromInstruction( instruction, MAVEN_DEPENDENCIES );
-282                     analyzer.setProperty( directiveName, cleanInstruction );
-283                 }
-284                 else
-285                 {
-286                     String mergedInstruction = StringUtils.replace( instruction, MAVEN_DEPENDENCIES, mavenDependencies );
-287                     analyzer.setProperty( directiveName, mergedInstruction );
-288                 }
-289             }
-290             else if ( mavenDependencies.length() > 0 )
-291             {
-292                 if ( Analyzer.INCLUDE_RESOURCE.equalsIgnoreCase( directiveName ) )
-293                 {
-294                     // dependencies should be prepended so they can be overwritten by local resources
-295                     analyzer.setProperty( directiveName, mavenDependencies + ',' + instruction );
-296                 }
-297                 else
-298                 // Analyzer.BUNDLE_CLASSPATH
-299                 {
-300                     // for the classpath we want dependencies to be appended after local entries
-301                     analyzer.setProperty( directiveName, instruction + ',' + mavenDependencies );
-302                 }
-303             }
-304             // otherwise leave instruction unchanged
-305         }
-306         else if ( mavenDependencies.length() > 0 )
-307         {
-308             analyzer.setProperty( directiveName, mavenDependencies );
-309         }
-310         // otherwise leave instruction unchanged
-311     }
-312 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/DependencyExcluder.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/DependencyExcluder.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/DependencyExcluder.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/DependencyExcluder.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ - - - - -DependencyExcluder xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.util.Collection;
-23  import java.util.HashSet;
-24  
-25  import org.apache.maven.plugin.MojoExecutionException;
-26  
-27  
-28  /**
-29   * Exclude selected dependencies from the classpath passed to BND.
-30   * 
-31   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-32   */
-33  public final class DependencyExcluder extends AbstractDependencyFilter
-34  {
-35      /**
-36       * Excluded artifacts.
-37       */
-38      private final Collection m_excludedArtifacts;
-39  
-40  
-41      public DependencyExcluder( Collection dependencyArtifacts )
-42      {
-43          super( dependencyArtifacts );
-44  
-45          m_excludedArtifacts = new HashSet();
-46      }
-47  
-48  
-49      public void processHeaders( String excludeDependencies ) throws MojoExecutionException
-50      {
-51          m_excludedArtifacts.clear();
-52  
-53          if ( null != excludeDependencies && excludeDependencies.length() > 0 )
-54          {
-55              processInstructions( excludeDependencies );
-56          }
-57      }
-58  
-59  
-60      @Override
-61      protected void processDependencies( Collection dependencies, String inline )
-62      {
-63          m_excludedArtifacts.addAll( dependencies );
-64      }
-65  
-66  
-67      public Collection getExcludedArtifacts()
-68      {
-69          return m_excludedArtifacts;
-70      }
-71  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ - - - - -InstructionsPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FileNotFoundException;
-24  import java.io.IOException;
-25  import java.util.Map;
-26  import java.util.Properties;
-27  
-28  import org.apache.maven.plugin.MojoExecutionException;
-29  import org.apache.maven.plugin.MojoFailureException;
-30  import org.apache.maven.project.MavenProject;
-31  
-32  import aQute.bnd.osgi.Jar;
-33  
-34  
-35  /**
-36   * Generate BND instructions for this project
-37   * 
-38   * @goal instructions
-39   * @requiresDependencyResolution test
-40   * @threadSafe
-41   */
-42  public class InstructionsPlugin extends BundlePlugin
-43  {
-44      protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
-45          throws MojoExecutionException
-46      {
-47          if ( dumpInstructions == null )
-48          {
-49              dumpInstructions = new File( getBuildDirectory(), "instructions.bnd" );
-50          }
-51  
-52          try
-53          {
-54              addMavenInstructions( project, getOSGiBuilder( project, instructions, properties, classpath ) );
-55          }
-56          catch ( FileNotFoundException e )
-57          {
-58              throw new MojoExecutionException( "Cannot find " + e.getMessage(), e );
-59          }
-60          catch ( IOException e )
-61          {
-62              throw new MojoExecutionException( "Error trying to generate instructions", e );
-63          }
-64          catch ( MojoFailureException e )
-65          {
-66              getLog().error( e.getLocalizedMessage() );
-67              throw new MojoExecutionException( "Error(s) found in instructions", e );
-68          }
-69          catch ( Exception e )
-70          {
-71              getLog().error( "An internal error occurred", e );
-72              throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
-73          }
-74      }
-75  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ - - - - -JarPluginConfiguration xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import org.apache.maven.archiver.MavenArchiveConfiguration;
-23  import org.apache.maven.project.MavenProject;
-24  import org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter;
-25  import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
-26  import org.codehaus.plexus.component.configurator.converters.lookup.DefaultConverterLookup;
-27  import org.codehaus.plexus.component.configurator.expression.DefaultExpressionEvaluator;
-28  import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
-29  import org.codehaus.plexus.configuration.PlexusConfiguration;
-30  import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
-31  import org.codehaus.plexus.util.xml.Xpp3Dom;
-32  
-33  
-34  /**
-35   * Provide access to the archive configuration from the jar plugin
-36   * 
-37   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-38   */
-39  public final class JarPluginConfiguration
-40  {
-41      public static MavenArchiveConfiguration getArchiveConfiguration( MavenProject project )
-42      {
-43          MavenArchiveConfiguration archiveConfig = new MavenArchiveConfiguration();
-44  
-45          try
-46          {
-47              ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter();
-48              ClassLoader loader = JarPluginConfiguration.class.getClassLoader();
-49              ExpressionEvaluator evaluator = new DefaultExpressionEvaluator();
-50              ConverterLookup converters = new DefaultConverterLookup();
-51  
-52              PlexusConfiguration settings = null;
-53  
-54              try
-55              {
-56                  // first look for bundle specific archive settings
-57                  settings = getPluginConfiguration( project, "org.apache.felix", "maven-bundle-plugin" );
-58                  settings = settings.getChild( "archive" );
-59              }
-60              catch ( Exception e )
-61              {
-62              }
-63  
-64              // if it's empty fall back to the jar archive settings
-65              if ( null == settings || settings.getChildCount() == 0 )
-66              {
-67                  settings = getCorePluginConfiguration( project, "jar" );
-68                  settings = settings.getChild( "archive" );
-69              }
-70  
-71              converter.processConfiguration( converters, archiveConfig, loader, settings, evaluator, null );
-72          }
-73          catch ( Exception e )
-74          {
-75              // ignore and return empty configuration...
-76          }
-77  
-78          return archiveConfig;
-79      }
-80  
-81  
-82      private static PlexusConfiguration getCorePluginConfiguration( MavenProject project, String pluginName )
-83      {
-84          return getPluginConfiguration( project, "org.apache.maven.plugins", "maven-" + pluginName + "-plugin" );
-85      }
-86  
-87  
-88      private static PlexusConfiguration getPluginConfiguration( MavenProject project, String groupId, String artifactId )
-89      {
-90          Xpp3Dom pluginConfig = project.getGoalConfiguration( groupId, artifactId, null, null );
-91  
-92          return new XmlPlexusConfiguration( pluginConfig );
-93      }
-94  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/ManifestPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/ManifestPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/ManifestPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/ManifestPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ - - - - -ManifestPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FileNotFoundException;
-24  import java.io.FileOutputStream;
-25  import java.io.IOException;
-26  import java.io.OutputStream;
-27  import java.util.Iterator;
-28  import java.util.LinkedHashMap;
-29  import java.util.Map;
-30  import java.util.Map.Entry;
-31  import java.util.Properties;
-32  import java.util.jar.Manifest;
-33  
-34  import org.apache.maven.plugin.MojoExecutionException;
-35  import org.apache.maven.plugin.MojoFailureException;
-36  import org.apache.maven.project.MavenProject;
-37  
-38  import aQute.bnd.osgi.Analyzer;
-39  import aQute.bnd.osgi.Builder;
-40  import aQute.bnd.osgi.Jar;
-41  import aQute.bnd.osgi.Resource;
-42  
-43  
-44  /**
-45   * Generate an OSGi manifest for this project
-46   * 
-47   * @goal manifest
-48   * @phase process-classes
-49   * @requiresDependencyResolution test
-50   * @threadSafe
-51   */
-52  public class ManifestPlugin extends BundlePlugin
-53  {
-54      /**
-55       * When true, generate the manifest by rebuilding the full bundle in memory 
-56       *
-57       * @parameter expression="${rebuildBundle}"
-58       */
-59      protected boolean rebuildBundle;
-60  
-61  
-62      @Override
-63      protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
-64          throws MojoExecutionException
-65      {
-66          Manifest manifest;
-67          try
-68          {
-69              manifest = getManifest( project, instructions, properties, classpath );
-70          }
-71          catch ( FileNotFoundException e )
-72          {
-73              throw new MojoExecutionException( "Cannot find " + e.getMessage()
-74                  + " (manifest goal must be run after compile phase)", e );
-75          }
-76          catch ( IOException e )
-77          {
-78              throw new MojoExecutionException( "Error trying to generate Manifest", e );
-79          }
-80          catch ( MojoFailureException e )
-81          {
-82              getLog().error( e.getLocalizedMessage() );
-83              throw new MojoExecutionException( "Error(s) found in manifest configuration", e );
-84          }
-85          catch ( Exception e )
-86          {
-87              getLog().error( "An internal error occurred", e );
-88              throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
-89          }
-90  
-91          File outputFile = new File( manifestLocation, "MANIFEST.MF" );
-92  
-93          try
-94          {
-95              writeManifest( manifest, outputFile );
-96          }
-97          catch ( IOException e )
-98          {
-99              throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e );
-100         }
-101     }
-102 
-103 
-104     public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException, MojoFailureException,
-105         MojoExecutionException, Exception
-106     {
-107         return getManifest( project, new LinkedHashMap(), new Properties(), classpath );
-108     }
-109 
-110 
-111     public Manifest getManifest( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
-112         throws IOException, MojoFailureException, MojoExecutionException, Exception
-113     {
-114         Analyzer analyzer = getAnalyzer( project, instructions, properties, classpath );
-115         boolean hasErrors = reportErrors( "Manifest " + project.getArtifact(), analyzer );
-116         if ( hasErrors )
-117         {
-118             String failok = analyzer.getProperty( "-failok" );
-119             if ( null == failok || "false".equalsIgnoreCase( failok ) )
-120             {
-121                 throw new MojoFailureException( "Error(s) found in manifest configuration" );
-122             }
-123         }
-124 
-125         Jar jar = analyzer.getJar();
-126 
-127         if ( unpackBundle )
-128         {
-129             File outputFile = getOutputDirectory();
-130             for ( Entry<String, Resource> entry : jar.getResources().entrySet() )
-131             {
-132                 File entryFile = new File( outputFile, entry.getKey() );
-133                 if ( !entryFile.exists() || entry.getValue().lastModified() == 0 )
-134                 {
-135                     entryFile.getParentFile().mkdirs();
-136                     OutputStream os = new FileOutputStream( entryFile );
-137                     entry.getValue().write( os );
-138                     os.close();
-139                 }
-140             }
-141         }
-142 
-143         Manifest manifest = jar.getManifest();
-144 
-145         // cleanup...
-146         analyzer.close();
-147 
-148         return manifest;
-149     }
-150 
-151 
-152     protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath ) throws IOException, MojoExecutionException,
-153         Exception
-154     {
-155         return getAnalyzer( project, new LinkedHashMap(), new Properties(), classpath );
-156     }
-157 
-158 
-159     protected Analyzer getAnalyzer( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
-160         throws IOException, MojoExecutionException, Exception
-161     {
-162         if ( rebuildBundle && supportedProjectTypes.contains( project.getArtifact().getType() ) )
-163         {
-164             return buildOSGiBundle( project, instructions, properties, classpath );
-165         }
-166 
-167         File file = getOutputDirectory();
-168         if ( file == null )
-169         {
-170             file = project.getArtifact().getFile();
-171         }
-172 
-173         if ( !file.exists() )
-174         {
-175             if ( file.equals( getOutputDirectory() ) )
-176             {
-177                 file.mkdirs();
-178             }
-179             else
-180             {
-181                 throw new FileNotFoundException( file.getPath() );
-182             }
-183         }
-184 
-185         Builder analyzer = getOSGiBuilder( project, instructions, properties, classpath );
-186 
-187         analyzer.setJar( file );
-188 
-189         // calculateExportsFromContents when we have no explicit instructions defining
-190         // the contents of the bundle *and* we are not analyzing the output directory,
-191         // otherwise fall-back to addMavenInstructions approach
-192 
-193         boolean isOutputDirectory = file.equals( getOutputDirectory() );
-194 
-195         if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null
-196             && analyzer.getProperty( Analyzer.EXPORT_CONTENTS ) == null
-197             && analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) == null && !isOutputDirectory )
-198         {
-199             String export = calculateExportsFromContents( analyzer.getJar() );
-200             analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
-201         }
-202 
-203         addMavenInstructions( project, analyzer );
-204 
-205         // if we spot Embed-Dependency and the bundle is "target/classes", assume we need to rebuild
-206         if ( analyzer.getProperty( DependencyEmbedder.EMBED_DEPENDENCY ) != null && isOutputDirectory )
-207         {
-208             analyzer.build();
-209         }
-210         else
-211         {
-212             analyzer.mergeManifest( analyzer.getJar().getManifest() );
-213             analyzer.getJar().setManifest( analyzer.calcManifest() );
-214         }
-215 
-216         mergeMavenManifest( project, analyzer );
-217 
-218         return analyzer;
-219     }
-220 
-221 
-222     public static void writeManifest( Manifest manifest, File outputFile ) throws IOException
-223     {
-224         outputFile.getParentFile().mkdirs();
-225 
-226         FileOutputStream os;
-227         os = new FileOutputStream( outputFile );
-228         try
-229         {
-230             Jar.writeManifest( manifest, os );
-231         }
-232         finally
-233         {
-234             try
-235             {
-236                 os.close();
-237             }
-238             catch ( IOException e )
-239             {
-240                 // nothing we can do here
-241             }
-242         }
-243     }
-244 
-245 
-246     /*
-247      * Patched version of bnd's Analyzer.calculateExportsFromContents
-248      */
-249     public static String calculateExportsFromContents( Jar bundle )
-250     {
-251         String ddel = "";
-252         StringBuffer sb = new StringBuffer();
-253         Map<String, Map<String, Resource>> map = bundle.getDirectories();
-254         for ( Iterator<Entry<String, Map<String, Resource>>> i = map.entrySet().iterator(); i.hasNext(); )
-255         {
-256             //----------------------------------------------------
-257             // should also ignore directories with no resources
-258             //----------------------------------------------------
-259             Entry<String, Map<String, Resource>> entry = i.next();
-260             if ( entry.getValue() == null || entry.getValue().isEmpty() )
-261                 continue;
-262             //----------------------------------------------------
-263             String directory = entry.getKey();
-264             if ( directory.equals( "META-INF" ) || directory.startsWith( "META-INF/" ) )
-265                 continue;
-266             if ( directory.equals( "OSGI-OPT" ) || directory.startsWith( "OSGI-OPT/" ) )
-267                 continue;
-268             if ( directory.equals( "/" ) )
-269                 continue;
-270 
-271             if ( directory.endsWith( "/" ) )
-272                 directory = directory.substring( 0, directory.length() - 1 );
-273 
-274             directory = directory.replace( '/', '.' );
-275             sb.append( ddel );
-276             sb.append( directory );
-277             ddel = ",";
-278         }
-279         return sb.toString();
-280     }
-281 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/ManifestWriter.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/ManifestWriter.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/ManifestWriter.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/ManifestWriter.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,264 +0,0 @@ - - - - -ManifestWriter xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  import java.io.IOException;
-22  import java.io.OutputStream;
-23  import java.util.Arrays;
-24  import java.util.HashSet;
-25  import java.util.Map;
-26  import java.util.Set;
-27  import java.util.TreeMap;
-28  import java.util.TreeSet;
-29  import java.util.jar.Attributes;
-30  import java.util.jar.Manifest;
-31  
-32  import org.apache.felix.utils.manifest.Parser;
-33  import org.osgi.framework.Constants;
-34  
-35  public class ManifestWriter {
-36  
-37      /**
-38       * Unfortunately we have to write our own manifest :-( because of a stupid
-39       * bug in the manifest code. It tries to handle UTF-8 but the way it does it
-40       * it makes the bytes platform dependent. So the following code outputs the
-41       * manifest. A Manifest consists of
-42       *
-43       * <pre>
-44       *   'Manifest-Version: 1.0\r\n'
-45       *   main-attributes *
-46       *   \r\n
-47       *   name-section
-48       *
-49       *   main-attributes ::= attributes
-50       *   attributes      ::= key ': ' value '\r\n'
-51       *   name-section    ::= 'Name: ' name '\r\n' attributes
-52       * </pre>
-53       *
-54       * Lines in the manifest should not exceed 72 bytes (! this is where the
-55       * manifest screwed up as well when 16 bit unicodes were used).
-56       * <p>
-57       * As a bonus, we can now sort the manifest!
-58       */
-59      static byte[]	CONTINUE	= new byte[] {
-60              '\r', '\n', ' '
-61      };
-62  
-63      static Set<String> NICE_HEADERS = new HashSet<String>(
-64              Arrays.asList(
-65                      Constants.IMPORT_PACKAGE,
-66                      Constants.DYNAMICIMPORT_PACKAGE,
-67                      Constants.IMPORT_SERVICE,
-68                      Constants.REQUIRE_CAPABILITY,
-69                      Constants.EXPORT_PACKAGE,
-70                      Constants.EXPORT_SERVICE,
-71                      Constants.PROVIDE_CAPABILITY
-72              )
-73      );
-74  
-75      /**
-76       * Main function to output a manifest properly in UTF-8.
-77       *
-78       * @param manifest
-79       *            The manifest to output
-80       * @param out
-81       *            The output stream
-82       * @throws IOException
-83       *             when something fails
-84       */
-85      public static void outputManifest(Manifest manifest, OutputStream out, boolean nice) throws IOException {
-86          writeEntry(out, "Manifest-Version", "1.0", nice);
-87          attributes(manifest.getMainAttributes(), out, nice);
-88  
-89          TreeSet<String> keys = new TreeSet<String>();
-90          for (Object o : manifest.getEntries().keySet())
-91              keys.add(o.toString());
-92  
-93          for (String key : keys) {
-94              write(out, 0, "\r\n");
-95              writeEntry(out, "Name", key, nice);
-96              attributes(manifest.getAttributes(key), out, nice);
-97          }
-98          out.flush();
-99      }
-100 
-101     /**
-102      * Write out an entry, handling proper unicode and line length constraints
-103      */
-104     private static void writeEntry(OutputStream out, String name, String value, boolean nice) throws IOException {
-105         if (nice && NICE_HEADERS.contains(name)) {
-106             int n = write(out, 0, name + ": ");
-107             String[] parts = Parser.parseDelimitedString(value, ",");
-108             if (parts.length > 1) {
-109                 write(out, 0, "\r\n ");
-110                 n = 1;
-111             }
-112             for (int i = 0; i < parts.length; i++) {
-113                 if (i < parts.length - 1) {
-114                     write(out, n, parts[i] + ",");
-115                     write(out, 0, "\r\n ");
-116                 } else {
-117                     write(out, n, parts[i]);
-118                     write(out, 0, "\r\n");
-119                 }
-120                 n = 1;
-121             }
-122         } else {
-123             int n = write(out, 0, name + ": ");
-124             write(out, n, value);
-125             write(out, 0, "\r\n");
-126         }
-127     }
-128 
-129     /**
-130      * Convert a string to bytes with UTF8 and then output in max 72 bytes
-131      *
-132      * @param out
-133      *            the output string
-134      * @param i
-135      *            the current width
-136      * @param s
-137      *            the string to output
-138      * @return the new width
-139      * @throws IOException
-140      *             when something fails
-141      */
-142     private static int write(OutputStream out, int i, String s) throws IOException {
-143         byte[] bytes = s.getBytes("UTF8");
-144         return write(out, i, bytes);
-145     }
-146 
-147     /**
-148      * Write the bytes but ensure that the line length does not exceed 72
-149      * characters. If it is more than 70 characters, we just put a cr/lf +
-150      * space.
-151      *
-152      * @param out
-153      *            The output stream
-154      * @param width
-155      *            The nr of characters output in a line before this method
-156      *            started
-157      * @param bytes
-158      *            the bytes to output
-159      * @return the nr of characters in the last line
-160      * @throws IOException
-161      *             if something fails
-162      */
-163     private static int write(OutputStream out, int width, byte[] bytes) throws IOException {
-164         int w = width;
-165         for (int i = 0; i < bytes.length; i++) {
-166             if (w >= 72) { // we need to add the \n\r!
-167                 out.write(CONTINUE);
-168                 w = 1;
-169             }
-170             out.write(bytes[i]);
-171             w++;
-172         }
-173         return w;
-174     }
-175 
-176     /**
-177      * Output an Attributes map. We will sort this map before outputing.
-178      *
-179      * @param value
-180      *            the attrbutes
-181      * @param out
-182      *            the output stream
-183      * @throws IOException
-184      *             when something fails
-185      */
-186     private static void attributes(Attributes value, OutputStream out, boolean nice) throws IOException {
-187         TreeMap<String,String> map = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
-188         for (Map.Entry<Object,Object> entry : value.entrySet()) {
-189             map.put(entry.getKey().toString(), entry.getValue().toString());
-190         }
-191 
-192         map.remove("Manifest-Version"); // get rid of
-193         // manifest
-194         // version
-195         for (Map.Entry<String,String> entry : map.entrySet()) {
-196             writeEntry(out, entry.getKey(), entry.getValue(), nice);
-197         }
-198     }
-199 
-200     private static Manifest clean(Manifest org) {
-201 
-202         Manifest result = new Manifest();
-203         for (Map.Entry< ? , ? > entry : org.getMainAttributes().entrySet()) {
-204             String nice = clean((String) entry.getValue());
-205             result.getMainAttributes().put(entry.getKey(), nice);
-206         }
-207         for (String name : org.getEntries().keySet()) {
-208             Attributes attrs = result.getAttributes(name);
-209             if (attrs == null) {
-210                 attrs = new Attributes();
-211                 result.getEntries().put(name, attrs);
-212             }
-213 
-214             for (Map.Entry< ? , ? > entry : org.getAttributes(name).entrySet()) {
-215                 String nice = clean((String) entry.getValue());
-216                 attrs.put(entry.getKey(), nice);
-217             }
-218         }
-219         return result;
-220     }
-221 
-222     private static String clean(String s) {
-223         StringBuilder sb = new StringBuilder(s);
-224         boolean changed = false;
-225         boolean replacedPrev = false;
-226         for ( int i=0; i<sb.length(); i++) {
-227             char c = s.charAt(i);
-228             switch(c) {
-229             case 0:
-230             case '\n':
-231             case '\r':
-232                 changed = true;
-233                 if ( !replacedPrev ) {
-234                     sb.replace(i, i+1, " ");
-235                     replacedPrev= true;
-236                 } else
-237                     sb.delete(i, i+1);
-238                 break;
-239             default:
-240                 replacedPrev = false;
-241                 break;
-242             }
-243         }
-244         if ( changed)
-245             return sb.toString();
-246         else
-247             return s;
-248     }
-249 
-250 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.bundleplugin - - - - -

- org.apache.felix.bundleplugin -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.bundleplugin - - - -
- -
-
- -
- -

Package org.apache.felix.bundleplugin

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class Summary
- AbstractDependencyFilter -
- AntPlugin -
- BlueprintPlugin -
- BundleAllPlugin -
- BundleInfo -
- BundlePlugin -
- DependencyEmbedder -
- DependencyExcluder -
- DependencyFilter -
- InstructionsPlugin -
- JarPluginConfiguration -
- ManifestPlugin -
- ManifestWriter -
- ScrPlugin -
- VersionCleanerPlugin -
- WrapPlugin -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/ScrPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/ScrPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/ScrPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/ScrPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ - - - - -ScrPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.BufferedReader;
-23  import java.io.ByteArrayInputStream;
-24  import java.io.ByteArrayOutputStream;
-25  import java.io.IOException;
-26  import java.io.InputStream;
-27  import java.io.InputStreamReader;
-28  import java.net.URL;
-29  import java.util.ArrayList;
-30  import java.util.Arrays;
-31  import java.util.HashSet;
-32  import java.util.LinkedHashMap;
-33  import java.util.List;
-34  import java.util.Map;
-35  import java.util.Set;
-36  import java.util.TreeSet;
-37  import java.util.regex.Pattern;
-38  
-39  import javax.xml.transform.Transformer;
-40  import javax.xml.transform.TransformerFactory;
-41  import javax.xml.transform.stream.StreamResult;
-42  import javax.xml.transform.stream.StreamSource;
-43  
-44  import aQute.bnd.osgi.Analyzer;
-45  import aQute.bnd.osgi.Descriptors.PackageRef;
-46  import aQute.bnd.osgi.Jar;
-47  import aQute.bnd.osgi.Processor;
-48  import aQute.bnd.osgi.Resource;
-49  import aQute.bnd.service.AnalyzerPlugin;
-50  import aQute.libg.generics.Create;
-51  import org.apache.felix.utils.manifest.Attribute;
-52  import org.apache.felix.utils.manifest.Clause;
-53  import org.osgi.framework.Constants;
-54  
-55  import static org.apache.felix.utils.manifest.Parser.parseHeader;
-56  
-57  
-58  public class ScrPlugin implements AnalyzerPlugin
-59  {
-60  
-61      Transformer transformer;
-62  
-63      public ScrPlugin() throws Exception
-64      {
-65          transformer = getTransformer( getClass().getResource( "scr.xsl" ) );
-66      }
-67  
-68  
-69      public boolean analyzeJar( Analyzer analyzer ) throws Exception
-70      {
-71          Set<String> headers = Create.set();
-72  
-73          String bpHeader = analyzer.getProperty( "Service-Component" );
-74  
-75          Map<String, ? extends Map<String, String>> map = Processor.parseHeader( bpHeader, null );
-76          for ( String root : map.keySet() )
-77          {
-78              Resource resource = analyzer.getJar().getResource(root);
-79              if ( resource != null ) {
-80                  process(analyzer, root, resource, headers);
-81              }
-82          }
-83  
-84          // Group and analyze
-85          for ( String str : headers )
-86          {
-87              int idx = str.indexOf( ':' );
-88              if ( idx < 0 )
-89              {
-90                  analyzer.warning( ( new StringBuilder( "Error analyzing services in scr resource: " ) ).append( str ).toString() );
-91                  continue;
-92              }
-93              String h = str.substring( 0, idx ).trim();
-94              String v = str.substring( idx + 1 ).trim();
-95  
-96              StringBuilder sb = new StringBuilder();
-97              String header = analyzer.getProperty( h );
-98              if (header != null && !header.isEmpty())
-99              {
-100                 sb.append(header);
-101                 sb.append(",");
-102             }
-103             sb.append( v );
-104             analyzer.setProperty(h, sb.toString());
-105         }
-106         return false;
-107     }
-108 
-109 
-110     private void process( Analyzer analyzer, String path, Resource resource, Set<String> headers )
-111     {
-112         InputStream in = null;
-113         try
-114         {
-115             in = resource.openInputStream();
-116 
-117             // Retrieve headers
-118             Set<String> set = analyze( in );
-119             headers.addAll( set );
-120         }
-121         catch ( Exception e )
-122         {
-123             analyzer.error( ( new StringBuilder( "Unexpected exception in processing scr resources(" ) )
-124                 .append( path ).append( "): " ).append( e ).toString() );
-125         }
-126         finally
-127         {
-128             try
-129             {
-130                 if ( in != null )
-131                 {
-132                     in.close();
-133                 }
-134             }
-135             catch ( IOException e )
-136             {
-137             }
-138         }
-139     }
-140 
-141 
-142     public Set<String> analyze( InputStream in ) throws Exception
-143     {
-144         Set<String> refers = new HashSet<String>();
-145         ByteArrayOutputStream bout = new ByteArrayOutputStream();
-146         javax.xml.transform.Result r = new StreamResult( bout );
-147         javax.xml.transform.Source s = new StreamSource( in );
-148         transformer.transform( s, r );
-149         ByteArrayInputStream bin = new ByteArrayInputStream( bout.toByteArray() );
-150         bout.close();
-151         BufferedReader br = new BufferedReader( new InputStreamReader( bin ) );
-152         for ( String line = br.readLine(); line != null; line = br.readLine() )
-153         {
-154             line = line.trim();
-155             if ( line.length() > 0 )
-156             {
-157                 refers.add( line );
-158             }
-159         }
-160 
-161         br.close();
-162         return refers;
-163     }
-164 
-165 
-166     protected Transformer getTransformer( URL url ) throws Exception
-167     {
-168         TransformerFactory tf = TransformerFactory.newInstance();
-169         javax.xml.transform.Source source = new StreamSource( url.openStream() );
-170         return tf.newTransformer( source );
-171     }
-172 
-173 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/VersionCleanerPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/VersionCleanerPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/VersionCleanerPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/VersionCleanerPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ - - - - -VersionCleanerPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.util.LinkedHashMap;
-23  import java.util.Map;
-24  
-25  import org.apache.maven.plugin.AbstractMojo;
-26  import org.apache.maven.plugin.MojoExecutionException;
-27  import org.apache.maven.plugin.MojoFailureException;
-28  import org.apache.maven.project.MavenProject;
-29  import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-30  import org.apache.maven.shared.osgi.Maven2OsgiConverter;
-31  
-32  
-33  /**
-34   * Convert a group of versions to OSGi format.
-35   *
-36   * @goal cleanVersions
-37   * @description clean OSGi versions
-38   * @threadSafe
-39   */
-40  public class VersionCleanerPlugin extends AbstractMojo
-41  {
-42  
-43      /**
-44       * The BND instructions for the bundle.
-45       *
-46       * @parameter
-47       */
-48      private Map versions = new LinkedHashMap();
-49  
-50      /**
-51       * The Maven project.
-52       *
-53       * @parameter expression="${project}"
-54       * @required
-55       * @readonly
-56       */
-57      private MavenProject project;
-58  
-59      private Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-60  
-61  
-62      public Maven2OsgiConverter getMaven2OsgiConverter()
-63      {
-64          return maven2OsgiConverter;
-65      }
-66  
-67  
-68      public void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter )
-69      {
-70          this.maven2OsgiConverter = maven2OsgiConverter;
-71      }
-72  
-73  
-74      public void execute() throws MojoExecutionException, MojoFailureException
-75      {
-76          for ( Object key : versions.keySet() )
-77          {
-78              String name = ( String ) key;
-79              String version = ( String ) versions.get( key );
-80              String osgi = maven2OsgiConverter.getVersion( version );
-81              project.getProperties().put( name, osgi );
-82          }
-83      }
-84  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/WrapPlugin.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/WrapPlugin.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/bundleplugin/WrapPlugin.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/bundleplugin/WrapPlugin.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ - - - - -WrapPlugin xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import org.apache.maven.plugin.MojoExecutionException;
-23  
-24  
-25  /**
-26   * Create OSGi bundles from the direct dependencies of the Maven project.
-27   *
-28   * @goal wrap
-29   * @phase package
-30   * @requiresDependencyResolution test
-31   * @description build an OSGi bundle jar for direct dependencies
-32   * @deprecated The wrap goal is no longer supported and may be removed in a future release
-33   */
-34  @Deprecated
-35  public final class WrapPlugin extends BundleAllPlugin
-36  {
-37      public void execute() throws MojoExecutionException
-38      {
-39          getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
-40          getLog().warn( "! The wrap goal is no longer supported and may be removed in a future release !" );
-41          getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
-42  
-43          BundleInfo bundleInfo = bundleAll( getProject(), 1 );
-44          logDuplicatedPackages( bundleInfo );
-45      }
-46  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/AbstractFileMojo.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/AbstractFileMojo.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/AbstractFileMojo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/AbstractFileMojo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ - - - - -AbstractFileMojo xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  
-24  import org.apache.maven.artifact.Artifact;
-25  import org.apache.maven.artifact.factory.ArtifactFactory;
-26  import org.apache.maven.plugin.AbstractMojo;
-27  import org.apache.maven.plugin.MojoExecutionException;
-28  import org.apache.maven.project.MavenProject;
-29  
-30  
-31  /**
-32   * Base class for the command-line install-file and deploy-file goals.
-33   * 
-34   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-35   */
-36  public abstract class AbstractFileMojo extends AbstractMojo
-37  {
-38      /**
-39       * GroupId of the bundle. Retrieved from POM file if specified.
-40       *
-41       * @parameter expression="${groupId}"
-42       */
-43      private String groupId;
-44  
-45      /**
-46       * ArtifactId of the bundle. Retrieved from POM file if specified.
-47       *
-48       * @parameter expression="${artifactId}"
-49       */
-50      private String artifactId;
-51  
-52      /**
-53       * Version of the bundle. Retrieved from POM file if specified.
-54       *
-55       * @parameter expression="${version}"
-56       */
-57      private String version;
-58  
-59      /**
-60       * Packaging type of the bundle. Retrieved from POM file if specified.
-61       *
-62       * @parameter expression="${packaging}"
-63       */
-64      private String packaging;
-65  
-66      /**
-67       * Classifier type of the bundle. Defaults to none.
-68       *
-69       * @parameter expression="${classifier}"
-70       */
-71      private String classifier;
-72  
-73      /**
-74       * Location of an existing POM file.
-75       *
-76       * @parameter expression="${pomFile}"
-77       */
-78      private File pomFile;
-79  
-80      /**
-81       * Bundle file, defaults to the artifact in the local Maven repository.
-82       *
-83       * @parameter expression="${file}"
-84       */
-85      protected File file;
-86  
-87      /**
-88       * Optional XML file describing additional requirements and capabilities.
-89       * 
-90       * @parameter expression="${obrXml}"
-91       */
-92      protected String obrXml;
-93  
-94      /**
-95       * Component factory for Maven artifacts
-96       * 
-97       * @component
-98       */
-99      private ArtifactFactory m_factory;
-100 
-101 
-102     /**
-103      * @return project based on command-line settings, with bundle attached
-104      * @throws MojoExecutionException
-105      */
-106     public MavenProject getProject() throws MojoExecutionException
-107     {
-108         final MavenProject project;
-109         if ( pomFile != null && pomFile.exists() )
-110         {
-111             project = PomHelper.readPom( pomFile );
-112 
-113             groupId = project.getGroupId();
-114             artifactId = project.getArtifactId();
-115             version = project.getVersion();
-116             packaging = project.getPackaging();
-117         }
-118         else
-119         {
-120             project = PomHelper.buildPom( groupId, artifactId, version, packaging );
-121         }
-122 
-123         if ( groupId == null || artifactId == null || version == null || packaging == null )
-124         {
-125             throw new MojoExecutionException( "Missing group, artifact, version, or packaging information" );
-126         }
-127 
-128         Artifact bundle = m_factory.createArtifactWithClassifier( groupId, artifactId, version, packaging, classifier );
-129         project.setArtifact( bundle );
-130 
-131         return project;
-132     }
-133 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/Config.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/Config.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/Config.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/Config.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ - - - - -Config xref - - - -
-
-1   /* 
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.net.URI;
-23  
-24  
-25  /**
-26   * this class is used to store some user information about configuration of the plugin.
-27   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-28   *
-29   */
-30  public class Config
-31  {
-32      private boolean m_pathRelative; // use relative or absolute path in repository.xml
-33      private boolean m_remoteFile; // deploy file on remote server
-34      private URI m_remoteBundle; // public address of deployed bundle
-35  
-36  
-37      /**
-38       * constructor: set default configuration: use relative path and don't upload file.
-39       */
-40      public Config()
-41      {
-42          // default configuration
-43          m_pathRelative = true;
-44          m_remoteFile = false;
-45          m_remoteBundle = null;
-46      }
-47  
-48  
-49      /**
-50       * @param value enable to use relative path
-51       */
-52      public void setPathRelative( boolean value )
-53      {
-54          m_pathRelative = value;
-55      }
-56  
-57  
-58      /**
-59       * @param value enable when uploading
-60       */
-61      public void setRemoteFile( boolean value )
-62      {
-63          m_remoteFile = value;
-64      }
-65  
-66  
-67      /**
-68       * @param value public address of deployed bundle
-69       */
-70      public void setRemoteBundle( URI value )
-71      {
-72          m_remoteBundle = value;
-73      }
-74  
-75  
-76      /**
-77       * @return true if plugin uses relative path, else false
-78       */
-79      public boolean isPathRelative()
-80      {
-81          return m_pathRelative;
-82      }
-83  
-84  
-85      /**
-86       * @return true if the file will be uploaded, else false
-87       */
-88      public boolean isRemoteFile()
-89      {
-90          return m_remoteFile;
-91      }
-92  
-93  
-94      /**
-95       * @return public address of deployed bundle
-96       */
-97      public URI getRemoteBundle()
-98      {
-99          return m_remoteBundle;
-100     }
-101 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrCleanRepo.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrCleanRepo.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrCleanRepo.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrCleanRepo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,331 +0,0 @@ - - - - -ObrCleanRepo xref - - - -
-
-1   /* 
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FileOutputStream;
-24  import java.io.IOException;
-25  import java.net.URI;
-26  import java.text.SimpleDateFormat;
-27  import java.util.ArrayList;
-28  import java.util.Date;
-29  import java.util.List;
-30  import java.util.Properties;
-31  
-32  import javax.xml.parsers.DocumentBuilder;
-33  import javax.xml.parsers.DocumentBuilderFactory;
-34  import javax.xml.parsers.ParserConfigurationException;
-35  import javax.xml.transform.Result;
-36  import javax.xml.transform.Transformer;
-37  import javax.xml.transform.TransformerConfigurationException;
-38  import javax.xml.transform.TransformerException;
-39  import javax.xml.transform.TransformerFactory;
-40  import javax.xml.transform.dom.DOMSource;
-41  import javax.xml.transform.stream.StreamResult;
-42  
-43  import org.apache.maven.artifact.repository.ArtifactRepository;
-44  import org.apache.maven.plugin.AbstractMojo;
-45  import org.apache.maven.plugin.MojoExecutionException;
-46  import org.codehaus.plexus.util.FileUtils;
-47  import org.w3c.dom.Document;
-48  import org.w3c.dom.Element;
-49  import org.w3c.dom.Node;
-50  import org.w3c.dom.NodeList;
-51  import org.xml.sax.SAXException;
-52  
-53  
-54  /**
-55   * Clean an OBR repository by finding and removing missing resources.
-56   * 
-57   * @requiresProject false
-58   * @goal clean
-59   * @phase clean
-60   * 
-61   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-62   */
-63  public class ObrCleanRepo extends AbstractMojo
-64  {
-65      /**
-66       * OBR Repository.
-67       * 
-68       * @parameter expression="${obrRepository}"
-69       */
-70      private String obrRepository;
-71  
-72      /**
-73       * Local Repository.
-74       * 
-75       * @parameter expression="${localRepository}"
-76       * @required
-77       * @readonly
-78       */
-79      private ArtifactRepository localRepository;
-80  
-81  
-82      public void execute()
-83      {
-84          if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) )
-85          {
-86              getLog().info( "Local OBR clean disabled (enable with -DobrRepository)" );
-87              return;
-88          }
-89  
-90          try
-91          {
-92              // Compute local repository location
-93              URI repositoryXml = ObrUtils.findRepositoryXml( localRepository.getBasedir(), obrRepository );
-94              if ( !"file".equals( repositoryXml.getScheme() ) )
-95              {
-96                  getLog().error( "The repository URI " + repositoryXml + " is not a local file" );
-97                  return;
-98              }
-99  
-100             File repositoryFile = new File( repositoryXml );
-101 
-102             // Check if the file exist
-103             if ( !repositoryFile.exists() )
-104             {
-105                 getLog().error( "The repository file " + repositoryFile + " does not exist" );
-106                 return;
-107             }
-108 
-109             getLog().info( "Cleaning..." );
-110 
-111             Document doc = parseFile( repositoryFile, initConstructor() );
-112             Node finalDocument = cleanDocument( doc.getDocumentElement() ); // Analyze existing repository.
-113 
-114             if ( finalDocument == null )
-115             {
-116                 getLog().info( "Nothing to clean in " + repositoryFile );
-117             }
-118             else
-119             {
-120                 writeToFile( repositoryXml, finalDocument ); // Write the new file
-121                 getLog().info( "Repository " + repositoryFile + " cleaned" );
-122             }
-123         }
-124         catch ( Exception e )
-125         {
-126             getLog().error( "Exception while cleaning local OBR: " + e.getLocalizedMessage(), e );
-127         }
-128     }
-129 
-130 
-131     /**
-132      * Analyze the given XML tree (DOM of the repository file) and remove missing resources.
-133      * 
-134      * @param elem : the input XML tree
-135      * @return the cleaned XML tree
-136      */
-137     private Element cleanDocument( Element elem )
-138     {
-139         String localRepoPath = localRepository.getBasedir();
-140         URI baseURI = new File( localRepoPath + '/' ).toURI();
-141         NodeList nodes = elem.getElementsByTagName( "resource" );
-142         List toRemove = new ArrayList();
-143 
-144         // First, look for missing resources
-145         for ( int i = 0; i < nodes.getLength(); i++ )
-146         {
-147             Element n = ( Element ) nodes.item( i );
-148             String value = n.getAttribute( "uri" );
-149 
-150             URI resource;
-151             try
-152             {
-153                 resource = baseURI.resolve( value );
-154             }
-155             catch ( IllegalArgumentException e )
-156             {
-157                 getLog().error( "Malformed URL when creating the resource absolute URI : " + e.getMessage() );
-158                 return null;
-159             }
-160 
-161             if ( "file".equals( resource.getScheme() ) && !new File( resource ).exists() )
-162             {
-163                 getLog().info(
-164                     "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" )
-165                         + " will be removed" );
-166                 toRemove.add( n );
-167             }
-168         }
-169 
-170         Date d = new Date();
-171         if ( toRemove.size() > 0 )
-172         {
-173             // Then remove missing resources.
-174             for ( int i = 0; i < toRemove.size(); i++ )
-175             {
-176                 elem.removeChild( ( Node ) toRemove.get( i ) );
-177             }
-178 
-179             // If we have to remove resources, we need to update 'lastmodified' attribute
-180             SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" );
-181             d.setTime( System.currentTimeMillis() );
-182             elem.setAttribute( "lastmodified", format.format( d ) );
-183             return elem;
-184         }
-185 
-186         return null;
-187     }
-188 
-189 
-190     /**
-191      * Initialize the document builder from Xerces.
-192      * 
-193      * @return DocumentBuilder ready to create new document
-194      * @throws MojoExecutionException : occurs when the instantiation of the document builder fails
-195      */
-196     private DocumentBuilder initConstructor() throws MojoExecutionException
-197     {
-198         DocumentBuilder constructor = null;
-199         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-200         try
-201         {
-202             constructor = factory.newDocumentBuilder();
-203         }
-204         catch ( ParserConfigurationException e )
-205         {
-206             getLog().error( "Unable to create a new xml document" );
-207             throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() );
-208         }
-209         return constructor;
-210     }
-211 
-212 
-213     /**
-214      * Open an XML file.
-215      * 
-216      * @param file : XML file path
-217      * @param constructor DocumentBuilder get from xerces
-218      * @return Document which describes this file
-219      * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file.
-220      */
-221     private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException
-222     {
-223         if ( constructor == null )
-224         {
-225             return null;
-226         }
-227         // The document is the root of the DOM tree.
-228         File targetFile = file.getAbsoluteFile();
-229         getLog().info( "Parsing " + targetFile );
-230         Document doc = null;
-231         try
-232         {
-233             doc = constructor.parse( targetFile );
-234         }
-235         catch ( SAXException e )
-236         {
-237             getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() );
-238             throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() );
-239         }
-240         catch ( IOException e )
-241         {
-242             getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() );
-243             throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() );
-244         }
-245         return doc;
-246     }
-247 
-248 
-249     /**
-250      * write a Node in a xml file.
-251      * 
-252      * @param outputFilename URI to the output file
-253      * @param treeToBeWrite Node root of the tree to be write in file
-254      * @throws MojoExecutionException if the plugin failed
-255      */
-256     private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException
-257     {
-258         // init the transformer
-259         Transformer transformer = null;
-260         TransformerFactory tfabrique = TransformerFactory.newInstance();
-261         try
-262         {
-263             transformer = tfabrique.newTransformer();
-264         }
-265         catch ( TransformerConfigurationException e )
-266         {
-267             getLog().error( "Unable to write to file: " + outputFilename.toString() );
-268             throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "
-269                 + e.getMessage() );
-270         }
-271         Properties proprietes = new Properties();
-272         proprietes.put( "method", "xml" );
-273         proprietes.put( "version", "1.0" );
-274         proprietes.put( "encoding", "ISO-8859-1" );
-275         proprietes.put( "standalone", "yes" );
-276         proprietes.put( "indent", "yes" );
-277         proprietes.put( "omit-xml-declaration", "no" );
-278         transformer.setOutputProperties( proprietes );
-279 
-280         DOMSource input = new DOMSource( treeToBeWrite );
-281 
-282         File fichier = null;
-283         FileOutputStream flux = null;
-284         try
-285         {
-286             fichier = File.createTempFile( "repository", ".xml" );
-287             flux = new FileOutputStream( fichier );
-288         }
-289         catch ( IOException e )
-290         {
-291             getLog().error( "Unable to write to file: " + fichier.getName() );
-292             throw new MojoExecutionException( "Unable to write to file: " + fichier.getName() + " : " + e.getMessage() );
-293         }
-294         Result output = new StreamResult( flux );
-295         try
-296         {
-297             transformer.transform( input, output );
-298         }
-299         catch ( TransformerException e )
-300         {
-301             throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "
-302                 + e.getMessage() );
-303         }
-304 
-305         try
-306         {
-307             flux.flush();
-308             flux.close();
-309 
-310             FileUtils.rename( fichier, new File( outputFilename ) );
-311         }
-312         catch ( IOException e )
-313         {
-314             throw new MojoExecutionException( "IOException when closing file : " + e.getMessage() );
-315         }
-316     }
-317 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrDeployFile.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrDeployFile.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrDeployFile.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrDeployFile.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ - - - - -ObrDeployFile xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.net.URI;
-24  import java.util.Arrays;
-25  import java.util.List;
-26  
-27  import org.apache.maven.artifact.manager.WagonManager;
-28  import org.apache.maven.artifact.repository.ArtifactRepository;
-29  import org.apache.maven.plugin.MojoExecutionException;
-30  import org.apache.maven.plugin.logging.Log;
-31  import org.apache.maven.project.MavenProject;
-32  import org.apache.maven.settings.Settings;
-33  
-34  
-35  /**
-36   * Deploys bundle details to a remote OBR repository (command-line goal)
-37   * 
-38   * @requiresProject false
-39   * @goal deploy-file
-40   * @phase deploy
-41   * 
-42   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-43   */
-44  public final class ObrDeployFile extends AbstractFileMojo
-45  {
-46      /**
-47       * When true, ignore remote locking.
-48       * 
-49       * @parameter expression="${ignoreLock}"
-50       */
-51      private boolean ignoreLock;
-52  
-53      /**
-54       * Remote OBR Repository.
-55       * 
-56       * @parameter expression="${remoteOBR}"
-57       */
-58      private String remoteOBR;
-59  
-60      /**
-61       * Local OBR Repository.
-62       * 
-63       * @parameter expression="${obrRepository}"
-64       */
-65      private String obrRepository;
-66  
-67      /**
-68       * Project types which this plugin supports.
-69       *
-70       * @parameter
-71       */
-72      private List supportedProjectTypes = Arrays.asList( new String[]
-73          { "jar", "bundle" } );
-74  
-75      /**
-76       * Remote repository id, used to lookup authentication settings.
-77       *
-78       * @parameter expression="${repositoryId}" default-value="remote-repository"
-79       * @required
-80       */
-81      private String repositoryId;
-82  
-83      /**
-84       * Remote OBR repository URL, where the bundle details are to be uploaded.
-85       *
-86       * @parameter expression="${url}"
-87       * @required
-88       */
-89      private String url;
-90  
-91      /**
-92       * Optional public URL where the bundle has been deployed.
-93       *
-94       * @parameter expression="${bundleUrl}"
-95       */
-96      private String bundleUrl;
-97  
-98      /**
-99       * Local Repository.
-100      * 
-101      * @parameter expression="${localRepository}"
-102      * @required
-103      * @readonly
-104      */
-105     private ArtifactRepository localRepository;
-106 
-107     /**
-108      * Local Maven settings.
-109      * 
-110      * @parameter expression="${settings}"
-111      * @required
-112      * @readonly
-113      */
-114     private Settings settings;
-115 
-116     /**
-117      * The Wagon manager.
-118      * 
-119      * @component
-120      */
-121     private WagonManager m_wagonManager;
-122 
-123 
-124     public void execute() throws MojoExecutionException
-125     {
-126         MavenProject project = getProject();
-127         String projectType = project.getPackaging();
-128 
-129         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
-130         if ( !supportedProjectTypes.contains( projectType ) )
-131         {
-132             getLog().warn(
-133                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
-134             return;
-135         }
-136         else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) )
-137         {
-138             getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" );
-139             return;
-140         }
-141 
-142         // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead
-143         if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) )
-144         {
-145             remoteOBR = obrRepository;
-146         }
-147 
-148         URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR );
-149         String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName();
-150 
-151         Log log = getLog();
-152         ObrUpdate update;
-153 
-154         RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log );
-155         remoteFile.connect( repositoryId, url );
-156 
-157         // ======== LOCK REMOTE OBR ========
-158         log.info( "LOCK " + remoteFile + '/' + repositoryName );
-159         remoteFile.lockFile( repositoryName, ignoreLock );
-160         File downloadedRepositoryXml = null;
-161 
-162         try
-163         {
-164             // ======== DOWNLOAD REMOTE OBR ========
-165             log.info( "Downloading " + repositoryName );
-166             downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" );
-167 
-168             String mavenRepository = localRepository.getBasedir();
-169 
-170             URI repositoryXml = downloadedRepositoryXml.toURI();
-171             URI obrXmlFile = ObrUtils.toFileURI( obrXml );
-172             URI bundleJar;
-173 
-174             if ( null == file )
-175             {
-176                 bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() );
-177             }
-178             else
-179             {
-180                 bundleJar = file.toURI();
-181             }
-182 
-183             Config userConfig = new Config();
-184             userConfig.setRemoteFile( true );
-185 
-186             if ( null != bundleUrl )
-187             {
-188                 // public URL differs from the bundle file location
-189                 URI uri = URI.create( bundleUrl );
-190                 log.info( "Computed bundle uri: " + uri );
-191                 userConfig.setRemoteBundle( uri );
-192             }
-193             else if ( null != file )
-194             {
-195                 // assume file will be deployed in remote repository, so find the remote relative location
-196                 URI uri = URI.create( localRepository.pathOf( project.getArtifact() ) );
-197                 log.info( "Computed bundle uri: " + uri );
-198                 userConfig.setRemoteBundle( uri );
-199             }
-200 
-201             update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log );
-202             update.parseRepositoryXml();
-203 
-204             update.updateRepository( bundleJar, null, null );
-205 
-206             update.writeRepositoryXml();
-207 
-208             if ( downloadedRepositoryXml.exists() )
-209             {
-210                 // ======== UPLOAD MODIFIED OBR ========
-211                 log.info( "Uploading " + repositoryName );
-212                 remoteFile.put( downloadedRepositoryXml, repositoryName );
-213             }
-214         }
-215         catch ( Exception e )
-216         {
-217             log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e );
-218         }
-219         finally
-220         {
-221             // ======== UNLOCK REMOTE OBR ========
-222             log.info( "UNLOCK " + remoteFile + '/' + repositoryName );
-223             remoteFile.unlockFile( repositoryName );
-224             remoteFile.disconnect();
-225 
-226             if ( null != downloadedRepositoryXml )
-227             {
-228                 downloadedRepositoryXml.delete();
-229             }
-230         }
-231     }
-232 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrDeploy.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrDeploy.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrDeploy.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrDeploy.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,368 +0,0 @@ - - - - -ObrDeploy xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.net.URI;
-24  import java.net.URL;
-25  import java.util.Arrays;
-26  import java.util.Iterator;
-27  import java.util.List;
-28  import java.util.regex.Matcher;
-29  import java.util.regex.Pattern;
-30  
-31  import org.apache.maven.artifact.Artifact;
-32  import org.apache.maven.artifact.manager.WagonManager;
-33  import org.apache.maven.artifact.repository.ArtifactRepository;
-34  import org.apache.maven.plugin.AbstractMojo;
-35  import org.apache.maven.plugin.MojoExecutionException;
-36  import org.apache.maven.plugin.logging.Log;
-37  import org.apache.maven.project.MavenProject;
-38  import org.apache.maven.settings.Settings;
-39  
-40  
-41  /**
-42   * Deploys bundle details to a remote OBR repository (life-cycle goal)
-43   * 
-44   * @goal deploy
-45   * @phase deploy
-46   * @threadSafe
-47   * 
-48   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-49   */
-50  public final class ObrDeploy extends AbstractMojo
-51  {
-52      /**
-53       * When true, ignore remote locking.
-54       * 
-55       * @parameter expression="${ignoreLock}"
-56       */
-57      private boolean ignoreLock;
-58  
-59      /**
-60       * Optional public URL prefix for the remote repository.
-61       *
-62       * @parameter expression="${prefixUrl}"
-63       */
-64      private String prefixUrl;
-65  
-66      /**
-67       * Optional public URL where the bundle has been deployed.
-68       *
-69       * @parameter expression="${bundleUrl}"
-70       */
-71      private String bundleUrl;
-72  
-73      /**
-74       * Remote OBR Repository.
-75       * 
-76       * @parameter expression="${remoteOBR}" default-value="NONE"
-77       */
-78      private String remoteOBR;
-79  
-80      /**
-81       * Local OBR Repository.
-82       * 
-83       * @parameter expression="${obrRepository}"
-84       */
-85      private String obrRepository;
-86  
-87      /**
-88       * Project types which this plugin supports.
-89       *
-90       * @parameter
-91       */
-92      private List supportedProjectTypes = Arrays.asList( new String[]
-93          { "jar", "bundle" } );
-94  
-95      /**
-96       * @parameter expression="${project.distributionManagementArtifactRepository}"
-97       * @readonly
-98       */
-99      private ArtifactRepository deploymentRepository;
-100 
-101     /**
-102      * Alternative deployment repository. Format: id::layout::url
-103      * 
-104      * @parameter expression="${altDeploymentRepository}"
-105      */
-106     private String altDeploymentRepository;
-107 
-108     /**
-109      * OBR specific deployment repository. Format: id::layout::url
-110      * 
-111      * @parameter expression="${obrDeploymentRepository}"
-112      */
-113     private String obrDeploymentRepository;
-114 
-115     /**
-116      * Local Repository.
-117      * 
-118      * @parameter expression="${localRepository}"
-119      * @required
-120      * @readonly
-121      */
-122     private ArtifactRepository localRepository;
-123 
-124     /**
-125      * The Maven project.
-126      * 
-127      * @parameter expression="${project}"
-128      * @required
-129      * @readonly
-130      */
-131     private MavenProject project;
-132 
-133     /**
-134      * @parameter expression="${project.attachedArtifacts}
-135      * @required
-136      * @readonly
-137      */
-138     private List attachedArtifacts;
-139 
-140     /**
-141      * Local Maven settings.
-142      * 
-143      * @parameter expression="${settings}"
-144      * @required
-145      * @readonly
-146      */
-147     private Settings settings;
-148 
-149     /**
-150      * The Wagon manager.
-151      * 
-152      * @component
-153      */
-154     private WagonManager m_wagonManager;
-155 
-156     /**
-157      * Attached source artifact
-158      */
-159     private Artifact m_sourceArtifact;
-160 
-161     /**
-162      * Attached doc artifact
-163      */
-164     private Artifact m_docArtifact;
-165 
-166 
-167     public void execute() throws MojoExecutionException
-168     {
-169         String projectType = project.getPackaging();
-170 
-171         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
-172         if ( !supportedProjectTypes.contains( projectType ) )
-173         {
-174             getLog().warn(
-175                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
-176             return;
-177         }
-178         else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) )
-179         {
-180             getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" );
-181             return;
-182         }
-183 
-184         // check for any attached sources or docs
-185         for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
-186         {
-187             Artifact artifact = ( Artifact ) i.next();
-188             if ( "sources".equals( artifact.getClassifier() ) )
-189             {
-190                 m_sourceArtifact = artifact;
-191             }
-192             else if ( "javadoc".equals( artifact.getClassifier() ) )
-193             {
-194                 m_docArtifact = artifact;
-195             }
-196         }
-197 
-198         // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead
-199         if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) )
-200         {
-201             remoteOBR = obrRepository;
-202         }
-203 
-204         URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR );
-205         String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName();
-206 
-207         Log log = getLog();
-208         ObrUpdate update;
-209 
-210         RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log );
-211         openRepositoryConnection( remoteFile );
-212 
-213         // ======== LOCK REMOTE OBR ========
-214         log.info( "LOCK " + remoteFile + '/' + repositoryName );
-215         remoteFile.lockFile( repositoryName, ignoreLock );
-216         File downloadedRepositoryXml = null;
-217 
-218         try
-219         {
-220             // ======== DOWNLOAD REMOTE OBR ========
-221             log.info( "Downloading " + repositoryName );
-222             downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" );
-223 
-224             String mavenRepository = localRepository.getBasedir();
-225 
-226             URI repositoryXml = downloadedRepositoryXml.toURI();
-227             URI obrXmlFile = ObrUtils.findObrXml( project );
-228 
-229             Config userConfig = new Config();
-230             userConfig.setRemoteFile( true );
-231 
-232             if ( bundleUrl != null )
-233             {
-234                 // public URL differs from the bundle file location
-235                 URI uri = URI.create( bundleUrl );
-236                 log.info( "Computed bundle uri: " + uri );
-237                 userConfig.setRemoteBundle( uri );
-238             }
-239             else if ( prefixUrl != null )
-240             {
-241                 // support absolute bundle URLs based on given prefix
-242                 URI bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() );
-243                 String relative = ObrUtils.getRelativeURI( ObrUtils.toFileURI( mavenRepository ), bundleJar )
-244                     .toASCIIString();
-245                 URL resourceURL = new URL( new URL( prefixUrl + '/' ), relative );
-246                 URI uri = URI.create( resourceURL.toString() );
-247                 log.info( "Computed bundle uri: " + uri );
-248                 userConfig.setRemoteBundle( uri );
-249             }
-250 
-251             update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log );
-252             update.parseRepositoryXml();
-253 
-254             updateRemoteBundleMetadata( project.getArtifact(), update );
-255             for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
-256             {
-257                 updateRemoteBundleMetadata( ( Artifact ) i.next(), update );
-258             }
-259 
-260             update.writeRepositoryXml();
-261 
-262             if ( downloadedRepositoryXml.exists() )
-263             {
-264                 // ======== UPLOAD MODIFIED OBR ========
-265                 log.info( "Uploading " + repositoryName );
-266                 remoteFile.put( downloadedRepositoryXml, repositoryName );
-267             }
-268         }
-269         catch ( Exception e )
-270         {
-271             log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e );
-272         }
-273         finally
-274         {
-275             // ======== UNLOCK REMOTE OBR ========
-276             log.info( "UNLOCK " + remoteFile + '/' + repositoryName );
-277             remoteFile.unlockFile( repositoryName );
-278             remoteFile.disconnect();
-279 
-280             if ( null != downloadedRepositoryXml )
-281             {
-282                 downloadedRepositoryXml.delete();
-283             }
-284         }
-285     }
-286 
-287     private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" );
-288 
-289 
-290     private void openRepositoryConnection( RemoteFileManager remoteFile ) throws MojoExecutionException
-291     {
-292         // use OBR specific deployment location?
-293         if ( obrDeploymentRepository != null )
-294         {
-295             altDeploymentRepository = obrDeploymentRepository;
-296         }
-297 
-298         if ( deploymentRepository == null && altDeploymentRepository == null )
-299         {
-300             String msg = "Deployment failed: repository element was not specified in the pom inside"
-301                 + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter";
-302 
-303             throw new MojoExecutionException( msg );
-304         }
-305 
-306         if ( altDeploymentRepository != null )
-307         {
-308             getLog().info( "Using alternate deployment repository " + altDeploymentRepository );
-309 
-310             Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( altDeploymentRepository );
-311             if ( !matcher.matches() )
-312             {
-313                 throw new MojoExecutionException( "Invalid syntax for alternative repository \""
-314                     + altDeploymentRepository + "\". Use \"id::layout::url\"." );
-315             }
-316 
-317             remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() );
-318         }
-319         else
-320         {
-321             remoteFile.connect( deploymentRepository.getId(), deploymentRepository.getUrl() );
-322         }
-323     }
-324 
-325 
-326     private void updateRemoteBundleMetadata( Artifact artifact, ObrUpdate update ) throws MojoExecutionException
-327     {
-328         if ( !supportedProjectTypes.contains( artifact.getType() ) )
-329         {
-330             return;
-331         }
-332         else if ( null == artifact.getFile() || artifact.getFile().isDirectory() )
-333         {
-334             getLog().error( "No artifact found, try \"mvn install bundle:deploy\"" );
-335             return;
-336         }
-337 
-338         URI bundleJar = ObrUtils.getArtifactURI( localRepository, artifact );
-339 
-340         URI sourceJar = null;
-341         if ( null != m_sourceArtifact )
-342         {
-343             sourceJar = ObrUtils.getArtifactURI( localRepository, m_sourceArtifact );
-344         }
-345 
-346         URI docJar = null;
-347         if ( null != m_docArtifact )
-348         {
-349             docJar = ObrUtils.getArtifactURI( localRepository, m_docArtifact );
-350         }
-351 
-352         update.updateRepository( bundleJar, sourceJar, docJar );
-353     }
-354 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrIndex.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrIndex.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrIndex.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrIndex.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,288 +0,0 @@ - - - - -ObrIndex xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FileFilter;
-24  import java.io.FileWriter;
-25  import java.io.IOException;
-26  import java.io.Writer;
-27  import java.net.URI;
-28  import java.net.URISyntaxException;
-29  import java.util.ArrayList;
-30  import java.util.List;
-31  
-32  import org.apache.felix.bundlerepository.Property;
-33  import org.apache.felix.bundlerepository.Resource;
-34  import org.apache.felix.bundlerepository.impl.DataModelHelperImpl;
-35  import org.apache.felix.bundlerepository.impl.RepositoryImpl;
-36  import org.apache.felix.bundlerepository.impl.ResourceImpl;
-37  import org.apache.maven.artifact.repository.ArtifactRepository;
-38  import org.apache.maven.plugin.AbstractMojo;
-39  import org.apache.maven.plugin.MojoExecutionException;
-40  import org.apache.maven.plugin.logging.Log;
-41  
-42  
-43  /**
-44   * Index the content of a maven repository using OBR
-45   *
-46   * @goal index
-47   * @requiresProject false
-48   *
-49   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-50   */
-51  public final class ObrIndex extends AbstractMojo
-52  {
-53  
-54      /**
-55       * OBR Repository.
-56       *
-57       * @parameter expression="${obrRepository}"
-58       */
-59      private String obrRepository;
-60  
-61      /**
-62       * Template for urls
-63       *
-64       * @parameter expression="${urlTemplate}"
-65       */
-66      private String urlTemplate;
-67  
-68      /**
-69       * The repository to index
-70       *
-71       * @parameter expression="${mavenRepository}
-72       */
-73      private String mavenRepository;
-74  
-75      /**
-76       * Local Repository.
-77       *
-78       * @parameter expression="${localRepository}"
-79       * @required
-80       * @readonly
-81       */
-82      private ArtifactRepository localRepository;
-83  
-84  
-85      public void execute() throws MojoExecutionException
-86      {
-87          Log log = getLog();
-88          try
-89          {
-90              log.info( "Indexing..." );
-91  
-92              String repo = mavenRepository;
-93              if ( repo == null )
-94              {
-95                  repo = localRepository.getBasedir();
-96              }
-97              URI mavenRepoUri = new File( repo ).toURI();
-98  
-99              URI repositoryXml = ObrUtils.findRepositoryXml( repo, obrRepository );
-100 
-101             log.info( "Repository:   " + mavenRepoUri );
-102             log.info( "OBR xml:      " + repositoryXml );
-103             log.info( "URL template: " + urlTemplate );
-104 
-105             List<File> files = new ArrayList<File>();
-106             findAllJars( new File( repo ), files );
-107 
-108             DataModelHelperImpl dmh = new DataModelHelperImpl();
-109             RepositoryImpl repository;
-110 
-111             File obrRepoFile = new File( repositoryXml );
-112             if ( obrRepoFile.isFile() )
-113             {
-114                 repository = ( RepositoryImpl ) dmh.repository( repositoryXml.toURL() );
-115             }
-116             else
-117             {
-118                 repository = new RepositoryImpl();
-119             }
-120 
-121             for ( File file : files )
-122             {
-123                 try
-124                 {
-125                     ResourceImpl resource = ( ResourceImpl ) dmh.createResource( file.toURI().toURL() );
-126                     if ( resource != null )
-127                     {
-128                         repository.addResource( resource );
-129                         doTemplate( mavenRepoUri, file, resource );
-130                         log.info( "Adding resource: " + file );
-131                     }
-132                     else
-133                     {
-134                         log.info( "Ignoring non OSGi bundle: " + file );
-135                     }
-136                 }
-137                 catch ( Exception e )
-138                 {
-139                     log.warn( "Error processing bundle: " + file + " " + e.getMessage() );
-140                 }
-141             }
-142             Writer writer = new FileWriter( obrRepoFile );
-143             try
-144             {
-145                 dmh.writeRepository( repository, writer );
-146             }
-147             finally
-148             {
-149                 writer.close();
-150             }
-151         }
-152         catch ( Exception e )
-153         {
-154             log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e );
-155         }
-156     }
-157 
-158 
-159     protected void doTemplate( URI root, File path, ResourceImpl resource ) throws IOException, URISyntaxException
-160     {
-161         path = path.getAbsoluteFile().getCanonicalFile();
-162         String finalUri = root.relativize( path.toURI() ).toString();
-163         if ( "maven".equals( urlTemplate ) )
-164         {
-165             String dir = root.relativize( path.toURI() ).toString();
-166             String[] p = dir.split( "/" );
-167             if ( p.length >= 4 && p[p.length - 1].startsWith( p[p.length - 3] + "-" + p[p.length - 2] ) )
-168             {
-169                 String artifactId = p[p.length - 3];
-170                 String version = p[p.length - 2];
-171                 String classifier;
-172                 String type;
-173                 String artifactIdVersion = artifactId + "-" + version;
-174                 StringBuffer sb = new StringBuffer();
-175                 if ( p[p.length - 1].charAt( artifactIdVersion.length() ) == '-' )
-176                 {
-177                     classifier = p[p.length - 1].substring( artifactIdVersion.length() + 1,
-178                         p[p.length - 1].lastIndexOf( '.' ) );
-179                 }
-180                 else
-181                 {
-182                     classifier = null;
-183                 }
-184                 type = p[p.length - 1].substring( p[p.length - 1].lastIndexOf( '.' ) + 1 );
-185                 sb.append( "mvn:" );
-186                 for ( int j = 0; j < p.length - 3; j++ )
-187                 {
-188                     if ( j > 0 )
-189                     {
-190                         sb.append( '.' );
-191                     }
-192                     sb.append( p[j] );
-193                 }
-194                 sb.append( '/' ).append( artifactId ).append( '/' ).append( version );
-195                 if ( !"jar".equals( type ) || classifier != null )
-196                 {
-197                     sb.append( '/' );
-198                     if ( !"jar".equals( type ) )
-199                     {
-200                         sb.append( type );
-201                     }
-202                     if ( classifier != null )
-203                     {
-204                         sb.append( '/' ).append( classifier );
-205                     }
-206                 }
-207                 finalUri = sb.toString();
-208             }
-209         }
-210         else if ( urlTemplate != null )
-211         {
-212             URI parentDir = path.getParentFile().toURI();
-213 
-214             String absoluteDir = trim( root.toString(), parentDir.toURL().toString() );
-215             String relativeDir = trim( root.toString(), root.relativize( parentDir ).toString() );
-216 
-217             String url = urlTemplate.replaceAll( "%v", "" + resource.getVersion() );
-218             url = url.replaceAll( "%s", resource.getSymbolicName() );
-219             url = url.replaceAll( "%f", path.getName() );
-220             url = url.replaceAll( "%p", absoluteDir );
-221             url = url.replaceAll( "%rp", relativeDir );
-222             finalUri = url;
-223         }
-224         resource.put( Resource.URI, finalUri, Property.URI );
-225     }
-226 
-227 
-228     private String trim( String prefix, String path )
-229     {
-230         if ( path.endsWith( "/" ) )
-231             path = path.substring( 0, path.length() - 1 );
-232 
-233         if ( path.startsWith( prefix ) )
-234             path = path.substring( prefix.length() );
-235 
-236         return path;
-237     }
-238 
-239 
-240     private final FileFilter filter = new FileFilter()
-241     {
-242         public boolean accept( File pathname )
-243         {
-244             return pathname.getName().endsWith( "ar" );
-245         }
-246     };
-247 
-248 
-249     private void findAllJars( File mainRoot, List<File> files )
-250     {
-251         List<File> roots = new ArrayList<File>();
-252         roots.add( mainRoot );
-253         while ( !roots.isEmpty() )
-254         {
-255             File root = roots.remove( 0 );
-256             File[] children = root.listFiles();
-257             if ( children != null )
-258             {
-259                 for ( File child : children )
-260                 {
-261                     if ( child.isFile() && filter.accept( child ) )
-262                     {
-263                         files.add( child );
-264                     }
-265                     else if ( child.isDirectory() )
-266                     {
-267                         roots.add( child );
-268                     }
-269                 }
-270             }
-271         }
-272     }
-273 
-274 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrInstallFile.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrInstallFile.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrInstallFile.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrInstallFile.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,127 +0,0 @@ - - - - -ObrInstallFile xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.net.URI;
-23  import java.util.Arrays;
-24  import java.util.List;
-25  
-26  import org.apache.maven.artifact.repository.ArtifactRepository;
-27  import org.apache.maven.plugin.MojoExecutionException;
-28  import org.apache.maven.plugin.logging.Log;
-29  import org.apache.maven.project.MavenProject;
-30  
-31  
-32  /**
-33   * Installs bundle details in the local OBR repository (command-line goal)
-34   * 
-35   * @requiresProject false
-36   * @goal install-file
-37   * @phase install
-38   * 
-39   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-40   */
-41  public final class ObrInstallFile extends AbstractFileMojo
-42  {
-43      /**
-44       * OBR Repository.
-45       * 
-46       * @parameter expression="${obrRepository}"
-47       */
-48      private String obrRepository;
-49  
-50      /**
-51       * Project types which this plugin supports.
-52       *
-53       * @parameter
-54       */
-55      private List supportedProjectTypes = Arrays.asList( new String[]
-56          { "jar", "bundle" } );
-57  
-58      /**
-59       * Local Repository.
-60       * 
-61       * @parameter expression="${localRepository}"
-62       * @required
-63       * @readonly
-64       */
-65      private ArtifactRepository localRepository;
-66  
-67  
-68      public void execute() throws MojoExecutionException
-69      {
-70          MavenProject project = getProject();
-71          String projectType = project.getPackaging();
-72  
-73          // ignore unsupported project types, useful when bundleplugin is configured in parent pom
-74          if ( !supportedProjectTypes.contains( projectType ) )
-75          {
-76              getLog().warn(
-77                  "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
-78              return;
-79          }
-80          else if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) )
-81          {
-82              getLog().info( "Local OBR update disabled (enable with -DobrRepository)" );
-83              return;
-84          }
-85  
-86          Log log = getLog();
-87          ObrUpdate update;
-88  
-89          String mavenRepository = localRepository.getBasedir();
-90  
-91          URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository );
-92          URI obrXmlFile = ObrUtils.toFileURI( obrXml );
-93          URI bundleJar;
-94  
-95          if ( null == file )
-96          {
-97              bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() );
-98          }
-99          else
-100         {
-101             bundleJar = file.toURI();
-102         }
-103 
-104         Config userConfig = new Config();
-105 
-106         update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log );
-107         update.parseRepositoryXml();
-108 
-109         update.updateRepository( bundleJar, null, null );
-110 
-111         update.writeRepositoryXml();
-112     }
-113 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrInstall.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrInstall.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrInstall.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrInstall.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ - - - - -ObrInstall xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.net.URI;
-23  import java.util.Arrays;
-24  import java.util.Iterator;
-25  import java.util.List;
-26  
-27  import org.apache.maven.artifact.Artifact;
-28  import org.apache.maven.artifact.repository.ArtifactRepository;
-29  import org.apache.maven.plugin.AbstractMojo;
-30  import org.apache.maven.plugin.MojoExecutionException;
-31  import org.apache.maven.plugin.logging.Log;
-32  import org.apache.maven.project.MavenProject;
-33  
-34  
-35  /**
-36   * Installs bundle details in the local OBR repository (life-cycle goal)
-37   * 
-38   * @goal install
-39   * @phase install
-40   * @threadSafe
-41   * 
-42   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-43   */
-44  public final class ObrInstall extends AbstractMojo
-45  {
-46      /**
-47       * OBR Repository.
-48       * 
-49       * @parameter expression="${obrRepository}"
-50       */
-51      private String obrRepository;
-52  
-53      /**
-54       * Project types which this plugin supports.
-55       *
-56       * @parameter
-57       */
-58      private List supportedProjectTypes = Arrays.asList( new String[]
-59          { "jar", "bundle" } );
-60  
-61      /**
-62       * Local Repository.
-63       * 
-64       * @parameter expression="${localRepository}"
-65       * @required
-66       * @readonly
-67       */
-68      private ArtifactRepository localRepository;
-69  
-70      /**
-71       * The Maven project.
-72       * 
-73       * @parameter expression="${project}"
-74       * @required
-75       * @readonly
-76       */
-77      private MavenProject project;
-78  
-79      /**
-80       * @parameter expression="${project.attachedArtifacts}
-81       * @required
-82       * @readonly
-83       */
-84      private List attachedArtifacts;
-85  
-86      /**
-87       * Attached source artifact
-88       */
-89      private Artifact m_sourceArtifact;
-90  
-91      /**
-92       * Attached doc artifact
-93       */
-94      private Artifact m_docArtifact;
-95  
-96  
-97      public void execute()
-98      {
-99          String projectType = project.getPackaging();
-100 
-101         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
-102         if ( !supportedProjectTypes.contains( projectType ) )
-103         {
-104             getLog().warn(
-105                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
-106             return;
-107         }
-108         else if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) )
-109         {
-110             getLog().info( "Local OBR update disabled (enable with -DobrRepository)" );
-111             return;
-112         }
-113 
-114         // check for any attached sources or docs
-115         for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
-116         {
-117             Artifact artifact = ( Artifact ) i.next();
-118             if ( "sources".equals( artifact.getClassifier() ) )
-119             {
-120                 m_sourceArtifact = artifact;
-121             }
-122             else if ( "javadoc".equals( artifact.getClassifier() ) )
-123             {
-124                 m_docArtifact = artifact;
-125             }
-126         }
-127 
-128         Log log = getLog();
-129         ObrUpdate update;
-130 
-131         try
-132         {
-133             String mavenRepository = localRepository.getBasedir();
-134 
-135             URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository );
-136             URI obrXmlFile = ObrUtils.findObrXml( project );
-137 
-138             Config userConfig = new Config();
-139 
-140             update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log );
-141             synchronized ( ObrUpdate.class ) // protect against concurrent in-process updates
-142             {
-143                 update.parseRepositoryXml();
-144 
-145                 updateLocalBundleMetadata( project.getArtifact(), update );
-146                 for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
-147                 {
-148                     updateLocalBundleMetadata( ( Artifact ) i.next(), update );
-149                 }
-150 
-151                 update.writeRepositoryXml();
-152             }
-153         }
-154         catch ( Exception e )
-155         {
-156             log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e );
-157         }
-158     }
-159 
-160 
-161     private void updateLocalBundleMetadata( Artifact artifact, ObrUpdate update ) throws MojoExecutionException
-162     {
-163         if ( !supportedProjectTypes.contains( artifact.getType() ) )
-164         {
-165             return;
-166         }
-167         else if ( null == artifact.getFile() || artifact.getFile().isDirectory() )
-168         {
-169             getLog().error( "No artifact found, try \"mvn install bundle:install\"" );
-170             return;
-171         }
-172 
-173         URI bundleJar = ObrUtils.getArtifactURI( localRepository, artifact );
-174 
-175         URI sourceJar = null;
-176         if ( null != m_sourceArtifact )
-177         {
-178             sourceJar = ObrUtils.getArtifactURI( localRepository, m_sourceArtifact );
-179         }
-180 
-181         URI docJar = null;
-182         if ( null != m_docArtifact )
-183         {
-184             docJar = ObrUtils.getArtifactURI( localRepository, m_docArtifact );
-185         }
-186 
-187         update.updateRepository( bundleJar, sourceJar, docJar );
-188     }
-189 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrRemoteClean.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrRemoteClean.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrRemoteClean.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrRemoteClean.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,513 +0,0 @@ - - - - -ObrRemoteClean xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.BufferedReader;
-23  import java.io.File;
-24  import java.io.FileNotFoundException;
-25  import java.io.FileOutputStream;
-26  import java.io.IOException;
-27  import java.io.InputStreamReader;
-28  import java.net.MalformedURLException;
-29  import java.net.URI;
-30  import java.net.URL;
-31  import java.text.SimpleDateFormat;
-32  import java.util.ArrayList;
-33  import java.util.Arrays;
-34  import java.util.Date;
-35  import java.util.List;
-36  import java.util.Properties;
-37  import java.util.regex.Matcher;
-38  import java.util.regex.Pattern;
-39  
-40  import javax.xml.parsers.DocumentBuilder;
-41  import javax.xml.parsers.DocumentBuilderFactory;
-42  import javax.xml.parsers.ParserConfigurationException;
-43  import javax.xml.transform.Result;
-44  import javax.xml.transform.Transformer;
-45  import javax.xml.transform.TransformerConfigurationException;
-46  import javax.xml.transform.TransformerException;
-47  import javax.xml.transform.TransformerFactory;
-48  import javax.xml.transform.dom.DOMSource;
-49  import javax.xml.transform.stream.StreamResult;
-50  
-51  import org.apache.maven.artifact.manager.WagonManager;
-52  import org.apache.maven.artifact.repository.ArtifactRepository;
-53  import org.apache.maven.plugin.AbstractMojo;
-54  import org.apache.maven.plugin.MojoExecutionException;
-55  import org.apache.maven.plugin.logging.Log;
-56  import org.apache.maven.project.MavenProject;
-57  import org.apache.maven.settings.Settings;
-58  import org.w3c.dom.Document;
-59  import org.w3c.dom.Element;
-60  import org.w3c.dom.Node;
-61  import org.w3c.dom.NodeList;
-62  import org.xml.sax.SAXException;
-63  
-64  
-65  /**
-66   * Clean a remote repository file.
-67   * It just looks for every resources and check that pointed file exists.
-68   * 
-69   * @requiresProject false
-70   * @goal remote-clean
-71   * @phase clean
-72   * 
-73   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-74   */
-75  public final class ObrRemoteClean extends AbstractMojo
-76  {
-77      /**
-78       * When true, ignore remote locking.
-79       * 
-80       * @parameter expression="${ignoreLock}"
-81       */
-82      private boolean ignoreLock;
-83  
-84      /**
-85       * Optional public URL prefix for the remote repository.
-86       *
-87       * @parameter expression="${prefixUrl}"
-88       */
-89      private String prefixUrl;
-90  
-91      /**
-92       * Remote OBR Repository.
-93       * 
-94       * @parameter expression="${remoteOBR}" default-value="NONE"
-95       */
-96      private String remoteOBR;
-97  
-98      /**
-99       * Local OBR Repository.
-100      * 
-101      * @parameter expression="${obrRepository}"
-102      */
-103     private String obrRepository;
-104 
-105     /**
-106      * Project types which this plugin supports.
-107      *
-108      * @parameter
-109      */
-110     private List supportedProjectTypes = Arrays.asList( new String[]
-111         { "jar", "bundle" } );
-112 
-113     /**
-114      * @parameter expression="${project.distributionManagementArtifactRepository}"
-115      * @readonly
-116      */
-117     private ArtifactRepository deploymentRepository;
-118 
-119     /**
-120      * Alternative deployment repository. Format: id::layout::url
-121      * 
-122      * @parameter expression="${altDeploymentRepository}"
-123      */
-124     private String altDeploymentRepository;
-125 
-126     /**
-127      * OBR specific deployment repository. Format: id::layout::url
-128      *
-129      * @parameter expression="${obrDeploymentRepository}"
-130      */
-131     private String obrDeploymentRepository;
-132 
-133     /**
-134      * @parameter default-value="${settings.interactiveMode}"
-135      * @readonly
-136      */
-137     private boolean interactive;
-138 
-139     /**
-140      * The Maven project.
-141      * 
-142      * @parameter expression="${project}"
-143      * @required
-144      * @readonly
-145      */
-146     private MavenProject project;
-147 
-148     /**
-149      * Local Maven settings.
-150      * 
-151      * @parameter expression="${settings}"
-152      * @required
-153      * @readonly
-154      */
-155     private Settings settings;
-156 
-157     /**
-158      * The Wagon manager.
-159      * 
-160      * @component
-161      */
-162     private WagonManager m_wagonManager;
-163 
-164 
-165     public void execute() throws MojoExecutionException
-166     {
-167         String projectType = project.getPackaging();
-168 
-169         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
-170         if ( !supportedProjectTypes.contains( projectType ) )
-171         {
-172             getLog().warn(
-173                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
-174             return;
-175         }
-176         else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) )
-177         {
-178             getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" );
-179             return;
-180         }
-181 
-182         // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead
-183         if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) )
-184         {
-185             remoteOBR = obrRepository;
-186         }
-187 
-188         URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR );
-189         String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName();
-190 
-191         Log log = getLog();
-192 
-193         RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log );
-194         openRepositoryConnection( remoteFile );
-195         if ( null == prefixUrl )
-196         {
-197             prefixUrl = remoteFile.toString();
-198         }
-199 
-200         // ======== LOCK REMOTE OBR ========
-201         log.info( "LOCK " + remoteFile + '/' + repositoryName );
-202         remoteFile.lockFile( repositoryName, ignoreLock );
-203         File downloadedRepositoryXml = null;
-204 
-205         try
-206         {
-207             // ======== DOWNLOAD REMOTE OBR ========
-208             log.info( "Downloading " + repositoryName );
-209             downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" );
-210 
-211             URI repositoryXml = downloadedRepositoryXml.toURI();
-212 
-213             Config userConfig = new Config();
-214             userConfig.setRemoteFile( true );
-215 
-216             // Clean the downloaded file.
-217             Document doc = parseFile( new File( repositoryXml ), initConstructor() );
-218             Node finalDocument = cleanDocument( doc.getDocumentElement() );
-219 
-220             if ( finalDocument == null )
-221             {
-222                 getLog().info( "Nothing to clean in " + repositoryName );
-223             }
-224             else
-225             {
-226                 writeToFile( repositoryXml, finalDocument ); // Write the new file
-227                 getLog().info( "Repository " + repositoryName + " cleaned" );
-228                 // ======== UPLOAD MODIFIED OBR ========
-229                 log.info( "Uploading " + repositoryName );
-230                 remoteFile.put( downloadedRepositoryXml, repositoryName );
-231             }
-232         }
-233         catch ( Exception e )
-234         {
-235             log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e );
-236         }
-237         finally
-238         {
-239             // ======== UNLOCK REMOTE OBR ========
-240             log.info( "UNLOCK " + remoteFile + '/' + repositoryName );
-241             remoteFile.unlockFile( repositoryName );
-242             remoteFile.disconnect();
-243 
-244             if ( null != downloadedRepositoryXml )
-245             {
-246                 downloadedRepositoryXml.delete();
-247             }
-248         }
-249     }
-250 
-251     private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" );
-252 
-253 
-254     private void openRepositoryConnection( RemoteFileManager remoteFile ) throws MojoExecutionException
-255     {
-256         // use OBR specific deployment location?
-257         if ( obrDeploymentRepository != null )
-258         {
-259             altDeploymentRepository = obrDeploymentRepository;
-260         }
-261 
-262         if ( deploymentRepository == null && altDeploymentRepository == null )
-263         {
-264             String msg = "Deployment failed: repository element was not specified in the pom inside"
-265                 + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter";
-266 
-267             throw new MojoExecutionException( msg );
-268         }
-269 
-270         if ( altDeploymentRepository != null )
-271         {
-272             getLog().info( "Using alternate deployment repository " + altDeploymentRepository );
-273 
-274             Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( altDeploymentRepository );
-275             if ( !matcher.matches() )
-276             {
-277                 throw new MojoExecutionException( "Invalid syntax for alternative repository \""
-278                     + altDeploymentRepository + "\". Use \"id::layout::url\"." );
-279             }
-280 
-281             remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() );
-282         }
-283         else
-284         {
-285             remoteFile.connect( deploymentRepository.getId(), deploymentRepository.getUrl() );
-286         }
-287     }
-288 
-289 
-290     /**
-291      * Analyze the given XML tree (DOM of the repository file) and remove missing resources.
-292      * This method ask the user before deleting the resources from the repository.
-293      * @param elem : the input XML tree
-294      * @return the cleaned XML tree
-295      */
-296     private Element cleanDocument( Element elem )
-297     {
-298         NodeList nodes = elem.getElementsByTagName( "resource" );
-299         List toRemove = new ArrayList();
-300 
-301         // First, look for missing resources
-302         for ( int i = 0; i < nodes.getLength(); i++ )
-303         {
-304             Element n = ( Element ) nodes.item( i );
-305             String value = n.getAttribute( "uri" );
-306 
-307             URL url;
-308             try
-309             {
-310                 url = new URL( new URL( prefixUrl + '/' ), value );
-311             }
-312             catch ( MalformedURLException e )
-313             {
-314                 getLog().error( "Malformed URL when creating the resource absolute URI : " + e.getMessage() );
-315                 return null;
-316             }
-317 
-318             try
-319             {
-320                 url.openConnection().getContent();
-321             }
-322             catch ( IOException e )
-323             {
-324                 getLog().info(
-325                     "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" )
-326                         + " will be removed : " + e.getMessage() );
-327                 toRemove.add( n );
-328             }
-329         }
-330 
-331         Date d = new Date();
-332         if ( toRemove.size() > 0 )
-333         {
-334             String answer = "y";
-335             if ( interactive )
-336             {
-337                 System.out.println( "Do you want to remove these bundles from the repository file [y/N]:" );
-338                 BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
-339 
-340                 try
-341                 {
-342                     answer = br.readLine();
-343                 }
-344                 catch ( IOException ioe )
-345                 {
-346                     getLog().error( "IO error trying to read the user confirmation" );
-347                     return null;
-348                 }
-349             }
-350 
-351             if ( answer != null && answer.trim().equalsIgnoreCase( "y" ) )
-352             {
-353                 // Then remove missing resources.
-354                 for ( int i = 0; i < toRemove.size(); i++ )
-355                 {
-356                     elem.removeChild( ( Node ) toRemove.get( i ) );
-357                 }
-358 
-359                 // If we have to remove resources, we need to update 'lastmodified' attribute
-360                 SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" );
-361                 d.setTime( System.currentTimeMillis() );
-362                 elem.setAttribute( "lastmodified", format.format( d ) );
-363                 return elem;
-364             }
-365             else
-366             {
-367                 return null;
-368             }
-369         }
-370 
-371         return null;
-372     }
-373 
-374 
-375     /**
-376      * Initialize the document builder from Xerces.
-377      * 
-378      * @return DocumentBuilder ready to create new document
-379      * @throws MojoExecutionException : occurs when the instantiation of the document builder fails
-380      */
-381     private DocumentBuilder initConstructor() throws MojoExecutionException
-382     {
-383         DocumentBuilder constructor = null;
-384         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-385         try
-386         {
-387             constructor = factory.newDocumentBuilder();
-388         }
-389         catch ( ParserConfigurationException e )
-390         {
-391             getLog().error( "Unable to create a new xml document" );
-392             throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() );
-393         }
-394         return constructor;
-395     }
-396 
-397 
-398     /**
-399      * Open an XML file.
-400      * 
-401      * @param file : XML file
-402      * @param constructor DocumentBuilder get from xerces
-403      * @return Document which describes this file
-404      * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file.
-405      */
-406     private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException
-407     {
-408         if ( constructor == null )
-409         {
-410             return null;
-411         }
-412         // The document is the root of the DOM tree.
-413         File targetFile = file.getAbsoluteFile();
-414         getLog().info( "Parsing " + targetFile );
-415         Document doc = null;
-416         try
-417         {
-418             doc = constructor.parse( targetFile );
-419         }
-420         catch ( SAXException e )
-421         {
-422             getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() );
-423             throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() );
-424         }
-425         catch ( IOException e )
-426         {
-427             getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() );
-428             throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() );
-429         }
-430         return doc;
-431     }
-432 
-433 
-434     /**
-435      * write a Node in a xml file.
-436      * 
-437      * @param outputFilename URI to the output file
-438      * @param treeToBeWrite Node root of the tree to be write in file
-439      * @throws MojoExecutionException if the plugin failed
-440      */
-441     private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException
-442     {
-443         // init the transformer
-444         Transformer transformer = null;
-445         TransformerFactory tfabrique = TransformerFactory.newInstance();
-446         try
-447         {
-448             transformer = tfabrique.newTransformer();
-449         }
-450         catch ( TransformerConfigurationException e )
-451         {
-452             getLog().error( "Unable to write to file: " + outputFilename.toString() );
-453             throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "
-454                 + e.getMessage() );
-455         }
-456         Properties proprietes = new Properties();
-457         proprietes.put( "method", "xml" );
-458         proprietes.put( "version", "1.0" );
-459         proprietes.put( "encoding", "ISO-8859-1" );
-460         proprietes.put( "standalone", "yes" );
-461         proprietes.put( "indent", "yes" );
-462         proprietes.put( "omit-xml-declaration", "no" );
-463         transformer.setOutputProperties( proprietes );
-464 
-465         DOMSource input = new DOMSource( treeToBeWrite );
-466 
-467         File fichier = new File( outputFilename );
-468         FileOutputStream flux = null;
-469         try
-470         {
-471             flux = new FileOutputStream( fichier );
-472         }
-473         catch ( FileNotFoundException e )
-474         {
-475             getLog().error( "Unable to write to file: " + fichier.getName() );
-476             throw new MojoExecutionException( "Unable to write to file: " + fichier.getName() + " : " + e.getMessage() );
-477         }
-478         Result output = new StreamResult( flux );
-479         try
-480         {
-481             transformer.transform( input, output );
-482         }
-483         catch ( TransformerException e )
-484         {
-485             throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "
-486                 + e.getMessage() );
-487         }
-488 
-489         try
-490         {
-491             flux.flush();
-492             flux.close();
-493         }
-494         catch ( IOException e )
-495         {
-496             throw new MojoExecutionException( "IOException when closing file : " + e.getMessage() );
-497         }
-498     }
-499 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrUpdate.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrUpdate.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrUpdate.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrUpdate.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ - - - - -ObrUpdate xref - - - -
-
-1   /* 
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FileInputStream;
-24  import java.io.FileOutputStream;
-25  import java.io.IOException;
-26  import java.io.InputStream;
-27  import java.io.OutputStreamWriter;
-28  import java.io.Writer;
-29  import java.lang.reflect.Method;
-30  import java.net.URI;
-31  import java.util.regex.Pattern;
-32  
-33  import org.apache.felix.bundlerepository.Resource;
-34  import org.apache.felix.bundlerepository.impl.DataModelHelperImpl;
-35  import org.apache.felix.bundlerepository.impl.PullParser;
-36  import org.apache.felix.bundlerepository.impl.RepositoryImpl;
-37  import org.apache.felix.bundlerepository.impl.RepositoryParser;
-38  import org.apache.felix.bundlerepository.impl.ResourceImpl;
-39  import org.apache.maven.plugin.MojoExecutionException;
-40  import org.apache.maven.plugin.logging.Log;
-41  import org.apache.maven.project.MavenProject;
-42  import org.codehaus.plexus.util.FileUtils;
-43  import org.kxml2.io.KXmlParser;
-44  import org.xmlpull.v1.XmlPullParser;
-45  
-46  
-47  /**
-48   * this class parse the old repository.xml file build the bundle resource description and update the repository.
-49   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-50   */
-51  public class ObrUpdate
-52  {
-53      private static Pattern TIMESTAMP = Pattern.compile( "-[0-9]{8}\\.[0-9]{6}-[0-9]+" );
-54  
-55      private static Method setURI;
-56  
-57      static
-58      {
-59          try
-60          {
-61              setURI = RepositoryImpl.class.getDeclaredMethod( "setURI", String.class );
-62              setURI.setAccessible( true );
-63          }
-64          catch ( Exception e )
-65          {
-66              setURI = null;
-67          }
-68      }
-69  
-70      /**
-71       * logger for this plugin.
-72       */
-73      private Log m_logger;
-74  
-75      /**
-76       * name and path to the repository descriptor file.
-77       */
-78      private URI m_repositoryXml;
-79  
-80      /**
-81       * name and path to the obr.xml file.
-82       */
-83      private URI m_obrXml;
-84  
-85      /**
-86       * maven project description.
-87       */
-88      private MavenProject m_project;
-89  
-90      /**
-91       * user configuration information.
-92       */
-93      private Config m_userConfig;
-94  
-95      /**
-96       * root on parent document.
-97       */
-98      private RepositoryImpl m_repository;
-99  
-100     /**
-101      * used to store bundle information.
-102      */
-103     private ResourceImpl m_resourceBundle;
-104 
-105     /**
-106      * base URI used to relativize bundle URIs.
-107      */
-108     private URI m_baseURI;
-109 
-110 
-111     /**
-112      * initialize information.
-113      * @param repositoryXml path to the repository descriptor file
-114      * @param obrXml path and filename to the obr.xml file
-115      * @param project maven project description
-116      * @param mavenRepositoryPath path to the local maven repository
-117      * @param userConfig user information
-118      * @param logger plugin logger
-119      */
-120     public ObrUpdate( URI repositoryXml, URI obrXml, MavenProject project, String mavenRepositoryPath,
-121         Config userConfig, Log logger )
-122     {
-123         m_repositoryXml = repositoryXml;
-124         m_obrXml = obrXml;
-125         m_project = project;
-126         m_logger = logger;
-127 
-128         m_userConfig = userConfig;
-129 
-130         if ( userConfig.isRemoteFile() )
-131         {
-132             m_baseURI = ObrUtils.toFileURI( mavenRepositoryPath );
-133         }
-134         else
-135         {
-136             m_baseURI = m_repositoryXml;
-137         }
-138     }
-139 
-140 
-141     /**
-142      * update the repository descriptor file. parse the old repository descriptor file,
-143      * get the old reference of the bundle or determine the id for a new bundle, extract
-144      * information from bindex set the new information in descriptor file and save it.
-145      * 
-146      * @param bundleJar path to the bundle jar file
-147      * @param sourceJar path to the source jar file
-148      * @param docJar path to the docs jar file
-149      * 
-150      * @throws MojoExecutionException if the plugin failed
-151      */
-152     public void updateRepository( URI bundleJar, URI sourceJar, URI docJar ) throws MojoExecutionException
-153     {
-154         m_logger.debug( " (f) repositoryXml = " + m_repositoryXml );
-155         m_logger.debug( " (f) bundleJar = " + bundleJar );
-156         m_logger.debug( " (f) sourceJar = " + sourceJar );
-157         m_logger.debug( " (f) docJar = " + docJar );
-158         m_logger.debug( " (f) obrXml = " + m_obrXml );
-159 
-160         if ( m_repository == null )
-161         {
-162             return;
-163         }
-164 
-165         // get the file size
-166         File bundleFile = new File( bundleJar );
-167         if ( !bundleFile.exists() )
-168         {
-169             String snapshot = TIMESTAMP.matcher( bundleFile.getName() ).replaceFirst( "-SNAPSHOT" );
-170             bundleFile = new File( bundleFile.getParentFile(), snapshot );
-171         }
-172         if ( bundleFile.exists() )
-173         {
-174             URI resourceURI = m_userConfig.getRemoteBundle();
-175             if ( null == resourceURI )
-176             {
-177                 resourceURI = bundleJar;
-178                 if ( m_userConfig.isPathRelative() )
-179                 {
-180                     resourceURI = ObrUtils.getRelativeURI( m_baseURI, resourceURI );
-181                 }
-182             }
-183 
-184             if ( m_userConfig.isRemoteFile() )
-185             {
-186                 m_logger.info( "Deploying " + resourceURI );
-187             }
-188             else
-189             {
-190                 m_logger.info( "Installing " + resourceURI );
-191             }
-192 
-193             try
-194             {
-195                 m_resourceBundle = ( ResourceImpl ) new DataModelHelperImpl().createResource( bundleFile.toURI().toURL() );
-196                 if ( m_resourceBundle == null )
-197                 {
-198                     return;
-199                 }
-200             }
-201             catch ( IOException e )
-202             {
-203                 throw new MojoExecutionException( "Unable to load resource information", e );
-204             }
-205 
-206             m_resourceBundle.put( Resource.SIZE, String.valueOf( bundleFile.length() ) );
-207             m_resourceBundle.put( Resource.URI, resourceURI.toASCIIString() );
-208         }
-209         else
-210         {
-211             m_logger.error( "file doesn't exist: " + bundleJar );
-212             return;
-213         }
-214 
-215         // parse the obr.xml file
-216         if ( m_obrXml != null )
-217         {
-218             m_logger.info( "Adding " + m_obrXml );
-219 
-220             // URL url = getClass().getResource("/SchemaObr.xsd");
-221             // TODO validate obr.xml file
-222 
-223             // add contents to resource bundle
-224             parseObrXml();
-225         }
-226 
-227         String sourcePath = relativisePath( sourceJar );
-228         String docPath = relativisePath( docJar );
-229 
-230         //        m_resourceBundle.construct( m_project, bindexExtractor, sourcePath, docPath );
-231         //         TODO: rebuild wrt m_project
-232 
-233         m_repository.addResource( m_resourceBundle );
-234         m_repository.setLastModified( System.currentTimeMillis() );
-235     }
-236 
-237 
-238     private String relativisePath( URI uri )
-239     {
-240         if ( null != uri )
-241         {
-242             if ( m_userConfig.isPathRelative() )
-243             {
-244                 return ObrUtils.getRelativeURI( m_baseURI, uri ).toASCIIString();
-245             }
-246 
-247             return uri.toASCIIString();
-248         }
-249 
-250         return null;
-251     }
-252 
-253 
-254     public void writeRepositoryXml() throws MojoExecutionException
-255     {
-256         m_logger.info( "Writing OBR metadata" );
-257 
-258         File file = null;
-259         Writer writer;
-260         try
-261         {
-262             file = File.createTempFile( "repository", ".xml" );
-263             writer = new OutputStreamWriter( new FileOutputStream( file ) );
-264         }
-265         catch ( IOException e )
-266         {
-267             m_logger.error( "Unable to write to file: " + file.getName() );
-268             e.printStackTrace();
-269             throw new MojoExecutionException( "Unable to write to file: " + file.getName() + " : " + e.getMessage() );
-270         }
-271 
-272         try
-273         {
-274             new DataModelHelperImpl().writeRepository( m_repository, writer );
-275         }
-276         catch ( IOException e )
-277         {
-278             throw new MojoExecutionException( "Unable to write repository xml", e );
-279         }
-280 
-281         try
-282         {
-283             writer.flush();
-284             writer.close();
-285 
-286             File outputFile = new File( m_repositoryXml );
-287             outputFile.getParentFile().mkdirs();
-288             FileUtils.rename( file, outputFile );
-289         }
-290         catch ( IOException e )
-291         {
-292             e.printStackTrace();
-293             throw new MojoExecutionException( "IOException" );
-294         }
-295 
-296     }
-297 
-298 
-299     /**
-300       * Parse the repository descriptor file.
-301       *
-302       * @throws MojoExecutionException if the plugin failed
-303       */
-304     public void parseRepositoryXml() throws MojoExecutionException
-305     {
-306         File fout = new File( m_repositoryXml );
-307         if ( !fout.exists() )
-308         {
-309             m_repository = new RepositoryImpl();
-310             writeRepositoryXml();
-311         }
-312         else
-313         {
-314             try
-315             {
-316                 m_repository = ( RepositoryImpl ) new DataModelHelperImpl().repository( m_repositoryXml.toURL() );
-317                 if ( setURI != null )
-318                 {
-319                     setURI.invoke( m_repository, ( String ) null );
-320                 }
-321             }
-322             catch ( Exception e )
-323             {
-324                 throw new MojoExecutionException( "Unable to read repository xml: " + m_repositoryXml, e );
-325             }
-326         }
-327     }
-328 
-329 
-330     /**
-331      * put the information from obr.xml into ressourceBundle object.
-332      */
-333     private void parseObrXml() throws MojoExecutionException
-334     {
-335         try
-336         {
-337             InputStream is = new FileInputStream( new File( m_obrXml ) );
-338             try
-339             {
-340                 KXmlParser kxp = new KXmlParser();
-341                 kxp.setInput( is, null );
-342                 kxp.nextTag(); // skip top level element
-343                 kxp.nextTag(); // go to first child element
-344                 parseObrXml( kxp );
-345             }
-346             finally
-347             {
-348                 is.close();
-349             }
-350         }
-351         catch ( Exception e )
-352         {
-353             throw new MojoExecutionException( "Unable to parse obr xml: " + m_obrXml, e );
-354         }
-355     }
-356 
-357 
-358     private void parseObrXml( KXmlParser kxp ) throws Exception
-359     {
-360         PullParser parser = new PullParser();
-361         while ( kxp.getEventType() == XmlPullParser.START_TAG )
-362         {
-363             if ( RepositoryParser.CATEGORY.equals( kxp.getName() ) )
-364             {
-365                 m_resourceBundle.addCategory( parser.parseCategory( kxp ) );
-366             }
-367             else if ( RepositoryParser.REQUIRE.equals( kxp.getName() ) )
-368             {
-369                 m_resourceBundle.addRequire( parser.parseRequire( kxp ) );
-370             }
-371             else if ( RepositoryParser.CAPABILITY.equals( kxp.getName() ) )
-372             {
-373                 m_resourceBundle.addCapability( parser.parseCapability( kxp ) );
-374             }
-375             else
-376             {
-377                 kxp.nextTag();
-378                 parseObrXml( kxp );
-379             }
-380             kxp.nextTag();
-381         }
-382     }
-383 
-384 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrUtils.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrUtils.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/ObrUtils.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/ObrUtils.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ - - - - -ObrUtils xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.net.URI;
-24  import java.util.Iterator;
-25  import java.util.regex.Pattern;
-26  
-27  import org.apache.maven.artifact.Artifact;
-28  import org.apache.maven.artifact.repository.ArtifactRepository;
-29  import org.apache.maven.model.Resource;
-30  import org.apache.maven.project.MavenProject;
-31  
-32  
-33  /**
-34   * Various OBR utility methods
-35   * 
-36   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-37   */
-38  public class ObrUtils
-39  {
-40      private static final String DOT_XML = ".xml";
-41      private static final String REPO_XML = "repository.xml";
-42      private static final String OBR_XML = "obr.xml";
-43  
-44  
-45      /**
-46       * @param mavenRepository path to local maven repository
-47       * @param obrRepository path to specific repository.xml
-48       * @return URI pointing to correct repository.xml
-49       */
-50      public static URI findRepositoryXml( String mavenRepository, String obrRepository )
-51      {
-52          String targetPath = obrRepository;
-53  
-54          Pattern ignoredNames = Pattern.compile( "^(true|false|none|null)?$", Pattern.CASE_INSENSITIVE );
-55  
-56          // Combine location settings into a single repository location
-57          if ( null == targetPath || ignoredNames.matcher( targetPath ).matches() )
-58          {
-59              targetPath = mavenRepository + '/' + REPO_XML;
-60          }
-61          else if ( !targetPath.toLowerCase().endsWith( DOT_XML ) )
-62          {
-63              targetPath = targetPath + '/' + REPO_XML;
-64          }
-65  
-66          URI uri;
-67          try
-68          {
-69              uri = new URI( targetPath );
-70              uri.toURL(); // check protocol
-71          }
-72          catch ( Exception e )
-73          {
-74              uri = null;
-75          }
-76  
-77          // fall-back to file-system approach
-78          if ( null == uri || !uri.isAbsolute() )
-79          {
-80              uri = new File( targetPath ).toURI();
-81          }
-82  
-83          return uri;
-84      }
-85  
-86  
-87      /**
-88       * @param project current project
-89       * @return URI pointing to correct obr.xml, null if not found
-90       */
-91      public static URI findObrXml( MavenProject project )
-92      {
-93          File obrFile = new File( project.getBuild().getOutputDirectory(), OBR_XML );
-94          if ( obrFile.exists() )
-95          {
-96              return obrFile.toURI();
-97          }
-98          for ( Iterator i = project.getResources().iterator(); i.hasNext(); )
-99          {
-100             Resource resource = ( Resource ) i.next();
-101             obrFile = new File( resource.getDirectory(), OBR_XML );
-102             if ( obrFile.exists() )
-103             {
-104                 return obrFile.toURI();
-105             }
-106         }
-107         return null;
-108     }
-109 
-110 
-111     /**
-112      * @param repository maven repository
-113      * @param artifact maven artifact
-114      * @return file URI pointing to artifact in repository
-115      */
-116     public static URI getArtifactURI( ArtifactRepository repository, Artifact artifact )
-117     {
-118         String baseDir = repository.getBasedir();
-119         String artifactPath = repository.pathOf( artifact );
-120 
-121         return toFileURI( baseDir + '/' + artifactPath );
-122     }
-123 
-124 
-125     /**
-126      * @param path filesystem path
-127      * @return file URI for the path
-128      */
-129     public static URI toFileURI( String path )
-130     {
-131         if ( null == path )
-132         {
-133             return null;
-134         }
-135         else if ( path.startsWith( "file:" ) )
-136         {
-137             return URI.create( path );
-138         }
-139         else
-140         {
-141             return new File( path ).toURI();
-142         }
-143     }
-144 
-145 
-146     /**
-147      * @param repositoryXml URI pointing to repository.xml, or directory containing it
-148      * @param bundleJar URI pointing to bundle jarfile
-149      * @return relative URI to bundle jarfile
-150      */
-151     public static URI getRelativeURI( URI repositoryXml, URI bundleJar )
-152     {
-153         try
-154         {
-155             String repositoryPath = repositoryXml.getPath();
-156             if ( repositoryPath.toLowerCase().endsWith( DOT_XML ) )
-157             {
-158                 // remove filename to get containing directory
-159                 int dirnameIndex = repositoryPath.lastIndexOf( '/' );
-160                 repositoryPath = repositoryPath.substring( 0, dirnameIndex );
-161             }
-162 
-163             URI rootURI = new URI( null, repositoryPath, null );
-164             URI localURI = new URI( null, bundleJar.getPath(), null );
-165 
-166             return rootURI.relativize( localURI );
-167         }
-168         catch ( Exception e )
-169         {
-170             return bundleJar;
-171         }
-172     }
-173 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.obrplugin - - - - -

- org.apache.felix.obrplugin -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.obrplugin - - - -
- -
-
- -
- -

Package org.apache.felix.obrplugin

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class Summary
- AbstractFileMojo -
- Config -
- ObrCleanRepo -
- ObrDeploy -
- ObrDeployFile -
- ObrIndex -
- ObrInstall -
- ObrInstallFile -
- ObrRemoteClean -
- ObrUpdate -
- ObrUtils -
- PomHelper -
- RemoteFileManager -
- XmlHelper -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/PomHelper.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/PomHelper.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/PomHelper.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/PomHelper.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ - - - - -PomHelper xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.io.FileNotFoundException;
-24  import java.io.FileReader;
-25  import java.io.IOException;
-26  import java.io.Reader;
-27  
-28  import org.apache.maven.model.Model;
-29  import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-30  import org.apache.maven.plugin.MojoExecutionException;
-31  import org.apache.maven.project.MavenProject;
-32  import org.codehaus.plexus.util.IOUtil;
-33  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-34  
-35  
-36  /**
-37   * Maven POM helper methods.
-38   * 
-39   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-40   */
-41  public final class PomHelper
-42  {
-43      public static MavenProject readPom( File pomFile ) throws MojoExecutionException
-44      {
-45          Reader reader = null;
-46  
-47          try
-48          {
-49              reader = new FileReader( pomFile );
-50              MavenXpp3Reader modelReader = new MavenXpp3Reader();
-51              return new MavenProject( modelReader.read( reader ) );
-52          }
-53          catch ( FileNotFoundException e )
-54          {
-55              throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e );
-56          }
-57          catch ( IOException e )
-58          {
-59              throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e );
-60          }
-61          catch ( XmlPullParserException e )
-62          {
-63              throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e );
-64          }
-65          finally
-66          {
-67              IOUtil.close( reader );
-68          }
-69      }
-70  
-71  
-72      public static MavenProject buildPom( String groupId, String artifactId, String version, String packaging )
-73      {
-74          Model model = new Model();
-75  
-76          model.setModelVersion( "4.0.0" );
-77          model.setGroupId( groupId );
-78          model.setArtifactId( artifactId );
-79          model.setVersion( version );
-80          model.setPackaging( packaging );
-81  
-82          return new MavenProject( model );
-83      }
-84  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/RemoteFileManager.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/RemoteFileManager.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/RemoteFileManager.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/RemoteFileManager.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,387 +0,0 @@ - - - - -RemoteFileManager xref - - - -
-
-1   /* 
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import java.io.BufferedWriter;
-23  import java.io.File;
-24  import java.io.FileWriter;
-25  import java.io.IOException;
-26  import java.io.Writer;
-27  
-28  import org.apache.maven.artifact.manager.WagonManager;
-29  import org.apache.maven.plugin.MojoExecutionException;
-30  import org.apache.maven.plugin.logging.Log;
-31  import org.apache.maven.settings.Proxy;
-32  import org.apache.maven.settings.Settings;
-33  import org.apache.maven.wagon.ConnectionException;
-34  import org.apache.maven.wagon.ResourceDoesNotExistException;
-35  import org.apache.maven.wagon.TransferFailedException;
-36  import org.apache.maven.wagon.UnsupportedProtocolException;
-37  import org.apache.maven.wagon.Wagon;
-38  import org.apache.maven.wagon.WagonException;
-39  import org.apache.maven.wagon.authentication.AuthenticationException;
-40  import org.apache.maven.wagon.authorization.AuthorizationException;
-41  import org.apache.maven.wagon.proxy.ProxyInfo;
-42  import org.apache.maven.wagon.repository.Repository;
-43  
-44  
-45  /**
-46   * this class is used to manage all connections by wagon.
-47   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-48   */
-49  public class RemoteFileManager
-50  {
-51      /**
-52       * save the connection.
-53       */
-54      private Wagon m_wagon;
-55  
-56      /**
-57       * the wagon manager.
-58       */
-59      private WagonManager m_wagonManager;
-60  
-61      /**
-62       * the project settings.
-63       */
-64      private Settings m_settings;
-65  
-66      /**
-67       * logger instance.
-68       */
-69      private Log m_log;
-70  
-71  
-72      /**
-73       * initialize main information.
-74       * @param wm WagonManager provides by maven
-75       * @param settings settings of the current project provides by maven
-76       * @param log logger
-77       */
-78      public RemoteFileManager( WagonManager wm, Settings settings, Log log )
-79      {
-80          m_wagonManager = wm;
-81          m_settings = settings;
-82          m_log = log;
-83          m_wagon = null;
-84      }
-85  
-86  
-87      /**
-88       * disconnect the current object.
-89       */
-90      public void disconnect()
-91      {
-92          try
-93          {
-94              if ( m_wagon != null )
-95              {
-96                  m_wagon.disconnect();
-97              }
-98          }
-99          catch ( ConnectionException e )
-100         {
-101             m_log.error( "Error disconnecting Wagon", e );
-102         }
-103     }
-104 
-105 
-106     /**
-107      * connect the current object to repository given in constructor.
-108      * @param id repository id
-109      * @param url repository url
-110      * @throws MojoExecutionException
-111      */
-112     public void connect( String id, String url ) throws MojoExecutionException
-113     {
-114         Repository repository = new Repository( id, url );
-115 
-116         try
-117         {
-118             m_wagon = m_wagonManager.getWagon( repository );
-119         }
-120         catch ( UnsupportedProtocolException e )
-121         {
-122             throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );
-123         }
-124         catch ( WagonException e )
-125         {
-126             throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );
-127         }
-128 
-129         try
-130         {
-131             ProxyInfo proxyInfo = getProxyInfo( m_settings );
-132             if ( proxyInfo != null )
-133             {
-134                 m_wagon.connect( repository, m_wagonManager.getAuthenticationInfo( id ), proxyInfo );
-135             }
-136             else
-137             {
-138                 m_wagon.connect( repository, m_wagonManager.getAuthenticationInfo( id ) );
-139             }
-140         }
-141         catch ( ConnectionException e )
-142         {
-143             throw new MojoExecutionException( "Connection failed", e );
-144         }
-145         catch ( AuthenticationException e )
-146         {
-147             throw new MojoExecutionException( "Authentication failed", e );
-148         }
-149     }
-150 
-151 
-152     /**
-153      * get a file from the current repository connected.
-154      * @param url url to the targeted file
-155      * @param suffix suggested file suffix
-156      * @return get a file descriptor on the required resource
-157      * @throws MojoExecutionException
-158      */
-159     public File get( String url, String suffix ) throws MojoExecutionException
-160     {
-161         if ( m_wagon == null )
-162         {
-163             m_log.error( "must be connected first!" );
-164             return null;
-165         }
-166 
-167         File file = null;
-168         try
-169         {
-170             file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), suffix );
-171         }
-172         catch ( IOException e )
-173         {
-174             throw new MojoExecutionException( "I/O problem", e );
-175         }
-176 
-177         try
-178         {
-179             m_wagon.get( url, file );
-180         }
-181         catch ( TransferFailedException e )
-182         {
-183             file.delete(); // cleanup on failure
-184             throw new MojoExecutionException( "Transfer failed", e );
-185         }
-186         catch ( AuthorizationException e )
-187         {
-188             file.delete(); // cleanup on failure
-189             throw new MojoExecutionException( "Authorization failed", e );
-190         }
-191         catch ( ResourceDoesNotExistException e )
-192         {
-193             file.delete(); // return non-existent file
-194         }
-195 
-196         return file;
-197     }
-198 
-199 
-200     /**
-201      * put a file on the current repository connected.
-202      * @param file file to upload
-203      * @param url url to copy file
-204      * @throws MojoExecutionException
-205      */
-206     public void put( File file, String url ) throws MojoExecutionException
-207     {
-208         if ( m_wagon == null )
-209         {
-210             m_log.error( "must be connected first!" );
-211             return;
-212         }
-213 
-214         try
-215         {
-216             m_wagon.put( file, url );
-217         }
-218         catch ( TransferFailedException e )
-219         {
-220             throw new MojoExecutionException( "Transfer failed", e );
-221         }
-222         catch ( AuthorizationException e )
-223         {
-224             throw new MojoExecutionException( "Authorization failed", e );
-225         }
-226         catch ( ResourceDoesNotExistException e )
-227         {
-228             throw new MojoExecutionException( "Resource does not exist:" + file, e );
-229         }
-230     }
-231 
-232 
-233     /**
-234      * Convenience method to map a Proxy object from the user system settings to a ProxyInfo object.
-235      * @param settings project settings given by maven
-236      * @return a proxyInfo object instancied or null if no active proxy is define in the settings.xml
-237      */
-238     public static ProxyInfo getProxyInfo( Settings settings )
-239     {
-240         ProxyInfo proxyInfo = null;
-241         if ( settings != null && settings.getActiveProxy() != null )
-242         {
-243             Proxy settingsProxy = settings.getActiveProxy();
-244 
-245             proxyInfo = new ProxyInfo();
-246             proxyInfo.setHost( settingsProxy.getHost() );
-247             proxyInfo.setType( settingsProxy.getProtocol() );
-248             proxyInfo.setPort( settingsProxy.getPort() );
-249             proxyInfo.setNonProxyHosts( settingsProxy.getNonProxyHosts() );
-250             proxyInfo.setUserName( settingsProxy.getUsername() );
-251             proxyInfo.setPassword( settingsProxy.getPassword() );
-252         }
-253 
-254         return proxyInfo;
-255     }
-256 
-257 
-258     public void lockFile( String fileName, boolean ignoreLock ) throws MojoExecutionException
-259     {
-260         if ( !ignoreLock )
-261         {
-262             int countError = 0;
-263             while ( isLockedFile( fileName ) && countError < 2 )
-264             {
-265                 countError++;
-266                 m_log.warn( "File is currently locked, retry in 10s" );
-267                 try
-268                 {
-269                     Thread.sleep( 10000 );
-270                 }
-271                 catch ( InterruptedException e )
-272                 {
-273                     m_log.warn( "Sleep interrupted" );
-274                 }
-275             }
-276 
-277             if ( countError == 2 )
-278             {
-279                 m_log.error( "File " + fileName + " is locked. Use -DignoreLock to force uploading" );
-280                 throw new MojoExecutionException( "Remote file locked" );
-281             }
-282         }
-283 
-284         File file = null;
-285         try
-286         {
-287             // create a non-empty file used to lock the remote file
-288             file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), ".lock" );
-289 
-290             Writer writer = new BufferedWriter( new FileWriter( file ) );
-291             writer.write( "LOCKED" );
-292             writer.close();
-293 
-294             put( file, fileName + ".lock" );
-295         }
-296         catch ( IOException e )
-297         {
-298             throw new MojoExecutionException( "I/O problem", e );
-299         }
-300         finally
-301         {
-302             if ( null != file )
-303             {
-304                 file.delete();
-305             }
-306         }
-307     }
-308 
-309 
-310     public void unlockFile( String fileName ) throws MojoExecutionException
-311     {
-312         File file = null;
-313         try
-314         {
-315             // clear the contents of the file used to lock the remote file
-316             file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), ".lock" );
-317 
-318             Writer writer = new BufferedWriter( new FileWriter( file ) );
-319             writer.write( " " ); // write 1 byte to force wagon upload
-320             writer.close();
-321 
-322             put( file, fileName + ".lock" );
-323         }
-324         catch ( IOException e )
-325         {
-326             throw new MojoExecutionException( "I/O problem", e );
-327         }
-328         finally
-329         {
-330             if ( null != file )
-331             {
-332                 file.delete();
-333             }
-334         }
-335     }
-336 
-337 
-338     /**
-339      * this method indicates if the targeted file is locked or not.
-340      * @param fileName name targeted
-341      * @return  true if the required file is locked, else false
-342      * @throws MojoExecutionException
-343      */
-344     public boolean isLockedFile( String fileName ) throws MojoExecutionException
-345     {
-346         File file = null;
-347         try
-348         {
-349             file = get( fileName + ".lock", ".lock" );
-350 
-351             // file is locked with contents "LOCKED"
-352             if ( null != file && file.length() <= 2 )
-353             {
-354                 return false;
-355             }
-356         }
-357         finally
-358         {
-359             if ( null != file )
-360             {
-361                 file.delete();
-362             }
-363         }
-364 
-365         return true;
-366     }
-367 
-368 
-369     public String toString()
-370     {
-371         return m_wagon.getRepository().getUrl();
-372     }
-373 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/XmlHelper.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/XmlHelper.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/felix/obrplugin/XmlHelper.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/felix/obrplugin/XmlHelper.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ - - - - -XmlHelper xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.obrplugin;
-20  
-21  
-22  import org.w3c.dom.Node;
-23  import org.w3c.dom.NodeList;
-24  
-25  
-26  /**
-27   * Provide XML helper methods to support pre-Java5 runtimes
-28   * 
-29   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-30   */
-31  public class XmlHelper
-32  {
-33      /**
-34       * based on public Java5 javadoc of org.w3c.dom.Node.getTextContent method
-35       */
-36      public static String getTextContent( Node node )
-37      {
-38          switch ( node.getNodeType() )
-39          {
-40              case Node.ELEMENT_NODE:
-41              case Node.ATTRIBUTE_NODE:
-42              case Node.ENTITY_NODE:
-43              case Node.ENTITY_REFERENCE_NODE:
-44              case Node.DOCUMENT_FRAGMENT_NODE:
-45                  return mergeTextContent( node.getChildNodes() );
-46              case Node.TEXT_NODE:
-47              case Node.CDATA_SECTION_NODE:
-48              case Node.COMMENT_NODE:
-49              case Node.PROCESSING_INSTRUCTION_NODE:
-50                  return node.getNodeValue();
-51              case Node.DOCUMENT_NODE:
-52              case Node.DOCUMENT_TYPE_NODE:
-53              case Node.NOTATION_NODE:
-54              default:
-55                  return null;
-56          }
-57      }
-58  
-59  
-60      /**
-61       * based on the following quote from public Java5 javadoc of org.w3c.dom.Node.getTextContent method:
-62       * 
-63       * "concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and
-64       * PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children"
-65       */
-66      private static String mergeTextContent( NodeList nodes )
-67      {
-68          StringBuffer buf = new StringBuffer();
-69          for ( int i = 0; i < nodes.getLength(); i++ )
-70          {
-71              Node n = nodes.item( i );
-72              final String text;
-73  
-74              switch ( n.getNodeType() )
-75              {
-76                  case Node.COMMENT_NODE:
-77                  case Node.PROCESSING_INSTRUCTION_NODE:
-78                      text = null;
-79                      break;
-80                  default:
-81                      text = getTextContent( n );
-82                      break;
-83              }
-84  
-85              if ( text != null )
-86              {
-87                  buf.append( text );
-88              }
-89          }
-90          return buf.toString();
-91      }
-92  
-93  
-94      /**
-95       * based on public Java5 javadoc of org.w3c.dom.Node.setTextContent method
-96       */
-97      public static void setTextContent( Node node, final String text )
-98      {
-99          while ( node.hasChildNodes() )
-100         {
-101             node.removeChild( node.getFirstChild() );
-102         }
-103 
-104         if ( text != null && text.length() > 0 )
-105         {
-106             Node textNode = node.getOwnerDocument().createTextNode( text );
-107             node.appendChild( textNode );
-108         }
-109     }
-110 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,598 +0,0 @@ - - - - -DependencyTreeResolutionListener xref - - - -
-
-1   package org.apache.maven.shared.dependency.tree;
-2   
-3   
-4   /*
-5    * Licensed to the Apache Software Foundation (ASF) under one
-6    * or more contributor license agreements.  See the NOTICE file
-7    * distributed with this work for additional information
-8    * regarding copyright ownership.  The ASF licenses this file
-9    * to you under the Apache License, Version 2.0 (the
-10   * "License"); you may not use this file except in compliance
-11   * with the License.  You may obtain a copy of the License at
-12   *
-13   *  http://www.apache.org/licenses/LICENSE-2.0
-14   *
-15   * Unless required by applicable law or agreed to in writing,
-16   * software distributed under the License is distributed on an
-17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-18   * KIND, either express or implied.  See the License for the
-19   * specific language governing permissions and limitations
-20   * under the License.
-21   */
-22  
-23  import java.util.Collection;
-24  import java.util.Collections;
-25  import java.util.HashMap;
-26  import java.util.IdentityHashMap;
-27  import java.util.Iterator;
-28  import java.util.Map;
-29  import java.util.Stack;
-30  
-31  import org.apache.maven.artifact.Artifact;
-32  import org.apache.maven.artifact.resolver.ResolutionListener;
-33  import org.apache.maven.artifact.resolver.ResolutionListenerForDepMgmt;
-34  import org.apache.maven.artifact.versioning.VersionRange;
-35  import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor;
-36  import org.codehaus.plexus.logging.Logger;
-37  
-38  
-39  /**
-40   * An artifact resolution listener that constructs a dependency tree.
-41   * 
-42   * @author Edwin Punzalan
-43   * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
-44   * @version $Id: DependencyTreeResolutionListener.java 661727 2008-05-30 14:21:49Z bentmann $
-45   */
-46  public class DependencyTreeResolutionListener implements ResolutionListener, ResolutionListenerForDepMgmt
-47  {
-48      // fields -----------------------------------------------------------------
-49  
-50      /**
-51       * The log to write debug messages to.
-52       */
-53      private final Logger logger;
-54  
-55      /**
-56       * The parent dependency nodes of the current dependency node.
-57       */
-58      private final Stack parentNodes;
-59  
-60      /**
-61       * A map of dependency nodes by their attached artifact.
-62       */
-63      private final Map nodesByArtifact;
-64  
-65      /**
-66       * The root dependency node of the computed dependency tree.
-67       */
-68      private DependencyNode rootNode;
-69  
-70      /**
-71       * The dependency node currently being processed by this listener.
-72       */
-73      private DependencyNode currentNode;
-74  
-75      /**
-76       * Map &lt; String replacementId, String premanaged version >
-77       */
-78      private Map managedVersions = new HashMap();
-79  
-80      /**
-81       * Map &lt; String replacementId, String premanaged scope >
-82       */
-83      private Map managedScopes = new HashMap();
-84  
-85  
-86      // constructors -----------------------------------------------------------
-87  
-88      /**
-89       * Creates a new dependency tree resolution listener that writes to the specified log.
-90       * 
-91       * @param logger
-92       *            the log to write debug messages to
-93       */
-94      public DependencyTreeResolutionListener( Logger logger )
-95      {
-96          this.logger = logger;
-97  
-98          parentNodes = new Stack();
-99          nodesByArtifact = new IdentityHashMap();
-100         rootNode = null;
-101         currentNode = null;
-102     }
-103 
-104 
-105     // ResolutionListener methods ---------------------------------------------
-106 
-107     /**
-108      * {@inheritDoc}
-109      */
-110     public void testArtifact( Artifact artifact )
-111     {
-112         log( "testArtifact: artifact=" + artifact );
-113     }
-114 
-115 
-116     /**
-117      * {@inheritDoc}
-118      */
-119     public void startProcessChildren( Artifact artifact )
-120     {
-121         log( "startProcessChildren: artifact=" + artifact );
-122 
-123         if ( !currentNode.getArtifact().equals( artifact ) )
-124         {
-125             throw new IllegalStateException( "Artifact was expected to be " + currentNode.getArtifact() + " but was "
-126                 + artifact );
-127         }
-128 
-129         parentNodes.push( currentNode );
-130     }
-131 
-132 
-133     /**
-134      * {@inheritDoc}
-135      */
-136     public void endProcessChildren( Artifact artifact )
-137     {
-138         DependencyNode node = ( DependencyNode ) parentNodes.pop();
-139 
-140         log( "endProcessChildren: artifact=" + artifact );
-141 
-142         if ( node == null )
-143         {
-144             throw new IllegalStateException( "Parent dependency node was null" );
-145         }
-146 
-147         if ( !node.getArtifact().equals( artifact ) )
-148         {
-149             throw new IllegalStateException( "Parent dependency node artifact was expected to be " + node.getArtifact()
-150                 + " but was " + artifact );
-151         }
-152     }
-153 
-154 
-155     /**
-156      * {@inheritDoc}
-157      */
-158     public void includeArtifact( Artifact artifact )
-159     {
-160         log( "includeArtifact: artifact=" + artifact );
-161 
-162         DependencyNode existingNode = getNode( artifact );
-163 
-164         /*
-165          * Ignore duplicate includeArtifact calls since omitForNearer can be called prior to includeArtifact on the same
-166          * artifact, and we don't wish to include it twice.
-167          */
-168         if ( existingNode == null && isCurrentNodeIncluded() )
-169         {
-170             DependencyNode node = addNode( artifact );
-171 
-172             /*
-173              * Add the dependency management information cached in any prior manageArtifact calls, since includeArtifact
-174              * is always called after manageArtifact.
-175              */
-176             flushDependencyManagement( node );
-177         }
-178     }
-179 
-180 
-181     /**
-182      * {@inheritDoc}
-183      */
-184     public void omitForNearer( Artifact omitted, Artifact kept )
-185     {
-186         log( "omitForNearer: omitted=" + omitted + " kept=" + kept );
-187 
-188         if ( !omitted.getDependencyConflictId().equals( kept.getDependencyConflictId() ) )
-189         {
-190             throw new IllegalArgumentException( "Omitted artifact dependency conflict id "
-191                 + omitted.getDependencyConflictId() + " differs from kept artifact dependency conflict id "
-192                 + kept.getDependencyConflictId() );
-193         }
-194 
-195         if ( isCurrentNodeIncluded() )
-196         {
-197             DependencyNode omittedNode = getNode( omitted );
-198 
-199             if ( omittedNode != null )
-200             {
-201                 removeNode( omitted );
-202             }
-203             else
-204             {
-205                 omittedNode = createNode( omitted );
-206 
-207                 currentNode = omittedNode;
-208             }
-209 
-210             omittedNode.omitForConflict( kept );
-211 
-212             /*
-213              * Add the dependency management information cached in any prior manageArtifact calls, since omitForNearer
-214              * is always called after manageArtifact.
-215              */
-216             flushDependencyManagement( omittedNode );
-217 
-218             DependencyNode keptNode = getNode( kept );
-219 
-220             if ( keptNode == null )
-221             {
-222                 addNode( kept );
-223             }
-224         }
-225     }
-226 
-227 
-228     /**
-229      * {@inheritDoc}
-230      */
-231     public void updateScope( Artifact artifact, String scope )
-232     {
-233         log( "updateScope: artifact=" + artifact + ", scope=" + scope );
-234 
-235         DependencyNode node = getNode( artifact );
-236 
-237         if ( node == null )
-238         {
-239             // updateScope events can be received prior to includeArtifact events
-240             node = addNode( artifact );
-241         }
-242 
-243         node.setOriginalScope( artifact.getScope() );
-244     }
-245 
-246 
-247     /**
-248      * {@inheritDoc}
-249      */
-250     public void manageArtifact( Artifact artifact, Artifact replacement )
-251     {
-252         // TODO: remove when ResolutionListenerForDepMgmt merged into ResolutionListener
-253 
-254         log( "manageArtifact: artifact=" + artifact + ", replacement=" + replacement );
-255 
-256         if ( replacement.getVersion() != null )
-257         {
-258             manageArtifactVersion( artifact, replacement );
-259         }
-260 
-261         if ( replacement.getScope() != null )
-262         {
-263             manageArtifactScope( artifact, replacement );
-264         }
-265     }
-266 
-267 
-268     /**
-269      * {@inheritDoc}
-270      */
-271     public void omitForCycle( Artifact artifact )
-272     {
-273         log( "omitForCycle: artifact=" + artifact );
-274 
-275         if ( isCurrentNodeIncluded() )
-276         {
-277             DependencyNode node = createNode( artifact );
-278 
-279             node.omitForCycle();
-280         }
-281     }
-282 
-283 
-284     /**
-285      * {@inheritDoc}
-286      */
-287     public void updateScopeCurrentPom( Artifact artifact, String scopeIgnored )
-288     {
-289         log( "updateScopeCurrentPom: artifact=" + artifact + ", scopeIgnored=" + scopeIgnored );
-290 
-291         DependencyNode node = getNode( artifact );
-292 
-293         if ( node == null )
-294         {
-295             // updateScopeCurrentPom events can be received prior to includeArtifact events
-296             node = addNode( artifact );
-297             // TODO remove the node that tried to impose its scope and add some info
-298         }
-299 
-300         node.setFailedUpdateScope( scopeIgnored );
-301     }
-302 
-303 
-304     /**
-305      * {@inheritDoc}
-306      */
-307     public void selectVersionFromRange( Artifact artifact )
-308     {
-309         log( "selectVersionFromRange: artifact=" + artifact );
-310 
-311         DependencyNode node = getNode( artifact );
-312 
-313         /*
-314          * selectVersionFromRange is called before includeArtifact
-315          */
-316         if ( node == null && isCurrentNodeIncluded() )
-317         {
-318             node = addNode( artifact );
-319         }
-320 
-321         node.setVersionSelectedFromRange( artifact.getVersionRange() );
-322         node.setAvailableVersions( artifact.getAvailableVersions() );
-323     }
-324 
-325 
-326     /**
-327      * {@inheritDoc}
-328      */
-329     public void restrictRange( Artifact artifact, Artifact replacement, VersionRange versionRange )
-330     {
-331         log( "restrictRange: artifact=" + artifact + ", replacement=" + replacement + ", versionRange=" + versionRange );
-332 
-333         // TODO: track range restriction in node (MNG-3093)
-334     }
-335 
-336 
-337     // ResolutionListenerForDepMgmt methods -----------------------------------
-338 
-339     /**
-340      * {@inheritDoc}
-341      */
-342     public void manageArtifactVersion( Artifact artifact, Artifact replacement )
-343     {
-344         log( "manageArtifactVersion: artifact=" + artifact + ", replacement=" + replacement );
-345 
-346         /*
-347          * DefaultArtifactCollector calls manageArtifact twice: first with the change; then subsequently with no change.
-348          * We ignore the second call when the versions are equal.
-349          */
-350         if ( isCurrentNodeIncluded() && !replacement.getVersion().equals( artifact.getVersion() ) )
-351         {
-352             /*
-353              * Cache management information and apply in includeArtifact, since DefaultArtifactCollector mutates the
-354              * artifact and then calls includeArtifact after manageArtifact.
-355              */
-356             managedVersions.put( getRangeId( replacement ), artifact.getVersion() );
-357         }
-358     }
-359 
-360 
-361     /**
-362      * {@inheritDoc}
-363      */
-364     public void manageArtifactScope( Artifact artifact, Artifact replacement )
-365     {
-366         log( "manageArtifactScope: artifact=" + artifact + ", replacement=" + replacement );
-367 
-368         /*
-369          * DefaultArtifactCollector calls manageArtifact twice: first with the change; then subsequently with no change.
-370          * We ignore the second call when the scopes are equal.
-371          */
-372         if ( isCurrentNodeIncluded() && !replacement.getScope().equals( artifact.getScope() ) )
-373         {
-374             /*
-375              * Cache management information and apply in includeArtifact, since DefaultArtifactCollector mutates the
-376              * artifact and then calls includeArtifact after manageArtifact.
-377              */
-378             managedScopes.put( getRangeId( replacement ), artifact.getScope() );
-379         }
-380     }
-381 
-382 
-383     // public methods ---------------------------------------------------------
-384 
-385     /**
-386      * Gets a list of all dependency nodes in the computed dependency tree.
-387      * 
-388      * @return a list of dependency nodes
-389      * @deprecated As of 1.1, use a {@link CollectingDependencyNodeVisitor} on the root dependency node
-390      */
-391     public Collection getNodes()
-392     {
-393         return Collections.unmodifiableCollection( nodesByArtifact.values() );
-394     }
-395 
-396 
-397     /**
-398      * Gets the root dependency node of the computed dependency tree.
-399      * 
-400      * @return the root node
-401      */
-402     public DependencyNode getRootNode()
-403     {
-404         return rootNode;
-405     }
-406 
-407 
-408     // private methods --------------------------------------------------------
-409 
-410     /**
-411      * Writes the specified message to the log at debug level with indentation for the current node's depth.
-412      * 
-413      * @param message
-414      *            the message to write to the log
-415      */
-416     private void log( String message )
-417     {
-418         int depth = parentNodes.size();
-419 
-420         StringBuffer buffer = new StringBuffer();
-421 
-422         for ( int i = 0; i < depth; i++ )
-423         {
-424             buffer.append( "  " );
-425         }
-426 
-427         buffer.append( message );
-428 
-429         logger.debug( buffer.toString() );
-430     }
-431 
-432 
-433     /**
-434      * Creates a new dependency node for the specified artifact and appends it to the current parent dependency node.
-435      * 
-436      * @param artifact
-437      *            the attached artifact for the new dependency node
-438      * @return the new dependency node
-439      */
-440     private DependencyNode createNode( Artifact artifact )
-441     {
-442         DependencyNode node = new DependencyNode( artifact );
-443 
-444         if ( !parentNodes.isEmpty() )
-445         {
-446             DependencyNode parent = ( DependencyNode ) parentNodes.peek();
-447 
-448             parent.addChild( node );
-449         }
-450 
-451         return node;
-452     }
-453 
-454 
-455     /**
-456      * Creates a new dependency node for the specified artifact, appends it to the current parent dependency node and
-457      * puts it into the dependency node cache.
-458      * 
-459      * @param artifact
-460      *            the attached artifact for the new dependency node
-461      * @return the new dependency node
-462      */
-463     // package protected for unit test
-464     DependencyNode addNode( Artifact artifact )
-465     {
-466         DependencyNode node = createNode( artifact );
-467 
-468         DependencyNode previousNode = ( DependencyNode ) nodesByArtifact.put( node.getArtifact(), node );
-469 
-470         if ( previousNode != null )
-471         {
-472             throw new IllegalStateException( "Duplicate node registered for artifact: " + node.getArtifact() );
-473         }
-474 
-475         if ( rootNode == null )
-476         {
-477             rootNode = node;
-478         }
-479 
-480         currentNode = node;
-481 
-482         return node;
-483     }
-484 
-485 
-486     /**
-487      * Gets the dependency node for the specified artifact from the dependency node cache.
-488      * 
-489      * @param artifact
-490      *            the artifact to find the dependency node for
-491      * @return the dependency node, or <code>null</code> if the specified artifact has no corresponding dependency
-492      *         node
-493      */
-494     private DependencyNode getNode( Artifact artifact )
-495     {
-496         return ( DependencyNode ) nodesByArtifact.get( artifact );
-497     }
-498 
-499 
-500     /**
-501      * Removes the dependency node for the specified artifact from the dependency node cache.
-502      * 
-503      * @param artifact
-504      *            the artifact to remove the dependency node for
-505      */
-506     private void removeNode( Artifact artifact )
-507     {
-508         DependencyNode node = ( DependencyNode ) nodesByArtifact.remove( artifact );
-509 
-510         if ( !artifact.equals( node.getArtifact() ) )
-511         {
-512             throw new IllegalStateException( "Removed dependency node artifact was expected to be " + artifact
-513                 + " but was " + node.getArtifact() );
-514         }
-515     }
-516 
-517 
-518     /**
-519      * Gets whether the all the ancestors of the dependency node currently being processed by this listener have an
-520      * included state.
-521      * 
-522      * @return <code>true</code> if all the ancestors of the current dependency node have a state of
-523      *         <code>INCLUDED</code>
-524      */
-525     private boolean isCurrentNodeIncluded()
-526     {
-527         boolean included = true;
-528 
-529         for ( Iterator iterator = parentNodes.iterator(); included && iterator.hasNext(); )
-530         {
-531             DependencyNode node = ( DependencyNode ) iterator.next();
-532 
-533             if ( node.getState() != DependencyNode.INCLUDED )
-534             {
-535                 included = false;
-536             }
-537         }
-538 
-539         return included;
-540     }
-541 
-542 
-543     /**
-544      * Updates the specified node with any dependency management information cached in prior <code>manageArtifact</code>
-545      * calls.
-546      * 
-547      * @param node
-548      *            the node to update
-549      */
-550     private void flushDependencyManagement( DependencyNode node )
-551     {
-552         Artifact artifact = node.getArtifact();
-553         String premanagedVersion = ( String ) managedVersions.get( getRangeId( artifact ) );
-554         String premanagedScope = ( String ) managedScopes.get( getRangeId( artifact ) );
-555 
-556         if ( premanagedVersion != null || premanagedScope != null )
-557         {
-558             if ( premanagedVersion != null )
-559             {
-560                 node.setPremanagedVersion( premanagedVersion );
-561             }
-562 
-563             if ( premanagedScope != null )
-564             {
-565                 node.setPremanagedScope( premanagedScope );
-566             }
-567 
-568             premanagedVersion = null;
-569             premanagedScope = null;
-570         }
-571     }
-572 
-573 
-574     private static String getRangeId( Artifact artifact )
-575     {
-576         return artifact.getDependencyConflictId() + ":" + artifact.getVersionRange();
-577     }
-578 
-579 
-580     public void manageArtifactSystemPath( Artifact artifact, Artifact replacement )
-581     {
-582         // NO-OP
-583     }
-584 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/dependency/tree/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/dependency/tree/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/dependency/tree/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/dependency/tree/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.maven.shared.dependency.tree - - - - -

- org.apache.maven.shared.dependency.tree -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/dependency/tree/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/dependency/tree/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/dependency/tree/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/dependency/tree/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.maven.shared.dependency.tree - - - -
- -
-
- -
- -

Package org.apache.maven.shared.dependency.tree

- - - - - - - - - - - - -
Class Summary
- DependencyTreeResolutionListener -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,352 +0,0 @@ - - - - -DefaultMaven2OsgiConverter xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.maven.shared.osgi;
-20  
-21  
-22  import java.io.File;
-23  import java.io.IOException;
-24  import java.util.Enumeration;
-25  import java.util.HashSet;
-26  import java.util.Iterator;
-27  import java.util.Map;
-28  import java.util.Set;
-29  import java.util.jar.JarFile;
-30  import java.util.regex.Matcher;
-31  import java.util.regex.Pattern;
-32  import java.util.zip.ZipEntry;
-33  
-34  import org.apache.maven.artifact.Artifact;
-35  
-36  import aQute.bnd.osgi.Analyzer;
-37  
-38  
-39  /**
-40   * Default implementation of {@link Maven2OsgiConverter}
-41   * 
-42   * @plexus.component
-43   * 
-44   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
-45   * @version $Id: DefaultMaven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $
-46   */
-47  public class DefaultMaven2OsgiConverter implements Maven2OsgiConverter
-48  {
-49  
-50      private static final String FILE_SEPARATOR = System.getProperty( "file.separator" );
-51  
-52  
-53      private String getBundleSymbolicName( String groupId, String artifactId )
-54      {
-55          return groupId + "." + artifactId;
-56      }
-57  
-58  
-59      /**
-60       * Get the symbolic name as groupId + "." + artifactId, with the following exceptions
-61       * <ul>
-62       * <li>if artifact.getFile is not null and the jar contains a OSGi Manifest with
-63       * Bundle-SymbolicName property then that value is returned</li>
-64       * <li>if groupId has only one section (no dots) and artifact.getFile is not null then the
-65       * first package name with classes is returned. eg. commons-logging:commons-logging ->
-66       * org.apache.commons.logging</li>
-67       * <li>if artifactId is equal to last section of groupId then groupId is returned. eg.
-68       * org.apache.maven:maven -> org.apache.maven</li>
-69       * <li>if artifactId starts with last section of groupId that portion is removed. eg.
-70       * org.apache.maven:maven-core -> org.apache.maven.core</li>
-71       * <li>if artifactId starts with groupId then the artifactId is removed. eg.
-72       * org.apache:org.apache.maven.core -> org.apache.maven.core</li>
-73       * </ul>
-74       */
-75      public String getBundleSymbolicName( Artifact artifact )
-76      {
-77          if ( ( artifact.getFile() != null ) && artifact.getFile().isFile() )
-78          {
-79              Analyzer analyzer = new Analyzer();
-80  
-81              JarFile jar = null;
-82              try
-83              {
-84                  jar = new JarFile( artifact.getFile(), false );
-85  
-86                  if ( jar.getManifest() != null )
-87                  {
-88                      String symbolicNameAttribute = jar.getManifest().getMainAttributes()
-89                          .getValue( Analyzer.BUNDLE_SYMBOLICNAME );
-90                      Map bundleSymbolicNameHeader = analyzer.parseHeader( symbolicNameAttribute );
-91  
-92                      Iterator it = bundleSymbolicNameHeader.keySet().iterator();
-93                      if ( it.hasNext() )
-94                      {
-95                          return ( String ) it.next();
-96                      }
-97                  }
-98              }
-99              catch ( IOException e )
-100             {
-101                 throw new ManifestReadingException( "Error reading manifest in jar "
-102                     + artifact.getFile().getAbsolutePath(), e );
-103             }
-104             finally
-105             {
-106                 if ( jar != null )
-107                 {
-108                     try
-109                     {
-110                         jar.close();
-111                     }
-112                     catch ( IOException e )
-113                     {
-114                     }
-115                 }
-116             }
-117         }
-118 
-119         int i = artifact.getGroupId().lastIndexOf( '.' );
-120         if ( ( i < 0 ) && ( artifact.getFile() != null ) && artifact.getFile().isFile() )
-121         {
-122             String groupIdFromPackage = getGroupIdFromPackage( artifact.getFile() );
-123             if ( groupIdFromPackage != null )
-124             {
-125                 return groupIdFromPackage;
-126             }
-127         }
-128         String lastSection = artifact.getGroupId().substring( ++i );
-129         if ( artifact.getArtifactId().equals( lastSection ) )
-130         {
-131             return artifact.getGroupId();
-132         }
-133         if ( artifact.getArtifactId().equals( artifact.getGroupId() )
-134             || artifact.getArtifactId().startsWith( artifact.getGroupId() + "." ) )
-135         {
-136             return artifact.getArtifactId();
-137         }
-138         if ( artifact.getArtifactId().startsWith( lastSection ) )
-139         {
-140             String artifactId = artifact.getArtifactId().substring( lastSection.length() );
-141             if ( Character.isLetterOrDigit( artifactId.charAt( 0 ) ) )
-142             {
-143                 return getBundleSymbolicName( artifact.getGroupId(), artifactId );
-144             }
-145             else
-146             {
-147                 return getBundleSymbolicName( artifact.getGroupId(), artifactId.substring( 1 ) );
-148             }
-149         }
-150         return getBundleSymbolicName( artifact.getGroupId(), artifact.getArtifactId() );
-151     }
-152 
-153 
-154     private String getGroupIdFromPackage( File artifactFile )
-155     {
-156         try
-157         {
-158             /* get package names from jar */
-159             Set packageNames = new HashSet();
-160             JarFile jar = new JarFile( artifactFile, false );
-161             Enumeration entries = jar.entries();
-162             while ( entries.hasMoreElements() )
-163             {
-164                 ZipEntry entry = ( ZipEntry ) entries.nextElement();
-165                 if ( entry.getName().endsWith( ".class" ) )
-166                 {
-167                     File f = new File( entry.getName() );
-168                     String packageName = f.getParent();
-169                     if ( packageName != null )
-170                     {
-171                         packageNames.add( packageName );
-172                     }
-173                 }
-174             }
-175             jar.close();
-176 
-177             /* find the top package */
-178             String[] groupIdSections = null;
-179             for ( Iterator it = packageNames.iterator(); it.hasNext(); )
-180             {
-181                 String packageName = ( String ) it.next();
-182 
-183                 String[] packageNameSections = packageName.split( "\\" + FILE_SEPARATOR );
-184                 if ( groupIdSections == null )
-185                 {
-186                     /* first candidate */
-187                     groupIdSections = packageNameSections;
-188                 }
-189                 else
-190                 // if ( packageNameSections.length < groupIdSections.length )
-191                 {
-192                     /*
-193                      * find the common portion of current package and previous selected groupId
-194                      */
-195                     int i;
-196                     for ( i = 0; ( i < packageNameSections.length ) && ( i < groupIdSections.length ); i++ )
-197                     {
-198                         if ( !packageNameSections[i].equals( groupIdSections[i] ) )
-199                         {
-200                             break;
-201                         }
-202                     }
-203                     groupIdSections = new String[i];
-204                     System.arraycopy( packageNameSections, 0, groupIdSections, 0, i );
-205                 }
-206             }
-207 
-208             if ( ( groupIdSections == null ) || ( groupIdSections.length == 0 ) )
-209             {
-210                 return null;
-211             }
-212 
-213             /* only one section as id doesn't seem enough, so ignore it */
-214             if ( groupIdSections.length == 1 )
-215             {
-216                 return null;
-217             }
-218 
-219             StringBuffer sb = new StringBuffer();
-220             for ( int i = 0; i < groupIdSections.length; i++ )
-221             {
-222                 sb.append( groupIdSections[i] );
-223                 if ( i < groupIdSections.length - 1 )
-224                 {
-225                     sb.append( '.' );
-226                 }
-227             }
-228             return sb.toString();
-229         }
-230         catch ( IOException e )
-231         {
-232             /* we took all the precautions to avoid this */
-233             throw new RuntimeException( e );
-234         }
-235     }
-236 
-237 
-238     public String getBundleFileName( Artifact artifact )
-239     {
-240         return getBundleSymbolicName( artifact ) + "_" + getVersion( artifact.getVersion() ) + ".jar";
-241     }
-242 
-243 
-244     public String getVersion( Artifact artifact )
-245     {
-246         return getVersion( artifact.getVersion() );
-247     }
-248 
-249 
-250     public String getVersion( String version )
-251     {
-252         return cleanupVersion( version );
-253     }
-254 
-255     /**
-256      * Clean up version parameters. Other builders use more fuzzy definitions of
-257      * the version syntax. This method cleans up such a version to match an OSGi
-258      * version.
-259      *
-260      * @param VERSION_STRING
-261      * @return
-262      */
-263     static final Pattern FUZZY_VERSION = Pattern.compile( "(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?",
-264         Pattern.DOTALL );
-265 
-266 
-267     static public String cleanupVersion( String version )
-268     {
-269         StringBuffer result = new StringBuffer();
-270         Matcher m = FUZZY_VERSION.matcher( version );
-271         if ( m.matches() )
-272         {
-273             String major = m.group( 1 );
-274             String minor = m.group( 3 );
-275             String micro = m.group( 5 );
-276             String qualifier = m.group( 7 );
-277 
-278             if ( major != null )
-279             {
-280                 result.append( major );
-281                 if ( minor != null )
-282                 {
-283                     result.append( "." );
-284                     result.append( minor );
-285                     if ( micro != null )
-286                     {
-287                         result.append( "." );
-288                         result.append( micro );
-289                         if ( qualifier != null )
-290                         {
-291                             result.append( "." );
-292                             cleanupModifier( result, qualifier );
-293                         }
-294                     }
-295                     else if ( qualifier != null )
-296                     {
-297                         result.append( ".0." );
-298                         cleanupModifier( result, qualifier );
-299                     }
-300                     else
-301                     {
-302                         result.append( ".0" );
-303                     }
-304                 }
-305                 else if ( qualifier != null )
-306                 {
-307                     result.append( ".0.0." );
-308                     cleanupModifier( result, qualifier );
-309                 }
-310                 else
-311                 {
-312                     result.append( ".0.0" );
-313                 }
-314             }
-315         }
-316         else
-317         {
-318             result.append( "0.0.0." );
-319             cleanupModifier( result, version );
-320         }
-321         return result.toString();
-322     }
-323 
-324 
-325     static void cleanupModifier( StringBuffer result, String modifier )
-326     {
-327         for ( int i = 0; i < modifier.length(); i++ )
-328         {
-329             char c = modifier.charAt( i );
-330             if ( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || c == '_'
-331                 || c == '-' )
-332                 result.append( c );
-333             else
-334                 result.append( '_' );
-335         }
-336     }
-337 
-338 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/ManifestReadingException.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/ManifestReadingException.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/ManifestReadingException.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/ManifestReadingException.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - - -ManifestReadingException xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.maven.shared.osgi;
-20  
-21  
-22  /**
-23   * Exception while reading the manifest. Encapsulates an IOException to make it runtime
-24   * 
-25   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
-26   * @version $Id: ManifestReadingException.java 661727 2008-05-30 14:21:49Z bentmann $
-27   */
-28  public class ManifestReadingException extends RuntimeException
-29  {
-30  
-31      public ManifestReadingException()
-32      {
-33          super();
-34      }
-35  
-36  
-37      public ManifestReadingException( String message, Throwable cause )
-38      {
-39          super( message, cause );
-40      }
-41  
-42  
-43      public ManifestReadingException( String message )
-44      {
-45          super( message );
-46      }
-47  
-48  
-49      public ManifestReadingException( Throwable cause )
-50      {
-51          super( cause );
-52      }
-53  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/Maven2OsgiConverter.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/Maven2OsgiConverter.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/Maven2OsgiConverter.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/Maven2OsgiConverter.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ - - - - -Maven2OsgiConverter xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.maven.shared.osgi;
-20  
-21  
-22  import org.apache.maven.artifact.Artifact;
-23  
-24  
-25  /**
-26   * Converter from Maven groupId,artifactId and versions to OSGi Bundle-SymbolicName and version
-27   * 
-28   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
-29   * @version $Id: Maven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $
-30   */
-31  public interface Maven2OsgiConverter
-32  {
-33  
-34      /**
-35       * Get the OSGi symbolic name for the artifact
-36       * 
-37       * @param artifact
-38       * @return the Bundle-SymbolicName manifest property
-39       */
-40      String getBundleSymbolicName( Artifact artifact );
-41  
-42  
-43      String getBundleFileName( Artifact artifact );
-44  
-45  
-46      /**
-47       * Convert a Maven version into an OSGi compliant version
-48       * 
-49       * @param artifact Maven artifact
-50       * @return the OSGi version
-51       */
-52      String getVersion( Artifact artifact );
-53  
-54  
-55      /**
-56       * Convert a Maven version into an OSGi compliant version
-57       * 
-58       * @param version Maven version
-59       * @return the OSGi version
-60       */
-61      String getVersion( String version );
-62  
-63  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.maven.shared.osgi - - - - -

- org.apache.maven.shared.osgi -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref/org/apache/maven/shared/osgi/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/org/apache/maven/shared/osgi/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.maven.shared.osgi - - - -
- -
-
- -
- -

Package org.apache.maven.shared.osgi

- - - - - - - - - - - - - - - - - - -
Class Summary
- DefaultMaven2OsgiConverter -
- ManifestReadingException -
- Maven2OsgiConverter -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/overview-frame.html maven-bundle-plugin-3.5.0/doc/site/xref/overview-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref/overview-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/overview-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference - - - - -

- All Classes -

- -

Packages

- - - - - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/overview-summary.html maven-bundle-plugin-3.5.0/doc/site/xref/overview-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref/overview-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/overview-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference - - - -
-
    -
  • Overview
  • -
  • Package
  • -
-
-
- -
- -

Maven Bundle Plugin 2.5.0 Reference

- - - - - - - - - - - - - - - - - - - - - - - - -
Packages
- org.apache.felix.bundleplugin -
- org.apache.felix.bundleplugin.baseline -
- org.apache.felix.obrplugin -
- org.apache.maven.shared.dependency.tree -
- org.apache.maven.shared.osgi -
- -
-
    -
  • Overview
  • -
  • Package
  • -
-
-
- -
- -
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref/stylesheet.css maven-bundle-plugin-3.5.0/doc/site/xref/stylesheet.css --- maven-bundle-plugin-2.5.4/doc/site/xref/stylesheet.css 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref/stylesheet.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -/* Javadoc style sheet */ -/* Define colors, fonts and other style attributes here to override the defaults */ -body { - background-color: #fff; - font-family: Arial, Helvetica, sans-serif; -} - -a:link { - color: #00f; -} -a:visited { - color: #00a; -} - -a:active, a:hover { - color: #f30 !important; -} - -ul, li { - list-style-type:none; - margin:0; - padding:0; -} - -table td { - padding: 3px; - border: 1px solid #000; -} -table { - width:100%; - border: 1px solid #000; - border-collapse: collapse; -} - -div.overview { - background-color:#ddd; - padding: 4px 4px 4px 0; -} -div.overview li, div.framenoframe li { - display: inline; -} -div.framenoframe { - text-align: center; - font-size: x-small; -} -div.framenoframe li { - margin: 0 3px 0 3px; -} -div.overview li { - margin:3px 3px 0 3px; - padding: 4px; -} -li.selected { - background-color:#888; - color: #fff; - font-weight: bold; -} - -table.summary { - margin-bottom: 20px; -} -table.summary td, table.summary th { - font-weight: bold; - text-align: left; - padding: 3px; -} -table.summary th { - background-color:#036; - color: #fff; -} -table.summary td { - background-color:#eee; - border: 1px solid black; -} - -em { - color: #A00; -} -em.comment { - color: #390; -} -.string { - color: #009; -} -div#footer { - text-align:center; -} -#overview { - padding:2px; -} - -hr { - height: 1px; - color: #000; -} - -/* JXR style sheet */ -.jxr_comment -{ - color: #390; -} - -.jxr_javadoccomment -{ - color: #A00; -} - -.jxr_string -{ - color: #009; -} - -.jxr_keyword -{ - color: #000; -} diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/allclasses-frame.html maven-bundle-plugin-3.5.0/doc/site/xref-test/allclasses-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/allclasses-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/allclasses-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ - - - - - - All Classes - - - - -

All Classes

- - - - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/index.html maven-bundle-plugin-3.5.0/doc/site/xref-test/index.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/index.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/index.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference - - - - - - - - - <body> - <h1>Frame Alert</h1> - <p> - You don't have frames. Go <a href="overview-summary.html">here</a> - </p> - </body> - - - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ - - - - -AbstractBundlePluginTest xref - - - -
-
-1   package org.apache.felix.bundleplugin;
-2   
-3   
-4   /*
-5    * Licensed to the Apache Software Foundation (ASF) under one
-6    * or more contributor license agreements.  See the NOTICE file
-7    * distributed with this work for additional information
-8    * regarding copyright ownership.  The ASF licenses this file
-9    * to you under the Apache License, Version 2.0 (the
-10   * "License"); you may not use this file except in compliance
-11   * with the License.  You may obtain a copy of the License at
-12   *
-13   *   http://www.apache.org/licenses/LICENSE-2.0
-14   *
-15   * Unless required by applicable law or agreed to in writing,
-16   * software distributed under the License is distributed on an
-17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-18   * KIND, either express or implied.  See the License for the
-19   * specific language governing permissions and limitations
-20   * under the License.
-21   */
-22  
-23  import java.io.File;
-24  
-25  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-26  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-27  import org.codehaus.plexus.PlexusTestCase;
-28  
-29  
-30  /**
-31   * Common methods for bundle plugin testing
-32   * 
-33   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
-34   * @version $Id: AbstractBundlePluginTest.java 1189376 2011-10-26 18:50:20Z mcculls $
-35   */
-36  public abstract class AbstractBundlePluginTest extends PlexusTestCase
-37  {
-38  
-39      protected MavenProjectStub getMavenProjectStub()
-40      {
-41          MavenProjectStub project = new MavenProjectStub();
-42          project.setGroupId( "group" );
-43          project.setArtifactId( "project" );
-44          project.setVersion( "1.2.3.4" );
-45          return project;
-46      }
-47  
-48  
-49      protected ArtifactStub getArtifactStub()
-50      {
-51          ArtifactStub artifact = new ArtifactStub();
-52          artifact.setGroupId( "group" );
-53          artifact.setArtifactId( "artifact" );
-54          artifact.setVersion( "1.0" );
-55          return artifact;
-56      }
-57  
-58  
-59      protected File getTestBundle()
-60      {
-61          String osgiBundleFileName = "org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar";
-62          return getTestFile( getBasedir(), "src/test/resources/" + osgiBundleFileName );
-63      }
-64  
-65  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ - - - - -ArtifactStubFactory xref - - - -
-
-1   package org.apache.felix.bundleplugin;
-2   
-3   /*
-4    * Licensed to the Apache Software Foundation (ASF) under one
-5    * or more contributor license agreements.  See the NOTICE file
-6    * distributed with this work for additional information
-7    * regarding copyright ownership.  The ASF licenses this file
-8    * to you under the Apache License, Version 2.0 (the
-9    * "License"); you may not use this file except in compliance
-10   * with the License.  You may obtain a copy of the License at
-11   *
-12   *   http://www.apache.org/licenses/LICENSE-2.0
-13   *
-14   * Unless required by applicable law or agreed to in writing,
-15   * software distributed under the License is distributed on an
-16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-17   * KIND, either express or implied.  See the License for the
-18   * specific language governing permissions and limitations
-19   * under the License.
-20   */
-21  
-22  import java.io.File;
-23  import java.io.IOException;
-24  import java.util.LinkedHashSet;
-25  import java.util.Set;
-26  
-27  import org.apache.maven.artifact.Artifact;
-28  
-29  /**
-30   * Fixed version of class that uses stable set ordering for reliable testing.
-31   */
-32  @SuppressWarnings( { "rawtypes", "unchecked" } )
-33  class ArtifactStubFactory extends org.apache.maven.plugin.testing.ArtifactStubFactory
-34  {
-35  
-36      public ArtifactStubFactory( File workingDir, boolean createFiles )
-37      {
-38          super( workingDir, createFiles );
-39      }
-40  
-41      @Override
-42      public Set getClassifiedArtifacts() throws IOException
-43      {
-44          Set set = new LinkedHashSet();
-45          set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) );
-46          set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) );
-47          set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) );
-48          set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "jar", "four" ) );
-49          return set;
-50      }
-51  
-52      @Override
-53      public Set getScopedArtifacts() throws IOException
-54      {
-55          Set set = new LinkedHashSet();
-56          set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) );
-57          set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) );
-58          set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) );
-59          set.add( createArtifact( "g", "runtime", "1.0", Artifact.SCOPE_RUNTIME ) );
-60          set.add( createArtifact( "g", "system", "1.0", Artifact.SCOPE_SYSTEM ) );
-61          return set;
-62      }
-63  
-64      @Override
-65      public Set getTypedArtifacts() throws IOException
-66      {
-67          Set set = new LinkedHashSet();
-68          set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
-69          set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
-70          set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) );
-71          set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) );
-72          set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) );
-73          return set;
-74      }
-75  
-76  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ - - - - -BlueprintComponentTest xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  
-22  import java.io.File;
-23  import java.util.ArrayList;
-24  import java.util.Arrays;
-25  import java.util.HashMap;
-26  import java.util.List;
-27  import java.util.Map;
-28  import java.util.Properties;
-29  import java.util.jar.Manifest;
-30  
-31  import aQute.bnd.osgi.Analyzer;
-32  import aQute.bnd.osgi.Jar;
-33  import aQute.bnd.osgi.Verifier;
-34  import aQute.libg.generics.Create;
-35  import junit.framework.TestCase;
-36  
-37  import org.apache.felix.utils.manifest.Clause;
-38  import org.apache.felix.utils.manifest.Parser;
-39  import org.apache.maven.model.Resource;
-40  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-41  import org.osgi.framework.Constants;
-42  
-43  import aQute.bnd.osgi.Builder;
-44  
-45  
-46  public class BlueprintComponentTest extends TestCase
-47  {
-48  
-49      public void testBlueprintServices() throws Exception
-50      {
-51          test( "service" );
-52      }
-53  
-54      public void testBlueprintGeneric() throws Exception
-55      {
-56          test( "generic" );
-57      }
-58  
-59      protected void test(String mode) throws Exception
-60      {
-61          MavenProjectStub project = new MavenProjectStub()
-62          {
-63              private final List resources = new ArrayList();
-64  
-65  
-66              @Override
-67              public void addResource( Resource resource )
-68              {
-69                  resources.add( resource );
-70              }
-71  
-72  
-73              @Override
-74              public List getResources()
-75              {
-76                  return resources;
-77              }
-78  
-79  
-80              @Override
-81              public File getBasedir()
-82              {
-83                  return new File( "target/tmp/basedir" );
-84              }
-85          };
-86          project.setGroupId( "group" );
-87          project.setArtifactId( "artifact" );
-88          project.setVersion( "1.1.0.0" );
-89          Resource r = new Resource();
-90          r.setDirectory( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
-91          r.setIncludes( Arrays.asList( "**/*.*" ) );
-92          project.addResource( r );
-93          project.addCompileSourceRoot( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
-94  
-95          ManifestPlugin plugin = new ManifestPlugin();
-96          plugin.setBuildDirectory( "target/tmp/basedir/target" );
-97          plugin.setOutputDirectory( new File( "target/tmp/basedir/target/classes" ) );
-98  
-99          Map instructions = new HashMap();
-100         instructions.put( "service_mode", mode );
-101         instructions.put( "Test", "Foo" );
-102 
-103         instructions.put( "nsh_interface", "foo.bar.Namespace" );
-104         instructions.put( "nsh_namespace", "ns" );
-105 
-106         instructions.put( "Export-Service", "p7.Foo;mk=mv" );
-107         instructions.put( "Import-Service", "org.osgi.service.cm.ConfigurationAdmin;availability:=optional" );
-108 
-109         Properties props = new Properties();
-110         Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
-111 
-112         Manifest manifest = builder.getJar().getManifest();
-113         String expSvc = manifest.getMainAttributes().getValue( Constants.EXPORT_SERVICE );
-114         String impSvc = manifest.getMainAttributes().getValue( Constants.IMPORT_SERVICE );
-115         assertNotNull( expSvc );
-116         assertNotNull( impSvc );
-117 
-118         String impPkg = manifest.getMainAttributes().getValue( Constants.IMPORT_PACKAGE );
-119         List<String> pkgs = Create.list();
-120         for (Clause clause : Parser.parseHeader(impPkg))
-121         {
-122             pkgs.add(clause.getName());
-123         }
-124         for ( int i = 1; i <= 14; i++ )
-125         {
-126             assertTrue( pkgs.contains( "p" + i ) );
-127         }
-128 
-129         new Verifier(builder).verify();
-130     }
-131 
-132     public void testAnalyzer() throws Exception
-133     {
-134         Analyzer analyzer = new Analyzer();
-135         Manifest manifest = new Manifest();
-136         manifest.read(getClass().getResourceAsStream("/test.mf"));
-137         Jar jar = new Jar("name");
-138         jar.setManifest(manifest);
-139         analyzer.setJar(jar);
-140         analyzer.analyze();
-141         new Verifier(analyzer).verify();
-142     }
-143 
-144 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ - - - - -BundleAllPluginTest xref - - - -
-
-1   package org.apache.felix.bundleplugin;
-2   
-3   
-4   /*
-5    * Licensed to the Apache Software Foundation (ASF) under one
-6    * or more contributor license agreements.  See the NOTICE file
-7    * distributed with this work for additional information
-8    * regarding copyright ownership.  The ASF licenses this file
-9    * to you under the Apache License, Version 2.0 (the
-10   * "License"); you may not use this file except in compliance
-11   * with the License.  You may obtain a copy of the License at
-12   * 
-13   * http://www.apache.org/licenses/LICENSE-2.0
-14   * 
-15   * Unless required by applicable law or agreed to in writing,
-16   * software distributed under the License is distributed on an
-17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-18   * KIND, either express or implied.  See the License for the
-19   * specific language governing permissions and limitations
-20   * under the License.
-21   */
-22  
-23  import java.io.File;
-24  import java.util.Collections;
-25  import java.util.Map;
-26  
-27  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-28  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-29  import org.apache.maven.project.MavenProject;
-30  import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-31  
-32  
-33  /**
-34   * Test for {@link BundleAllPlugin}
-35   * 
-36   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-37   */
-38  public class BundleAllPluginTest extends AbstractBundlePluginTest
-39  {
-40  
-41      private BundleAllPlugin plugin;
-42  
-43  
-44      protected void setUp() throws Exception
-45      {
-46          super.setUp();
-47          init();
-48      }
-49  
-50  
-51      private void init()
-52      {
-53          plugin = new BundleAllPlugin();
-54          File baseDirectory = new File( getBasedir() );
-55          File buildDirectory = new File( baseDirectory, "target" );
-56          plugin.setBuildDirectory( buildDirectory.getPath() );
-57          File outputDirectory = new File( buildDirectory, "test-classes" );
-58          plugin.setOutputDirectory( outputDirectory );
-59          plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
-60      }
-61  
-62  
-63      public void testSnapshotMatch()
-64      {
-65          ArtifactStub artifact = getArtifactStub();
-66          String bundleName;
-67  
-68          artifact.setVersion( "2.1-SNAPSHOT" );
-69          bundleName = "group.artifact_2.1.0.20070207_193904_2.jar";
-70  
-71          assertTrue( plugin.snapshotMatch( artifact, bundleName ) );
-72  
-73          artifact.setVersion( "2-SNAPSHOT" );
-74          assertFalse( plugin.snapshotMatch( artifact, bundleName ) );
-75  
-76          artifact.setArtifactId( "artifactx" );
-77          artifact.setVersion( "2.1-SNAPSHOT" );
-78          assertFalse( plugin.snapshotMatch( artifact, bundleName ) );
-79      }
-80  
-81  
-82      public void testNoReBundling() throws Exception
-83      {
-84          File testFile = getTestFile( "target/test-classes/org.apache.maven.maven-model_1.0.0.0.jar" );
-85          if ( testFile.exists() )
-86          {
-87              testFile.delete();
-88          }
-89  
-90          ArtifactStub artifact = new ArtifactStub();
-91          artifact.setGroupId( "group" );
-92          artifact.setArtifactId( "artifact" );
-93          artifact.setVersion( "1.0.0.0" );
-94  
-95          MavenProject project = new MavenProjectStub();
-96          project.setGroupId( artifact.getGroupId() );
-97          project.setArtifactId( artifact.getArtifactId() );
-98          project.setVersion( artifact.getVersion() );
-99          project.setArtifact( artifact );
-100         project.setArtifacts( Collections.EMPTY_SET );
-101         project.setDependencyArtifacts( Collections.EMPTY_SET );
-102         File bundleFile = getTestFile( "src/test/resources/org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar" );
-103         artifact.setFile( bundleFile );
-104 
-105         BundleInfo bundleInfo = plugin.bundle( project );
-106 
-107         Map exports = bundleInfo.getExportedPackages();
-108         String[] packages = new String[]
-109             { "org.apache.maven.model.io.jdom", "org.apache.maven.model" };
-110 
-111         for ( int i = 0; i < packages.length; i++ )
-112         {
-113             assertTrue( "Bundle info does not contain a package that it is  exported in the manifest: " + packages[i],
-114                 exports.containsKey( packages[i] ) );
-115         }
-116 
-117         assertFalse( "Bundle info contains a package that it is not exported in the manifest",
-118             exports.containsKey( "org.apache.maven.model.io.xpp3" ) );
-119     }
-120 
-121     //    public void testRewriting()
-122     //        throws Exception
-123     //    {
-124     //
-125     //        MavenProjectStub project = new MavenProjectStub();
-126     //        project.setArtifact( getArtifactStub() );
-127     //        project.getArtifact().setFile( getTestBundle() );
-128     //        project.setDependencyArtifacts( Collections.EMPTY_SET );
-129     //        project.setVersion( project.getArtifact().getVersion() );
-130     //
-131     //        File output = new File( plugin.getBuildDirectory(), plugin.getBundleName( project ) );
-132     //        boolean delete = output.delete();
-133     //
-134     //        plugin.bundle( project );
-135     //
-136     //        init();
-137     //        try
-138     //        {
-139     //            plugin.bundle( project );
-140     //            fail();
-141     //        }
-142     //        catch ( RuntimeException e )
-143     //        {
-144     //            // expected
-145     //        }
-146     //    }
-147 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/BundlePluginTest.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/BundlePluginTest.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/BundlePluginTest.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/BundlePluginTest.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,410 +0,0 @@ - - - - -BundlePluginTest xref - - - -
-
-1   package org.apache.felix.bundleplugin;
-2   
-3   
-4   /*
-5    * Licensed to the Apache Software Foundation (ASF) under one
-6    * or more contributor license agreements.  See the NOTICE file
-7    * distributed with this work for additional information
-8    * regarding copyright ownership.  The ASF licenses this file
-9    * to you under the Apache License, Version 2.0 (the
-10   * "License"); you may not use this file except in compliance
-11   * with the License.  You may obtain a copy of the License at
-12   *
-13   *   http://www.apache.org/licenses/LICENSE-2.0
-14   *
-15   * Unless required by applicable law or agreed to in writing,
-16   * software distributed under the License is distributed on an
-17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-18   * KIND, either express or implied.  See the License for the
-19   * specific language governing permissions and limitations
-20   * under the License.
-21   */
-22  
-23  import java.io.File;
-24  import java.io.FileOutputStream;
-25  import java.util.Arrays;
-26  import java.util.HashMap;
-27  import java.util.LinkedHashSet;
-28  import java.util.Map;
-29  import java.util.Properties;
-30  import java.util.Set;
-31  import java.util.TreeMap;
-32  import java.util.jar.Manifest;
-33  
-34  import org.apache.maven.model.Organization;
-35  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-36  import org.apache.maven.project.MavenProject;
-37  import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-38  import org.osgi.framework.Constants;
-39  
-40  import aQute.bnd.osgi.Analyzer;
-41  import aQute.bnd.osgi.Builder;
-42  import aQute.bnd.osgi.Jar;
-43  
-44  
-45  /**
-46   * Test for {@link BundlePlugin}.
-47   * 
-48   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-49   */
-50  public class BundlePluginTest extends AbstractBundlePluginTest
-51  {
-52  
-53      private BundlePlugin plugin;
-54  
-55  
-56      protected void setUp() throws Exception
-57      {
-58          super.setUp();
-59          plugin = new BundlePlugin();
-60          plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
-61          plugin.setBuildDirectory( "." );
-62          plugin.setOutputDirectory( new File( getBasedir(), "target" + File.separatorChar + "scratch" ) );
-63      }
-64  
-65  
-66      public void testConvertVersionToOsgi()
-67      {
-68          String osgiVersion;
-69  
-70          osgiVersion = plugin.convertVersionToOsgi( "2.1.0-SNAPSHOT" );
-71          assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
-72  
-73          osgiVersion = plugin.convertVersionToOsgi( "2.1-SNAPSHOT" );
-74          assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
-75  
-76          osgiVersion = plugin.convertVersionToOsgi( "2-SNAPSHOT" );
-77          assertEquals( "2.0.0.SNAPSHOT", osgiVersion );
-78  
-79          osgiVersion = plugin.convertVersionToOsgi( "2" );
-80          assertEquals( "2.0.0", osgiVersion );
-81  
-82          osgiVersion = plugin.convertVersionToOsgi( "2.1" );
-83          assertEquals( "2.1.0", osgiVersion );
-84  
-85          osgiVersion = plugin.convertVersionToOsgi( "2.1.3" );
-86          assertEquals( "2.1.3", osgiVersion );
-87  
-88          osgiVersion = plugin.convertVersionToOsgi( "2.1.3.4" );
-89          assertEquals( "2.1.3.4", osgiVersion );
-90  
-91          osgiVersion = plugin.convertVersionToOsgi( "4aug2000r7-dev" );
-92          assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion );
-93  
-94          osgiVersion = plugin.convertVersionToOsgi( "1.1-alpha-2" );
-95          assertEquals( "1.1.0.alpha-2", osgiVersion );
-96  
-97          osgiVersion = plugin.convertVersionToOsgi( "1.0-alpha-16-20070122.203121-13" );
-98          assertEquals( "1.0.0.alpha-16-20070122_203121-13", osgiVersion );
-99  
-100         osgiVersion = plugin.convertVersionToOsgi( "1.0-20070119.021432-1" );
-101         assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
-102 
-103         osgiVersion = plugin.convertVersionToOsgi( "1-20070119.021432-1" );
-104         assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
-105 
-106         osgiVersion = plugin.convertVersionToOsgi( "1.4.1-20070217.082013-7" );
-107         assertEquals( "1.4.1.20070217_082013-7", osgiVersion );
-108     }
-109 
-110 
-111     public void testReadExportedModules() throws Exception
-112     {
-113         File osgiBundleFile = getTestBundle();
-114 
-115         assertTrue( osgiBundleFile.exists() );
-116 
-117         MavenProject project = getMavenProjectStub();
-118 
-119         //        PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
-120         Builder analyzer = new Builder();
-121         Jar jar = new Jar( "name", osgiBundleFile );
-122         analyzer.setJar( jar );
-123         analyzer.setClasspath( new Jar[]
-124             { jar } );
-125 
-126         analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "*" );
-127         analyzer.getJar().setManifest( analyzer.calcManifest() );
-128 
-129         assertEquals( 3, analyzer.getExports().size() );
-130 
-131         analyzer.close();
-132     }
-133 
-134 
-135     public void testTransformDirectives() throws Exception
-136     {
-137         Map instructions = new TreeMap();
-138 
-139         instructions.put( "a", "1" );
-140         instructions.put( "-a", "2" );
-141         instructions.put( "_a", "3" );
-142         instructions.put( "A", "3" );
-143         instructions.put( "_A", "1" );
-144         instructions.put( "_b", "4" );
-145         instructions.put( "b", "6" );
-146         instructions.put( "_B", "6" );
-147         instructions.put( "-B", "5" );
-148         instructions.put( "B", "4" );
-149 
-150         instructions.put( "z", null );
-151         instructions.put( "_z", null );
-152 
-153         Map transformedInstructions = BundlePlugin.transformDirectives( instructions );
-154 
-155         assertEquals( "1", transformedInstructions.get( "a" ) );
-156         assertEquals( "3", transformedInstructions.get( "-a" ) );
-157         assertEquals( null, transformedInstructions.get( "_a" ) );
-158         assertEquals( "3", transformedInstructions.get( "A" ) );
-159         assertEquals( "1", transformedInstructions.get( "-A" ) );
-160         assertEquals( null, transformedInstructions.get( "_A" ) );
-161         assertEquals( null, transformedInstructions.get( "_b" ) );
-162         assertEquals( "4", transformedInstructions.get( "-b" ) );
-163         assertEquals( "6", transformedInstructions.get( "b" ) );
-164         assertEquals( null, transformedInstructions.get( "_B" ) );
-165         assertEquals( "6", transformedInstructions.get( "-B" ) );
-166         assertEquals( "4", transformedInstructions.get( "B" ) );
-167 
-168         assertEquals( "", transformedInstructions.get( "z" ) );
-169         assertEquals( "", transformedInstructions.get( "-z" ) );
-170     }
-171 
-172 
-173     public void testDefaultPropertiesIncludeOrganization()
-174     {
-175         final Organization organization = new Organization();
-176         organization.setName( "Example Organization" );
-177         organization.setUrl( "http://example.org" );
-178 
-179         // MavenProjectStub.setOrganization(Organization) doesn't do anything, so we have to make it work this way
-180         MavenProject project = new MavenProjectStub()
-181         {
-182             @Override
-183             public Organization getOrganization()
-184             {
-185                 return organization;
-186             }
-187         };
-188         project.setGroupId( "group" );
-189         project.setArtifactId( "project" );
-190         project.setVersion( "1.2.3.4" );
-191 
-192         Properties properties = plugin.getDefaultProperties( project );
-193         assertEquals( organization.getName(), properties.getProperty( "project.organization.name" ) );
-194         assertEquals( organization.getName(), properties.getProperty( "pom.organization.name" ) );
-195         assertEquals( organization.getUrl(), properties.getProperty( "project.organization.url" ) );
-196         assertEquals( organization.getUrl(), properties.getProperty( "pom.organization.url" ) );
-197     }
-198 
-199 
-200     public void testVersion() throws Exception
-201     {
-202         String cleanupVersion = Builder.cleanupVersion( "0.0.0.4aug2000r7-dev" );
-203         assertEquals( "0.0.0.4aug2000r7-dev", cleanupVersion );
-204     }
-205 
-206 
-207     public void testPackageInfoDetection() throws Exception
-208     {
-209         MavenProject project = getMavenProjectStub();
-210         project.addCompileSourceRoot( getBasedir() + "/src/test/java" );
-211 
-212         String resourcePaths = plugin.getMavenResourcePaths( project, false );
-213 
-214         assertEquals( "org/apache/felix/bundleplugin/packageinfo="
-215             + "src/test/java/org/apache/felix/bundleplugin/packageinfo", resourcePaths );
-216     }
-217 
-218 
-219     public void testEmbedDependencyPositiveClauses() throws Exception
-220     {
-221         ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
-222 
-223         Set artifacts = new LinkedHashSet();
-224 
-225         artifacts.addAll( artifactFactory.getClassifiedArtifacts() );
-226         artifacts.addAll( artifactFactory.getScopedArtifacts() );
-227         artifacts.addAll( artifactFactory.getTypedArtifacts() );
-228 
-229         MavenProject project = getMavenProjectStub();
-230         project.setDependencyArtifacts( artifacts );
-231 
-232         Map instructions = new HashMap();
-233         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "*;classifier=;type=jar;scope=compile,"
-234             + "*;classifier=;type=jar;scope=runtime" );
-235         Properties props = new Properties();
-236 
-237         Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
-238         Manifest manifest = builder.getJar().getManifest();
-239 
-240         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
-241         assertEquals( ".," + "compile-1.0.jar,b-1.0.jar,runtime-1.0.jar", bcp );
-242 
-243         String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
-244         assertEquals( "compile-1.0.jar;g=\"g\";a=\"compile\";v=\"1.0\"," + "b-1.0.jar;g=\"g\";a=\"b\";v=\"1.0\","
-245             + "runtime-1.0.jar;g=\"g\";a=\"runtime\";v=\"1.0\"", eas );
-246     }
-247 
-248 
-249     public void testEmbedDependencyNegativeClauses() throws Exception
-250     {
-251         ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
-252 
-253         Set artifacts = new LinkedHashSet();
-254 
-255         artifacts.addAll( artifactFactory.getClassifiedArtifacts() );
-256         artifacts.addAll( artifactFactory.getScopedArtifacts() );
-257         artifacts.addAll( artifactFactory.getTypedArtifacts() );
-258 
-259         MavenProject project = getMavenProjectStub();
-260         project.setDependencyArtifacts( artifacts );
-261 
-262         Map instructions = new HashMap();
-263         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "!type=jar, !artifactId=c" );
-264         Properties props = new Properties();
-265 
-266         Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
-267         Manifest manifest = builder.getJar().getManifest();
-268 
-269         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
-270         assertEquals( ".," + "a-1.0.war," + "d-1.0.zip," + "e-1.0.rar", bcp );
-271 
-272         String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
-273         assertEquals( "a-1.0.war;g=\"g\";a=\"a\";v=\"1.0\"," + "d-1.0.zip;g=\"g\";a=\"d\";v=\"1.0\","
-274             + "e-1.0.rar;g=\"g\";a=\"e\";v=\"1.0\"", eas );
-275     }
-276 
-277 
-278     public void testEmbedDependencyDuplicateKeys() throws Exception
-279     {
-280         ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
-281 
-282         Set artifacts = new LinkedHashSet();
-283 
-284         artifacts.addAll( artifactFactory.getClassifiedArtifacts() );
-285         artifacts.addAll( artifactFactory.getScopedArtifacts() );
-286         artifacts.addAll( artifactFactory.getTypedArtifacts() );
-287 
-288         MavenProject project = getMavenProjectStub();
-289         project.setDependencyArtifacts( artifacts );
-290 
-291         Map instructions = new HashMap();
-292         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "c;type=jar,c;type=sources" );
-293         Properties props = new Properties();
-294 
-295         Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
-296         Manifest manifest = builder.getJar().getManifest();
-297 
-298         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
-299         assertEquals( ".," + "c-1.0-three.jar," + "c-1.0.sources", bcp );
-300 
-301         String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
-302         assertEquals( "c-1.0-three.jar;g=\"g\";a=\"c\";v=\"1.0\";c=\"three\","
-303             + "c-1.0.sources;g=\"g\";a=\"c\";v=\"1.0\"", eas );
-304     }
-305 
-306 
-307     public void testEmbedDependencyMissingPositiveKey() throws Exception
-308     {
-309         ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
-310 
-311         Set artifacts = new LinkedHashSet();
-312 
-313         artifacts.addAll( artifactFactory.getClassifiedArtifacts() );
-314         artifacts.addAll( artifactFactory.getScopedArtifacts() );
-315         artifacts.addAll( artifactFactory.getTypedArtifacts() );
-316 
-317         MavenProject project = getMavenProjectStub();
-318         project.setDependencyArtifacts( artifacts );
-319 
-320         Map instructions = new HashMap();
-321         instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "artifactId=a|b" );
-322         Properties props = new Properties();
-323 
-324         Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
-325         Manifest manifest = builder.getJar().getManifest();
-326 
-327         String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
-328         assertEquals( ".," + "a-1.0-one.jar," + "b-1.0-two.jar," + "a-1.0.war," + "b-1.0.jar", bcp );
-329 
-330         String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
-331         assertEquals( "a-1.0-one.jar;g=\"g\";a=\"a\";v=\"1.0\";c=\"one\","
-332             + "b-1.0-two.jar;g=\"g\";a=\"b\";v=\"1.0\";c=\"two\"," + "a-1.0.war;g=\"g\";a=\"a\";v=\"1.0\","
-333             + "b-1.0.jar;g=\"g\";a=\"b\";v=\"1.0\"", eas );
-334     }
-335 
-336 
-337     public void testEmbedDependencyMissingNegativeKey() throws Exception
-338     {
-339         ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
-340 
-341         Set artifacts = new LinkedHashSet();
-342 
-343         artifacts.addAll( artifactFactory.getClassifiedArtifacts() );
-344         artifacts.addAll( artifactFactory.getScopedArtifacts() );
-345         artifacts.addAll( artifactFactory.getTypedArtifacts() );
-346 
-347         MavenProject project = getMavenProjectStub();
-348         project.setDependencyArtifacts( artifacts );
-349         Properties props = new Properties();
-350 
-351         Map instructions1 = new HashMap();
-352         instructions1.put( DependencyEmbedder.EMBED_DEPENDENCY, "!scope=compile" );
-353         Builder builder1 = plugin.buildOSGiBundle( project, instructions1, props, plugin.getClasspath( project ) );
-354         Manifest manifest1 = builder1.getJar().getManifest();
-355 
-356         Map instructions2 = new HashMap();
-357         instructions2.put( DependencyEmbedder.EMBED_DEPENDENCY, "scope=!compile" );
-358         Builder builder2 = plugin.buildOSGiBundle( project, instructions2, props, plugin.getClasspath( project ) );
-359         Manifest manifest2 = builder2.getJar().getManifest();
-360 
-361         String bcp1 = manifest1.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
-362         assertEquals( ".," + "provided-1.0.jar," + "test-1.0.jar," + "runtime-1.0.jar," + "system-1.0.jar", bcp1 );
-363 
-364         String eas1 = manifest1.getMainAttributes().getValue( "Embedded-Artifacts" );
-365         assertEquals( "provided-1.0.jar;g=\"g\";a=\"provided\";v=\"1.0\","
-366             + "test-1.0.jar;g=\"g\";a=\"test\";v=\"1.0\"," + "runtime-1.0.jar;g=\"g\";a=\"runtime\";v=\"1.0\","
-367             + "system-1.0.jar;g=\"g\";a=\"system\";v=\"1.0\"", eas1 );
-368 
-369         String bcp2 = manifest2.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
-370         assertEquals( bcp1, bcp2 );
-371 
-372         String eas2 = manifest2.getMainAttributes().getValue( "Embedded-Artifacts" );
-373         assertEquals( eas1, eas2 );
-374     }
-375 
-376 
-377     public void testPropertySanitizing() throws Exception
-378     {
-379         MavenProject project = getMavenProjectStub();
-380 
-381         Properties props = new Properties();
-382 
-383         props.put( new File( "A" ), new File( "B" ) );
-384         props.put( new int[4], new HashMap( 2 ) );
-385         props.put( Arrays.asList( 1, "two", 3.0 ), new float[5] );
-386 
-387         props.put( "A", new File( "B" ) );
-388         props.put( "4", new HashMap( 2 ) );
-389         props.put( "1, two, 3.0", new char[5] );
-390 
-391         Builder builder = plugin.getOSGiBuilder( project, new HashMap(), props, plugin.getClasspath( project ) );
-392 
-393         File file = new File( getBasedir(), "target" + File.separatorChar + "test.props" );
-394         builder.getProperties().store( new FileOutputStream( file ), "TEST" );
-395     }
-396 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/ManifestWriterTest.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/ManifestWriterTest.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/ManifestWriterTest.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/ManifestWriterTest.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - - -ManifestWriterTest xref - - - -
-
-1   /*
-2    * Licensed to the Apache Software Foundation (ASF) under one
-3    * or more contributor license agreements.  See the NOTICE file
-4    * distributed with this work for additional information
-5    * regarding copyright ownership.  The ASF licenses this file
-6    * to you under the Apache License, Version 2.0 (the
-7    * "License"); you may not use this file except in compliance
-8    * with the License.  You may obtain a copy of the License at
-9    *
-10   *   http://www.apache.org/licenses/LICENSE-2.0
-11   *
-12   * Unless required by applicable law or agreed to in writing,
-13   * software distributed under the License is distributed on an
-14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-15   * KIND, either express or implied.  See the License for the
-16   * specific language governing permissions and limitations
-17   * under the License.
-18   */
-19  package org.apache.felix.bundleplugin;
-20  
-21  import java.io.ByteArrayInputStream;
-22  import java.io.ByteArrayOutputStream;
-23  import java.util.jar.Manifest;
-24  
-25  import junit.framework.TestCase;
-26  
-27  public class ManifestWriterTest extends TestCase
-28  {
-29  
-30      public void testNiceManifest() throws Exception
-31      {
-32          // This manifest has an export clause ending on char 73
-33          Manifest manifest = new Manifest();
-34          manifest.read(getClass().getResourceAsStream("/test2.mf"));
-35  
-36          ByteArrayOutputStream baos = new ByteArrayOutputStream();
-37          ManifestWriter.outputManifest( manifest, baos, true );
-38  
-39          Manifest manifest2 = new Manifest();
-40          manifest2.read(new ByteArrayInputStream(baos.toByteArray()));
-41  
-42          assertEquals( toString(manifest, false), toString(manifest2, false) );
-43  
-44      }
-45  
-46      String toString(Manifest manifest, boolean nice) throws Exception
-47      {
-48          ByteArrayOutputStream baos = new ByteArrayOutputStream();
-49          ManifestWriter.outputManifest( manifest, baos, nice );
-50          return baos.toString();
-51      }
-52  
-53  }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.bundleplugin - - - - -

- org.apache.felix.bundleplugin -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/felix/bundleplugin/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/felix/bundleplugin/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.felix.bundleplugin - - - -
- -
-
- -
- -

Package org.apache.felix.bundleplugin

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class Summary
- AbstractBundlePluginTest -
- ArtifactStubFactory -
- BlueprintComponentTest -
- BundleAllPluginTest -
- BundlePluginTest -
- ManifestWriterTest -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ - - - - -Maven2OsgiConverterTest xref - - - -
-
-1   package org.apache.maven.shared.osgi;
-2   
-3   /*
-4    * Licensed to the Apache Software Foundation (ASF) under one
-5    * or more contributor license agreements.  See the NOTICE file
-6    * distributed with this work for additional information
-7    * regarding copyright ownership.  The ASF licenses this file
-8    * to you under the Apache License, Version 2.0 (the
-9    * "License"); you may not use this file except in compliance
-10   * with the License.  You may obtain a copy of the License at
-11   *
-12   *   http://www.apache.org/licenses/LICENSE-2.0
-13   *
-14   * Unless required by applicable law or agreed to in writing,
-15   * software distributed under the License is distributed on an
-16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-17   * KIND, either express or implied.  See the License for the
-18   * specific language governing permissions and limitations
-19   * under the License.
-20   */
-21  
-22  import java.io.File;
-23  
-24  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-25  import org.codehaus.plexus.PlexusTestCase;
-26  
-27  /**
-28   * Test for {@link DefaultMaven2OsgiConverter}
-29   * 
-30   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
-31   * @version $Id: Maven2OsgiConverterTest.java 1342631 2012-05-25 14:18:01Z mcculls $
-32   */
-33  public class Maven2OsgiConverterTest
-34      extends PlexusTestCase
-35  {
-36  
-37      private Maven2OsgiConverter maven2Osgi = new DefaultMaven2OsgiConverter();
-38  
-39      public void testGetBundleSymbolicName()
-40      {
-41          ArtifactStub artifact = getTestArtifact();
-42          String s;
-43          s = maven2Osgi.getBundleSymbolicName( artifact );
-44          assertEquals( "org.apache.commons.logging", s );
-45  
-46          artifact.setGroupId( "org.apache.commons" );
-47          s = maven2Osgi.getBundleSymbolicName( artifact );
-48          assertEquals( "org.apache.commons.logging", s );
-49  
-50          artifact.setGroupId( "org.apache.commons.commons-logging" );
-51          s = maven2Osgi.getBundleSymbolicName( artifact );
-52          assertEquals( "org.apache.commons.commons-logging", s );
-53  
-54          artifact.setGroupId( "org.apache" );
-55          artifact.setArtifactId( "org.apache.commons-logging" );
-56          s = maven2Osgi.getBundleSymbolicName( artifact );
-57          assertEquals( "org.apache.commons-logging", s );
-58  
-59          artifact.setFile( getTestFile( "junit-3.8.2.jar" ) );
-60          artifact.setGroupId( "junit" );
-61          artifact.setArtifactId( "junit" );
-62          s = maven2Osgi.getBundleSymbolicName( artifact );
-63          assertEquals( "junit", s );
-64  
-65          artifact.setFile( getTestFile( "xml-apis-1.0.b2.jar" ) );
-66          artifact.setGroupId( "xml-apis" );
-67          artifact.setArtifactId( "a" );
-68          s = maven2Osgi.getBundleSymbolicName( artifact );
-69          assertEquals( "xml-apis.a", s );
-70  
-71          artifact.setFile( getTestFile( "test-1.jar" ) );
-72          artifact.setGroupId( "test" );
-73          artifact.setArtifactId( "test" );
-74          s = maven2Osgi.getBundleSymbolicName( artifact );
-75          assertEquals( "test", s );
-76  
-77          artifact.setFile( getTestFile( "xercesImpl-2.6.2.jar" ) );
-78          artifact.setGroupId( "xerces" );
-79          artifact.setArtifactId( "xercesImpl" );
-80          s = maven2Osgi.getBundleSymbolicName( artifact );
-81          assertEquals( "xerces.Impl", s );
-82  
-83          artifact.setFile( getTestFile( "aopalliance-1.0.jar" ) );
-84          artifact.setGroupId( "org.aopalliance" );
-85          artifact.setArtifactId( "aopalliance" );
-86          s = maven2Osgi.getBundleSymbolicName( artifact );
-87          assertEquals( "org.aopalliance", s );
-88      }
-89  
-90      public void testGetBundleFileName()
-91      {
-92          ArtifactStub artifact = getTestArtifact();
-93          String s;
-94          s = maven2Osgi.getBundleFileName( artifact );
-95          assertEquals( "org.apache.commons.logging_1.1.0.jar", s );
-96  
-97          artifact.setGroupId( "org.aopalliance" );
-98          artifact.setArtifactId( "aopalliance" );
-99          s = maven2Osgi.getBundleFileName( artifact );
-100         assertEquals( "org.aopalliance_1.1.0.jar", s );
-101     }
-102 
-103     public void testGetVersion()
-104     {
-105         ArtifactStub artifact = getTestArtifact();
-106         String s = maven2Osgi.getVersion( artifact );
-107         assertEquals( "1.1.0", s );
-108     }
-109 
-110     public void testConvertVersionToOsgi()
-111     {
-112         String osgiVersion;
-113 
-114         osgiVersion = maven2Osgi.getVersion( "2.1.0-SNAPSHOT" );
-115         assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
-116 
-117         osgiVersion = maven2Osgi.getVersion( "2.1-SNAPSHOT" );
-118         assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
-119 
-120         osgiVersion = maven2Osgi.getVersion( "2-SNAPSHOT" );
-121         assertEquals( "2.0.0.SNAPSHOT", osgiVersion );
-122 
-123         osgiVersion = maven2Osgi.getVersion( "2" );
-124         assertEquals( "2.0.0", osgiVersion );
-125 
-126         osgiVersion = maven2Osgi.getVersion( "2.1" );
-127         assertEquals( "2.1.0", osgiVersion );
-128 
-129         osgiVersion = maven2Osgi.getVersion( "2.1.3" );
-130         assertEquals( "2.1.3", osgiVersion );
-131 
-132         osgiVersion = maven2Osgi.getVersion( "2.1.3.4" );
-133         assertEquals( "2.1.3.4", osgiVersion );
-134 
-135         osgiVersion = maven2Osgi.getVersion( "4aug2000r7-dev" );
-136         assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion );
-137 
-138         osgiVersion = maven2Osgi.getVersion( "1.1-alpha-2" );
-139         assertEquals( "1.1.0.alpha-2", osgiVersion );
-140 
-141         osgiVersion = maven2Osgi.getVersion( "1.0-alpha-16-20070122.203121-13" );
-142         assertEquals( "1.0.0.alpha-16-20070122_203121-13", osgiVersion );
-143 
-144         osgiVersion = maven2Osgi.getVersion( "1.0-20070119.021432-1" );
-145         assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
-146 
-147         osgiVersion = maven2Osgi.getVersion( "1-20070119.021432-1" );
-148         assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
-149 
-150         osgiVersion = maven2Osgi.getVersion( "1.4.1-20070217.082013-7" );
-151         assertEquals( "1.4.1.20070217_082013-7", osgiVersion );
-152         
-153         osgiVersion = maven2Osgi.getVersion( "0.0.0.4aug2000r7-dev" );
-154         assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion );
-155         
-156         osgiVersion = maven2Osgi.getVersion( "4aug2000r7-dev" );
-157         assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion );
-158     }
-159 
-160     private ArtifactStub getTestArtifact()
-161     {
-162         ArtifactStub a = new ArtifactStub();
-163         a.setGroupId( "commons-logging" );
-164         a.setArtifactId( "commons-logging" );
-165         a.setVersion( "1.1" );
-166         a.setFile( getTestFile( "commons-logging-1.1.jar" ) );
-167         return a;
-168     }
-169 
-170     public static File getTestFile( String fileName )
-171     {
-172         return PlexusTestCase.getTestFile( "src/test/resources/" + fileName );
-173     }
-174 }
-
-
- - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/maven/shared/osgi/package-frame.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/maven/shared/osgi/package-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/maven/shared/osgi/package-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/maven/shared/osgi/package-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.maven.shared.osgi - - - - -

- org.apache.maven.shared.osgi -

- -

Classes

- - - - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/maven/shared/osgi/package-summary.html maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/maven/shared/osgi/package-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/org/apache/maven/shared/osgi/package-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/org/apache/maven/shared/osgi/package-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference Package org.apache.maven.shared.osgi - - - -
- -
-
- -
- -

Package org.apache.maven.shared.osgi

- - - - - - - - - - - - -
Class Summary
- Maven2OsgiConverterTest -
- -
- -
-
- -
-
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/overview-frame.html maven-bundle-plugin-3.5.0/doc/site/xref-test/overview-frame.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/overview-frame.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/overview-frame.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference - - - - -

- All Classes -

- -

Packages

- - - - - - diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/overview-summary.html maven-bundle-plugin-3.5.0/doc/site/xref-test/overview-summary.html --- maven-bundle-plugin-2.5.4/doc/site/xref-test/overview-summary.html 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/overview-summary.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ - - - - - - Maven Bundle Plugin 2.5.0 Reference - - - -
-
    -
  • Overview
  • -
  • Package
  • -
-
-
- -
- -

Maven Bundle Plugin 2.5.0 Reference

- - - - - - - - - - - - - - - -
Packages
- org.apache.felix.bundleplugin -
- org.apache.maven.shared.osgi -
- -
-
    -
  • Overview
  • -
  • Package
  • -
-
-
- -
- -
- Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved. - - \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/doc/site/xref-test/stylesheet.css maven-bundle-plugin-3.5.0/doc/site/xref-test/stylesheet.css --- maven-bundle-plugin-2.5.4/doc/site/xref-test/stylesheet.css 2014-06-26 23:02:50.000000000 +0000 +++ maven-bundle-plugin-3.5.0/doc/site/xref-test/stylesheet.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -/* Javadoc style sheet */ -/* Define colors, fonts and other style attributes here to override the defaults */ -body { - background-color: #fff; - font-family: Arial, Helvetica, sans-serif; -} - -a:link { - color: #00f; -} -a:visited { - color: #00a; -} - -a:active, a:hover { - color: #f30 !important; -} - -ul, li { - list-style-type:none; - margin:0; - padding:0; -} - -table td { - padding: 3px; - border: 1px solid #000; -} -table { - width:100%; - border: 1px solid #000; - border-collapse: collapse; -} - -div.overview { - background-color:#ddd; - padding: 4px 4px 4px 0; -} -div.overview li, div.framenoframe li { - display: inline; -} -div.framenoframe { - text-align: center; - font-size: x-small; -} -div.framenoframe li { - margin: 0 3px 0 3px; -} -div.overview li { - margin:3px 3px 0 3px; - padding: 4px; -} -li.selected { - background-color:#888; - color: #fff; - font-weight: bold; -} - -table.summary { - margin-bottom: 20px; -} -table.summary td, table.summary th { - font-weight: bold; - text-align: left; - padding: 3px; -} -table.summary th { - background-color:#036; - color: #fff; -} -table.summary td { - background-color:#eee; - border: 1px solid black; -} - -em { - color: #A00; -} -em.comment { - color: #390; -} -.string { - color: #009; -} -div#footer { - text-align:center; -} -#overview { - padding:2px; -} - -hr { - height: 1px; - color: #000; -} - -/* JXR style sheet */ -.jxr_comment -{ - color: #390; -} - -.jxr_javadoccomment -{ - color: #A00; -} - -.jxr_string -{ - color: #009; -} - -.jxr_keyword -{ - color: #000; -} diff -Nru maven-bundle-plugin-2.5.4/NOTICE maven-bundle-plugin-3.5.0/NOTICE --- maven-bundle-plugin-2.5.4/NOTICE 2014-05-14 09:16:49.000000000 +0000 +++ maven-bundle-plugin-3.5.0/NOTICE 2018-01-03 12:49:20.000000000 +0000 @@ -1,5 +1,5 @@ Apache Felix Bundle Maven Plugin -Copyright 2006-2014 The Apache Software Foundation +Copyright 2006-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff -Nru maven-bundle-plugin-2.5.4/pom.xml maven-bundle-plugin-3.5.0/pom.xml --- maven-bundle-plugin-2.5.4/pom.xml 2015-04-17 12:08:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/pom.xml 2018-01-03 12:49:20.000000000 +0000 @@ -21,14 +21,14 @@ felix-parent org.apache.felix - 2.1 - ../pom/pom.xml + 4 + ../../pom/pom.xml 4.0.0 maven-bundle-plugin - 2.5.4 + 3.5.0 maven-plugin Maven Bundle Plugin @@ -38,13 +38,28 @@ resources and dependencies. Plus a zillion other features. The plugin uses the Bnd tool (http://www.aqute.biz/Code/Bnd) + + http://felix.apache.org/components/bundle-plugin/ - scm:svn:http://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.5.4 - scm:svn:https://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.5.4 - http://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.5.4 + scm:svn:http://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-3.5.0 + scm:svn:https://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-3.5.0 + http://svn.apache.org/viewvc/felix/releases/maven-bundle-plugin-3.5.0 + + + + apache.website + scm:svn:https://svn.apache.org/repos/asf/felix/site/trunk/content/components/${maven.site.path} + + + + + 7 + bundle-plugin-archives/bundle-plugin-LATEST + + @@ -59,19 +74,49 @@ + + maven-site-plugin + 3.4 + + + org.apache.maven + maven-archiver + 2.6 + + + org.codehaus.plexus + plexus-archiver + 2.4.4 + + + org.apache.maven.doxia + doxia-core + 1.6 + + + xercesImpl + xerces + + + + + + scm:svn:https://svn.apache.org/repos/infra/websites/production/felix/content/components/${maven.site.path} + + + + maven-scm-publish-plugin + 1.1 + + ${user.home}/maven-sites/${maven.site.path} + true + + org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.maven.plugins maven-plugin-plugin @@ -80,9 +125,33 @@ **/*.mf + src/repo/**/*.pom + @@ -95,7 +164,7 @@ biz.aQute.bnd biz.aQute.bndlib - 2.4.1 + 3.5.0 org.apache.felix @@ -110,12 +179,12 @@ org.apache.maven maven-core - 2.0.7 + 2.2.0 org.apache.maven maven-archiver - 2.5 + 2.6 org.apache.maven.shared @@ -154,6 +223,11 @@ 1.1 test + + org.jdom + jdom + 1.1 + @@ -171,7 +245,8 @@ 12311143 maven-bundle-plugin- Resolved,Closed - 1000 + + 100 JIRA @@ -180,4 +255,48 @@ + + + + + only-eclipse + + + m2e.version + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-plugin-plugin + [3.4,) + + descriptor + helpmojo + + + + + + + + + + + + + + + + diff -Nru maven-bundle-plugin-2.5.4/src/it/dep-reduced/pom.xml maven-bundle-plugin-3.5.0/src/it/dep-reduced/pom.xml --- maven-bundle-plugin-2.5.4/src/it/dep-reduced/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/dep-reduced/pom.xml 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,55 @@ + + + + 4.0.0 + org.apache.felix.bundleits + dep-reduced + 1-SNAPSHOT + bundle + + + commons-io + commons-io + 2.4 + + + org.apache.commons + commons-compress + 1.10 + + + + + + org.apache.felix + maven-bundle-plugin + @project.version@ + true + + true + + commons-io + + + + + + diff -Nru maven-bundle-plugin-2.5.4/src/it/dep-reduced/verify.groovy maven-bundle-plugin-3.5.0/src/it/dep-reduced/verify.groovy --- maven-bundle-plugin-2.5.4/src/it/dep-reduced/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/dep-reduced/verify.groovy 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,27 @@ +/* + * 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. + */ + +File pomFile = new File( basedir, "dependency-reduced-pom.xml" ); +assert pomFile.isFile() + +def ns = new groovy.xml.Namespace("http://maven.apache.org/POM/4.0.0") +def pom = new XmlParser().parse( pomFile ) + +assert pom[ns.modelVersion].size() == 1 +assert pom[ns.dependencies][ns.dependency].size() == 1 diff -Nru maven-bundle-plugin-2.5.4/src/it/embed-multiple-artifacts/pom.xml maven-bundle-plugin-3.5.0/src/it/embed-multiple-artifacts/pom.xml --- maven-bundle-plugin-2.5.4/src/it/embed-multiple-artifacts/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/embed-multiple-artifacts/pom.xml 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,54 @@ + + + + 4.0.0 + org.apache.felix.bundleits + embed-multiple-artifacts + 1-SNAPSHOT + bundle + + + commons-io + commons-io + 2.4 + + + org.apache.commons + commons-compress + 1.10 + + + + + + org.apache.felix + maven-bundle-plugin + @project.version@ + true + + + commons-io,commons-compress + + + + + + diff -Nru maven-bundle-plugin-2.5.4/src/it/embed-multiple-artifacts/verify.groovy maven-bundle-plugin-3.5.0/src/it/embed-multiple-artifacts/verify.groovy --- maven-bundle-plugin-2.5.4/src/it/embed-multiple-artifacts/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/embed-multiple-artifacts/verify.groovy 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,25 @@ +/* + * 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. + */ + +new File(basedir, "target/classes/META-INF/MANIFEST.MF").eachLine() { line -> + if (line.contains("Embed-Dependency") && !(line.contains("commons-io") && line.contains("commons-compress"))) { + throw new Exception("Failed to embed both"); + } +} + diff -Nru maven-bundle-plugin-2.5.4/src/it/no-test-scoped-imports/pom.xml maven-bundle-plugin-3.5.0/src/it/no-test-scoped-imports/pom.xml --- maven-bundle-plugin-2.5.4/src/it/no-test-scoped-imports/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/no-test-scoped-imports/pom.xml 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,51 @@ + + + + 4.0.0 + org.apache.felix.bundleits + no-test-scoped-imports + 1-SNAPSHOT + bundle + + + javax.servlet + servlet-api + 2.4 + + + + org.apache.sling + org.apache.sling.testing.sling-mock + 1.5.0 + test + + + + + + org.apache.felix + maven-bundle-plugin + @project.version@ + true + + + + diff -Nru maven-bundle-plugin-2.5.4/src/it/no-test-scoped-imports/src/main/java/org/apache/felix/test/Dummy.java maven-bundle-plugin-3.5.0/src/it/no-test-scoped-imports/src/main/java/org/apache/felix/test/Dummy.java --- maven-bundle-plugin-2.5.4/src/it/no-test-scoped-imports/src/main/java/org/apache/felix/test/Dummy.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/no-test-scoped-imports/src/main/java/org/apache/felix/test/Dummy.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,25 @@ +/* + * 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. + */ +package org.apache.felix.test; + +import javax.servlet.Servlet; + +public class Dummy { + private Servlet servlet; +} \ No newline at end of file diff -Nru maven-bundle-plugin-2.5.4/src/it/no-test-scoped-imports/verify.groovy maven-bundle-plugin-3.5.0/src/it/no-test-scoped-imports/verify.groovy --- maven-bundle-plugin-2.5.4/src/it/no-test-scoped-imports/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/it/no-test-scoped-imports/verify.groovy 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,25 @@ +/* + * 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. + */ + +new File(basedir, "target/classes/META-INF/MANIFEST.MF").eachLine() { line -> + if (line.contains("Import-Package") && !line.equals("Import-Package: javax.servlet")) { + throw new Exception("Import-Package instruction contains version number from test dependency"); + } +} + diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java 2015-03-04 13:26:21.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java 2018-01-03 12:49:20.000000000 +0000 @@ -22,15 +22,26 @@ import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; +import java.util.Set; import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.plugin.MojoExecutionException; import aQute.bnd.header.Attrs; import aQute.bnd.header.OSGiHeader; import aQute.bnd.osgi.Instruction; +import org.apache.maven.shared.dependency.graph.DependencyNode; +import org.apache.maven.shared.dependency.graph.filter.ArtifactDependencyNodeFilter; +import org.apache.maven.shared.dependency.graph.filter.DependencyNodeFilter; +import org.apache.maven.shared.dependency.graph.traversal.BuildingDependencyNodeVisitor; +import org.apache.maven.shared.dependency.graph.traversal.CollectingDependencyNodeVisitor; +import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor; +import org.apache.maven.shared.dependency.graph.traversal.FilteringDependencyNodeVisitor; /** @@ -43,17 +54,22 @@ private static final Pattern MISSING_KEY_PATTERN = Pattern.compile( "(^|,)\\p{Blank}*(!)?\\p{Blank}*([a-zA-Z]+=)" ); /** + * Dependency Graph. + */ + private final DependencyNode m_dependencyGraph; + /** * Dependency artifacts. */ private final Collection m_dependencyArtifacts; - public AbstractDependencyFilter( Collection dependencyArtifacts ) + public AbstractDependencyFilter( DependencyNode dependencyGraph, Collection dependencyArtifacts ) { + m_dependencyGraph = dependencyGraph; m_dependencyArtifacts = dependencyArtifacts; } - private static abstract class DependencyFilter + private static abstract class DependencyFilter implements ArtifactFilter { private final Instruction m_instruction; private final String m_defaultValue; @@ -71,21 +87,7 @@ m_defaultValue = defaultValue; } - - public void filter( Collection dependencies ) - { - for ( Iterator i = dependencies.iterator(); i.hasNext(); ) - { - if ( false == matches( i.next() ) ) - { - i.remove(); - } - } - } - - - abstract boolean matches( Artifact dependency ); - + public abstract boolean include( Artifact dependency ); boolean matches( String text ) { @@ -104,6 +106,26 @@ } } + private static class TrimmingDependencyNodeFilter implements DependencyNodeFilter + { + private DependencyNodeFilter dependencyNodeFilter; + + public TrimmingDependencyNodeFilter( DependencyNodeFilter dependencyNodeFilter ) + { + this.dependencyNodeFilter = dependencyNodeFilter; + } + + public boolean accept( DependencyNode node ) + { + boolean accepted = dependencyNodeFilter.accept( node ); + if( !accepted ) + { + List children = node.getChildren(); + children.clear(); + } + return accepted; + } + } protected final void processInstructions( String header ) throws MojoExecutionException { @@ -111,7 +133,6 @@ Collection availableDependencies = new LinkedHashSet( m_dependencyArtifacts ); - DependencyFilter filter; for ( Iterator> clauseIterator = instructions.entrySet().iterator(); clauseIterator.hasNext(); ) { String inline = "false"; @@ -128,22 +149,24 @@ primaryKey = primaryKey.substring( 1 ); } + final AndArtifactFilter andArtifactFilter = new AndArtifactFilter(); if ( !"*".equals( primaryKey ) ) { - filter = new DependencyFilter( primaryKey ) + ArtifactFilter filter = new DependencyFilter( primaryKey ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( dependency.getArtifactId() ); } }; // FILTER ON MAIN CLAUSE - filter.filter( filteredDependencies ); + andArtifactFilter.add(filter); } for ( Iterator> attrIterator = clause.getValue().entrySet().iterator(); attrIterator.hasNext(); ) { + final ArtifactFilter filter; // ATTRIBUTE: KEY --> REGEXP Map.Entry attr = attrIterator.next(); if ( "groupId".equals( attr.getKey() ) ) @@ -151,7 +174,7 @@ filter = new DependencyFilter( attr.getValue() ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( dependency.getGroupId() ); } @@ -162,7 +185,7 @@ filter = new DependencyFilter( attr.getValue() ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( dependency.getArtifactId() ); } @@ -173,7 +196,7 @@ filter = new DependencyFilter( attr.getValue() ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { try { @@ -192,7 +215,7 @@ filter = new DependencyFilter( attr.getValue(), "compile" ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( dependency.getScope() ); } @@ -203,7 +226,7 @@ filter = new DependencyFilter( attr.getValue(), "jar" ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( dependency.getType() ); } @@ -214,7 +237,7 @@ filter = new DependencyFilter( attr.getValue() ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( dependency.getClassifier() ); } @@ -225,7 +248,7 @@ filter = new DependencyFilter( attr.getValue(), "false" ) { @Override - boolean matches( Artifact dependency ) + public boolean include( Artifact dependency ) { return super.matches( "" + dependency.isOptional() ); } @@ -242,9 +265,11 @@ } // FILTER ON EACH ATTRIBUTE - filter.filter( filteredDependencies ); + andArtifactFilter.add( filter ); } + filteredDependencies( andArtifactFilter, filteredDependencies ); + if ( isNegative ) { // negative clauses reduce the set of available artifacts @@ -265,4 +290,43 @@ protected abstract void processDependencies( Collection dependencies, String inline ); + + private void filteredDependencies( final ArtifactFilter artifactFilter, Collection filteredDependencies ) + { + CollectingDependencyNodeVisitor collectingDependencyNodeVisitor = new CollectingDependencyNodeVisitor(); + final Artifact rootArtifact = m_dependencyGraph.getArtifact(); + ArtifactFilter filter = new ArtifactFilter() + { + + + public boolean include( Artifact artifact ) + { + return artifact.equals( rootArtifact ) || artifactFilter.include( artifact ); + } + + + }; + DependencyNodeFilter dependencyNodeFilter = new ArtifactDependencyNodeFilter( filter ); + dependencyNodeFilter = new TrimmingDependencyNodeFilter( dependencyNodeFilter ); + DependencyNodeVisitor dependencyNodeVisitor = + new FilteringDependencyNodeVisitor( collectingDependencyNodeVisitor, dependencyNodeFilter ); + dependencyNodeVisitor = new BuildingDependencyNodeVisitor( dependencyNodeVisitor ); + m_dependencyGraph.accept( dependencyNodeVisitor ); + List dependencyNodes = collectingDependencyNodeVisitor.getNodes(); + Set ids = new LinkedHashSet( dependencyNodes.size() ); + for( DependencyNode dependencyNode : dependencyNodes ) { + Artifact artifact = dependencyNode.getArtifact(); + String id = artifact.getId(); + ids.add(id); + } + for (Iterator iterator = filteredDependencies.iterator(); iterator.hasNext();) + { + Artifact artifact = iterator.next(); + String id = artifact.getId(); + if (!ids.contains(id)) + { + iterator.remove(); + } + } + } } diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -19,7 +19,7 @@ package org.apache.felix.bundleplugin; -import java.io.FileOutputStream; +import java.io.File; import java.io.OutputStream; import java.util.Iterator; import java.util.Map; @@ -29,6 +29,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.dependency.graph.DependencyNode; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; @@ -49,7 +50,7 @@ @Override - protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties, + protected void execute( MavenProject currentProject, DependencyNode dependencyGraph, Map originalInstructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { final String artifactId = getProject().getArtifactId(); @@ -58,7 +59,8 @@ try { // assemble bundle as usual, but don't save it - this way we have all the instructions we need - Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties, classpath ); + Builder builder = buildOSGiBundle( currentProject, + dependencyGraph, originalInstructions, properties, classpath ); Properties bndProperties = builder.getProperties(); // cleanup and remove all non-strings from the builder properties @@ -73,7 +75,7 @@ // save the BND generated bundle to the same output directory that maven uses bndProperties.setProperty( "-output", "${maven.build.dir}/${maven.build.finalName}.jar" ); - OutputStream out = new FileOutputStream( baseDir + BUILD_BND ); + OutputStream out = buildContext.newFileOutputStream( new File(baseDir + BUILD_BND) ); bndProperties.store( out, " Merged BND Instructions" ); IOUtil.close( out ); diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -47,6 +47,7 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.StringUtils; +import org.sonatype.plexus.build.incremental.BuildContext; import aQute.bnd.differ.Baseline; import aQute.bnd.differ.Baseline.Info; @@ -106,12 +107,30 @@ private ArtifactMetadataSource metadataSource; /** + * Group id to compare the current code against. + */ + @Parameter( defaultValue = "${project.groupId}", property="comparisonGroupId" ) + protected String comparisonGroupId; + + /** + * Artifact to compare the current code against. + */ + @Parameter( defaultValue = "${project.artifactId}", property="comparisonArtifactId" ) + protected String comparisonArtifactId; + + /** * Version to compare the current code against. */ @Parameter( defaultValue = "(,${project.version})", property="comparisonVersion" ) protected String comparisonVersion; /** + * Artifact to compare the current code against. + */ + @Parameter( defaultValue = "${project.packaging}", property="comparisonPackaging" ) + protected String comparisonPackaging; + + /** * Classifier for the artifact to compare the current code against. */ @Parameter( property="comparisonClassifier" ) @@ -130,6 +149,9 @@ @Parameter protected List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); + @Component + protected BuildContext buildContext; + public final void execute() throws MojoExecutionException, MojoFailureException { @@ -161,7 +183,17 @@ } final Artifact previousArtifact = getPreviousArtifact(); - final Jar previousBundle = openJar(previousArtifact.getFile()); + + final Jar previousBundle; + if (previousArtifact != null) + { + previousBundle = openJar(previousArtifact.getFile()); + } + else + { + previousBundle = null; + } + if ( previousBundle == null ) { getLog().info( "Not generating Baseline report as there is no previous version of the library to compare against" ); @@ -424,10 +456,10 @@ try { previousArtifact = - factory.createDependencyArtifact( project.getGroupId(), - project.getArtifactId(), + factory.createDependencyArtifact( comparisonGroupId, + comparisonArtifactId, range, - project.getPackaging(), + comparisonPackaging, comparisonClassifier, Artifact.SCOPE_COMPILE ); @@ -484,7 +516,7 @@ for ( Iterator versionIterator = versions.iterator(); versionIterator.hasNext(); ) { ArtifactVersion version = versionIterator.next(); - if ( "SNAPSHOT".equals( version.getQualifier() ) ) + if ( version.getQualifier() != null && version.getQualifier().endsWith( "SNAPSHOT" ) ) { versionIterator.remove(); } diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -24,7 +24,6 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -38,8 +37,9 @@ * BND Baseline check between two bundles. * @since 2.4.1 */ -@Mojo( name = "baseline", threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST ) -@Execute( phase = LifecyclePhase.VERIFY ) +@Mojo( name = "baseline", threadSafe = true, + requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.VERIFY) public final class BaselinePlugin extends AbstractBaselinePlugin { diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java 2018-01-03 12:49:20.000000000 +0000 @@ -19,7 +19,6 @@ package org.apache.felix.bundleplugin.baseline; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -28,7 +27,6 @@ import java.util.ResourceBundle; import org.apache.maven.doxia.sink.Sink; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -43,8 +41,8 @@ * * @since 2.4.1 */ -@Mojo( name = "baseline-report", threadSafe = true ) -@Execute( phase = LifecyclePhase.SITE ) +@Mojo( name = "baseline-report", threadSafe = true, + defaultPhase = LifecyclePhase.SITE) public final class BaselineReport extends AbstractBaselinePlugin implements MavenReport @@ -101,7 +99,7 @@ try { - target = new FileOutputStream( targetFile ); + target = buildContext.newFileOutputStream( targetFile ); IOUtil.copy( source, target ); } catch ( IOException e ) diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -45,7 +45,6 @@ import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -65,12 +64,11 @@ /** * Build an OSGi bundle jar for all transitive dependencies. - * + * * @deprecated The bundleall goal is no longer supported and may be removed in a future release */ @Deprecated -@Mojo( name = "bundleall", requiresDependencyResolution = ResolutionScope.TEST ) -@Execute( phase = LifecyclePhase.PACKAGE ) +@Mojo( name = "bundleall", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.PACKAGE ) public class BundleAllPlugin extends ManifestPlugin { private static final String LS = System.getProperty( "line.separator" ); @@ -126,12 +124,13 @@ private Set m_artifactsBeingProcessed = new HashSet(); /** - * Process up to some depth + * Process up to some depth */ @Parameter private int depth = Integer.MAX_VALUE; + @Override public void execute() throws MojoExecutionException { getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ); @@ -145,7 +144,7 @@ /** * Bundle a project and all its dependencies - * + * * @param project * @throws MojoExecutionException */ @@ -157,7 +156,7 @@ /** * Bundle a project and its transitive dependencies up to some depth level - * + * * @param project * @param maxDepth how deep to process the dependency tree * @throws MojoExecutionException @@ -290,7 +289,7 @@ /** * Bundle the root of a dependency tree after all its children have been bundled - * + * * @param project * @param bundleInfo * @return @@ -315,7 +314,7 @@ /** * Bundle one project only without building its childre - * + * * @param project * @throws MojoExecutionException */ @@ -330,7 +329,7 @@ instructions.put( Analyzer.IMPORT_PACKAGE, wrapImportPackage ); project.getArtifact().setFile( getFile( artifact ) ); - File outputFile = getOutputFile( artifact ); + File outputFile = getOutputFile(artifact); if ( project.getArtifact().getFile().equals( outputFile ) ) { @@ -343,7 +342,8 @@ // + " to the same file, try cleaning: " + outputFile ); } - Analyzer analyzer = getAnalyzer( project, instructions, new Properties(), getClasspath( project ) ); + org.apache.maven.shared.dependency.graph.DependencyNode dependencyGraph = buildDependencyGraph( project ); + Analyzer analyzer = getAnalyzer( project, dependencyGraph, instructions, new Properties(), getClasspath( project, dependencyGraph ) ); Jar osgiJar = new Jar( project.getArtifactId(), project.getArtifact().getFile() ); @@ -428,9 +428,10 @@ /** * Use previously built bundles when available. - * + * * @param artifact */ + @Override protected File getFile( final Artifact artifact ) { File bundle = getBuiltFile( artifact ); @@ -457,7 +458,7 @@ /* * Find snapshots in output folder, eg. 2.1-SNAPSHOT will match 2.1.0.20070207_193904_2 - * TODO there has to be another way to do this using Maven libs + * TODO there has to be another way to do this using Maven libs */ if ( ( bundle == null ) && artifact.isSnapshot() ) { @@ -495,9 +496,9 @@ /** * Check that the bundleName provided correspond to the artifact provided. * Used to determine when the bundle name is a timestamped snapshot and the artifact is a snapshot not timestamped. - * + * * @param artifact artifact with snapshot version - * @param bundleName bundle file name + * @param bundleName bundle file name * @return if both represent the same artifact and version, forgetting about the snapshot timestamp */ protected boolean snapshotMatch( Artifact artifact, String bundleName ) diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java 2015-03-04 13:26:21.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java 2018-01-03 12:49:20.000000000 +0000 @@ -28,7 +28,7 @@ * Information result of the bundling process * * @author Carlos Sanchez - * @version $Id: BundleInfo.java 1663988 2015-03-04 13:26:21Z cziegeler $ + * @version $Id$ */ public class BundleInfo { @@ -60,7 +60,7 @@ /** * Get a list of packages that are exported in more than one bundle. * Key is package name and value list of artifacts where it's exported. - * @return {@link Map} < {@link String}, {@link Set} < {@link Artifact} > > + * @return {@link Map} < {@link String}, {@link Set} < {@link Artifact} > > */ public Map> getDuplicatedExports() { diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -25,6 +25,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.Writer; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.ArrayList; @@ -41,15 +42,24 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.TreeMap; import java.util.jar.Attributes; import java.util.jar.Manifest; +import org.apache.felix.bundleplugin.pom.PomWriter; import org.apache.maven.archiver.ManifestSection; import org.apache.maven.archiver.MavenArchiveConfiguration; import org.apache.maven.archiver.MavenArchiver; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactCollector; +import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Exclusion; import org.apache.maven.model.License; import org.apache.maven.model.Model; import org.apache.maven.model.Resource; @@ -58,13 +68,19 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.MavenProjectHelper; +import org.apache.maven.project.ProjectBuildingException; +import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; +import org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException; +import org.apache.maven.shared.dependency.graph.DependencyNode; +import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; +import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; import org.apache.maven.shared.osgi.Maven2OsgiConverter; import org.codehaus.plexus.archiver.UnArchiver; @@ -73,26 +89,35 @@ import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.PropertyUtils; import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.WriterFactory; +import org.sonatype.plexus.build.incremental.BuildContext; import aQute.bnd.header.Attrs; +import aQute.bnd.header.OSGiHeader; +import aQute.bnd.header.Parameters; import aQute.bnd.osgi.Analyzer; import aQute.bnd.osgi.Builder; import aQute.bnd.osgi.Constants; import aQute.bnd.osgi.Descriptors.PackageRef; import aQute.bnd.osgi.EmbeddedResource; import aQute.bnd.osgi.FileResource; +import aQute.bnd.osgi.Instruction; +import aQute.bnd.osgi.Instructions; import aQute.bnd.osgi.Jar; import aQute.bnd.osgi.Packages; import aQute.bnd.osgi.Processor; +import aQute.lib.collections.ExtList; import aQute.lib.spring.SpringXMLType; +import aQute.libg.generics.Create; /** * Create an OSGi bundle from Maven project * */ -@Mojo( name = "bundle", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) -@Execute( phase = LifecyclePhase.PACKAGE ) +@Mojo( name = "bundle", requiresDependencyResolution = ResolutionScope.TEST, + threadSafe = true, + defaultPhase = LifecyclePhase.PACKAGE ) public class BundlePlugin extends AbstractMojo { /** @@ -151,6 +176,32 @@ @Parameter protected String packaging; + /** + * If true, remove any inlined or embedded dependencies from the resulting pom. + */ + @Parameter + protected boolean createDependencyReducedPom; + + /** + * Where to put the dependency reduced pom. Note: setting a value for this parameter with a directory other than + * ${basedir} will change the value of ${basedir} for all executions that come after the shade execution. This is + * often not what you want. This is considered an open issue with this plugin. + */ + @Parameter( defaultValue = "${basedir}/dependency-reduced-pom.xml" ) + protected File dependencyReducedPomLocation; + + /** + * Directory where the SCR files will be written + */ + @Parameter(defaultValue="${project.build.outputDirectory}") + protected File scrLocation; + + /** + * When true, dump the generated SCR files + */ + @Parameter + protected boolean exportScr; + @Component private MavenProjectHelper m_projectHelper; @@ -160,12 +211,64 @@ @Component private ArtifactHandlerManager m_artifactHandlerManager; + @Component + protected DependencyGraphBuilder m_dependencyGraphBuilder; + + /* The current Maven session. */ + @Parameter( defaultValue = "${session}", readonly = true ) + protected MavenSession session; + + + /** + * ProjectBuilder, needed to create projects from the artifacts. + */ + @Component + protected MavenProjectBuilder mavenProjectBuilder; + + @Component + private DependencyTreeBuilder dependencyTreeBuilder; + + /** + * The dependency graph builder to use. + */ + @Component + protected DependencyGraphBuilder dependencyGraphBuilder; + + @Component + private ArtifactMetadataSource artifactMetadataSource; + + @Component + private ArtifactCollector artifactCollector; + + @Component + protected ArtifactFactory artifactFactory; + + /** + * Artifact resolver, needed to download source jars for inclusion in classpath. + */ + @Component + protected ArtifactResolver artifactResolver; + + + /** + * Local maven repository. + */ + @Parameter( readonly = true, required = true, defaultValue = "${localRepository}" ) + protected ArtifactRepository localRepository; + + /** + * Remote repositories which will be searched for source attachments. + */ + @Parameter( readonly = true, required = true, defaultValue = "${project.remoteArtifactRepositories}" ) + protected List remoteArtifactRepositories; + + + /** * Project types which this plugin supports. */ @Parameter - protected List supportedProjectTypes = Arrays.asList( new String[] - { "jar", "bundle" } ); + protected List supportedProjectTypes = Arrays.asList("jar", "bundle"); /** * The directory for the generated bundles. @@ -183,10 +286,13 @@ * The Maven project. */ @Parameter( defaultValue = "${project}", readonly = true, required = true ) - private MavenProject project; + protected MavenProject project; /** * The BND instructions for the bundle. + * Maven will expand property macros in these values. If you want to use a BND macro, you must double the dollar sign + * for the plugin to pass it to BND correctly. For example:
+ * {@code <_consumer-policy>$${range;[===,+)}}{@code } */ @Parameter private Map instructions = new LinkedHashMap(); @@ -194,7 +300,7 @@ /** * Use locally patched version for now. */ - private Maven2OsgiConverter m_maven2OsgiConverter = new DefaultMaven2OsgiConverter(); + private final Maven2OsgiConverter m_maven2OsgiConverter = new DefaultMaven2OsgiConverter(); /** * The archive configuration to use. @@ -205,6 +311,9 @@ @Parameter( defaultValue = "${session}", readonly = true, required = true ) private MavenSession m_mavenSession; + @Component + protected BuildContext buildContext; + private static final String MAVEN_SYMBOLICNAME = "maven-symbolicname"; private static final String MAVEN_RESOURCES = "{maven-resources}"; private static final String MAVEN_TEST_RESOURCES = "{maven-test-resources}"; @@ -228,17 +337,24 @@ } - protected void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter ) - { - m_maven2OsgiConverter = maven2OsgiConverter; - } - - protected MavenProject getProject() { return project; } + protected DependencyNode buildDependencyGraph( MavenProject mavenProject ) throws MojoExecutionException + { + DependencyNode dependencyGraph; + try + { + dependencyGraph = m_dependencyGraphBuilder.buildDependencyGraph( mavenProject, null ); + } + catch ( DependencyGraphBuilderException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + return dependencyGraph; + } /** * @see org.apache.maven.plugin.AbstractMojo#execute() @@ -256,16 +372,16 @@ return; } - execute( getProject(), instructions, properties ); + execute( getProject(), buildDependencyGraph(getProject()), instructions, properties ); } - protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties ) + protected void execute( MavenProject currentProject, DependencyNode dependencyGraph, Map originalInstructions, Properties properties ) throws MojoExecutionException { try { - execute( currentProject, originalInstructions, properties, getClasspath( currentProject ) ); + execute( currentProject, dependencyGraph, originalInstructions, properties, getClasspath( currentProject, dependencyGraph ) ); } catch ( IOException e ) { @@ -326,7 +442,7 @@ for ( Iterator e = errors.iterator(); e.hasNext(); ) { String msg = e.next(); - if ( msg.startsWith( fileNotFound ) && msg.endsWith( "~" ) ) + if ( msg.startsWith(fileNotFound) && msg.endsWith( "~" ) ) { // treat as warning; this error happens when you have duplicate entries in Include-Resource String duplicate = Processor.removeDuplicateMarker( msg.substring( fileNotFound.length() ) ); @@ -342,13 +458,13 @@ } - protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties, + protected void execute( MavenProject currentProject, DependencyNode dependencyGraph, Map originalInstructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { try { File jarFile = new File( getBuildDirectory(), getBundleName( currentProject ) ); - Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties, classpath ); + Builder builder = buildOSGiBundle( currentProject, dependencyGraph, originalInstructions, properties, classpath ); boolean hasErrors = reportErrors( "Bundle " + currentProject.getArtifact(), builder ); if ( hasErrors ) { @@ -404,8 +520,7 @@ try { - Manifest manifest = builder.getJar().getManifest(); - ManifestPlugin.writeManifest( manifest, outputFile, niceManifest ); + ManifestPlugin.writeManifest( builder, outputFile, niceManifest, exportScr, scrLocation, buildContext, getLog() ); } catch ( IOException e ) { @@ -526,7 +641,7 @@ Map.Entry entry = itr.next(); if ( entry.getKey() instanceof String == false ) { - String key = sanitize( entry.getKey() ); + String key = sanitize(entry.getKey()); if ( !properties.containsKey( key ) ) { sanitizedEntries.setProperty( key, sanitize( entry.getValue() ) ); @@ -578,23 +693,39 @@ } - protected void addMavenInstructions( MavenProject currentProject, Builder builder ) throws Exception + protected void addMavenInstructions( MavenProject currentProject, DependencyNode dependencyGraph, Builder builder ) throws Exception { if ( currentProject.getBasedir() != null ) { // update BND instructions to add included Maven resources - includeMavenResources( currentProject, builder, getLog() ); + includeMavenResources(currentProject, builder, getLog()); + + // Fixup error messages + includeJava9Fixups(currentProject, builder); // calculate default export/private settings based on sources - addLocalPackages( outputDirectory, builder ); + addLocalPackages(outputDirectory, builder); // tell BND where the current project source resides - addMavenSourcePath( currentProject, builder, getLog() ); + addMavenSourcePath(currentProject, builder, getLog()); } // update BND instructions to embed selected Maven dependencies - Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, builder ); - new DependencyEmbedder( getLog(), embeddableArtifacts ).processHeaders( builder ); + Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, dependencyGraph, builder ); + DependencyEmbedder dependencyEmbedder = new DependencyEmbedder(getLog(), dependencyGraph, embeddableArtifacts); + dependencyEmbedder.processHeaders(builder); + + Collection embeddedArtifacts = dependencyEmbedder.getEmbeddedArtifacts(); + if ( !embeddedArtifacts.isEmpty() && createDependencyReducedPom ) + { + Set embeddedIds = new HashSet(); + for ( Artifact artifact : embeddedArtifacts ) + { + embeddedIds.add( getId( artifact ) ); + } + createDependencyReducedPom( embeddedIds ); + + } if ( dumpInstructions != null || getLog().isDebugEnabled() ) { @@ -608,10 +739,12 @@ } } + + if ( dumpClasspath != null || getLog().isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); - getLog().debug( "BND Classpath:" + NL + dumpClasspath( builder.getClasspath(), buf ) ); + getLog().debug("BND Classpath:" + NL + dumpClasspath(builder.getClasspath(), buf)); if ( dumpClasspath != null ) { getLog().info( "Writing BND classpath to " + dumpClasspath ); @@ -622,16 +755,223 @@ } - protected Builder buildOSGiBundle( MavenProject currentProject, Map originalInstructions, Properties properties, + // We need to find the direct dependencies that have been included in the uber JAR so that we can modify the + // POM accordingly. + private void createDependencyReducedPom( Set artifactsToRemove ) + throws IOException, DependencyTreeBuilderException, ProjectBuildingException + { + Model model = project.getOriginalModel(); + List dependencies = new ArrayList(); + + boolean modified = false; + + List transitiveDeps = new ArrayList(); + + for ( Iterator it = project.getArtifacts().iterator(); it.hasNext(); ) + { + Artifact artifact = (Artifact) it.next(); + + if ( "pom".equals( artifact.getType() ) ) + { + // don't include pom type dependencies in dependency reduced pom + continue; + } + + //promote + Dependency dep = new Dependency(); + dep.setArtifactId( artifact.getArtifactId() ); + if ( artifact.hasClassifier() ) + { + dep.setClassifier( artifact.getClassifier() ); + } + dep.setGroupId( artifact.getGroupId() ); + dep.setOptional( artifact.isOptional() ); + dep.setScope( artifact.getScope() ); + dep.setType( artifact.getType() ); + dep.setVersion( artifact.getVersion() ); + + //we'll figure out the exclusions in a bit. + + transitiveDeps.add( dep ); + } + List origDeps = project.getDependencies(); + + for ( Iterator i = origDeps.iterator(); i.hasNext(); ) + { + Dependency d = i.next(); + + dependencies.add( d ); + + String id = getId( d ); + + if ( artifactsToRemove.contains( id ) ) + { + modified = true; + + dependencies.remove( d ); + } + } + + // Check to see if we have a reduction and if so rewrite the POM. + if ( modified ) + { + while ( modified ) + { + + model.setDependencies( dependencies ); + + if ( dependencyReducedPomLocation == null ) + { + // MSHADE-123: We can't default to 'target' because it messes up uses of ${project.basedir} + dependencyReducedPomLocation = new File ( project.getBasedir(), "dependency-reduced-pom.xml" ); + } + + File f = dependencyReducedPomLocation; + if ( f.exists() ) + { + f.delete(); + } + + Writer w = WriterFactory.newXmlWriter( f ); + + String origRelativePath = null; + String replaceRelativePath = null; + if ( model.getParent() != null) + { + origRelativePath = model.getParent().getRelativePath(); + + } + replaceRelativePath = origRelativePath; + + if ( origRelativePath == null ) + { + origRelativePath = "../pom.xml"; + } + + if ( model.getParent() != null ) + { + File parentFile = new File( project.getBasedir(), model.getParent().getRelativePath() ).getCanonicalFile(); + if ( !parentFile.isFile() ) + { + parentFile = new File( parentFile, "pom.xml"); + } + + parentFile = parentFile.getCanonicalFile(); + + String relPath = RelativizePath.convertToRelativePath( parentFile, f ); + model.getParent().setRelativePath( relPath ); + } + + try + { + PomWriter.write( w, model, true ); + } + finally + { + if ( model.getParent() != null ) + { + model.getParent().setRelativePath( replaceRelativePath ); + } + w.close(); + } + + MavenProject p2 = mavenProjectBuilder.build( f, localRepository, null ); + modified = updateExcludesInDeps( p2, dependencies, transitiveDeps ); + + } + + project.setFile( dependencyReducedPomLocation ); + } + } + + private String getId( Artifact artifact ) + { + return getId( artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getClassifier() ); + } + + private String getId( Dependency dependency ) + { + return getId( dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), + dependency.getClassifier() ); + } + + private String getId( String groupId, String artifactId, String type, String classifier ) + { + return groupId + ":" + artifactId + ":" + type + ":" + ( ( classifier != null ) ? classifier : "" ); + } + + public boolean updateExcludesInDeps( MavenProject project, List dependencies, List transitiveDeps ) + throws DependencyTreeBuilderException + { + org.apache.maven.shared.dependency.tree.DependencyNode node = dependencyTreeBuilder.buildDependencyTree(project, localRepository, artifactFactory, + artifactMetadataSource, null, + artifactCollector); + boolean modified = false; + Iterator it = node.getChildren().listIterator(); + while ( it.hasNext() ) + { + org.apache.maven.shared.dependency.tree.DependencyNode n2 = (org.apache.maven.shared.dependency.tree.DependencyNode) it.next(); + Iterator it2 = n2.getChildren().listIterator(); + while ( it2.hasNext() ) + { + org.apache.maven.shared.dependency.tree.DependencyNode n3 = (org.apache.maven.shared.dependency.tree.DependencyNode) it2.next(); + //anything two levels deep that is marked "included" + //is stuff that was excluded by the original poms, make sure it + //remains excluded IF promoting transitives. + if ( n3.getState() == org.apache.maven.shared.dependency.tree.DependencyNode.INCLUDED ) + { + //check if it really isn't in the list of original dependencies. Maven + //prior to 2.0.8 may grab versions from transients instead of + //from the direct deps in which case they would be marked included + //instead of OMITTED_FOR_DUPLICATE + + //also, if not promoting the transitives, level 2's would be included + boolean found = false; + for ( int x = 0; x < transitiveDeps.size(); x++ ) + { + Dependency dep = transitiveDeps.get( x ); + if ( dep.getArtifactId().equals( n3.getArtifact().getArtifactId() ) && dep.getGroupId().equals( + n3.getArtifact().getGroupId() ) ) + { + found = true; + } + + } + + if ( !found ) + { + for ( int x = 0; x < dependencies.size(); x++ ) + { + Dependency dep = dependencies.get( x ); + if ( dep.getArtifactId().equals( n2.getArtifact().getArtifactId() ) + && dep.getGroupId().equals( n2.getArtifact().getGroupId() ) ) + { + Exclusion exclusion = new Exclusion(); + exclusion.setArtifactId( n3.getArtifact().getArtifactId() ); + exclusion.setGroupId( n3.getArtifact().getGroupId() ); + dep.addExclusion( exclusion ); + modified = true; + break; + } + } + } + } + } + } + return modified; + } + + + protected Builder buildOSGiBundle( MavenProject currentProject, DependencyNode dependencyGraph, Map originalInstructions, Properties properties, Jar[] classpath ) throws Exception { Builder builder = getOSGiBuilder( currentProject, originalInstructions, properties, classpath ); - addMavenInstructions( currentProject, builder ); + addMavenInstructions( currentProject, dependencyGraph, builder ); builder.build(); - mergeMavenManifest( currentProject, builder ); + mergeMavenManifest(currentProject, dependencyGraph, builder); return builder; } @@ -670,7 +1010,7 @@ { try { - buf.append( "#-----------------------------------------------------------------------" + NL ); + buf.append("#-----------------------------------------------------------------------" + NL); buf.append( "-classpath:\\" + NL ); for ( Iterator i = classpath.iterator(); i.hasNext(); ) { @@ -696,7 +1036,7 @@ { buf.append( "#-----------------------------------------------------------------------" + NL ); ByteArrayOutputStream out = new ByteArrayOutputStream(); - ManifestWriter.outputManifest( manifest, out, true ); // manifest encoding is UTF8 + ManifestWriter.outputManifest(manifest, out, true); // manifest encoding is UTF8 buf.append( out.toString( "UTF8" ) ); buf.append( "#-----------------------------------------------------------------------" + NL ); } @@ -742,7 +1082,7 @@ } - protected void mergeMavenManifest( MavenProject currentProject, Builder builder ) throws Exception + protected void mergeMavenManifest( MavenProject currentProject, DependencyNode dependencyGraph, Builder builder ) throws Exception { Jar jar = builder.getJar(); @@ -828,18 +1168,30 @@ /* * Overlay generated bundle manifest with customized entries */ + Properties properties = builder.getProperties(); Manifest bundleManifest = jar.getManifest(); - bundleManifest.getMainAttributes().putAll( mainMavenAttributes ); - bundleManifest.getEntries().putAll( mavenManifest.getEntries() ); + if ( properties.containsKey( "Merge-Headers" ) ) + { + Instructions instructions = new Instructions( ExtList.from(builder.getProperty("Merge-Headers")) ); + mergeManifest( instructions, bundleManifest, mavenManifest ); + } + else + { + bundleManifest.getMainAttributes().putAll( mainMavenAttributes ); + bundleManifest.getEntries().putAll( mavenManifest.getEntries() ); + } // adjust the import package attributes so that optional dependencies use // optional resolution. String importPackages = bundleManifest.getMainAttributes().getValue( "Import-Package" ); if ( importPackages != null ) { - Set optionalPackages = getOptionalPackages( currentProject ); + Set optionalPackages = getOptionalPackages( currentProject, dependencyGraph ); - Map> values = new Analyzer().parseHeader( importPackages ); + Map> values; + try (Analyzer analyzer = new Analyzer()) { + values = analyzer.parseHeader( importPackages ); + } for ( Map.Entry> entry : values.entrySet() ) { String pkg = entry.getKey(); @@ -874,19 +1226,197 @@ } - protected Set getOptionalPackages( MavenProject currentProject ) throws IOException, MojoExecutionException + protected static void mergeManifest( Instructions instructions, Manifest... manifests ) throws IOException + { + for ( int i = manifests.length - 2; i >= 0; i-- ) + { + Manifest mergedManifest = manifests[i]; + Manifest manifest = manifests[i + 1]; + Attributes mergedMainAttributes = mergedManifest.getMainAttributes(); + Attributes mainAttributes = manifest.getMainAttributes(); + Attributes filteredMainAttributes = filterAttributes( instructions, mainAttributes, null ); + if ( !filteredMainAttributes.isEmpty() ) + { + mergeAttributes( mergedMainAttributes, filteredMainAttributes ); + } + Map mergedEntries = mergedManifest.getEntries(); + Map entries = manifest.getEntries(); + for ( Map.Entry entry : entries.entrySet() ) + { + String name = entry.getKey(); + Attributes attributes = entry.getValue(); + Attributes filteredAttributes = filterAttributes( instructions, attributes, null ); + if ( !filteredAttributes.isEmpty() ) + { + Attributes mergedAttributes = mergedManifest.getAttributes( name ); + if ( mergedAttributes != null) + { + mergeAttributes(mergedAttributes, filteredAttributes); + } + else + { + mergedEntries.put(name, filteredAttributes); + } + } + } + } + } + + + /** + * @see Analyzer#filter + */ + private static Attributes filterAttributes(Instructions instructions, Attributes source, Set nomatch) { + Attributes result = new Attributes(); + Map keys = new TreeMap(); + for ( Object key : source.keySet() ) + { + keys.put( key.toString(), key ); + } + + List filters = new ArrayList( instructions.keySet() ); + if (nomatch == null) + { + nomatch = Create.set(); + } + for ( Instruction instruction : filters ) { + boolean match = false; + for (Iterator> i = keys.entrySet().iterator(); i.hasNext();) + { + Map.Entry entry = i.next(); + String key = entry.getKey(); + if ( instruction.matches( key ) ) + { + match = true; + if (!instruction.isNegated()) { + Object name = entry.getValue(); + Object value = source.get( name ); + result.put( name, value ); + } + i.remove(); // Can never match again for another pattern + } + } + if (!match && !instruction.isAny()) + nomatch.add(instruction); + } + + /* + * Tricky. If we have umatched instructions they might indicate that we + * want to have multiple decorators for the same package. So we check + * the unmatched against the result list. If then then match and have + * actually interesting properties then we merge them + */ + + for (Iterator i = nomatch.iterator(); i.hasNext();) { + Instruction instruction = i.next(); + + // We assume the user knows what he is + // doing and inserted a literal. So + // we ignore any not matched literals + // #252, we should not be negated to make it a constant + if (instruction.isLiteral() && !instruction.isNegated()) { + Object key = keys.get( instruction.getLiteral() ); + if ( key != null ) + { + Object value = source.get( key ); + result.put( key, value ); + } + i.remove(); + continue; + } + + // Not matching a negated instruction looks + // like an error ... Though so, but + // in the second phase of Export-Package + // the !package will never match anymore. + if (instruction.isNegated()) { + i.remove(); + continue; + } + + // An optional instruction should not generate + // an error + if (instruction.isOptional()) { + i.remove(); + continue; + } + } + return result; + } + + + private static void mergeAttributes( Attributes... attributesArray ) throws IOException + { + for ( int i = attributesArray.length - 2; i >= 0; i-- ) + { + Attributes mergedAttributes = attributesArray[i]; + Attributes attributes = attributesArray[i + 1]; + for ( Map.Entry entry : attributes.entrySet() ) + { + Object name = entry.getKey(); + String value = (String) entry.getValue(); + String oldValue = (String) mergedAttributes.put( name, value ); + if ( oldValue != null ) + { + Parameters mergedClauses = OSGiHeader.parseHeader(oldValue); + Parameters clauses = OSGiHeader.parseHeader( value ); + if ( !mergedClauses.isEqual( clauses) ) + { + for ( Map.Entry clauseEntry : clauses.entrySet() ) + { + String clause = clauseEntry.getKey(); + Attrs attrs = clauseEntry.getValue(); + Attrs mergedAttrs = mergedClauses.get( clause ); + if ( mergedAttrs == null) + { + mergedClauses.put( clause, attrs ); + } + else if ( !mergedAttrs.isEqual(attrs) ) + { + for ( Map.Entry adentry : attrs.entrySet() ) + { + String adname = adentry.getKey(); + String ad = adentry.getValue(); + if ( mergedAttrs.containsKey( adname ) ) + { + Attrs.Type type = attrs.getType( adname ); + switch (type) + { + case VERSIONS: + case STRINGS: + case LONGS: + case DOUBLES: + ExtList mergedAd = ExtList.from( mergedAttrs.get( adname ) ); + ExtList.from( ad ).addAll( ExtList.from( ad ) ); + mergedAttrs.put(adname, mergedAd.join() ); + break; + } + } + else + { + mergedAttrs.put( adname, ad ); + } + } + } + } + mergedAttributes.put( name, Processor.printClauses( mergedClauses ) ); + } + } + } + } + } + + + protected Set getOptionalPackages( MavenProject currentProject, DependencyNode dependencyGraph ) throws IOException, MojoExecutionException { ArrayList inscope = new ArrayList(); - final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() ); + final Collection artifacts = getSelectedDependencies( dependencyGraph, currentProject.getArtifacts() ); for ( Iterator it = artifacts.iterator(); it.hasNext(); ) { Artifact artifact = it.next(); if ( artifact.getArtifactHandler().isAddedToClasspath() ) { - if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) ) - { - inscope.add( artifact ); - } + inscope.add( artifact ); } } @@ -1070,8 +1600,16 @@ private void doMavenMetadata( MavenProject currentProject, Jar jar ) throws IOException { String path = "META-INF/maven/" + currentProject.getGroupId() + "/" + currentProject.getArtifactId(); - File pomFile = new File( currentProject.getBasedir(), "pom.xml" ); - jar.putResource( path + "/pom.xml", new FileResource( pomFile ) ); + + File pomFile = currentProject.getFile(); + if ( pomFile == null || !pomFile.exists() ) + { + pomFile = new File( currentProject.getBasedir(), "pom.xml" ); + } + if ( pomFile.exists() ) + { + jar.putResource( path + "/pom.xml", new FileResource( pomFile ) ); + } Properties p = new Properties(); p.put( "version", currentProject.getVersion() ); @@ -1083,7 +1621,7 @@ } - protected Jar[] getClasspath( MavenProject currentProject ) throws IOException, MojoExecutionException + protected Jar[] getClasspath( MavenProject currentProject, DependencyNode dependencyGraph ) throws IOException, MojoExecutionException { List list = new ArrayList(); @@ -1092,25 +1630,22 @@ list.add( new Jar( ".", getOutputDirectory() ) ); } - final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() ); + final Collection artifacts = getSelectedDependencies( dependencyGraph, currentProject.getArtifacts() ); for ( Iterator it = artifacts.iterator(); it.hasNext(); ) { Artifact artifact = it.next(); - if ( artifact.getArtifactHandler().isAddedToClasspath() ) + if ( artifact.getArtifactHandler().isAddedToClasspath() && !Artifact.SCOPE_TEST.equals( artifact.getScope() ) ) { - if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) ) + File file = getFile( artifact ); + if ( file == null ) { - File file = getFile( artifact ); - if ( file == null ) - { - getLog().warn( - "File is not available for artifact " + artifact + " in project " - + currentProject.getArtifact() ); - continue; - } - Jar jar = new Jar( artifact.getArtifactId(), file ); - list.add( jar ); + getLog().warn( + "File is not available for artifact " + artifact + " in project " + + currentProject.getArtifact() ); + continue; } + Jar jar = new Jar( artifact.getArtifactId(), file ); + list.add( jar ); } } Jar[] cp = new Jar[list.size()]; @@ -1119,7 +1654,7 @@ } - private Collection getSelectedDependencies( Collection artifacts ) throws MojoExecutionException + private Collection getSelectedDependencies( DependencyNode dependencyGraph, Collection artifacts ) throws MojoExecutionException { if ( null == excludeDependencies || excludeDependencies.length() == 0 ) { @@ -1131,7 +1666,7 @@ } Collection selectedDependencies = new LinkedHashSet( artifacts ); - DependencyExcluder excluder = new DependencyExcluder( artifacts ); + DependencyExcluder excluder = new DependencyExcluder( dependencyGraph, artifacts ); excluder.processHeaders( excludeDependencies ); selectedDependencies.removeAll( excluder.getExcludedArtifacts() ); @@ -1305,9 +1840,9 @@ properties.put( "classifier", classifier == null ? "" : classifier ); // Add default plugins - header( properties, Analyzer.PLUGIN, ScrPlugin.class.getName() + "," - + BlueprintPlugin.class.getName() + "," - + SpringXMLType.class.getName() ); + header( properties, Analyzer.PLUGIN, BlueprintPlugin.class.getName() + "," + + SpringXMLType.class.getName() + "," + + JpaPlugin.class.getName() ); return properties; } @@ -1470,7 +2005,7 @@ scanner.setBasedir( sourcePath ); if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() ) { - scanner.setIncludes( ( String[] ) resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) ); + scanner.setIncludes( resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) ); } else { @@ -1479,7 +2014,7 @@ if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() ) { - scanner.setExcludes( ( String[] ) resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) ); + scanner.setExcludes( resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) ); } scanner.addDefaultExcludes(); @@ -1545,7 +2080,7 @@ } - protected Collection getEmbeddableArtifacts( MavenProject currentProject, Analyzer analyzer ) + protected Collection getEmbeddableArtifacts( MavenProject currentProject, DependencyNode dependencyGraph, Analyzer analyzer ) throws MojoExecutionException { final Collection artifacts; @@ -1562,7 +2097,7 @@ artifacts = currentProject.getDependencyArtifacts(); } - return getSelectedDependencies( artifacts ); + return getSelectedDependencies( dependencyGraph, artifacts ); } @@ -1614,7 +2149,7 @@ else if ( mavenTestSourcePaths.length() > 0 ) { log.warn( Analyzer.SOURCEPATH + ": overriding " + mavenTestSourcePaths + " with " + sourcePath + " (add " - + MAVEN_TEST_SOURCES + " if you want to include the maven sources)" ); + + MAVEN_TEST_SOURCES + " if you want to include the maven test sources)" ); } } else if ( mavenSourcePaths.length() > 0 ) @@ -1622,4 +2157,32 @@ analyzer.setProperty( Analyzer.SOURCEPATH, mavenSourcePaths.toString() ); } } + + /** + * Downgrade the message "Classes found in the wrong directory" to a warning. This allows the plugin + * to process a multi-release JAR (see JEP 238, http://openjdk.java.net/jeps/238). + * + * Note that the version-specific paths will NOT be visible at runtime nor processed by bnd for + * imported packages etc. This will not be possible until a runtime solution for multi-release + * JARs exists in OSGi. This fix only allows these JARs to be processed at all and to be usable on + * Java 8 (and below), and also on Java 9 where the version-specific customizations are optional. + */ + protected static void includeJava9Fixups(MavenProject currentProject, Analyzer analyzer) + { + final String classesInWrongDirError = "Classes found in the wrong directory"; + final String newFixup = "Classes found in the wrong directory;" + + Analyzer.FIXUPMESSAGES_IS_DIRECTIVE + "=" + + Analyzer.FIXUPMESSAGES_IS_WARNING; + + String fixups = analyzer.getProperty(Analyzer.FIXUPMESSAGES); + if (fixups != null && !fixups.isEmpty()) { + if (!fixups.contains(classesInWrongDirError)) { + fixups += "," + newFixup; + } + } else { + fixups = newFixup; + } + analyzer.setProperty(Analyzer.FIXUPMESSAGES, fixups); + } + } diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java 2015-03-04 13:26:21.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java 2018-01-03 12:49:20.000000000 +0000 @@ -27,6 +27,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; +import org.apache.maven.shared.dependency.graph.DependencyNode; import org.codehaus.plexus.util.StringUtils; import aQute.bnd.osgi.Analyzer; @@ -64,15 +65,14 @@ private final Collection m_embeddedArtifacts; - public DependencyEmbedder( Log log, Collection dependencyArtifacts ) + public DependencyEmbedder( Log log, DependencyNode dependencyGraph, Collection dependencyArtifacts ) { - super( dependencyArtifacts ); + super( dependencyGraph, dependencyArtifacts ); m_inlinedPaths = new LinkedHashSet(); m_embeddedArtifacts = new LinkedHashSet(); } - public void processHeaders( Analyzer analyzer ) throws MojoExecutionException { StringBuffer includeResource = new StringBuffer(); diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java 2015-03-04 13:26:21.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java 2018-01-03 12:49:20.000000000 +0000 @@ -24,6 +24,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.shared.dependency.graph.DependencyNode; /** @@ -39,9 +40,9 @@ private final Collection m_excludedArtifacts; - public DependencyExcluder( Collection dependencyArtifacts ) + public DependencyExcluder( DependencyNode dependencyGraph, Collection dependencyArtifacts ) { - super( dependencyArtifacts ); + super( dependencyGraph, dependencyArtifacts ); m_excludedArtifacts = new HashSet(); } diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -32,6 +32,7 @@ import org.apache.maven.project.MavenProject; import aQute.bnd.osgi.Jar; +import org.apache.maven.shared.dependency.graph.DependencyNode; /** @@ -41,7 +42,7 @@ public class InstructionsPlugin extends BundlePlugin { @Override - protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) + protected void execute( MavenProject project, DependencyNode dependencyGraph, Map instructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { if ( dumpInstructions == null ) @@ -51,7 +52,7 @@ try { - addMavenInstructions( project, getOSGiBuilder( project, instructions, properties, classpath ) ); + addMavenInstructions( project, dependencyGraph, getOSGiBuilder(project, instructions, properties, classpath) ); } catch ( FileNotFoundException e ) { diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/JpaPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/JpaPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/JpaPlugin.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/JpaPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,166 @@ +/* + * 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. + */ +package org.apache.felix.bundleplugin; + + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import aQute.bnd.osgi.Analyzer; +import aQute.bnd.osgi.Processor; +import aQute.bnd.osgi.Resource; +import aQute.bnd.service.AnalyzerPlugin; +import aQute.libg.generics.Create; + + +public class JpaPlugin implements AnalyzerPlugin +{ + + Transformer transformer; + + + public JpaPlugin() throws Exception + { + transformer = getTransformer( getClass().getResource( "jpa.xsl" ) ); + } + + + public boolean analyzeJar( Analyzer analyzer ) throws Exception + { + Set headers = Create.set(); + + String mpHeader = analyzer.getProperty( "Meta-Persistence" ); + + transformer.setParameter( "jpa-enable", analyzer.getProperty( "jpa-enable", "true" ) ); + transformer.setParameter( "jpa-implementation", analyzer.getProperty( "jpa-implementation", "aries" ) ); + transformer.setParameter( "jpa-datasource-req", analyzer.getProperty( "jpa-datasource-req", "true" ) ); + + Map> map = Processor.parseHeader( mpHeader, null ); + for ( String root : map.keySet() ) + { + Resource resource = analyzer.getJar().getResource(root); + if ( resource != null ) { + process(analyzer, root, resource, headers); + } + } + + // Group and analyze + for ( String str : headers ) + { + int idx = str.indexOf( ':' ); + if ( idx < 0 ) + { + analyzer.warning( ( new StringBuilder( "Error analyzing services in scr resource: " ) ).append( str ).toString() ); + continue; + } + String h = str.substring( 0, idx ).trim(); + String v = str.substring( idx + 1 ).trim(); + + StringBuilder sb = new StringBuilder(); + String header = analyzer.getProperty( h ); + if (header != null && !header.isEmpty()) + { + sb.append(header); + sb.append(","); + } + sb.append( v ); + analyzer.setProperty(h, sb.toString()); + } + return false; + } + + + private void process( Analyzer analyzer, String path, Resource resource, Set headers ) + { + InputStream in = null; + try + { + in = resource.openInputStream(); + + // Retrieve headers + Set set = analyze( in ); +System.err.println("Output: " + set.toString()); + headers.addAll( set ); + } + catch ( Exception e ) + { + analyzer.error( ( new StringBuilder( "Unexpected exception in processing spring resources(" ) ) + .append( path ).append( "): " ).append( e ).toString() ); + } + finally + { + try + { + if ( in != null ) + { + in.close(); + } + } + catch ( IOException e ) + { + } + } + } + + + public Set analyze( InputStream in ) throws Exception + { + Set refers = new HashSet(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + javax.xml.transform.Result r = new StreamResult( bout ); + javax.xml.transform.Source s = new StreamSource( in ); + transformer.transform( s, r ); + ByteArrayInputStream bin = new ByteArrayInputStream( bout.toByteArray() ); + bout.close(); + BufferedReader br = new BufferedReader( new InputStreamReader( bin ) ); + for ( String line = br.readLine(); line != null; line = br.readLine() ) + { + line = line.trim(); + if ( line.length() > 0 ) + { + refers.add( line ); + } + } + + br.close(); + return refers; + } + + + protected Transformer getTransformer( URL url ) throws Exception + { + TransformerFactory tf = TransformerFactory.newInstance(); + javax.xml.transform.Source source = new StreamSource( url.openStream() ); + return tf.newTransformer( source ); + } + +} diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -20,12 +20,14 @@ import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; @@ -33,24 +35,32 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.dependency.graph.DependencyNode; +import org.codehaus.plexus.util.Scanner; +import org.osgi.service.metatype.MetaTypeService; +import org.sonatype.plexus.build.incremental.BuildContext; import aQute.bnd.osgi.Analyzer; import aQute.bnd.osgi.Builder; +import aQute.bnd.osgi.Instructions; import aQute.bnd.osgi.Jar; import aQute.bnd.osgi.Resource; +import aQute.lib.collections.ExtList; /** * Generate an OSGi manifest for this project */ -@Mojo( name = "manifest", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true ) -@Execute( phase = LifecyclePhase.PROCESS_CLASSES ) +@Mojo( name = "manifest", requiresDependencyResolution = ResolutionScope.TEST, + threadSafe = true, + defaultPhase = LifecyclePhase.PROCESS_CLASSES) public class ManifestPlugin extends BundlePlugin { /** @@ -59,15 +69,33 @@ @Parameter( property = "rebuildBundle" ) protected boolean rebuildBundle; + /** + * When true, manifest generation on incremental builds is supported in IDEs like Eclipse. + * Please note that the underlying BND library does not support incremental build, which means + * always the whole manifest and SCR metadata is generated. + */ + @Parameter( property = "supportIncrementalBuild" ) + private boolean supportIncrementalBuild; + + @Component + private BuildContext buildContext; @Override - protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) + protected void execute( MavenProject project, DependencyNode dependencyGraph, Map instructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { - Manifest manifest; + + // in incremental build execute manifest generation only when explicitly activated + // and when any java file was touched since last build + if (buildContext.isIncremental() && !(supportIncrementalBuild && anyJavaSourceFileTouchedSinceLastBuild())) { + getLog().debug("Skipping manifest generation because no java source file was added, updated or removed since last build."); + return; + } + + Analyzer analyzer; try { - manifest = getManifest( project, instructions, properties, classpath ); + analyzer = getAnalyzer(project, dependencyGraph, instructions, properties, classpath); } catch ( FileNotFoundException e ) { @@ -93,76 +121,130 @@ try { - writeManifest( manifest, outputFile, niceManifest ); + writeManifest( analyzer, outputFile, niceManifest, exportScr, scrLocation, buildContext, getLog() ); } - catch ( IOException e ) + catch ( Exception e ) { throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e ); } + finally + { + try + { + analyzer.close(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e ); + } + } } + /** + * Checks if any *.java file was added, updated or removed since last build in any source directory. + */ + private boolean anyJavaSourceFileTouchedSinceLastBuild() { + @SuppressWarnings("unchecked") + List sourceDirectories = project.getCompileSourceRoots(); + for (String sourceDirectory : sourceDirectories) { + File directory = new File(sourceDirectory); + Scanner scanner = buildContext.newScanner(directory); + Scanner deleteScanner = buildContext.newDeleteScanner(directory); + if (containsJavaFile(scanner) || containsJavaFile(deleteScanner)) { + return true; + } + } + return false; + } + private boolean containsJavaFile(Scanner scanner) { + String[] includes = new String[] { "**/*.java" }; + scanner.setIncludes(includes); + scanner.scan(); + return scanner.getIncludedFiles().length > 0; + } - public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException, MojoFailureException, + public Manifest getManifest( MavenProject project, DependencyNode dependencyGraph, Jar[] classpath ) throws IOException, MojoFailureException, MojoExecutionException, Exception { - return getManifest( project, new LinkedHashMap(), new Properties(), classpath ); + return getManifest( project, dependencyGraph, new LinkedHashMap(), new Properties(), classpath, buildContext ); } - public Manifest getManifest( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) - throws IOException, MojoFailureException, MojoExecutionException, Exception + public Manifest getManifest( MavenProject project, DependencyNode dependencyGraph, Map instructions, Properties properties, Jar[] classpath, + BuildContext buildContext) throws IOException, MojoFailureException, MojoExecutionException, Exception { - Analyzer analyzer = getAnalyzer( project, instructions, properties, classpath ); - boolean hasErrors = reportErrors( "Manifest " + project.getArtifact(), analyzer ); - if ( hasErrors ) - { - String failok = analyzer.getProperty( "-failok" ); - if ( null == failok || "false".equalsIgnoreCase( failok ) ) - { - throw new MojoFailureException( "Error(s) found in manifest configuration" ); - } - } + Analyzer analyzer = getAnalyzer(project, dependencyGraph, instructions, properties, classpath); Jar jar = analyzer.getJar(); + Manifest manifest = jar.getManifest(); - if ( unpackBundle ) + if (exportScr) { - File outputFile = getOutputDirectory(); - for ( Entry entry : jar.getResources().entrySet() ) - { - File entryFile = new File( outputFile, entry.getKey() ); - if ( !entryFile.exists() || entry.getValue().lastModified() == 0 ) - { - entryFile.getParentFile().mkdirs(); - OutputStream os = new FileOutputStream( entryFile ); - entry.getValue().write( os ); - os.close(); - } - } + exportScr(analyzer, jar, scrLocation, buildContext, getLog() ); } - Manifest manifest = jar.getManifest(); - // cleanup... analyzer.close(); return manifest; } + private static void exportScr(Analyzer analyzer, Jar jar, File scrLocation, BuildContext buildContext, Log log ) throws Exception { + log.debug("Export SCR metadata to: " + scrLocation.getPath()); + scrLocation.mkdirs(); + + // export SCR metadata files from OSGI-INF/ + Map scrDir = jar.getDirectories().get("OSGI-INF"); + if (scrDir != null) { + for (Map.Entry entry : scrDir.entrySet()) { + String path = entry.getKey(); + Resource resource = entry.getValue(); + writeSCR(resource, new File(scrLocation, path), buildContext, + log); + } + } - protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath ) throws IOException, MojoExecutionException, + // export metatype files from OSGI-INF/metatype + Map metatypeDir = jar.getDirectories().get(MetaTypeService.METATYPE_DOCUMENTS_LOCATION); + if (metatypeDir != null) { + for (Map.Entry entry : metatypeDir.entrySet()) + { + String path = entry.getKey(); + Resource resource = entry.getValue(); + writeSCR(resource, new File(scrLocation, path), buildContext, log); + } + } + + } + + private static void writeSCR(Resource resource, File destination, BuildContext buildContext, Log log ) throws Exception + { + log.debug("Write SCR file: " + destination.getPath()); + destination.getParentFile().mkdirs(); + OutputStream os = buildContext.newFileOutputStream(destination); + try + { + resource.write(os); + } + finally + { + os.close(); + } + } + + protected Analyzer getAnalyzer( MavenProject project, DependencyNode dependencyGraph, Jar[] classpath ) throws IOException, MojoExecutionException, Exception { - return getAnalyzer( project, new LinkedHashMap(), new Properties(), classpath ); + return getAnalyzer( project, dependencyGraph, new LinkedHashMap(), new Properties(), classpath ); } - protected Analyzer getAnalyzer( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) + protected Analyzer getAnalyzer( MavenProject project, DependencyNode dependencyGraph, Map instructions, Properties properties, Jar[] classpath ) throws IOException, MojoExecutionException, Exception { if ( rebuildBundle && supportedProjectTypes.contains( project.getArtifact().getType() ) ) { - return buildOSGiBundle( project, instructions, properties, classpath ); + return buildOSGiBundle( project, dependencyGraph, instructions, properties, classpath ); } File file = getOutputDirectory(); @@ -201,7 +283,7 @@ analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export ); } - addMavenInstructions( project, analyzer ); + addMavenInstructions( project, dependencyGraph, analyzer ); // if we spot Embed-Dependency and the bundle is "target/classes", assume we need to rebuild if ( analyzer.getProperty( DependencyEmbedder.EMBED_DEPENDENCY ) != null && isOutputDirectory ) @@ -214,18 +296,83 @@ analyzer.getJar().setManifest( analyzer.calcManifest() ); } - mergeMavenManifest( project, analyzer ); + mergeMavenManifest( project, dependencyGraph, analyzer ); + + boolean hasErrors = reportErrors( "Manifest " + project.getArtifact(), analyzer ); + if ( hasErrors ) + { + String failok = analyzer.getProperty( "-failok" ); + if ( null == failok || "false".equalsIgnoreCase( failok ) ) + { + throw new MojoFailureException( "Error(s) found in manifest configuration" ); + } + } + + Jar jar = analyzer.getJar(); + + if ( unpackBundle ) + { + File outputFile = getOutputDirectory(); + for ( Entry entry : jar.getResources().entrySet() ) + { + File entryFile = new File( outputFile, entry.getKey() ); + if ( !entryFile.exists() || entry.getValue().lastModified() == 0 ) + { + entryFile.getParentFile().mkdirs(); + OutputStream os = buildContext.newFileOutputStream( entryFile ); + entry.getValue().write( os ); + os.close(); + } + } + } return analyzer; } - public static void writeManifest( Manifest manifest, File outputFile, boolean niceManifest ) throws IOException + public static void writeManifest( Analyzer analyzer, File outputFile, boolean niceManifest, + boolean exportScr, File scrLocation, BuildContext buildContext, Log log ) throws Exception + { + Properties properties = analyzer.getProperties(); + Jar jar = analyzer.getJar(); + Manifest manifest = jar.getManifest(); + if ( outputFile.exists() && properties.containsKey( "Merge-Headers" ) ) + { + Manifest analyzerManifest = manifest; + manifest = new Manifest(); + InputStream inputStream = new FileInputStream( outputFile ); + try + { + manifest.read( inputStream ); + } + finally + { + inputStream.close(); + } + Instructions instructions = new Instructions( ExtList.from( analyzer.getProperty("Merge-Headers") ) ); + mergeManifest( instructions, manifest, analyzerManifest ); + } + else + { + File parentFile = outputFile.getParentFile(); + parentFile.mkdirs(); + } + writeManifest( manifest, outputFile, niceManifest, buildContext, log ); + + if (exportScr) + { + exportScr(analyzer, jar, scrLocation, buildContext, log); + } + } + + + public static void writeManifest( Manifest manifest, File outputFile, boolean niceManifest, + BuildContext buildContext, Log log ) throws IOException { + log.debug("Write manifest to " + outputFile.getPath()); outputFile.getParentFile().mkdirs(); - FileOutputStream os; - os = new FileOutputStream( outputFile ); + OutputStream os = buildContext.newFileOutputStream( outputFile ); try { ManifestWriter.outputManifest( manifest, os, niceManifest ); diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/pom/Counter.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/pom/Counter.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/pom/Counter.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/pom/Counter.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,79 @@ +package org.apache.felix.bundleplugin.pom; + +/* + * 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. + */ + +/** + * Separate class for counter. + */ +public class Counter +{ + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field currentIndex + */ + private int currentIndex = 0; + + /** + * Field level + */ + private int level; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public Counter( int depthLevel ) + { + level = depthLevel; + } // -- org.apache.maven.model.io.jdom.Counter(int) + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method getCurrentIndex + */ + public int getCurrentIndex() + { + return currentIndex; + } // -- int getCurrentIndex() + + /** + * Method getDepth + */ + public int getDepth() + { + return level; + } // -- int getDepth() + + /** + * Method increaseCount + */ + public void increaseCount() + { + currentIndex = currentIndex + 1; + } // -- void increaseCount() + +} diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/pom/MavenJDOMWriter.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/pom/MavenJDOMWriter.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/pom/MavenJDOMWriter.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/pom/MavenJDOMWriter.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,2196 @@ +package org.apache.felix.bundleplugin.pom; + +/* + * 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. + */ + +import org.apache.maven.model.ActivationFile; +import org.apache.maven.model.ActivationOS; +import org.apache.maven.model.ActivationProperty; +import org.apache.maven.model.Build; +import org.apache.maven.model.BuildBase; +import org.apache.maven.model.CiManagement; +import org.apache.maven.model.ConfigurationContainer; +import org.apache.maven.model.Contributor; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.Developer; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Exclusion; +import org.apache.maven.model.Extension; +import org.apache.maven.model.FileSet; +import org.apache.maven.model.IssueManagement; +import org.apache.maven.model.License; +import org.apache.maven.model.MailingList; +import org.apache.maven.model.Model; +import org.apache.maven.model.ModelBase; +import org.apache.maven.model.Notifier; +import org.apache.maven.model.Organization; +import org.apache.maven.model.Parent; +import org.apache.maven.model.PatternSet; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginConfiguration; +import org.apache.maven.model.PluginContainer; +import org.apache.maven.model.PluginExecution; +import org.apache.maven.model.PluginManagement; +import org.apache.maven.model.Prerequisites; +import org.apache.maven.model.Profile; +import org.apache.maven.model.Relocation; +import org.apache.maven.model.ReportPlugin; +import org.apache.maven.model.ReportSet; +import org.apache.maven.model.Reporting; +import org.apache.maven.model.Repository; +import org.apache.maven.model.RepositoryBase; +import org.apache.maven.model.RepositoryPolicy; +import org.apache.maven.model.Resource; +import org.apache.maven.model.Scm; +import org.apache.maven.model.Site; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.jdom.Content; +import org.jdom.DefaultJDOMFactory; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.Text; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; + +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * Class MavenJDOMWriter. + * + * @version $Revision: 1682559 $ $Date: 2015-05-29 18:04:04 -0400 (Fri, 29 May 2015) $ + */ +public class MavenJDOMWriter +{ + /** + * Field factory + */ + private DefaultJDOMFactory factory; + + /** + * Field lineSeparator + */ + private String lineSeparator; + + public MavenJDOMWriter() + { + factory = new DefaultJDOMFactory(); + lineSeparator = "\n"; + } // -- org.apache.maven.model.io.jdom.MavenJDOMWriter() + + /** + * Method findAndReplaceProperties + * + * @param counter + * @param props + * @param name + * @param parent + */ + protected Element findAndReplaceProperties( Counter counter, Element parent, String name, Map props ) + { + boolean shouldExist = props != null && !props.isEmpty(); + Element element = updateElement( counter, parent, name, shouldExist ); + if ( shouldExist ) + { + Counter innerCounter = new Counter( counter.getDepth() + 1 ); + // while ( it.hasNext() ) + for ( Map.Entry entry : ( (Map) props ).entrySet() ) + { + String key = entry.getKey(); + findAndReplaceSimpleElement( innerCounter, element, key, entry.getValue(), null ); + } + List lst = new ArrayList( props.keySet() ); + Iterator it = element.getChildren().iterator(); + while ( it.hasNext() ) + { + Element elem = (Element) it.next(); + String key = elem.getName(); + if ( !lst.contains( key ) ) + { + it.remove(); + } + } + } + return element; + } // -- Element findAndReplaceProperties(Counter, Element, String, Map) + + /** + * Method findAndReplaceSimpleElement + * + * @param counter + * @param defaultValue + * @param text + * @param name + * @param parent + */ + protected Element findAndReplaceSimpleElement( Counter counter, Element parent, String name, String text, + String defaultValue ) + { + if ( defaultValue != null && text != null && defaultValue.equals( text ) ) + { + Element element = parent.getChild( name, parent.getNamespace() ); + // if exist and is default value or if doesn't exist.. just keep the way it is.. + if ( ( element != null && defaultValue.equals( element.getText() ) ) || element == null ) + { + return element; + } + } + boolean shouldExist = text != null && text.trim().length() > 0; + Element element = updateElement( counter, parent, name, shouldExist ); + if ( shouldExist ) + { + element.setText( text ); + } + return element; + } // -- Element findAndReplaceSimpleElement(Counter, Element, String, String, String) + + /** + * Method findAndReplaceSimpleLists + * + * @param counter + * @param childName + * @param parentName + * @param list + * @param parent + */ + protected Element findAndReplaceSimpleLists( Counter counter, Element parent, Collection list, + String parentName, String childName ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentName, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childName, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + String value = (String) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childName, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + el.setText( value ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + return element; + } // -- Element findAndReplaceSimpleLists(Counter, Element, java.util.Collection, String, String) + + /** + * Method findAndReplaceXpp3DOM + * + * @param counter + * @param dom + * @param name + * @param parent + */ + protected Element findAndReplaceXpp3DOM( Counter counter, Element parent, String name, Xpp3Dom dom ) + { + boolean shouldExist = dom != null && ( dom.getChildCount() > 0 || dom.getValue() != null ); + Element element = updateElement( counter, parent, name, shouldExist ); + if ( shouldExist ) + { + replaceXpp3DOM( element, dom, new Counter( counter.getDepth() + 1 ) ); + } + return element; + } // -- Element findAndReplaceXpp3DOM(Counter, Element, String, Xpp3Dom) + + /** + * Method insertAtPreferredLocation + * + * @param parent + * @param counter + * @param child + */ + protected void insertAtPreferredLocation( Element parent, Element child, Counter counter ) + { + int contentIndex = 0; + int elementCounter = 0; + Iterator it = parent.getContent().iterator(); + Text lastText = null; + int offset = 0; + while ( it.hasNext() && elementCounter <= counter.getCurrentIndex() ) + { + Object next = it.next(); + offset = offset + 1; + if ( next instanceof Element ) + { + elementCounter = elementCounter + 1; + contentIndex = contentIndex + offset; + offset = 0; + } + if ( next instanceof Text && it.hasNext() ) + { + lastText = (Text) next; + } + } + if ( lastText != null && lastText.getTextTrim().length() == 0 ) + { + lastText = (Text) lastText.clone(); + } + else + { + String starter = lineSeparator; + for ( int i = 0; i < counter.getDepth(); i++ ) + { + starter = starter + " "; // TODO make settable? + } + lastText = factory.text( starter ); + } + if ( parent.getContentSize() == 0 ) + { + Text finalText = (Text) lastText.clone(); + finalText.setText( finalText.getText().substring( 0, finalText.getText().length() - " ".length() ) ); + parent.addContent( contentIndex, finalText ); + } + parent.addContent( contentIndex, child ); + parent.addContent( contentIndex, lastText ); + } // -- void insertAtPreferredLocation(Element, Element, Counter) + + /** + * Method iterateContributor + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateContributor( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Contributor value = (Contributor) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateContributor( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateContributor(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateDependency + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateDependency( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Dependency value = (Dependency) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateDependency( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateDependency(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateDeveloper + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateDeveloper( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Developer value = (Developer) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateDeveloper( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateDeveloper(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateExclusion + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateExclusion( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Exclusion value = (Exclusion) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateExclusion( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateExclusion(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateExtension + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateExtension( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Extension value = (Extension) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateExtension( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateExtension(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateLicense + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateLicense( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + License value = (License) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateLicense( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateMailingList + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateMailingList( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + MailingList value = (MailingList) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateMailingList( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateMailingList(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateNotifier + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateNotifier( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Notifier value = (Notifier) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateNotifier( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateNotifier(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iteratePlugin + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iteratePlugin( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Plugin value = (Plugin) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updatePlugin( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iteratePlugin(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iteratePluginExecution + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iteratePluginExecution( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + PluginExecution value = (PluginExecution) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updatePluginExecution( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iteratePluginExecution(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateProfile + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateProfile( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Profile value = (Profile) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateProfile( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateProfile(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateReportPlugin + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateReportPlugin( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + ReportPlugin value = (ReportPlugin) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateReportPlugin( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateReportPlugin(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateReportSet + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateReportSet( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + ReportSet value = (ReportSet) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateReportSet( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateReportSet(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateRepository + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateRepository( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Repository value = (Repository) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateRepository( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateRepository(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method iterateResource + * + * @param counter + * @param childTag + * @param parentTag + * @param list + * @param parent + */ + protected void iterateResource( Counter counter, Element parent, Collection list, + String parentTag, String childTag ) + { + boolean shouldExist = list != null && list.size() > 0; + Element element = updateElement( counter, parent, parentTag, shouldExist ); + if ( shouldExist ) + { + Iterator it = list.iterator(); + Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + Counter innerCount = new Counter( counter.getDepth() + 1 ); + while ( it.hasNext() ) + { + Resource value = (Resource) it.next(); + Element el; + if ( elIt != null && elIt.hasNext() ) + { + el = (Element) elIt.next(); + if ( !elIt.hasNext() ) + { + elIt = null; + } + } + else + { + el = factory.element( childTag, element.getNamespace() ); + insertAtPreferredLocation( element, el, innerCount ); + } + updateResource( value, childTag, innerCount, el ); + innerCount.increaseCount(); + } + if ( elIt != null ) + { + while ( elIt.hasNext() ) + { + elIt.next(); + elIt.remove(); + } + } + } + } // -- void iterateResource(Counter, Element, java.util.Collection, java.lang.String, java.lang.String) + + /** + * Method replaceXpp3DOM + * + * @param parent + * @param counter + * @param parentDom + */ + protected void replaceXpp3DOM( Element parent, Xpp3Dom parentDom, Counter counter ) + { + if ( parentDom.getChildCount() > 0 ) + { + Xpp3Dom[] childs = parentDom.getChildren(); + Collection domChilds = new ArrayList(); + Collections.addAll( domChilds, childs ); + // int domIndex = 0; + for ( Object o : parent.getChildren() ) + { + Element elem = (Element) o; + Iterator it2 = domChilds.iterator(); + Xpp3Dom corrDom = null; + while ( it2.hasNext() ) + { + Xpp3Dom dm = (Xpp3Dom) it2.next(); + if ( dm.getName().equals( elem.getName() ) ) + { + corrDom = dm; + break; + } + } + if ( corrDom != null ) + { + domChilds.remove( corrDom ); + replaceXpp3DOM( elem, corrDom, new Counter( counter.getDepth() + 1 ) ); + counter.increaseCount(); + } + else + { + parent.removeContent( elem ); + } + } + for ( Object domChild : domChilds ) + { + Xpp3Dom dm = (Xpp3Dom) domChild; + Element elem = factory.element( dm.getName(), parent.getNamespace() ); + insertAtPreferredLocation( parent, elem, counter ); + counter.increaseCount(); + replaceXpp3DOM( elem, dm, new Counter( counter.getDepth() + 1 ) ); + } + } + else if ( parentDom.getValue() != null ) + { + parent.setText( parentDom.getValue() ); + } + } // -- void replaceXpp3DOM(Element, Xpp3Dom, Counter) + + /** + * Method updateActivationFile + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateActivationFile( ActivationFile value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "missing", value.getMissing(), null ); + findAndReplaceSimpleElement( innerCount, root, "exists", value.getExists(), null ); + } + } // -- void updateActivationFile(ActivationFile, String, Counter, Element) + + /** + * Method updateActivationOS + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateActivationOS( ActivationOS value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "family", value.getFamily(), null ); + findAndReplaceSimpleElement( innerCount, root, "arch", value.getArch(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + } + } // -- void updateActivationOS(ActivationOS, String, Counter, Element) + + /** + * Method updateActivationProperty + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateActivationProperty( ActivationProperty value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "value", value.getValue(), null ); + } + } // -- void updateActivationProperty(ActivationProperty, String, Counter, Element) + + /** + * Method updateBuild + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + //CHECKSTYLE_OFF: LineLength + protected void updateBuild( Build value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "sourceDirectory", value.getSourceDirectory(), null ); + findAndReplaceSimpleElement( innerCount, root, "scriptSourceDirectory", value.getScriptSourceDirectory(), + null ); + findAndReplaceSimpleElement( innerCount, root, "testSourceDirectory", value.getTestSourceDirectory(), null ); + findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null ); + findAndReplaceSimpleElement( innerCount, root, "testOutputDirectory", value.getTestOutputDirectory(), null ); + iterateExtension( innerCount, root, value.getExtensions(), "extensions", "extension" ); + findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null ); + iterateResource( innerCount, root, value.getResources(), "resources", "resource" ); + iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" ); + findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); + findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" ); + updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root ); + iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); + } + } // -- void updateBuild(Build, String, Counter, Element) + //CHECKSTYLE_ON: LineLength + + /** + * Method updateBuildBase + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateBuildBase( BuildBase value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null ); + iterateResource( innerCount, root, value.getResources(), "resources", "resource" ); + iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" ); + findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); + findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" ); + updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root ); + iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); + } + } // -- void updateBuildBase(BuildBase, String, Counter, Element) + + /** + * Method updateCiManagement + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateCiManagement( CiManagement value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + iterateNotifier( innerCount, root, value.getNotifiers(), "notifiers", "notifier" ); + } + } // -- void updateCiManagement(CiManagement, String, Counter, Element) + + /** + * Method updateConfigurationContainer + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateConfigurationContainer( ConfigurationContainer value, String xmlTag, Counter counter, + Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); + findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); + } + } // -- void updateConfigurationContainer(ConfigurationContainer, String, Counter, Element) + + /** + * Method updateContributor + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateContributor( Contributor value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null ); + findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" ); + findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null ); + findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); + } // -- void updateContributor(Contributor, String, Counter, Element) + + /** + * Method updateDependency + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateDependency( Dependency value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "jar" ); + findAndReplaceSimpleElement( innerCount, root, "classifier", value.getClassifier(), null ); + findAndReplaceSimpleElement( innerCount, root, "scope", value.getScope(), null ); + findAndReplaceSimpleElement( innerCount, root, "systemPath", value.getSystemPath(), null ); + iterateExclusion( innerCount, root, value.getExclusions(), "exclusions", "exclusion" ); + findAndReplaceSimpleElement( innerCount, root, "optional", + !value.isOptional() ? null : String.valueOf( value.isOptional() ), "false" ); + } // -- void updateDependency(Dependency, String, Counter, Element) + + /** + * Method updateDependencyManagement + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateDependencyManagement( DependencyManagement value, String xmlTag, Counter counter, + Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); + } + } // -- void updateDependencyManagement(DependencyManagement, String, Counter, Element) + + /** + * Method updateDeploymentRepository + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateDeploymentRepository( DeploymentRepository value, String xmlTag, Counter counter, + Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "uniqueVersion", + value.isUniqueVersion() ? null : String.valueOf( value.isUniqueVersion() ), + "true" ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" ); + } + } // -- void updateDeploymentRepository(DeploymentRepository, String, Counter, Element) + + /** + * Method updateDeveloper + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateDeveloper( Developer value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null ); + findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" ); + findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null ); + findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); + } // -- void updateDeveloper(Developer, String, Counter, Element) + + /** + * Method updateDistributionManagement + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateDistributionManagement( DistributionManagement value, String xmlTag, Counter counter, + Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + updateDeploymentRepository( value.getRepository(), "repository", innerCount, root ); + updateDeploymentRepository( value.getSnapshotRepository(), "snapshotRepository", innerCount, root ); + updateSite( value.getSite(), "site", innerCount, root ); + findAndReplaceSimpleElement( innerCount, root, "downloadUrl", value.getDownloadUrl(), null ); + updateRelocation( value.getRelocation(), "relocation", innerCount, root ); + findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null ); + } + } // -- void updateDistributionManagement(DistributionManagement, String, Counter, Element) + + /** + * Method updateElement + * + * @param counter + * @param shouldExist + * @param name + * @param parent + */ + protected Element updateElement( Counter counter, Element parent, String name, boolean shouldExist ) + { + Element element = parent.getChild( name, parent.getNamespace() ); + if ( element != null && shouldExist ) + { + counter.increaseCount(); + } + if ( element == null && shouldExist ) + { + element = factory.element( name, parent.getNamespace() ); + insertAtPreferredLocation( parent, element, counter ); + counter.increaseCount(); + } + if ( !shouldExist && element != null ) + { + int index = parent.indexOf( element ); + if ( index > 0 ) + { + Content previous = parent.getContent( index - 1 ); + if ( previous instanceof Text ) + { + Text txt = (Text) previous; + if ( txt.getTextTrim().length() == 0 ) + { + parent.removeContent( txt ); + } + } + } + parent.removeContent( element ); + } + return element; + } // -- Element updateElement(Counter, Element, String, boolean) + + /** + * Method updateExclusion + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateExclusion( Exclusion value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); + } // -- void updateExclusion(Exclusion, String, Counter, Element) + + /** + * Method updateExtension + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateExtension( Extension value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + } // -- void updateExtension(Extension, String, Counter, Element) + + /** + * Method updateFileSet + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateFileSet( FileSet value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" ); + findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" ); + } + } // -- void updateFileSet(FileSet, String, Counter, Element) + + /** + * Method updateIssueManagement + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateIssueManagement( IssueManagement value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + } + } // -- void updateIssueManagement(IssueManagement, String, Counter, Element) + + /** + * Method updateLicense + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateLicense( License value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + findAndReplaceSimpleElement( innerCount, root, "distribution", value.getDistribution(), null ); + findAndReplaceSimpleElement( innerCount, root, "comments", value.getComments(), null ); + } // -- void updateLicense(License, String, Counter, Element) + + /** + * Method updateMailingList + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateMailingList( MailingList value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "subscribe", value.getSubscribe(), null ); + findAndReplaceSimpleElement( innerCount, root, "unsubscribe", value.getUnsubscribe(), null ); + findAndReplaceSimpleElement( innerCount, root, "post", value.getPost(), null ); + findAndReplaceSimpleElement( innerCount, root, "archive", value.getArchive(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getOtherArchives(), "otherArchives", "otherArchive" ); + } // -- void updateMailingList(MailingList, String, Counter, Element) + + /** + * Method updateModel + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateModel( Model value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + updateParent( value.getParent(), "parent", innerCount, root ); + findAndReplaceSimpleElement( innerCount, root, "modelVersion", value.getModelVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "packaging", value.getPackaging(), "jar" ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "description", value.getDescription(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + updatePrerequisites( value.getPrerequisites(), "prerequisites", innerCount, root ); + updateIssueManagement( value.getIssueManagement(), "issueManagement", innerCount, root ); + updateCiManagement( value.getCiManagement(), "ciManagement", innerCount, root ); + findAndReplaceSimpleElement( innerCount, root, "inceptionYear", value.getInceptionYear(), null ); + iterateMailingList( innerCount, root, value.getMailingLists(), "mailingLists", "mailingList" ); + iterateDeveloper( innerCount, root, value.getDevelopers(), "developers", "developer" ); + iterateContributor( innerCount, root, value.getContributors(), "contributors", "contributor" ); + iterateLicense( innerCount, root, value.getLicenses(), "licenses", "license" ); + updateScm( value.getScm(), "scm", innerCount, root ); + updateOrganization( value.getOrganization(), "organization", innerCount, root ); + updateBuild( value.getBuild(), "build", innerCount, root ); + iterateProfile( innerCount, root, value.getProfiles(), "profiles", "profile" ); + findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" ); + iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" ); + iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" ); + iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); + findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() ); + updateReporting( value.getReporting(), "reporting", innerCount, root ); + updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root ); + updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root ); + findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); + } // -- void updateModel(Model, String, Counter, Element) + + /** + * Method updateModelBase + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + //CHECKSTYLE_OFF: LineLength + protected void updateModelBase( ModelBase value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" ); + iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" ); + iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", + "pluginRepository" ); + iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); + findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() ); + updateReporting( value.getReporting(), "reporting", innerCount, root ); + updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root ); + updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root ); + findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); + } + } // -- void updateModelBase(ModelBase, String, Counter, Element) + //CHECKSTYLE_ON: LineLength + + /** + * Method updateNotifier + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + //CHECKSTYLE_OFF: LineLength + protected void updateNotifier( Notifier value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "mail" ); + findAndReplaceSimpleElement( innerCount, root, "sendOnError", + value.isSendOnError() ? null : String.valueOf( value.isSendOnError() ), "true" ); + findAndReplaceSimpleElement( innerCount, root, "sendOnFailure", + value.isSendOnFailure() ? null : String.valueOf( value.isSendOnFailure() ), "true" ); + findAndReplaceSimpleElement( innerCount, root, "sendOnSuccess", + value.isSendOnSuccess() ? null : String.valueOf( value.isSendOnSuccess() ), "true" ); + findAndReplaceSimpleElement( innerCount, root, "sendOnWarning", + value.isSendOnWarning() ? null : String.valueOf( value.isSendOnWarning() ), "true" ); + findAndReplaceSimpleElement( innerCount, root, "address", value.getAddress(), null ); + findAndReplaceProperties( innerCount, root, "configuration", value.getConfiguration() ); + } // -- void updateNotifier(Notifier, String, Counter, Element) + //CHECKSTYLE_ON: LineLength + + /** + * Method updateOrganization + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateOrganization( Organization value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + } + } // -- void updateOrganization(Organization, String, Counter, Element) + + /** + * Method updateParent + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateParent( Parent value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "relativePath", value.getRelativePath(), "../pom.xml" ); + } + } // -- void updateParent(Parent, String, Counter, Element) + + /** + * Method updatePatternSet + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updatePatternSet( PatternSet value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" ); + findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" ); + } + } // -- void updatePatternSet(PatternSet, String, Counter, Element) + + /** + * Method updatePlugin + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updatePlugin( Plugin value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "extensions", + !value.isExtensions() ? null : String.valueOf( value.isExtensions() ), "false" ); + iteratePluginExecution( innerCount, root, value.getExecutions(), "executions", "execution" ); + iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); + findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() ); + findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); + findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); + } // -- void updatePlugin(Plugin, String, Counter, Element) + + /** + * Method updatePluginConfiguration + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + //CHECKSTYLE_OFF: LineLength + protected void updatePluginConfiguration( PluginConfiguration value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root ); + iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); + } + } // -- void updatePluginConfiguration(PluginConfiguration, String, Counter, Element) + //CHECKSTYLE_ON: LineLength + + /** + * Method updatePluginContainer + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updatePluginContainer( PluginContainer value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); + } + } // -- void updatePluginContainer(PluginContainer, String, Counter, Element) + + /** + * Method updatePluginExecution + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updatePluginExecution( PluginExecution value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); + findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" ); + findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); + findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); + } // -- void updatePluginExecution(PluginExecution, String, Counter, Element) + + /** + * Method updatePluginManagement + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updatePluginManagement( PluginManagement value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); + } + } // -- void updatePluginManagement(PluginManagement, String, Counter, Element) + + /** + * Method updatePrerequisites + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updatePrerequisites( Prerequisites value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "maven", value.getMaven(), "2.0" ); + } + } // -- void updatePrerequisites(Prerequisites, String, Counter, Element) + + /** + * Method updateProfile + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); + // updateActivation( value.getActivation(), "activation", innerCount, root); + updateBuildBase( value.getBuild(), "build", innerCount, root ); + findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" ); + iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" ); + iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" ); + iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); + findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() ); + updateReporting( value.getReporting(), "reporting", innerCount, root ); + updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root ); + updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root ); + findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); + } // -- void updateProfile(Profile, String, Counter, Element) + + /** + * Method updateRelocation + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateRelocation( Relocation value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "message", value.getMessage(), null ); + } + } // -- void updateRelocation(Relocation, String, Counter, Element) + + /** + * Method updateReportPlugin + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateReportPlugin( ReportPlugin value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" ); + findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); + findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); + findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); + findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); + iterateReportSet( innerCount, root, value.getReportSets(), "reportSets", "reportSet" ); + } // -- void updateReportPlugin(ReportPlugin, String, Counter, Element) + + /** + * Method updateReportSet + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateReportSet( ReportSet value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); + findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); + findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getReports(), "reports", "report" ); + } // -- void updateReportSet(ReportSet, String, Counter, Element) + + /** + * Method updateReporting + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateReporting( Reporting value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "excludeDefaults", !value.isExcludeDefaults() ? null + : String.valueOf( value.isExcludeDefaults() ), "false" ); + findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null ); + iterateReportPlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); + } + } // -- void updateReporting(Reporting, String, Counter, Element) + + /** + * Method updateRepository + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateRepository( Repository value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root ); + updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" ); + } // -- void updateRepository(Repository, String, Counter, Element) + + /** + * Method updateRepositoryBase + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateRepositoryBase( RepositoryBase value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" ); + } + } // -- void updateRepositoryBase(RepositoryBase, String, Counter, Element) + + /** + * Method updateRepositoryPolicy + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateRepositoryPolicy( RepositoryPolicy value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "enabled", + value.isEnabled() ? null : String.valueOf( value.isEnabled() ), "true" ); + findAndReplaceSimpleElement( innerCount, root, "updatePolicy", value.getUpdatePolicy(), null ); + findAndReplaceSimpleElement( innerCount, root, "checksumPolicy", value.getChecksumPolicy(), null ); + } + } // -- void updateRepositoryPolicy(RepositoryPolicy, String, Counter, Element) + + /** + * Method updateResource + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateResource( Resource value, String xmlTag, Counter counter, Element element ) + { + Element root = element; + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "targetPath", value.getTargetPath(), null ); + findAndReplaceSimpleElement( innerCount, root, "filtering", + !value.isFiltering() ? null : String.valueOf( value.isFiltering() ), "false" ); + findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); + findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" ); + findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" ); + } // -- void updateResource(Resource, String, Counter, Element) + + /** + * Method updateScm + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateScm( Scm value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + //CHECKSTYLE_OFF: LineLength + + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "connection", value.getConnection(), null ); + findAndReplaceSimpleElement( innerCount, root, "developerConnection", value.getDeveloperConnection(), null ); + findAndReplaceSimpleElement( innerCount, root, "tag", value.getTag(), "HEAD" ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + + //CHECKSTYLE_ON: LineLength + } + } // -- void updateScm(Scm, String, Counter, Element) + + /** + * Method updateSite + * + * @param value + * @param element + * @param counter + * @param xmlTag + */ + protected void updateSite( Site value, String xmlTag, Counter counter, Element element ) + { + boolean shouldExist = value != null; + Element root = updateElement( counter, element, xmlTag, shouldExist ); + if ( shouldExist ) + { + Counter innerCount = new Counter( counter.getDepth() + 1 ); + findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); + findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); + findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); + } + } // -- void updateSite(Site, String, Counter, Element) + + /** + * Method write + * + * @param project + * @param stream + * @param document + * @deprecated + */ + public void write( Model project, Document document, OutputStream stream ) + throws java.io.IOException + { + updateModel( project, "project", new Counter( 0 ), document.getRootElement() ); + XMLOutputter outputter = new XMLOutputter(); + Format format = Format.getPrettyFormat(); + format.setIndent( " " ).setLineSeparator( System.getProperty( "line.separator" ) ); + outputter.setFormat( format ); + outputter.output( document, stream ); + } // -- void write(Model, Document, OutputStream) + + /** + * Method write + * + * @param project + * @param writer + * @param document + */ + public void write( Model project, Document document, OutputStreamWriter writer ) + throws java.io.IOException + { + Format format = Format.getRawFormat(); + format.setEncoding( writer.getEncoding() ).setLineSeparator( System.getProperty( "line.separator" ) ); + write( project, document, writer, format ); + } // -- void write(Model, Document, OutputStreamWriter) + + /** + * Method write + * + * @param project + * @param jdomFormat + * @param writer + * @param document + */ + public void write( Model project, Document document, Writer writer, Format jdomFormat ) + throws java.io.IOException + { + updateModel( project, "project", new Counter( 0 ), document.getRootElement() ); + XMLOutputter outputter = new XMLOutputter(); + outputter.setFormat( jdomFormat ); + outputter.output( document, writer ); + } // -- void write(Model, Document, Writer, Format) + +} diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/pom/PomWriter.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/pom/PomWriter.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/pom/PomWriter.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/pom/PomWriter.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,77 @@ +package org.apache.felix.bundleplugin.pom; + +/* + * 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. + */ + +import org.apache.maven.model.Model; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.Namespace; +import org.jdom.output.Format; + +import java.io.IOException; +import java.io.Writer; + +/** + * @author Jason van Zyl + */ +public class PomWriter +{ + public static void write( Writer w, Model newModel ) + throws IOException + { + write( w, newModel, false ); + } + + public static void write( Writer w, Model newModel, boolean namespaceDeclaration ) + throws IOException + { + Element root = new Element( "project" ); + + if ( namespaceDeclaration ) + { + String modelVersion = newModel.getModelVersion(); + + Namespace pomNamespace = Namespace.getNamespace( "", "http://maven.apache.org/POM/" + modelVersion ); + + root.setNamespace( pomNamespace ); + + Namespace xsiNamespace = Namespace.getNamespace( "xsi", "http://www.w3.org/2001/XMLSchema-instance" ); + + root.addNamespaceDeclaration( xsiNamespace ); + + if ( root.getAttribute( "schemaLocation", xsiNamespace ) == null ) + { + root.setAttribute( "schemaLocation", + "http://maven.apache.org/POM/" + modelVersion + " http://maven.apache.org/maven-v" + + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace ); + } + } + + Document doc = new Document( root ); + + MavenJDOMWriter writer = new MavenJDOMWriter(); + + String encoding = newModel.getModelEncoding() != null ? newModel.getModelEncoding() : "UTF-8"; + + Format format = Format.getPrettyFormat().setEncoding( encoding ); + + writer.write( newModel, doc, w, format ); + } +} diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/RelativizePath.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/RelativizePath.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/RelativizePath.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/RelativizePath.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,111 @@ +package org.apache.felix.bundleplugin; + +/* + * 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. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * + */ +public final class RelativizePath +{ + private RelativizePath() + { + // + } + + /** + * relativize a pathname. + * @param thing Absolute File of something. (e.g., a parent pom) + * @param relativeTo base to relativize it do. (e.g., a pom into which a relative pathname to the 'thing' is to be + * installed). + * @return + */ + static String convertToRelativePath( File thing, File relativeTo ) + { + StringBuilder relativePath; + + if ( thing.getParentFile().equals( relativeTo.getParentFile() ) ) + { + return thing.getName(); // a very simple relative path. + } + + List thingDirectories = RelativizePath.parentDirs( thing ); + List relativeToDirectories = RelativizePath.parentDirs( relativeTo ); + + //Get the shortest of the two paths + int length = + thingDirectories.size() < relativeToDirectories.size() ? thingDirectories.size() + : relativeToDirectories.size(); + + int lastCommonRoot = -1; // index of the lowest directory down from the root that the two have in common. + int index; + + //Find common root + for ( index = 0; index < length; index++ ) + { + if ( thingDirectories.get( index ).equals( relativeToDirectories.get( index ) ) ) + { + lastCommonRoot = index; + } + else + { + break; + } + } + if ( lastCommonRoot != -1 ) + { // possible on Windows or other multi-root cases. + // Build up the relative path + relativePath = new StringBuilder(); + // add ..'s to get from the base up to the common point + for ( index = lastCommonRoot + 1; index < relativeToDirectories.size(); index++ ) + { + relativePath.append( "../" ); + } + + // now add down from the common point to the actual 'thing' item. + for ( index = lastCommonRoot + 1; index < thingDirectories.size(); index++ ) + { + relativePath.append( thingDirectories.get( index ) ).append( '/' ); + } + relativePath.append( thing.getName() ); + return relativePath.toString(); + } + return null; + } + + static List parentDirs( File of ) + { + List results = new ArrayList(); + for ( File p = of.getParentFile() ; p != null ; p = p.getParentFile() ) + { + if ( !"".equals( p.getName() ) ) + { + results.add( p.getName() ); + } + } + + Collections.reverse( results ); + return results; + } +} diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/ScrPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/ScrPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/ScrPlugin.java 2015-03-04 13:26:21.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/ScrPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -41,7 +41,11 @@ import aQute.bnd.service.AnalyzerPlugin; import aQute.libg.generics.Create; - +/** + * Create capabilities for DS components + * @deprecated bnd generates these as well. + */ +@Deprecated public class ScrPlugin implements AnalyzerPlugin { diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/VerifyBundlePlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/VerifyBundlePlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/VerifyBundlePlugin.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/VerifyBundlePlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,186 @@ +/* + * 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. + */ +package org.apache.felix.bundleplugin; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Formatter; +import java.util.Set; +import java.util.TreeSet; +import java.util.jar.Attributes; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.Manifest; +import java.util.regex.Pattern; + +import org.apache.felix.utils.manifest.Clause; +import org.apache.felix.utils.manifest.Parser; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + +/** + * Verifies OSGi bundle metadata contains valid entries. + * + * Supported checks in the current version: + *
    + *
  • All packages declared in the Export-Package header are really included in the bundle.
  • + *
+ */ +@Mojo( + name = "verify", + threadSafe = true, + defaultPhase = LifecyclePhase.VERIFY +) +public final class VerifyBundlePlugin + extends AbstractMojo +{ + + private static final String EXPORT_PACKAGE = "Export-Package"; + + private Pattern skipDirs = Pattern.compile( "(META|OSGI)-INF(.*)" ); + + @Component + private MavenProject project; + + /** + * Flag to easily skip execution. + */ + @Parameter( property = "skip", defaultValue = "false" ) + protected boolean skip; + + /** + * Whether to fail on errors. + */ + @Parameter( property = "failOnError", defaultValue = "true" ) + protected boolean failOnError; + + @Override + public void execute() + throws MojoExecutionException, MojoFailureException + { + if ( skip ) + { + getLog().info( "Skipping Verify execution" ); + return; + } + + Set packagesNotFound = checkPackages(); + + if ( !packagesNotFound.isEmpty() ) + { + Formatter formatter = new Formatter(); + formatter.format( "Current bundle %s exports packages that do not exist:%n", + project.getArtifact().getFile() ); + for ( String packageNotFound : packagesNotFound ) + { + formatter.format( " * %s%n", packageNotFound ); + } + formatter.format( "Please review the instruction in the `configuration/instructions` element of the `maven-bundle-plugin`%n" ); + formatter.format( "For more details, see http://bnd.bndtools.org/heads/export_package.html" ); + String message = formatter.toString(); + formatter.close(); + + if ( failOnError ) + { + throw new MojoFailureException( message ); + } + else + { + getLog().warn( message ); + } + } + } + + private Set checkPackages() + throws MojoExecutionException + { + Set packagesNotFound = new TreeSet(); + + File bundle = project.getArtifact().getFile(); + JarInputStream input = null; + + try + { + input = new JarInputStream( new FileInputStream( bundle ) ); + Manifest manifest = input.getManifest(); + Attributes mainAttributes = manifest.getMainAttributes(); + String exportPackage = mainAttributes.getValue( EXPORT_PACKAGE ); + + if ( exportPackage == null || exportPackage.isEmpty() ) + { + getLog().warn( "Bundle manifest file does not contain valid 'Export-Package' OSGi entry, it will be ignored" ); + return packagesNotFound; + } + + // use a technique similar to the Sieve of Eratosthenes: + // create a set with all exported packages + Clause[] clauses = Parser.parseHeader( exportPackage ); + for ( Clause clause : clauses ) + { + packagesNotFound.add( clause.getName() ); + } + + // then, for each package found in the bundle, drop it from the set + JarEntry jarEntry = null; + while ( ( jarEntry = input.getNextJarEntry() ) != null ) + { + String entryName = jarEntry.getName(); + if ( jarEntry.isDirectory() && !skipDirs.matcher( entryName ).matches() ) + { + if ( File.separatorChar == entryName.charAt( entryName.length() - 1 ) ) + { + entryName = entryName.substring( 0, entryName.length() - 1 ); + } + + String currentPackage = entryName.replace( File.separatorChar, '.' ); + packagesNotFound.remove( currentPackage ); + } + } + + // if there is a package not found in the set, it is a misconfigured package + return packagesNotFound; + } + catch ( IOException ioe ) + { + throw new MojoExecutionException( "An error occurred while reading manifest file " + bundle, ioe ); + } + finally + { + if ( input != null ) + { + try + { + input.close(); + } + catch ( IOException e ) + { + // close it quietly + } + } + } + } + +} diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java 2018-01-03 12:49:20.000000000 +0000 @@ -20,7 +20,6 @@ import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; @@ -31,10 +30,11 @@ * @deprecated The wrap goal is no longer supported and may be removed in a future release */ @Deprecated -@Mojo( name = "wrap", requiresDependencyResolution = ResolutionScope.TEST ) -@Execute( phase = LifecyclePhase.PACKAGE ) +@Mojo( name = "wrap", requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.PACKAGE) public final class WrapPlugin extends BundleAllPlugin { + @Override public void execute() throws MojoExecutionException { getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ); diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java 2018-01-03 12:49:20.000000000 +0000 @@ -1,4 +1,4 @@ -/* +/* * 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 @@ -43,7 +43,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -57,11 +56,10 @@ /** * Clean an OBR repository by finding and removing missing resources. - * + * * @author Felix Project Team */ -@Mojo( name = "clean", requiresProject = false ) -@Execute( phase = LifecyclePhase.CLEAN ) +@Mojo( name = "clean", requiresProject = false, defaultPhase = LifecyclePhase.CLEAN ) public class ObrCleanRepo extends AbstractMojo { /** @@ -128,7 +126,7 @@ /** * Analyze the given XML tree (DOM of the repository file) and remove missing resources. - * + * * @param elem : the input XML tree * @return the cleaned XML tree */ @@ -187,7 +185,7 @@ /** * Initialize the document builder from Xerces. - * + * * @return DocumentBuilder ready to create new document * @throws MojoExecutionException : occurs when the instantiation of the document builder fails */ @@ -210,7 +208,7 @@ /** * Open an XML file. - * + * * @param file : XML file path * @param constructor DocumentBuilder get from xerces * @return Document which describes this file @@ -246,7 +244,7 @@ /** * write a Node in a xml file. - * + * * @param outputFilename URI to the output file * @param treeToBeWrite Node root of the tree to be write in file * @throws MojoExecutionException if the plugin failed diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java 2018-01-03 12:49:20.000000000 +0000 @@ -29,7 +29,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -39,11 +38,10 @@ /** * Deploys bundle details to a remote OBR repository (command-line goal) - * + * * @author Felix Project Team */ -@Mojo( name = "deploy-file", requiresProject = false ) -@Execute( phase = LifecyclePhase.DEPLOY ) +@Mojo( name = "deploy-file", requiresProject = false, defaultPhase = LifecyclePhase.DEPLOY ) public final class ObrDeployFile extends AbstractFileMojo { /** diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java 2018-01-03 12:49:20.000000000 +0000 @@ -35,7 +35,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -45,11 +44,10 @@ /** * Deploys bundle details to a remote OBR repository (life-cycle goal) - * + * * @author Felix Project Team */ -@Mojo( name = "deploy", threadSafe = true ) -@Execute( phase = LifecyclePhase.DEPLOY ) +@Mojo( name = "deploy", threadSafe = true, defaultPhase = LifecyclePhase.DEPLOY ) public final class ObrDeploy extends AbstractMojo { /** diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java 2018-01-03 12:49:20.000000000 +0000 @@ -26,7 +26,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -35,11 +34,10 @@ /** * Installs bundle details in the local OBR repository (command-line goal) - * + * * @author Felix Project Team */ -@Mojo( name = "install-file", requiresProject = false ) -@Execute( phase = LifecyclePhase.INSTALL ) +@Mojo( name = "install-file", requiresProject = false, defaultPhase = LifecyclePhase.INSTALL ) public final class ObrInstallFile extends AbstractFileMojo { /** diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrInstall.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrInstall.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrInstall.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrInstall.java 2018-01-03 12:49:20.000000000 +0000 @@ -29,7 +29,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -38,11 +37,10 @@ /** * Installs bundle details in the local OBR repository (life-cycle goal) - * + * * @author Felix Project Team */ -@Mojo( name = "install", threadSafe = true ) -@Execute( phase = LifecyclePhase.INSTALL ) +@Mojo( name = "install", threadSafe = true, defaultPhase = LifecyclePhase.INSTALL ) public final class ObrInstall extends AbstractMojo { /** diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java 2015-03-09 13:57:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java 2018-01-03 12:49:20.000000000 +0000 @@ -54,7 +54,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -70,11 +69,10 @@ /** * Clean a remote repository file. * It just looks for every resources and check that pointed file exists. - * + * * @author Felix Project Team */ -@Mojo( name = "remote-clean", requiresProject = false ) -@Execute( phase = LifecyclePhase.CLEAN ) +@Mojo( name = "remote-clean", requiresProject = false, defaultPhase = LifecyclePhase.CLEAN ) public final class ObrRemoteClean extends AbstractMojo { /** @@ -357,7 +355,7 @@ /** * Initialize the document builder from Xerces. - * + * * @return DocumentBuilder ready to create new document * @throws MojoExecutionException : occurs when the instantiation of the document builder fails */ @@ -380,7 +378,7 @@ /** * Open an XML file. - * + * * @param file : XML file * @param constructor DocumentBuilder get from xerces * @return Document which describes this file @@ -416,7 +414,7 @@ /** * write a Node in a xml file. - * + * * @param outputFilename URI to the output file * @param treeToBeWrite Node root of the tree to be write in file * @throws MojoExecutionException if the plugin failed diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.java 2012-02-11 14:47:23.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/maven/shared/dependency/tree/DependencyTreeResolutionListener.java 2018-01-03 12:49:20.000000000 +0000 @@ -32,7 +32,6 @@ import org.apache.maven.artifact.resolver.ResolutionListener; import org.apache.maven.artifact.resolver.ResolutionListenerForDepMgmt; import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor; import org.codehaus.plexus.logging.Logger; @@ -386,7 +385,7 @@ * Gets a list of all dependency nodes in the computed dependency tree. * * @return a list of dependency nodes - * @deprecated As of 1.1, use a {@link CollectingDependencyNodeVisitor} on the root dependency node + * @deprecated As of 1.1, use a CollectingDependencyNodeVisitor on the root dependency node */ public Collection getNodes() { diff -Nru maven-bundle-plugin-2.5.4/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java maven-bundle-plugin-3.5.0/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java --- maven-bundle-plugin-2.5.4/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java 2012-07-16 13:43:38.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java 2018-01-03 12:49:20.000000000 +0000 @@ -39,8 +39,6 @@ /** * Default implementation of {@link Maven2OsgiConverter} * - * @plexus.component - * * @author Carlos Sanchez * @version $Id: DefaultMaven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $ */ @@ -62,24 +60,23 @@ *
  • if artifact.getFile is not null and the jar contains a OSGi Manifest with * Bundle-SymbolicName property then that value is returned
  • *
  • if groupId has only one section (no dots) and artifact.getFile is not null then the - * first package name with classes is returned. eg. commons-logging:commons-logging -> + * first package name with classes is returned. eg. commons-logging:commons-logging -> * org.apache.commons.logging
  • *
  • if artifactId is equal to last section of groupId then groupId is returned. eg. - * org.apache.maven:maven -> org.apache.maven
  • + * org.apache.maven:maven -> org.apache.maven *
  • if artifactId starts with last section of groupId that portion is removed. eg. - * org.apache.maven:maven-core -> org.apache.maven.core
  • + * org.apache.maven:maven-core -> org.apache.maven.core *
  • if artifactId starts with groupId then the artifactId is removed. eg. - * org.apache:org.apache.maven.core -> org.apache.maven.core
  • + * org.apache:org.apache.maven.core -> org.apache.maven.core * */ public String getBundleSymbolicName( Artifact artifact ) { if ( ( artifact.getFile() != null ) && artifact.getFile().isFile() ) { - Analyzer analyzer = new Analyzer(); JarFile jar = null; - try + try (Analyzer analyzer = new Analyzer()) { jar = new JarFile( artifact.getFile(), false ); diff -Nru maven-bundle-plugin-2.5.4/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml maven-bundle-plugin-3.5.0/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml --- maven-bundle-plugin-2.5.4/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,40 @@ + + + + + + + + + manifest + + + + + false + true + + + + + + + + diff -Nru maven-bundle-plugin-2.5.4/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl maven-bundle-plugin-3.5.0/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl --- maven-bundle-plugin-2.5.4/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl 2014-06-17 07:55:31.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl 2018-01-03 12:49:20.000000000 +0000 @@ -104,6 +104,13 @@ + + + + + + + diff -Nru maven-bundle-plugin-2.5.4/src/main/resources/org/apache/felix/bundleplugin/jpa.xsl maven-bundle-plugin-3.5.0/src/main/resources/org/apache/felix/bundleplugin/jpa.xsl --- maven-bundle-plugin-2.5.4/src/main/resources/org/apache/felix/bundleplugin/jpa.xsl 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/main/resources/org/apache/felix/bundleplugin/jpa.xsl 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Require-Capability: osgi.extender;osgi.extender=aries.jpa + + + + + + + + + + + + + + Import-Package: org.hibernate.proxy;javassist.util.proxy;resolution:=optional + DynamicImport-Package: org.hibernate.proxy;javassist.util.proxy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru maven-bundle-plugin-2.5.4/src/site/apt/index.apt maven-bundle-plugin-3.5.0/src/site/apt/index.apt --- maven-bundle-plugin-2.5.4/src/site/apt/index.apt 2011-06-29 00:29:36.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/site/apt/index.apt 2018-01-03 12:49:20.000000000 +0000 @@ -28,7 +28,7 @@ Maven Bundle Plugin - This Maven 2 plugin is based on the {{{http://www.aqute.biz/Bnd/Bnd/}BND}} tool from Peter Kriens. The way BND works is by treating your project as a big collection of classes (e.g., project code, dependencies, and the class path). The way you create a bundle with BND is to tell it the content of the bundle's JAR file as a subset of the available classes. This plugin wraps BND to make it work specifically with the Maven 2 project structure and to provide it with reasonable default behavior for Maven 2 projects. + This Maven plugin is based on the {{{http://bnd.bndtools.org/}BND}} tool from Peter Kriens. The way BND works is by treating your project as a big collection of classes (e.g., project code, dependencies, and the class path). The way you create a bundle with BND is to tell it the content of the bundle's JAR file as a subset of the available classes. This plugin wraps BND to make it work specifically with the Maven project structure and to provide it with reasonable default behavior for Maven projects. * Goals Overview @@ -58,20 +58,23 @@ * {{{./ant-mojo.html}bundle:ant}} Generate Ant script to create the bundle. (you should run ant:ant first) - [] + * {{{./verify-mojo.html}bundle:verify}} Verifies OSGi bundle metadata contains valid entries. + + * {{{./baseline-mojo.html}bundle:baseline}} BND Baseline check between two bundles. + + * {{{./baseline-report-mojo.html}bundle:baseline-report}} BND Baseline report. * Usage - General instructions on how to use the Maven Bundle Plugin can be found on the - {{{http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html}wiki page}}. - Some more specific use cases are described in the examples given below. + General instructions on how to use the Maven Bundle Plugin can be found here: + {{{http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html}Apache Felix Maven Bundle Plugin (BND)}}. In case you still have questions regarding the plugin's usage, please have a look at the - {{{http://felix.apache.org/site/apache-felix-bundle-plugin-faq.html}FAQ}} and feel - free to contact the {{{http://felix.apache.org/site/mailinglists.html}user mailing list}}. + {{{http://felix.apache.org/documentation/faqs/apache-felix-bundle-plugin-faq.html}FAQ}} and feel + free to contact the {{{http://felix.apache.org/mailinglists.html}user mailing list}}. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching - the {{{http://www.mail-archive.com/users@felix.apache.org/}mail archive}}. + the {{{https://lists.apache.org/list.html?users@felix.apache.org}mail archive}}. If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our {{{./issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your @@ -79,12 +82,4 @@ entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our {{{./source-repository.html}source repository}} and will find supplementary information in the - {{{http://felix.apache.org/site/development.html}Apache Felix developers guide}}. - -* Examples - - To provide you with better understanding on some usages of the Maven Bundle Plugin, - you can take a look into the following examples: - - * Examples coming soon! - + {{{http://felix.apache.org/documentation/development.html}Apache Felix developers guide}}. diff -Nru maven-bundle-plugin-2.5.4/src/site/site.xml maven-bundle-plugin-3.5.0/src/site/site.xml --- maven-bundle-plugin-2.5.4/src/site/site.xml 2011-06-29 00:29:36.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/site/site.xml 2018-01-03 12:49:20.000000000 +0000 @@ -20,12 +20,17 @@ --> + + org.apache.maven.skins + maven-fluido-skin + 1.3.1 + - - + + diff -Nru maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java --- maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java 2011-10-26 18:50:20.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java 2018-01-03 12:49:20.000000000 +0000 @@ -22,26 +22,50 @@ import java.io.File; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DefaultArtifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.handler.DefaultArtifactHandler; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.DefaultArtifactRepository; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout; +import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.ArtifactStub; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.codehaus.plexus.PlexusTestCase; +import org.apache.maven.project.DefaultProjectBuilderConfiguration; +import org.apache.maven.project.ProjectBuilderConfiguration; /** * Common methods for bundle plugin testing * * @author Carlos Sanchez - * @version $Id: AbstractBundlePluginTest.java 1189376 2011-10-26 18:50:20Z mcculls $ + * @version $Id$ */ -public abstract class AbstractBundlePluginTest extends PlexusTestCase +public abstract class AbstractBundlePluginTest extends AbstractMojoTestCase { protected MavenProjectStub getMavenProjectStub() { MavenProjectStub project = new MavenProjectStub(); - project.setGroupId( "group" ); - project.setArtifactId( "project" ); + project.setGroupId("group"); + project.setArtifactId("project"); project.setVersion( "1.2.3.4" ); + + VersionRange versionRange = VersionRange.createFromVersion( project.getVersion() ); + ArtifactHandler artifactHandler = new DefaultArtifactHandler("pom"); + Artifact artifact = + new DefaultArtifact( project.getGroupId(), project.getArtifactId(), + versionRange, null, "pom", null, artifactHandler ); + artifact.setResolved( true ); + project.setArtifact( artifact ); + ProjectBuilderConfiguration projectBuilderConfiguration = new DefaultProjectBuilderConfiguration(); + ArtifactRepositoryLayout layout = new LegacyRepositoryLayout(); + ArtifactRepository artifactRepository = new DefaultArtifactRepository( "scratch", new File( getBasedir(), "target" + File.separatorChar + "scratch" ).toURI().toString(), layout ); + projectBuilderConfiguration.setLocalRepository( artifactRepository ); + project.setProjectBuilderConfiguration( projectBuilderConfiguration ); return project; } diff -Nru maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java --- maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java 2014-06-17 07:55:31.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java 2018-01-03 12:49:20.000000000 +0000 @@ -28,22 +28,30 @@ import java.util.Properties; import java.util.jar.Manifest; -import aQute.bnd.osgi.Analyzer; -import aQute.bnd.osgi.Jar; -import aQute.bnd.osgi.Verifier; -import aQute.libg.generics.Create; -import junit.framework.TestCase; - import org.apache.felix.utils.manifest.Clause; import org.apache.felix.utils.manifest.Parser; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DefaultArtifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.handler.DefaultArtifactHandler; +import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.model.Resource; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.DefaultProjectBuilderConfiguration; +import org.apache.maven.project.ProjectBuilderConfiguration; +import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; +import org.apache.maven.shared.dependency.graph.DependencyNode; import org.osgi.framework.Constants; +import aQute.bnd.osgi.Analyzer; import aQute.bnd.osgi.Builder; +import aQute.bnd.osgi.Jar; +import aQute.bnd.osgi.Verifier; +import aQute.libg.generics.Create; -public class BlueprintComponentTest extends TestCase +public class BlueprintComponentTest extends AbstractMojoTestCase { public void testBlueprintServices() throws Exception @@ -83,18 +91,28 @@ return new File( "target/tmp/basedir" ); } }; - project.setGroupId( "group" ); + project.setGroupId("group"); project.setArtifactId( "artifact" ); project.setVersion( "1.1.0.0" ); + VersionRange versionRange = VersionRange.createFromVersion(project.getVersion()); + ArtifactHandler artifactHandler = new DefaultArtifactHandler( "jar" ); + Artifact artifact = new DefaultArtifact(project.getGroupId(),project.getArtifactId(),versionRange, null, "jar", null, artifactHandler); + project.setArtifact(artifact); + + ProjectBuilderConfiguration projectBuilderConfiguration = new DefaultProjectBuilderConfiguration(); + projectBuilderConfiguration.setLocalRepository(null); + project.setProjectBuilderConfiguration(projectBuilderConfiguration); + Resource r = new Resource(); r.setDirectory( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() ); - r.setIncludes( Arrays.asList( "**/*.*" ) ); - project.addResource( r ); - project.addCompileSourceRoot( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() ); + r.setIncludes(Arrays.asList("**/*.*")); + project.addResource(r); + project.addCompileSourceRoot(new File("src/test/resources").getAbsoluteFile().getCanonicalPath()); ManifestPlugin plugin = new ManifestPlugin(); plugin.setBuildDirectory( "target/tmp/basedir/target" ); - plugin.setOutputDirectory( new File( "target/tmp/basedir/target/classes" ) ); + plugin.setOutputDirectory(new File("target/tmp/basedir/target/classes")); + setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default")); Map instructions = new HashMap(); instructions.put( "service_mode", mode ); @@ -107,12 +125,21 @@ instructions.put( "Import-Service", "org.osgi.service.cm.ConfigurationAdmin;availability:=optional" ); Properties props = new Properties(); - Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) ); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) ); Manifest manifest = builder.getJar().getManifest(); - String expSvc = manifest.getMainAttributes().getValue( Constants.EXPORT_SERVICE ); String impSvc = manifest.getMainAttributes().getValue( Constants.IMPORT_SERVICE ); - assertNotNull( expSvc ); + if ("service".equals(mode)) { + String expSvc = manifest.getMainAttributes().getValue( Constants.EXPORT_SERVICE ); + assertNotNull( expSvc ); + assertTrue( expSvc.contains("beanRef.Foo;osgi.service.blueprint.compname=myBean") ); + } else { + String prvCap = manifest.getMainAttributes().getValue( Constants.PROVIDE_CAPABILITY ); + assertNotNull( prvCap ); + assertTrue( prvCap.contains("osgi.service;effective:=active;objectClass=\"beanRef.Foo\";osgi.service.blueprint.compname=myBean") ); + } + assertNotNull( impSvc ); String impPkg = manifest.getMainAttributes().getValue( Constants.IMPORT_PACKAGE ); @@ -126,7 +153,9 @@ assertTrue( pkgs.contains( "p" + i ) ); } - new Verifier(builder).verify(); + try (Verifier verifier = new Verifier(builder)) { + verifier.verify(); + } } public void testAnalyzer() throws Exception @@ -138,7 +167,10 @@ jar.setManifest(manifest); analyzer.setJar(jar); analyzer.analyze(); - new Verifier(analyzer).verify(); + + try (Verifier verifier = new Verifier(analyzer)) { + verifier.verify(); + } } } diff -Nru maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java --- maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java 2011-06-28 23:20:37.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java 2018-01-03 12:49:20.000000000 +0000 @@ -9,9 +9,9 @@ * 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 @@ -24,15 +24,19 @@ import java.util.Collections; import java.util.Map; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DefaultArtifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.handler.DefaultArtifactHandler; +import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.plugin.testing.stubs.ArtifactStub; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; +import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; /** * Test for {@link BundleAllPlugin} - * + * * @author Felix Project Team */ public class BundleAllPluginTest extends AbstractBundlePluginTest @@ -41,6 +45,7 @@ private BundleAllPlugin plugin; + @Override protected void setUp() throws Exception { super.setUp(); @@ -48,7 +53,7 @@ } - private void init() + private void init() throws Exception { plugin = new BundleAllPlugin(); File baseDirectory = new File( getBasedir() ); @@ -56,7 +61,7 @@ plugin.setBuildDirectory( buildDirectory.getPath() ); File outputDirectory = new File( buildDirectory, "test-classes" ); plugin.setOutputDirectory( outputDirectory ); - plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() ); + setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default")); } @@ -87,12 +92,11 @@ testFile.delete(); } - ArtifactStub artifact = new ArtifactStub(); - artifact.setGroupId( "group" ); - artifact.setArtifactId( "artifact" ); - artifact.setVersion( "1.0.0.0" ); + VersionRange versionRange = VersionRange.createFromVersion("1.0.0.0"); + ArtifactHandler artifactHandler = new DefaultArtifactHandler( "jar" ); + Artifact artifact = new DefaultArtifact("group","artifact",versionRange, null, "jar", null, artifactHandler); - MavenProject project = new MavenProjectStub(); + MavenProject project = getMavenProjectStub(); project.setGroupId( artifact.getGroupId() ); project.setArtifactId( artifact.getArtifactId() ); project.setVersion( artifact.getVersion() ); diff -Nru maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java --- maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java 2014-06-16 07:07:12.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java 2018-01-03 12:49:20.000000000 +0000 @@ -34,7 +34,8 @@ import org.apache.maven.model.Organization; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; +import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder; +import org.apache.maven.shared.dependency.graph.DependencyNode; import org.osgi.framework.Constants; import aQute.bnd.osgi.Analyzer; @@ -44,7 +45,7 @@ /** * Test for {@link BundlePlugin}. - * + * * @author Felix Project Team */ public class BundlePluginTest extends AbstractBundlePluginTest @@ -53,13 +54,14 @@ private BundlePlugin plugin; + @Override protected void setUp() throws Exception { super.setUp(); plugin = new BundlePlugin(); - plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() ); plugin.setBuildDirectory( "." ); - plugin.setOutputDirectory( new File( getBasedir(), "target" + File.separatorChar + "scratch" ) ); + plugin.setOutputDirectory(new File(getBasedir(), "target" + File.separatorChar + "scratch")); + setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default")); } @@ -234,7 +236,8 @@ + "*;classifier=;type=jar;scope=runtime" ); Properties props = new Properties(); - Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) ); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) ); Manifest manifest = builder.getJar().getManifest(); String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH ); @@ -263,7 +266,8 @@ instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "!type=jar, !artifactId=c" ); Properties props = new Properties(); - Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) ); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) ); Manifest manifest = builder.getJar().getManifest(); String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH ); @@ -292,7 +296,8 @@ instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "c;type=jar,c;type=sources" ); Properties props = new Properties(); - Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) ); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) ); Manifest manifest = builder.getJar().getManifest(); String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH ); @@ -321,7 +326,8 @@ instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "artifactId=a|b" ); Properties props = new Properties(); - Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) ); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) ); Manifest manifest = builder.getJar().getManifest(); String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH ); @@ -342,20 +348,22 @@ artifacts.addAll( artifactFactory.getClassifiedArtifacts() ); artifacts.addAll( artifactFactory.getScopedArtifacts() ); - artifacts.addAll( artifactFactory.getTypedArtifacts() ); + artifacts.addAll(artifactFactory.getTypedArtifacts()); MavenProject project = getMavenProjectStub(); - project.setDependencyArtifacts( artifacts ); + project.setDependencyArtifacts(artifacts); Properties props = new Properties(); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Jar[] classpath = plugin.getClasspath(project, dependencyGraph); Map instructions1 = new HashMap(); instructions1.put( DependencyEmbedder.EMBED_DEPENDENCY, "!scope=compile" ); - Builder builder1 = plugin.buildOSGiBundle( project, instructions1, props, plugin.getClasspath( project ) ); + Builder builder1 = plugin.buildOSGiBundle( project, dependencyGraph, instructions1, props, classpath ); Manifest manifest1 = builder1.getJar().getManifest(); Map instructions2 = new HashMap(); instructions2.put( DependencyEmbedder.EMBED_DEPENDENCY, "scope=!compile" ); - Builder builder2 = plugin.buildOSGiBundle( project, instructions2, props, plugin.getClasspath( project ) ); + Builder builder2 = plugin.buildOSGiBundle( project, dependencyGraph, instructions2, props, classpath ); Manifest manifest2 = builder2.getJar().getManifest(); String bcp1 = manifest1.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH ); @@ -388,9 +396,30 @@ props.put( "4", new HashMap( 2 ) ); props.put( "1, two, 3.0", new char[5] ); - Builder builder = plugin.getOSGiBuilder( project, new HashMap(), props, plugin.getClasspath( project ) ); + DependencyNode dependencyGraph = plugin.buildDependencyGraph(project); + Builder builder = plugin.getOSGiBuilder( project, new HashMap(), props, plugin.getClasspath( project, dependencyGraph ) ); File file = new File( getBasedir(), "target" + File.separatorChar + "test.props" ); builder.getProperties().store( new FileOutputStream( file ), "TEST" ); } + + public void testIncludeJava9Fixups() { + Builder analyzer = new Builder(); + + MavenProject project = getMavenProjectStub(); + BundlePlugin.includeJava9Fixups(project, analyzer); + + assertEquals("Classes found in the wrong directory;is:=warning", analyzer.get("-fixupmessages")); + } + + public void testOverrideJava9Fixups() { + Builder analyzer = new Builder(); + + MavenProject project = getMavenProjectStub(); + analyzer.set("-fixupmessages", "Classes found in the wrong directory;is:=error"); + BundlePlugin.includeJava9Fixups(project, analyzer); + + assertEquals("Classes found in the wrong directory;is:=error", analyzer.get("-fixupmessages")); + } + } diff -Nru maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/JpaPluginTest.java maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/JpaPluginTest.java --- maven-bundle-plugin-2.5.4/src/test/java/org/apache/felix/bundleplugin/JpaPluginTest.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/java/org/apache/felix/bundleplugin/JpaPluginTest.java 2018-01-03 12:49:20.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * 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. + */ +package org.apache.felix.bundleplugin; + +import aQute.bnd.osgi.AbstractResource; +import aQute.bnd.osgi.Analyzer; +import aQute.bnd.osgi.Jar; +import aQute.bnd.osgi.Resource; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class JpaPluginTest { + + @Test + public void testNamedJndi() throws Exception { + String xmlStr = "\n" + + " \n" + + " osgi:service/jdbc/h2DS\n" + + " \n" + + ""; + String expectedReqs = "osgi.extender;osgi.extender=aries.jpa,osgi.service;effective:=active;objectClass=javax.transaction.TransactionManager;"; + assertTransformation(xmlStr, expectedReqs); + } + + @Test + public void testService() throws Exception { + String xmlStr = "\n" + + " \n" + + " osgi:service/javax.sql.DataSource/(&(db=mydb)(version=3.1))\n" + + " \n" + + ""; + String expectedReqs = "osgi.extender;osgi.extender=aries.jpa,osgi.service;effective:=active;objectClass=javax.sql.DataSource;filter:=\"(&(db=mydb)(version=3.1))\",osgi.service;effective:=active;objectClass=javax.transaction.TransactionManager;"; + assertTransformation(xmlStr, expectedReqs); + } + + private void assertTransformation(final String xmlStr, String expectedReqs) throws Exception { + Analyzer analyzer = new Analyzer(); + Jar jar = new Jar("the-jar"); + Resource xml = new AbstractResource(0) { + @Override + protected byte[] getBytes() throws Exception { + return xmlStr.getBytes(); + } + }; + JpaPlugin plugin = new JpaPlugin(); + + jar.putResource("the-persistence-xml", xml); + analyzer.setJar(jar); + analyzer.setProperty("Meta-Persistence", "the-persistence-xml"); + + plugin.analyzeJar(analyzer); + + assertEquals(expectedReqs, analyzer.getProperty("Require-Capability")); + } +} diff -Nru maven-bundle-plugin-2.5.4/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java maven-bundle-plugin-3.5.0/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java --- maven-bundle-plugin-2.5.4/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java 2012-05-25 14:18:01.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java 2018-01-03 12:49:20.000000000 +0000 @@ -26,9 +26,9 @@ /** * Test for {@link DefaultMaven2OsgiConverter} - * + * * @author Carlos Sanchez - * @version $Id: Maven2OsgiConverterTest.java 1342631 2012-05-25 14:18:01Z mcculls $ + * @version $Id$ */ public class Maven2OsgiConverterTest extends PlexusTestCase @@ -117,6 +117,9 @@ osgiVersion = maven2Osgi.getVersion( "2.1-SNAPSHOT" ); assertEquals( "2.1.0.SNAPSHOT", osgiVersion ); + osgiVersion = maven2Osgi.getVersion( "0.1-SNAPSHOT" ); + assertEquals( "0.1.0.SNAPSHOT", osgiVersion ); + osgiVersion = maven2Osgi.getVersion( "2-SNAPSHOT" ); assertEquals( "2.0.0.SNAPSHOT", osgiVersion ); @@ -149,10 +152,10 @@ osgiVersion = maven2Osgi.getVersion( "1.4.1-20070217.082013-7" ); assertEquals( "1.4.1.20070217_082013-7", osgiVersion ); - + osgiVersion = maven2Osgi.getVersion( "0.0.0.4aug2000r7-dev" ); assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion ); - + osgiVersion = maven2Osgi.getVersion( "4aug2000r7-dev" ); assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion ); } diff -Nru maven-bundle-plugin-2.5.4/src/test/resources/OSGI-INF/blueprint/bp.xml maven-bundle-plugin-3.5.0/src/test/resources/OSGI-INF/blueprint/bp.xml --- maven-bundle-plugin-2.5.4/src/test/resources/OSGI-INF/blueprint/bp.xml 2014-06-17 07:55:31.000000000 +0000 +++ maven-bundle-plugin-3.5.0/src/test/resources/OSGI-INF/blueprint/bp.xml 2018-01-03 12:49:20.000000000 +0000 @@ -73,4 +73,9 @@ + + + + +