pax_global_header00006660000000000000000000000064116456472610014526gustar00rootroot0000000000000052 comment=49a4ec3cdd4fea3e1775e80092a2241b9240d163 maven-bundle-plugin-2.3.5/000077500000000000000000000000001164564726100154065ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/DEPENDENCIES000066400000000000000000000021561164564726100171630ustar00rootroot00000000000000Apache Felix Bundle Maven Plugin Copyright 2006-2011 The Apache Software Foundation This software was developed at the Apache Software Foundation (http://www.apache.org) and may have dependencies on other Apache software licensed under Apache License 2.0. I. Included Third-Party Software II. Used Third-Party Software This product uses software developed by Peter Kriens (http://www.aqute.biz/Code/Bnd) Copyright 2006-2011 aQute, All rights reserved Licensed under the Apache License 2.0. This product uses software developed at The OSGi Alliance (http://www.osgi.org/). Copyright 2006-2011 The OSGi Alliance. Licensed under the Apache License 2.0. This product uses software developed at The Apache Software Foundation (http://www.apache.org/). Licensed under the Apache License 2.0. This product uses software developed at The Codehaus (http://www.codehaus.org) Licensed under the Apache License 2.0. This product uses software from http://kxml.sourceforge.net. Copyright (c) 2002-2011, Stefan Haustein, Oberhausen, Rhld., Germany. Licensed under the BSD License. III. License Summary - Apache License 2.0 - BSD License maven-bundle-plugin-2.3.5/LICENSE000066400000000000000000000261361164564726100164230ustar00rootroot00000000000000 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. maven-bundle-plugin-2.3.5/LICENSE.kxml2000066400000000000000000000021071164564726100174470ustar00rootroot00000000000000Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany 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. maven-bundle-plugin-2.3.5/NOTICE000066400000000000000000000003411164564726100163100ustar00rootroot00000000000000Apache Felix Bundle Maven Plugin Copyright 2006-2011 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Licensed under the Apache License 2.0. maven-bundle-plugin-2.3.5/doc/000077500000000000000000000000001164564726100161535ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd.html000066400000000000000000002075521164564726100260120ustar00rootroot00000000000000 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. 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.
  3. 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.

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:

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>

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:

More GOALs are available in the 1.4.0 release:

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 a single unknown character. 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:

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:

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:

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:

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:

Example:

mvn bundle:clean

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:

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.

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.

maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/000077500000000000000000000000001164564726100262735ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/apache.png000066400000000000000000000277221164564726100302340ustar00rootroot00000000000000‰PNG  IHDR<!ËX€ [iCCPICC Profilexœ•Xy8Ôo÷>Ÿ™aLvB™È¾“}ß³ïK„ƒ±Ž±/¥B¢D”¤¤B!’D”Dˆd©H)’%%Ê’/²4¿?ôí{]¿÷zß÷zÏ_÷s®û>÷yžÎu6^o %!¡‘T{S‚ë7ö 0 tÞÄо­­%üÛX`@Æ›B ~|[ü2¡‹­ã¢é{¿™Ó´¯<Õõ€" œþÛX8}¶±#pÆDR"à$xû ‰ Mu´7@Êï¿ï³»Mô@Þг‡ú’C°sô:¾¤"^|}#ˆ!øl”lHH˜/k ˆ)ÔHÖ/ ãzÀ°Ý²7@ÍëúOŽbp'@(럜È1€rr?ì„»?ÂOIfº4ÚQlÀÖYmã:¶U €h &FQ£¿‚ôü·óö@À. Á+$eŽÞa ¦?ˆ½Ë¸WËìÇï`»ÂAâ’æþÆ{…ψlWÐîïâž>a…½é"cb â‡%º¤ðÒ2¹²/ätC”.ìkRUYQcQߥ!¡©¤¥ª­¡£¡«ª§¤/k a(dÄgÌiÂlŠ1ýµÕlÞü‹Å¸åˆÕõK›^Ûn».ûN‡NÇN§.çn—×þnoÜGNxÌx.x­yƒ#‘Ãw7IÒOÅß À†ìœ’ZVEyÞE}19µƒeˆKOT=¬{Ä8Éü¨Í1ûãNÉÎ).©.'œÓOÚ§ÛfX2?mšixF/K;[ó¬ZŽj®Ê9åóÊy*TóÕ/jè\2¸l\hvŲÈöªã5×닽J|Jýno—…•‡WDÞŠªŒ©Š½Ww'®&öntmä½ðºÐzò}bƒG£ó«‡†Mêdš³¶@Ë·Öá'mmíYáOí:åºp]SÏšº³Ÿûö(÷Òõôõ¾Pz±ùòÉ«´óA–Á¾×§‡Ìß0¼i{dXmxé]Å{Ÿ¾‘W£ >ü«ù0N;‘5i:I›ªÿ2-2=òùü›ÜLçד³–sœsßîÏ™ZðZ´[²üa³ìþWÈJÚê͵ޟk›Ž[¿Úi4èFüPâ¨Ïè>L/Ý V™áŽŽé"‹þ k»Ç×a.Þ>1þ‹»0»=ïhB¦Â©{[E6ÄdÅ=%2%¤>Ê e…ä4å­<}•öù)RqV5USQÔ`И×к¯] “¨ë©§«¿Ç1˜0l3*1>aB6µÚ/oÆm¶i>eÑkyߪØ:Çæ¨-ÅÎÛÞÁÁØQÍIÊy· «+ÚuåÀg·a÷çyÜö¼ê•}è˜7Õ‡Htô5!©ùIù8ɸ@TàzÐrð÷¯¡Óa“”ñð1êhÄûÈᨡè˜þØž¸®ø' M‰õ‡o¹™Tt4ïXæñääø”°TÒ‰ƒi'ÍÒõ3ÔO)œ–Ì9#˜Å—Íu–-ŸËtŽá<]*va+ýâjÁò¥…Ës…_®L]}wmðz_qWI[ióÆ›ue5åÕU·nWVWݽ}¿ºéN[Í󻃵£÷¦ëê×FÆ;r6ñ>âkæ{ÌÛÂÕÊú„± i[iŸí}Úßù¸«êYAwêsJk¯^Ÿh?Sÿü‹W/k_åPí^Ë ± ;yööæpê;Ò{“‰Qüè_ÆÆz>6WO”N^™*ø”?}ñó¥/E3%_+fk濵~ïž\ø°øuiuóçŠÈªêšùÏCë1g6olµü¥Ñ€¬á:ÂŽ”£¬PkèNL]}#ö#Εéó"ÞpÇiÖ!vnkÎx®+Ü <ݼC;ßñ½ãèÛÕ¶»^°ŒpaOŠP˜°Ë^-‘]"¢ƒbåâq&’xÉ—Rg¥­e°2eÃär½òq " =Š‘JüJ-ûHÊ8åÛ**+ªj:jãê)âÏ5ôصê´]µ×u uõt'õNèKè÷„r6™Œï™x™âLïï'™qšµ™GXˆX Y¦[iY-X—ذÅÛ¶Û%Ø+ÚÏ8\stsbwêqNuÑuùéZ{ ÄMÜm½ð «‡GŸg†—É!Ô¡fïuŸUboI™´ê×è8À€Ì@îÌò – ^ éÍ ó¦ÈSháýÔ«á‘Q\QŸ£Äœ‰õ‰SgŽOhHÌ:L:¢•Ä™4w´ãXáñ˜dÛÉTLê‡içO†§[eHžb85}º=³øLr–o¶ÉYñ¦œ…Ü×çšÎç¾è¢eÆ%ñË<… …WŠ>_¿6z}¤x¬dªtîÆZ¶œ·Bú–a¥{UôíÜêš;¯j~ÔrßÓ¨óªO»_Ý0üóP¡ÉëQvsÛãõVå'QmM¬OC;ß=óì^î¹Ù—ø"üÕéÁž7zÃoGJÇò'j?­ÎøÏ--D/ ¯.o,ÐhÛ³€^ oÀõ €/@†'€Øî2[Gu@d²P HPêŸùÁò`$8à<ƒ Ø@8ÄñF<¤éCfQŒ(qÔ~uu5„ÚB‹¢íÐGЕèQ +Æ“ˆ©Ç,ÒÉÒ…Ðݦ[¤W¦O¤oÇâ±îØrì:ƒC1Ã&£+c=Žw7ÍäÀÔÆ¬Â\Å"ÆR‚Á—íÝQϪÏÚÏæÉ¶ÀžÂ±“£†Ó‚ó3W ·0w;/Ž·z§ÓÎM¾R~[þ ò].»±»ƒ» ƒ{2„ „6„ëö†‹ÈˆÌŠVˆŠK‹ÏKÜ“Œ—Ò—ÆIÊ\• •Ó–ÇË+Ô)žR"îÓVÞ©¼¦òVõZ‘zšEó –…¶–޼®¨ž >Ÿ¯!¯¿1ÁDÌT~¿¦Ù~s ËX«SÖWmêlŸÛMÚo8r:É:›»ø¹¦¸îÖæ>åõ”ö²?ï]ìÓOÜ$Iú¹ûg´’Wƒä‚É!¥¡“ápµ"b1J3:-f(N,>1aà°Ì‘Œ¤Ùc6Çï§¥æ¤ÑŸLJß:u4w¦ [álnäyBÞ@þ™›Ë¼…_Š_+,>VrÓ»Üý–GU@u\ÍÙÚ;u¯à\“Os~Ë«6|‡UgÖ³Á¾€÷^»¾)ž‘øpàcüDúÔ‰iêë¯ü³ÃßNÍ+-¼Z"ÿøùWÊ*n-w{ãÜÖŽ_'~Ï%°… HƒkÐC°ˆ0#¢ˆ>âÄ!yH-òYD±¡QN¨8Tê)j͇6EÇ ËУŒ%& ÓN‡¡3¡Ë {A¿“Þ—þ°vØRì&ƒ3C-#'c,ã8Î ×̤ÄTÉ,É\É¢ÄòoÝAeű–²²M²§qHs¼æLâ’âæNçÑàùÆ{u§_+œ€¢ÀÜ®²Ý$Á½‚Ÿe{B„ö ýîÞ›/ ª)¶ClZ¼Eâ’d¬”‹´ªÌN™ Ù1¹vù …lÅ%¯}û•UTUWÔ>©iti>Òº§]¥S¦[ªwC¿Ì Ê°Î¨Ùø¹É;ÓÙý¿Ì9,¤,¬<­ãmòmëí†ìWw:i:{¹¤¸Vxéöó °‡µg‚Wù¡aQÇ7‚tËo*€@ö ,  %‡ÕPÖ©ÆÙ‘£Ñ’11±ñì ^‰•‡×’ŒŽž=6š,™›Ú™Æs20½ù×éÐÌçYRÙYgWs‰çòL/´\Ô.h¾lTØWtðê÷ë©%„Ò–›¾å,*ƒo UÖÖz×IÔ/7´=8×ä߬ÙÂÚ:ÙVבÒiûŒ§û}OAŸã ¦—Í¡¯ù‡ž¾¥¼ã}ß:JcûØ8á3Åü©î³× Ãך9·ïÈ|Ù¢ÍÒòrþŠæêØÏä ÑÍÎ_~4ƒøC:Ü‚^˜GØ%ĉGŠdÅÒG…¢® ^ éÑ:èôC4 c‚ÉÁŒÓí£Ë ›¢×§¿†¥Ãcß0˜2Ÿ1¢EŒ2Æ£ÑÁ¨ÃáÌ>ŒF£‹ÑÄ(cÔûæîÏý©jø§ŸŠS@ÿÿ׫ ø7P!HA0 Tñ"ÿGÛ»:=+Àeo€ýrˆ$ÅF†Qâ¨dÿ€H‚>…L"†…P¢"ITi‚Y(QVš (/¯ ðQØwÏ:(Y¥ IDATxœíœiœTÅÕðOUÝ­÷éî™îÙ§gavVgQQÅ}‰&šW#1OãÂOШD#*¨¸5.K!²3 ̾öLwOOïË]ªÞ$¤yßGE}æÿmÎ9uï©ê{êž:Uwc FåÛD0t:QOµ#ßRð©v`”ï?~¿ÿ$-)cšª|°n}(ýZ]úN3´£|íüñ¼é¦›vïÞsb³÷ƒuÿô„eª©jGWO<‘øf<ünFÓãQ¾nZ[[/»ì²ööö /¼pþüù'N<®ÙÆM›Û‡fL™´jíz$Ç$›ãº+.6èõž¦¦`C«a;¼lYÞÙg©œt¨ªÔÐÜ:RP1.d29KÌ/í§M5•ŽÓ,F§¶Ë_£A;Ê7ÊŽOw<úÇGëëëüY3qò¼ë¯ÿá®vddìÚ½û•·ÞIËÊSB>É`2ŠäÒ©µŸ\°ÈëWM¼*B«`B(¤ÅÄ^ˆ¨€Ê4¡ B! …vÚõm6µ+ ¶¢J¡ÄÉÍ=§ä¢K„SÛá¯Ñ å›&‹¾ùæK–<ÞÐÐpD’›—wåWÌ›w£ÁhxçƒÕíÝ’Á 饟œuöš ñÄ™•‚p ƒÌÇPEIý(9E ¨•Ê(ÏSh’ Ee*€5A¤COÆL£fZ®üùŒ)ú4³ñ§¶ï_ £A;Ê)@Ó´þþþ%-Y¶|Yâß%bA¯¾êÊI“&¶´uúC‘ÂÊòžvþ’¹OÇpÔš a3IÚZ„LíaA;HAêibš* ÄCcÜÐK íÁÑ­äÇ×ètÂweïˆ,\¸ðÞ{ïíëë«­­=®Eÿš5kª««GÈW¯^­(ŠÃáø ½Y´xqggWÝ1ž¼üòËk׬=göWx¯ï"õõõÏ>ûìe—]vªùr>üðÃÇâŠ+.?ñ<‹êwPÀ“j§}Ö™f‹¹©©YUTj±XüPWc7mJÒ8á$#˜E <8Cˆ ¡p™ÃL1bÞ @FÆ8;@ƈ‘©%“)ezfûyRˆõ2Æm/–¤ Aðv'˺Iþl8Üѱ=>ÜtxÛÆž†6©¡h˜çEþ[|ˆ’€X,F)Åb‰DÂf³°hhhX¼xñ…^ˆ1ÖétG„š¦-]ºô¼9ç¹\.Q9ŽÑjØ?Ì ¼Ñh!gŒ1Æ0>Τ ·lþçÒ§–«zï÷~ñ_·¥JTU=ö¦#„ªªqÜÈi^UUBÈÑ'é ®sœ†Ç‹Å¢Ñ¨$I&“i„ŠRŠ1VU-¶ÛíÇ>¸áp8‘H&î8ë+MÓü~¿Á`Ðëõ©rY–eE–“Ép$òE™‘ÏçÁl6©ÿG`” éô:ƒÁ0RÅØÏEá8.µšFýþ!ƒÁ Ó鎖oüåéÓ¦Lf V¼þ–?äÆbÑšš9)«šˆ†û:û‰p«ÒØ éÔa"Ö2VGD I¸(1uCú(!¢‚0‹è€#%ƒÙDPýÌ[ &Á» f#Ù>Ꙅ8[Œlig"QÁ¨ßÌ̵çXpûê­95.ûÒ¹hIƪI΂µ¶Ü] bîø ¼$©!ˆãTp +ZMÆ5kþÞÒÚ¶g×®Ùsfß{bð¯<_Ó´wV¾ÓÑÞqã7VTT,X°àˆ¼©©içΞAϾýûn¹å–Ô·ô 7Ü`4šÜîöŽöùóç_uÕU©÷{ñÅ·lÙò /ëʺuëò ÊËËGÈ·mßÎ0Ìž3'U¸hÑ¢üüü믿þ¹çŸïíé¹ÿþû×­[÷6>ú‡ÅGmžxòI£^Ë-7ÿµ¾~ÛÖ­Z²dË–¾ñæ[ÿéO<ÿ¯1ê©§B¿üå/ÿúvýöm[—,Y²}Û¶WÿòæSO>qâÛ³gÏ‚… ±ÀpàúŸ\à 7¤ÎDëÖ­[±b…«°hßÞ=6›ý‰'ÏÌÌ<ªÝ°á‹/–D!ž”ï¼ýö .¼ õʇšÍ¿çžd"®(Ê]wÞ5ç¼ÿt\ŶֶÛ︳áàþœìÜeË—¥Î~¿ÿ¾ûîkooÌ›wÃÍ7ß|â.@Ooïí¿þu8VÊ7Ýxí¯MÕîÚµkÉ’Çò \»vízô‘GÆDÞØØxϽ÷&“ «-{ú©¥V«5µaGggGW×cKûRBÁ`SG§h0f-žŽÃ¢ÎXTZ®ªê%—ÍíÜܸõÉý1ÜFzܱöødOP!LtH.½fLbÝxJS˜G\ˆú%,ð1Èú+‘)BtMB%ãz k,¥é?T;hÄK£u1¡§îlI–«Ä œW/ ä‘4»:¾£=øö¾™=r ÓqFŽñ…úÌ’¨Õaáb"OìuY®/íàתQ“Ñp×w¼úÚ«o¾ñVSsóQ5!dÎùsJJK|ðÁ›nºé¨¼¤¤dòäÉWþàÊûªª*õŠÛ·oÏÏÏ{ö¹g-ZôЃõöö¦j333 ŽëÊÚµkÏ?ä)xgå;g5sÄœ‘áØ°a¼þÚëo½õWMÓ¶º=™ˆ§ÚH‚°aý:øÛ»ï¿òÒËÉdró¦r˜;±““³aýxë­7ß|ã­H4ºwÿ¾`à˸»\…O<þøk¯½ö›;~óÈ#x<žT­ÏçkjjºöšÕ×ׂÿüÄŸSµ55ãV¼°âÕW_=ÎìE‹Åãÿq;‹ý×/~yö™gÖ××/^¼8'';µ!¥TV”[oýY}ýÊÖÖÖU«VU1Æ,XÀóüûï¿ÿÊË/?óÌ3;wî—]«»à Ý¥ÅâXƒÎ*ƒ²/¹}CôÍbõŸÄßè—Ûd¤p€c=HïGñ!dñ i6*(g?Ò%A”8g;§?ˆÍ2²xA)ÓtÍ}‚YÉŠñºƒXæÓI%Ï& kØLå4ÐבÚ›t0R{0–öî>{ý»y+–;ÞxC~tùú‹¯ßqï[ßXqxÇöX8œLÊ'îìW‰D⬙3].c,'7gxx8Õ"Ó™i4KJJR…’$Y­ÖœœœÂÂÂWLOOŸ5k–Õj={öö‡R 'sçÎ;wî±~tvtôv÷Ìž=rÕê÷ûwïÚõüŠçGÈ'Mšôþûï557äççäd¯ú`Uscóu×_—jsι缳rå$8{öìµk×öööž>cFªMMMM$mjj6M³fûÞ»ïîݽwÎ1n Æèíú·›£á0U©¢(©ZEQª««'L˜W^yå3O?s$aþ—VV^|~E¿»¿³³KQUMÓŽ6ìïë÷x=ónºÑ`0Lžùä“F£±®®nüøš7m?¾&õvÓ¦M»å–[R[¹ûÝž›o¹Ù`0›Íføüþ¥týÚuwÜqÇ—Žá'Ÿîìhëp¦g †'Lž¬öt¶:²³'M{Ê»Y ’]¥Q¤¢œ|jðSãHÄ5`y(- ‘Yàmßû~<m8×ÔR˜ÞŸ‘%œ>¡¸t21ê²sªÈ×y"š„P2™Y–üùwÚˆÇñ(©ÚŽ6Á‹âI퉭|÷½)uu‹e„ü£]E….×ùرբ(.ýóÒÙsæÍÆú·W*šV]=6Õ¦¤¸Øát._þ섉“*ÊË^zé¥X,>eÊç"Áår9ÒÓ—.]zZíi•ÕUÏ..™H~щöTæÏŸïóùî¼ó.žç~þóŸSJSµ¡£EQDILÍæÍ›W^^vë­·z<ÞE‹¥îºiTS©úE7E)®Â¿—Íÿi¨i”ÒéÓ§;NJéܹsÇwâ.`Œ1ÆGGŽã4uäo:º²=ÚŠQF=ÒäØ-ÃÏví"©›Zwâ»@qQ±«À„÷4µê †49–1®FN$Æ–—üýƒ• %p47‰‡9¥T%2NÈÈ ìZ×bðE(éU„xŸ;Þٗ쇕ýfl–ˆ”Oª[‘ÇHDÊsÓ¡RfÄÆ( µ «•"ÓBĺ—D‡P¡¤õOAôO^ŸŽÓT¬n…°Àh)3ëôÒÉb¥ŒãôïIMÂiåL ð‘AÄ 5±—Û™»RÅ×íéùàííÉt¡Ü^\h3¾xfΠg ‰ðUŽÆ (ÊÑGA–åÏÇq>ŸÏçóh)'åÇiò9¹,û‡‡àwÞ ‚UU•©Úµk×>úè£#.•L&ׯ[{ÅñŠ¢«W­¾`î\|L=C’¤¼Ü¼×^}Òĉ3ÏšùñGa GÆÏÇŒ)yî¹gÏ=眺ںÏ>ÛH$ÆŒ“jÃó|EeÕK/¾8~üøiuS÷ìÚ Hà8ðàƒF"‘Ta[[Û¬Y³êêjÃá°×瑽cŒ$‰W^yuÆé3Ž0Ƽ^ÏÅ—^2iÒ¤®®Îp8”Ú0/?ßd4¿þú_ ±±±©©)U«iÚÑ QQ”ÔyÓjµN˜0¡¹±éÒK/½üòË™™#fÕ÷Þ{oùòå©’¬¬¬âââeÏ,€æææŸî˜9sfª¥tÄ ™YY™™Y ï[¸cçÎeÏ< …0ùÜ[åÝ•ïΘ1ãhYääçd»òóÆË B¦ÅtîÙ3‘pž3]B\²Ñ-³&°“%,B"G ØÔ¡u¸RÌÓÂ:ê€YIN¹4a¹ö|ýuµ¦sФ2;ÉÐáŽ#±akü½m±µ;ïïK®ßÇûhp'ÈIäðp^/v’´!œÙ‚DŒq~JP7—AÖ Á#É&i-D·ò°µóo †¸”›A ûx<œK6ê1ù4œ÷(§ |Sbë†Ì /›ì›œÒß»¼¯½ÕùƂ͸ìýÛ´ëÿܱÿîÅ-+ßþÒ9I8ÈÎÎNOO„ËåQ±¬©©9í´Ó.¿üòºººGyä¨üÆo\¸`Á~÷»ß¥¦a²,ÿþ–/[Öß×ÿðÃgd|.ZZZ¶lÙr×]w¥ 7oÞlÐ&Lœ0¹ææfŸÇ;kÖ¹Çu}ÚôiCÃþ1¥c!çÍ[QVvìÿ:¨«­›yö9ee¥pÁ…s­Ç[eÕÕÕÎ>ovÍøñ<Ï_pÑEÇ(z lܸñ¶Û>W¾ž?þïî»oýúõ¹¹¹e¥e©ëdÐétMM×üèÿ°?77÷¶_ü§-BèößÜñÛ{ûLî3‹¥¢¢"u'S¯Ó=öØ£ ,\½z•×ë½çž{***ŽjÓÒÒŽ®5rrrF”úzè¡»îº{îܹ‚ BüñTmccc{{{j®‹1^´hѯ~õ«K/½t`pð–ŸýlDŠa4]Çä8’(>³üé?,þÃ+/¿âp8ŒFcjzìõz÷ïÛ÷äSOŽåãÿÝñrWNq¡Ko4aªY óg×FöÕóЍÆ*µQ­ñK8ˆœgšØžˆU•a0$"‹‹M(Έr¡nuÞ­özµî´Ó&è¶Šš‘C8‡¥›dsHò3]é0ë›–C„m‡|Êlaý *Ö°˜ŠbA@åÌÚLB›‘IOƤ±ä6ì±0] Ñ»Õ!IÔP>/Êw¶EÿÔž3Uc¹C‹xgTµ€°çùD»Ë Ýbˆ¬Ÿ·eâ#ÿm±Ûÿ‡•ç“=Õ|èÍj±+;44400PQQ‘š§ÕÕÕ=ôЃùùÙÙÙÇî"—[~۔ɓçÍ»a„üþûï@ ü÷É\ä›'øýþ¢¢¢cUÏ?ÿüªU«V¬XŠ‹‹5p»Ý²,QMNUÕÆÆF—«Àl¹^øRÚÚZ5Ž3æ$¢0Æš››Ó322ÒÓOòCCCÇY,–—^zù/¯¿¾jõª£ïÕW_}õãM›V" =”Ò©S뎭ý0ÆÊÊË=hñí!--í‹ ¤f³Ùápw|Ž••u‚+s÷¥+Ò/¢¸¸äËR@¥¾ÌO†M›6=õÔS¢(Ì=ðûR3a»Ý>"%9ŽD,X­Ö#sMF†³fáÂîÓ'·¿ü„ÑCýE5yH¡X°iþ|þp©°ÓH#M£H;£*R­ „ˆ™D‘4,¤ÍS–4>LÃ4Ú„|1%܉.U¥Ö Œ]J˳”‘YHC>AÄUkDÝ8Ï„œAðáp&ÎÌb¸‹ r”MBö$'¤þWÄj?*ÑJ ÄôdÃ5êPsØòR"/‡³úP ªve`Wµ.3MàôiŸ6uô¿¾ÃáÆYÙö>tJŸŽuäON×!Œ$]Õ·ZíoÒN´ÍþÕŸ=2™L'³¤ùljĈÝËïýýýáp¸´´ôk=X×hãö:ÿö|a—»LÒ}Ö˜”ú¼Ä’gÿ´§rHøX`§Q}È9›Ì0£v4Ó¡l ±ÁJHó!úÉ 3„ÜpTóëQÌ£õ·Êƒ*R¼¨Ê)ë fÎ*© Qq6œ-òÀ@­é\–ÀBÅ4R…tzHšib&d‚ĈÉqÚ?o#= -ÑÕ ”ŸÇ<ê¾3“˸ƒ)‡UŽ„´)@xÐö¥Éñ)gŠ);Kˆ"Öcc,ƒ„ƒ|0¼èt柟뚔•_xÜÁý``”o5IEëìjÙßú¶9å‚r–ZãÆBÅG?Œ†Õ0S²Z œnbØK¹jÔB-ÿàhrh,œ¯xtH÷ŸaAö "!& !À·²@>¶6 Pp -¢W£ !ÔœìÕ´¤ ŠL©ŠU`*0ˆ!q*0˜óù23¨?g3A†Èíêàµ0ìub’‰KÔ¨Ÿ\« §Q$2m;"{y[° D"Š—ŠÑ¼2SŽSŠ+´­{Š9k¥AC`Mtêê $³ó–ô©…ãnÑ³Æ ÚQ¾hmmMÃ~K4<¸ù9¯×;ƬCÏxËÃP|,{@M}цx±+a¤^à\ØŨú¦©üjžRÞ©gø0„‹ ­³ÀÑ »øCDØÀ+™¸ …»I¢’ª¶çrJ›ÖÙI .I1-Ì#âá<‰D8Õ=AÔk:f SCHHà §#ZËÀ r/ZÅ’qH,bÔzËÔxEœ‰´9X÷tQºÀŠ$8'WïLÄÂJšc Ä“#Ž9ó.q•Ÿ¥×ÿ§z5´£|—H¨ÚÀ`—»«)Ü~лeÛÔÁ~#>‰ÓhëáDeˆøˆF$Z*“~Ì:(—Í8Ž×Ò–”‡‘1³ÍØäFr1: Î#ÎÆ6T1ãN$ }œi-XJƒŒ0uƒØEÄÈ΃-ʺíLwP‹rÄÓqšX”0$"ÔE½ÝšODrœÆ(€ôÐ8,{YPBR&ŸgUõÕ(PCgJ޲.IÏ+Ñù”œR“=[ìn Çb´´ÜÜÖNÏ’,&Î?$»ƒIx¬µ7Ž;í¬#›£A;Êw M£¥ YéèëjýØÜ¹¡Ø_–Éó=‰Ø’`u˜}XÆÆŸa׺äm[‚3cÂ}2oŠ1+I6®º‰LŠ€Ãëp€ MD1—*#;y©Ò÷£@H&FÚ‰0‚rYlØÚ‘rªñÖ!‡ Y<ÂŒuNcqS]ƒ$Ì寴ÎͯGÆdà±~úƒ‰ž5E€1I0†€Ê4MUy#aoG§2DÓƒ¢"õ;É «"•î¹"»ÜÙÚ¼ßH…ôtòÙ™¥\$h#ÎYSS¨—òÛö 9R¡UsïæMY&× ge9Ç ˜‚Fµx4̌Ãn6ÐÃñ}f~40˜íz£QäBGàØ3g£A;Ê('‹Æ@Õ¨J41'ˆ¢HN&)¥ Ç!A§'+™«J&IDATÉq™GÇsÀ¡„¦ P4ç6 Üñ~ª'ÿÀÿ8t?fëÛÈIEND®B`‚maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/button.html000066400000000000000000000005051164564726100304740ustar00rootroot00000000000000 maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/button_data/000077500000000000000000000000001164564726100305775ustar00rootroot000000000000002009-usa-125x125.png000066400000000000000000000327721164564726100333460ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/button_data‰PNG  IHDR}}€l% cHRMz&€„ú€èu0ê`:˜pœºQ<gAMA±Ž|ûQ“sRGB®ÎébKGDÿÿÿ ½§“ pHYsÄÄ•+ IDATxÚí}|\Õ¹çîÞ‹F£Ñ¨wË’»ÜÍa IH%ñ²!ÀfáínüÞœ———äy !¼$$ lŠ ¸ÅE–e«wfFÓ{ÛïÞiƶlËF&Ìño¬™;çÞ{îùåÿïœ3‚‹Öö$‘+_¨Â|Ú $q0‚½rùy)Âlð¸"`ØÉI -¦³¥b “@$G8Ê"ûÇ霫¾–o5sðÐzÚ§òâRËjÅЈp$‰/!{ íîäßtý¯r©QBÍ  ‘d&Ôl™D"<-P”/€ÃÚ_Ô‡OW@ˆH$–Ћ;?Á”xÜõ¿F§VÀ&]"ŠCàÛƒÒ|#L…E°»€ ›;Ž@èxðÅbFmuä‚AL«*@«¿¦R#Žô=Ö(__.IÅykLrV@À S ” J’e`øc¼eÐÈqIyFÊ©QµÉ~^|’Îkü]p*.§‘áQœ%÷¾Ñ(BB†. ;…vÐéžPŠ#xö×kÑØX‹¯Ýz;fVÖâhŸ€@dü$–2Ý"6‰]y607N!´z%¤¢~HüXڰ★R/Ä ?z· ¨i¯(¬‚Í'†ÃÃð/›[€Qu«TÐf·J.Ú™<|àt¦N³ ý}y¨šîé Û¹wÿwCàQlúO+6´$ÆŸ§q¦×NK¢çï:§uZË|û{â/Ïÿ _¿å+X¶ln»í64-Ÿ‹Ã= :†’°:Y$ (åd´#~°R%œN þ¶ÿæM¯AE wü+äeˆëÄ<>ß  I‚na%a" g‚½l9YçINtÉ¥2È[ý¼Uà,Ç ·™ðéB„¬><¹]€ï~M %_7–øÏÇϽa7Ì’¢€´'F.EH®Æe à™ vlÉÜ¥i¥÷^¥DV.›‹B£[·nÅ3Ï<ƒ#Ícn½—.,„VÅBÌ&`Ôz… C£û½ ‡‚(6åÁþË7àí¶ƒ1ꈅà‹õ…`).B`pÂGçˆÃ½u?¿øÔeKPsq5Å…C| ª™õqÒ¨§{ :á%±$ÌP;_‡frËfH Îc©Ë¥A¼z$ÎËñ÷I£J% bVŒaxK&Uˆ0¾o¿ÙÜ|§?¼”@ ²Ù)¤š$>|Í«Æ*Ì5ÒÉ1.š/ƒR˜¹gA‘m^4“,ó»…øÎ|j“î:BÝo¥t­^:\µXƒ¦‰ø³cCn|gSø´ÚxóZ3~°Œ_(à"Dø‰#,rܰˆÅö-AŒÒ7³–i±¨úE#ÅEóNÝÆ“@'zEþ•/H~6¡ÆôÆÙ¸ü¢z"uQlß¾ùË_°}ÛX Q\¿ª–|ÖÁ^´´u@,WÃëó#àó ¶¼­MAF:† ™^ Wï(Œ:†">ø½~˜õù褿 ½o¬‡úÁï@i#Ùû&¢ÿ÷÷6] u¾˜¯PÙ†â"!òHÈòŠ´¨Ñ¦5%Äÿà@ ‰G£9õ”º¶¿ÍuD’xW»_°á¡ç=xæ 7”3T¨×8ßÿn/:K5X­<¯Æ±åODíÄÛ»îc_qlÐÓæø/²ã˜LŠZÓS=Ç6© ÿzeêZ¡>V=dÃæ7ΖÐ1!Lôܯw&¡/‘ãêé)Ð=Ý>üyOôÔˆ×kðØÕéö…Cxìÿ áG›}(ž¡@¹†ŽÊÄhH ùdÚøzgbâ”N/G²Èßze¨)Z†[¾U‰yóæáÙgŸÅÑ£GñðÃãÉ'ŸÄå—_ޝ~õ«X½P¿nßK,]ˆDÀ…$9ýÞIÝ42é#n¸ÚÈc4,6"ÑìBkÀaKp¤¥‹›Ðå©DScÊHû_z#t"ÿ™À£—ñÇ´y1¨¯ø&ê.[ù¢Ÿ¤›ÂKÏ`?q×_#h¬+Aƒœã,1ÆÑnc±éÌ•RܽF‹L€²âã£|‹hüÁísàá©8sh$zœùÏ”ž[?„ßQ5“8\]-̺V†… …BÜ}­ b•püXI‘€wü§$ˆ•ª¬öõ}âÂ_Ý)áüåë\ümÜ\ PdRm£‡H‡Énp¬}ÈaACÍÍxäÑ™øË«/ãý÷ßGoo/~ÿûßãÏþ3–,Y‚ù ¢u` ùéx8Šh 'ûÉ–•Àsl²â|X[;a0lR «Ý†òâ ´5w pÃý¦ï­üþÌþþ MÒ-@é&ôt·C9Lì‰Ü‚=(NîÀ·–Öc(l„*Ëœ©µȉ Þ÷?͸Ø|êñ†¦ºŒsh‹ž™ùÙÒ—z« N¸–(Ó™f%n0ŸŽ Óõ³ÜˆT+<íí²Û7:ÏDsÝar‚)Ò;‹6žôŒÖ3 ëKŒþú$(+˜‹¯.ÅêÕ«yàwíÚ…àÝwßå_%•àºøºË/ƒ“`lL@m!ÄäÁP¨Ãh?i3+…»Ü«- Mž ñ"̽¼&sOz †4±ô—I7Oô/A¸üÿAÿ/鉹aº÷WpßX ñMÓ¿±-ä×Epu“qpë1~»É‡™7⪲Ô¹îÜÖÅÓR®/`y-:maO݉»[#ã×òµ9ñO/†Q OÕEÉ{Sð´w† (ßáÒb5î*öòZ9ñ53íSóf:Ý>²Êshã¤@*b\XxƒIxZÌ«™‡»îªáÁß³göîÝ‹;v ·³ƒ¯ç·¿E•sàqU!êÈ'ÝS¡ß‡ÀO’‰ F Ð›q´¹–oÞN¡oرýË_Gï[,Ôä·m}(Zt#–nYË[ᜫ 7¾‰>"HµüˆI äw×!ü^òß í˜©pîuÏûXxçã y k¢âºŒygd D¼œv§¢áâåܵg¿íHòƒG…"2ó‰IwàÈHFç”ä·ˆ&>›5Õù"Ì L:¼xצÁ—Œ8,Ö5R|[š·ÓYÛaTaVáE å‘V@?=Gv`zƒ™b{/šîZÌks¬g;ÞyÇ9…Æb€§ÏöãÐ}ôVÔÕ*8¯ˆØºÚ,ï¥EÞ#¡û¾,F¤‹÷•? þØ1x?¼ ¸©Ž'1sVWbج‡dqÓ `z{»l*ÌçaÍ}¥¸ÆCR,„‚ àÞ{G°?2¹øßsÀ…M]ŠÔh¢D‚;,Æ×qĈi+)ÔŠubÕ¿ûx?þ“Çì˜>68Êpõm…¸üR bJµ“M ½ø;;þÒ§ÄÕÅÔ>µ¿ø¹Ã~–,ÈXhÂã¿ 3ègL¸pcìÜk¹9†¹3ˆ$YŠ×]|¨OD`(Ÿ†úsqõÅ×àæ¢ïàšª¯¢©z ìþ¼ÓöGl:üs´Ë‡>Ϩ¤× Ø ¨¢0+ûžÿ]-¬dqÁNV!2³Ûÿð ÆôM»t1½3_>D}Y€Çà|ñGð?>‚è‡RˆyþÁÐ8ÈBò‚Ö-Û0ÞEäc«ÚÏ›±A×ø=äë(8ÛŽÃ\GU‘²1iᆩšþ,¦Þoø÷A<¹#4~©œåçÉ¡=K#ÝA|㻃xóHF„…65—¦ ö®0ìtŸ¯Às‡")ß-îêóáGŒà£ʺÍDm<Ž»)µ*%PmI`QÃ0lCmô0ôŒ8àÆÐ FGFPoÑC÷Æ Y?ÚÚÜ–›Ñ74‘…A° Ÿt|„Xâj²t;Úvc_÷؇R¤Å”‡˜§BK5™½|غ¼$zHÎýȨ 1ÐÚE‚¡ÇÞYõhÛÕaü'´Á”UõØýqôŒ†rêê‚lÄB–4Z§D†¬i»¢¡Í6?ÍÇP(!>{&{AO1+³¸ öÎ †ö¿ûÅåèp¨ÉB±há\hg—ÂVÀé‘5`Ñ;Þ"ŒRÈ ''¢þLóé§*œôú…¸Qˆ¤:J`wA#—À\HšÔÑ †B11UÒ$¢p‡ƒÈŽ ¢ÐŠy`Š;ÈzaVA“Ta G¾LäQVé«á²ØÁbè ¶bOÛÇ貦ˆ OÔ¥ZT4 â1ÂùýGp”4ÿP?êKU’B*‘aw[€,`ÄÓd°ì‡V¨Æ» ˜8E ÓŠ°ç(¹¤heÄ$zFX² »v#?L!ViF>0{Pªá2›Ðý~3,yRL+*Ãë½F ¾Ø3ksúü0#£w¡ïRbz… á+—£%PŒæn!GYÞ p}OréêÓ§•/8Ð9¿å#†Òe“ £ø™˜©Á¨‡vXJf6“™|b}#Œ%ŸØ'âÆÂÐøÁDº° a-bŠÝy¿ž$rH$‰‘C/× Ø†Ô'ô¤uóJúáQÙÐnoAç`öwoãÛñN'Yöm”åÕbP^B<ƒQS€#­$hŒ¥®>hHó÷M¯Æ‘#C¨È+Ã!+Ý;¡†Œ˜²­Îg_7d^"\+V£ùã6%ä`êÊÐ52™ÃŠ‚"ô{wïlÁ éŽêçà‘]Rhü!”³f˜‰`6ƒ= €ã ö£0“ÛQÑ+ôÔë¨ø—Û(b¸­},Ÿœrûî’ÒpÃÛD3bT/BÄŠ.Ç~MÌ .ÐÇÂ6¯Ÿ3õBHÅõpÙ’`Gés´®a +Àœ Böþ›DºlKâÍ ?¯‰$`& #—P 'TB}@Ì%Š A%#&@§‚³U³¦*KÊ/CP¦ðЇfçntv¡ËÖŠ.´bËXl,S¢TW _\ƺbtùH2–h`ßOBɨ ©Gë¡6h“2¸-Åþ½(ƒÄq¨³y¡j,d¾ƒV„¬£˜+ÔcÿŒ9ø·N)D"£¬×Nw¼í=òAEøÀ­GÜ1„¬ì<=ü³ÄÄn(‡_AøÕwQj®€0Qƒj¥‚¢ 1 %•äšÅðùýðGTd ݳ°¹ˆû$ìx6ñ‚}lˆÖä´å>R³bT`ƒI²ƧcþUƒ¶º©.¾à(|r""uzïa^¼˜¡˜"ŸÇ b¨Fí|ìï#¥Fº®H„Ò¥†?1‰M™|5ȯ$‚èC·­b~÷ý ‡©5¯ŽÞÊ4ÐuZPb©„SaDÛH «ŠÑÓ o× ä¬âj)!CQ%…‹ÍP‚˜ÎæãXu þƒE$‚&%‹tU­ÒOÞE@—þ HèžµŠbhf%ÈU4C¹GµF’ØÉB°÷=Ôé߃´FŽðeuzãD,P«x…*Œxa®%êÆô;dèJ ÏÆY‡Tÿ&’ècÀ§ÄðæÜ_nl+âI …Â`ÄŒY—<€–ÄaDv¿…Kƒèò—ÃÜÆÁG!—ÅQ|„XqW;<± AT[N º ˆÑkËCGÂ=ùe±Þ‹Õ·‹¦ÃÕN$ ÇÍŠ¥Es± R…d‘a’¿˜*‰^ xœ¡Q^:­-üëø€Šø„ZbBW·–B  lÎv©µ0ˆ Ðϲx!hFÌ¥6ɱªÖöà‡P(òñË‚°õø0]%Ãl]'F¶ÁLzew GOÇÈævô ™|†d-FÍ^$CžK e…S!Y Lúíp9#‡|Ð뱨bæÕ”cÏ1íƒÉóN…SqÎ,9Iš¹É.ŸŽüíBÔ]2¿k~rbÅâêíP»ð–(H» ($Â5Zi„¦ÃŽjÈK “ ˆX¡£˜Û£'P|1Ä5"ö`AR+q¹¸„žø@…X’Îs©Ð' BI&Sj¬„×VƒK4µ¼¥Ì—•!I1ø@ââ ÅÍA/œiX; m;9|J¡%€ú"Èò°Ÿ[cy1þ¨+‚mÈ ‰Ü€K Û`kîC£CXÄà†™pìj'—!‡¼º^ q{š¡×K &7c½¤½ù6¸ìnx)º‘Ë’(·TaVµ˜:¯•P8w°×-ú2u˰¿S„+x>p>&š §êBœTr“cz¬ 1™,,†¯@mNÀ=}ºÛvÀ>Øš+òà;` Âç²0˜6<ˆFè¬>xì AKîÃ@!¢Êí$ëAaY€9‡`‚BÁ ‘Nű8Ôb˜IØbJè:¼Ph¥ˆ8"?¯tŽ¢ÜÇb( áˆrm ,!H4°_.ägý$òƒ‡ÝÐ’ïí— I(H°b^XíècŸß§G|ËÌDx“¸H©ÚHLŸ|ºHÈÀ~Ì«,ƒL‘„„"šBO™®oÎF{­qN"À‘ä ê+-;eˆŒôCœgATÌ wB#;„Ñ!"—ò¥¨\²ÛZÄ 0üàP8r‚~b†ÎC!˃ÅÑ>¤5E†«Q4Û?3‚7”[p‘ÚŽ^«"ÿ(4}bD^u p8ˆþ%zX<1"~A014mA8´˜æ&B¨“ÂÐbãˆCu"a"Â粓9%AHÏl÷C@‘‚¡‡Áábjm¶Å¡ií‡`T†Ô^L§ÐIéöÁQTX¿V‹JëòˆhîV”"áÖ‘`±Ä$ƒÉʃ%ÑQ ƈÓ±&„bjWBG¿Š¬€A€¬T”HÜÛÁv<ïtQLOÑÜ©( ãïûÑP™V º,M3-hÙæƒYˆc{Ëâ…*ÈU%hí²Ãf†Ýûiø{¨žy-ÄU‹ðÉ"|QfJI?sæüÌ#ðS°|F} FÜ" {”ðÅò¡/›_^5ü¦j’ÆQ}-!ªê´ù&ˆ¯• ¿N€^òá%ŽVA±B‰1Žàá*ì^ ªPÚ5·V‚òÞQXËÔ¨¢ãN³Åv’tœõû87¢L³Z1/Ç!‰ r#"ÏJ Q4xá.£Ö> 3ã†KSY˜øI@Œ&òÉ3=A4õVJÀ ª‘oŠ£±Û½X‚Èù’pK|b¬ðåU™0#0Mú:,»RÕËt|¸V¨aÔÁ¶ƒÃhéöàÉš±ûHGºxãÃ.¸}I˜ò5ÄE+”8Ð| Ó(œ êÈrRt\ø ›}ÒnT/áü=0âbÐoc0èÖ37Aošo„BН?.Q£D›-dòŠ/Ó#QÃð®*?DËšJT¬¡—Q@±{aƒŠ´Ü¯Za4Bî%‰(Gá­ÕÔ÷9Ð]c"èF’ã³e/*\ô–(QîŽ õÃ(cÚ¶J ¦Úa”9 a¡ Ú¡RäBy8ŒZ²¾5™ï0ô•,tŽ QÆBï £.J&ž4¿AÄbº¾¨„ây ÇâŸÄÒ©Ðp©ƒ¶®\F!œH€Æ¹:¬\bDS™ËgÈ‘ Ð…Ð1ìBÇ€Ÿìé"NEkGºÂ& :8b>? O¬ýÄP½ ?€Ñ;Â`€Lª+\@¤g6+‚/òtduv80¼'‚ÂLp'…X0[îŠ` )Ö—p¥¸h¶ ]ƒ ŠÊt(-×£¼:ïW¢¢j:¼¨!Eòý6eŠøY/`äVÌp (¸ùôR1·L*ί´QP‡È¥IPtµ,¥˜|i„üw¾ñˆB§T ÃØÕÒ…iZ ä÷$.CÚª¦©¬¹=å€vM>Á¬Âˆ[Gѱ¤U3åÐ+ÿ¨Wˆê½v¸d,ä5y(íu`¿QƒbYGYâ CR”Ñjaa*N ‘”­•bVw¿̨ Ò ¦Cø˜M@,µ ¤ÍÂȲBLWÇé=¹›P>jÿfƒ-äG÷÷ª X”—ðÚˆ’5KŽ"èg U (‰a»ˆTQʪz"“Ó°¯]ÄëN%‹\h«V9![Å0Ü, bôbNþ¯„'Z% ù aƒP“dH¥RÄ£a0I?‚>+ Ää“^?Fúû1pAG“$mž­Rchp¾B!jÈ ÷nÆÜ׆à·Ù1²º%|Z ˆÈEˆzÕ(k¢Çc‡è+ÕDÈ S]ÛN´‡ûá¿¥3nX}j„Ũa™NA ² cèèó¡q( mGL5ìÓ¤ ‰ $ð%j ¡7äA¡)…;¤Ä°‹Å ]ÀƒÍ­6 E§v¤NðyYª|¢0ˆXNëf¹%³Égȼ§¾SŸL ‹€·œ‘ϧÀb ËXò¿,"P+"Œ¨·‘%!u:D–¤Èd‚£³‡B¿ªKÕè# âJ9‡m0RˆÉEj“8)@C&8OGÄ‹œ˜´ˆÂ>bÄ5@îC"J@J÷²1D£!>hJòãI$ÅF>oow àôqÓÐüØ<7+ù| Í ñ9)c£‰ØØ4H–:ˆÃ:I‚ÀÏ?ŸDzâÔ_—‰@H€ŒY ‘HÆ ·ÆN,ð‚£T`´$IÇ|6ìH€Î+œE` ÐL ¡J­rqS¨ô¤éq.y­Ñ#€‰_P¤£ô7ÜÅ¥'‰³pÉ–ÏU°¬"® 侸{ríত²oà}ujRÿçzf€>?ë¿?7 Ÿyh83Øš=DŒèD{¢öœ¯”'ów:ç3½±^‚RbºáHÃCd&ÏbFi®|æ©UþØ‚…ܼÅ@wÝŸ½d8óëˆ×ÿ*s“?»E›^4—U~:×q,7ΕIiúø,PöÔßq¾ù l¸M;¾Ì8ˆÁGæIË­•0ç}u®L!è§ ³¿ãâÝ1Àí‹Þôdj¹0·ñú™Ìy_g+Ÿ‰OÏbP ñŒDðûwr{¡–OEG2zŸ×hÀÛqs=“ëÕdÐ=-nþMÓZÔ§al½Q¨‹e¸k¥Ù›/H³¤A(Ìíú¹ Ùž}Ùƒ¯OÓñ›ÌÎÃÛ?ÂâæºÖDðê»äÏ7bÍ—eXsS>OŒü:‹Ú<„‡vÄs=üyÑt® ðâô2“_× &`C>³#äЮ;ìBi‹eZ†|1¼ÓËõìçôq`û"økßibu7q¬òg6EIDATî•ëË/Jœž+9Ðs%z®ä@ϕϑ«*Á¬g {=3+›2…H{DNÞ)éœê ÐT/†i’×Í•sý²5ùx`¹ô¤/ŒSȶɎ½Â~ªù2ÐÀ–£~<õz8mJÜû€W§g¥i¥ØíãßóV= Òç ï¶á–ßa^¬Ç3_Sò¦ùâÿ¦Ãs»S$'_—Å·¯WŒkö›O á'@¥Ïÿ@<:Z½Ze¯XOÞ91WÎMÓßÙ4ЇÇçJ‚ÀÈ,ÊÅÆ¦IIpÑ´ÌxüÆß¥ÆÚ‡v8ñÑhú°\ÎÿËYÕÕHQ;–ç‰GðÒôpo‡›ÄÇï}Íb6‡àùdï«3sœcc?–S)qì '‚½ã5’hµÆÇ‰XA>{vuéX6eÌÎÊë³¼Þœý¼®ž©Å-ãZšÄǤ´´ªB<¾I¿o |«nîÈ­Â:ñYÕ=®°B4h2ÍÍf&c¦~Ý W¦4dãK±¿ý¶z¼bÛ[ÃøIKªã3Y¶“¯ d¾ãòêgSn?ÞëKàþg8D¸s]*ß `ŽõFAçÏ•)×tu½ /=hà‰Wüuß~%£• E–y¿øU&gŽãgS—+~nC[`Ì}‹qñj-Îô§Ùè>§és“OݦN™d"S›Éúá¸Tá~¢"D—«£´HaF`Ül7TfLï`k„ê ']—/¡0¾}?n¸Aƒ¥%BÒ÷Žló`tV?ÚŸ‹Õ§ôJžQ<ù¿‡ñ¬{‚zaØ8À›186ž&du¦ ‰Ÿ]ݬ¨aÓ&'6á‰[Eã¡Ü‘Μ¦O‘ygðèZ]æb1è—¨pï êÔkw5ÉJ[ÇC(1nûZJLÌ‹uX¦;?€çøß49›º©ß?¹¬’=®]÷>êô¡Ø:rN‘¦ ŽŸö,—á†«ŽŸÊ+Žã7éÁ™ß?=ŠUëü KÁâ|¼ÚƒT-×Üþì_¹z6uó)bxðË2<ŽÁ>š€T/†v~'¬6ë…ÇÞã(‚yñËÐÑû®—Š`"³+iÜö>¿ÛdõE?€Ng‚D·—âH]¤‡3·ü»:(±"aæQuÆŠ,i÷†JHÒ—LŸ¢‰ÕÉÕ§xÉܯöŒ›‹»ßx …+^ÀÜúùÇkc²}/^‰AC]fžƒ£Š¯¡¾¼–?¦^ýo0R}dšó#ô¼¾€z…æ}Œ»•| õÈ¿Þ;}Î+á$ÛÇkK(D†K‘^kÉ6W ä5Þ¼z?Úv®‚•¿¹cþ5‘šnU}c ŠŒŠ“˜rJàÎ…žÜU,+œ’ûÅlÏð€—^¾YÑLæFu¨]ÛƒÚ •‡Àç„&”µ¿P–¢M‰ ̼gf·I`\üL»Öp1?­êèî_Ãëw#æmFïö‡x3¬×§$Wd¾ …œY;ø6”sÈT§Ék\ 2h{ñŸ`· v `ÝA× Ÿ{´Áùôm?ÃÐPbQ+l{&­CQyݧ¿_¢Ý/>”²̱ö0J/§µ“Êy“@Xšêàü`läÇqìþLþ*hµš ˼KEY·5 æúu°¾´.¥=L)*n}ñ×¾‚=O?–ªc¸snýa†1•0/]E¾ìm”ÕÍͺ²eßz ÌÖÕ8ôâæñ£µ7µ@¥˜¨%*ŒOÈÏ>†|º|øË£uìz×íâ èìïw"«õblËÅ6zÞÌc¬Ãòkn›ÔoNhæ)ö9}q~úÈ"4ÜôS¨%§â û‡{b:ûIâ…Jg}v"êNýŽ ûiv´ãÆ è"à¶[Š…Cˆ4`™ów¿sî-¿•gòB™iÂö]0>ýL~”•œû³ 3þKÀJÆ]‘P"9ï÷;çÞR˜&h.áò,9Ðs çÊ¡œwŸ§†KB0bXöÜëLM!"ôñÄ•i¾°/<sZ߇­û= üÓ4Ƹ ùå« —MVVüzeÚ@åõQbÒœc©hAóﯣvæÞñÜxlŸ=пu1ÚŽøÅFt}@à\ù!JJ&7ÑåF/©Ÿ›ü4u¦Æ™‰Òƒ¦*|‘7%g&ÒðÑÀKW¿…•k{°ò[[PYž:ÖñÚrXÝáÏßÓ „È• 4=é}¦Þç-} uiÛ^‰’ËÞ‚ï7«Á‚·ìÆ«àkÝ€žc¯Ã>«ÒÕÜòù߃F5q<w¾Ž£=¸éVL_pÅ)üj žÓ^75µªŸbYò]º~ŒC»ß7U}ÍÏPdI_Ç{0¸í‡8Ú²“ÿ®|颱Ñð{?β'6¡¨ê„‰lŠ­J½w÷"N]èÚúìâ9¨\tLÔ×Îc°ï8iå8#¥‹·¢ý¹µ°8a®¿ä4DêÌ×87Ã9°ÍÏ_œœ+;Ñöê"ÀçÂÝè'‹”¼…3Êѵí1ør˜Ÿ¬é÷Øú_„ý«8=:°Áè°Üq %¢´VWVÃú§µäŸwÐw·ñ¿e>~†aýh5é}ù5O#O%9M³g¼nÆ'³ný7¨#oâC. ;ÿ3× Ïûhãg²Ô¡î¦—`6(Pݰ {7®ýÂ¬Ìø°§bâ(~üXXFˆ¤oú›7’&Ísd¹ÏNëß~|†GQj1±YÉÀä®[yÝ?C§ áÖò™:kºN4Ю1 jmJPeŸ†ü¢ƒ~¬BéØ3›áuùOŠsÖt&ÉÒ±ç|´ñ+h;HÇL÷¡véÝ™$ÿ e\éaÈvú9ä çä¯ËŒ›£ãsÖqïpúÁ)$&zÚ ë¦¶¡rtû‘½=:´Í-©÷¦š¹ˆ mM}¨³V|…õ—¥³” 0' ²˜–üõ5éë¾ø#xN³]Lð,®{ªÕôCúfØŽ@zÚ¿ãUXs˜O§3•(½~ú^ZG~{=v¾ØŠêKÈ&îCÛî©:†QQG¬¾3½oHËÓèÔ´Á³ó1~¾g%†Ž}•u5ÍCÌË_ÆÈ±ëÈënÆÞ÷š°ìK_p €•Nþº§ŽýgñóïœhÅ¡?]‰<"ƒc‘@NÓ'2Ŧ۰lÍÓ(æ"Çf´m½pnõÅÒ›¾Ãkž´ø&òÏ)ÖÜCÀÈ–þ•i<úîÇqSȡԜ¸ëÖ¥>w=„Ž¶Ž s6×e& )UŸi×?šv ­8P{ù/Ó3t_hÐÏ8‰"´¦f†r³Uå&'0¯ñh˜c€©Y/üøvbù©ÏçZ¦èºq?b12ïŒBQnpfbó~bÙ™óB°Çu¦„ΑLIӦ京bAÍ™÷\Éž+_xóþiÊäóä~]ˆq“ Å:HU¦óŸqË>1‘ Ù¶c¤óƒôDzDR Ī2èʯ„âŒ9õóäBضÝ^”\òL†4ƒŽ¶¢ý·«‘ý#åT¿ì|æÕ©m¶åS•0ü½ïÁGÜS^x T Éx?ú{ßæ«JVA.¡~‹[1Ú¶£ÖŠD¨_ùå¯DAIÝñãG ª×ñ1Ÿo| j•ä<‚ïAï;ËÑÑ5ñI冕ú™A91O ‡§ÏáXf@%Ðñë4à_FãMß…ÈÝ RzÞ¥}¢¶|ºƒ{ÿZH yô0œt¼-}¼$Ï…Îß,O/:¾×ÖHxè8ðî†ô@ÕSX¹âÒ)TN$±¶mÀ W<‹ÊºÅT‘›ƒn…Ϻ é¹x ¯=S"{|?StKï@ž¡’_WvþËéÛrÎñoz-Þ‰®‰Í:Ý’|fÞòÐk$ˆyÛárÄN X~ŒÚùØò[x^ ä<€žp¿9>Ôª[Ä-Ý ¡dhøµV\¾ûg•GO=Ä1d¢`Á#0êtþ‡·¦ÆòGF iƒ´æTTpÀ»©þèØ¶! Y„Ò÷ ¤~qºÑY9õw—ø޶Lü;Axß™rí'·åÌ9ü©*c«4½üׯBUòT'v×NôsŠÇ-Zt´RìÄpo4ÕŸ^)N¢KÉØXŠ:¹vö)œt=«DìaïÚ|œIÍÎxÅÇÖ÷àƒoÎÀpjGÓíPr£sÜŒÞ{e|Dn<§þÒ•8Ô0¿þë̹ö‰ÚrnÏtÖ.VŽ·çÀŸ*ÑÙºÑ z;ÿÌ÷MõEO£¦ilðoïLI[Î:Ÿ>f'›G?ÎüðY^ñ?±à¢A|BÚž×°õ©Y:qÇ38Ê»—:4Üòɦ•–ÏćÏß»#s¾³îøœúÌ5ÿZâ²fÇLœkçˆ ¦è™ÎÚh®Å‚Ë»ñÉ©5z=[o¦×*~í™Ñv5‰X·qÂz7ŒF$â›n× ÇzطѳK¦ô3æÓÓ§M6ß}¦’“ò¬å¼!Ûîô;bÁi'Æj3ùò ×E¶7“lårêzf\c³O”k?ßÏÄœaûyÙ÷°ükËÑ·ë¡‹ß^åm²J3HÀñ³½‘"·åj„m­ˆP×(ÓV±ÿØ^˜,žZгóénû?C5AèÄç»yÍ¡¾¯¿µÓÂ÷½SPÆÁ ž°Ã\ò&+ÃΜÂ$*×>á-§ð™BœPއ±ñ%ÇÙÂÀªf£ì’·`ªþ5>~m=lx ‹@/‡³5õ]ë±·kýq×öí{Þ9‹¡ú–çä|ºv.¿î›+m/ýî×Y'Üp÷¼›#&“ï>û"1ÌL½q¼ÀØZû˜g|I¯\•wR¸tª0j²åL9ü¨ã ¶<ƒ¡Î¿b­,µ¤™3Ù=2kË£pt¥ØºRM‚w¾¬äêñù ñ=lx/8"]þ æÝò!®Ù‚ÜßçSÅ©mW¦8dcëPv̓|•“°Ø÷ôF˜æ<J…°·¶}᫺:Fœ*ß=ûSÅ“Bã*”b…6;±ÿ/¢~þB¸vÝ“º‡áAx-šÚy­gÊáçGÇÑmäW ë`¬˜=çÓ@×p;0ð¿yÒ<K±£{îçwØ€e1d"n?øðÅçPÜ´ ÁÞMãSù– (Úàî[Þørm†¬ë[P4£΃­è;ø6ÊÊn;çáÔ ½¶ÄòL>ó…ûÖ£õƒ‡ÐÅN䪲ò,òèÜd›÷s-T|ë-º&;ÇF´¼qœÙ]‡_þ$“L œ2×>A3åð!MOú—ŠO)Ð²Š‡0ïÒûxÇãlYæ·îçÛÍm‡6õ×SSÆøýt¸ÝëÐúîý"¦¦gW_¹…FÀÕÍÍ[¸ùfÃIú©«¹5õvà-xüç>¨tÆ|z»Ù;¹©$“,òêŸbYõ?Æì›è“õƒdqþQ:+—µþ–è9Ðs%z®üC–ÿC”Õ@Þs$IEND®B`‚maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/information.gif000066400000000000000000000017551164564726100313170ustar00rootroot00000000000000GIF89a÷1ÿÿÿDªŠ¦ÕzÖI„ÊáëøḟîAk·¬ËäJ­ö)—íN¨yàþîßlÕÕÿ#„ÚTºŸÄðrŸÚ¢ÿZºünÍWµÿÿõ²âÿ&­ÿ™ÿkÞéïù/}ÐL³cÁ©Öõ3uÇ{ãÄÐìvÕ<§ö±Èì‘ï`¾]ÃP˜ÚN¿ÿ÷$‘éaÅÿ÷òïÞQ­q×&zÏÿùì{ ÕÕîþrÏ B¥•©Ô´Ëî0…ÖX¾O°øšöOµƒélÇáúÿußJkµ yÚQ«%â*™í”÷!{ÖmÌJ°_ʼnïûïãfÌÿI²ú!J­”Øÿ¹çÿ—ô{¢×ÿh,!ùY,ʳH° Af 1²Ã @|<ñ!D% ¢ð ã‚E$8Ñ‘Q 4R²È…ÈN ¼1 ˆM62àxðDB€†YF¼ A´Ã… ‚@à%B¢^©FJ>flrŠ×­I¹Bk–\¨M’!ƒ†±4ž4ÍBAÁ"Ĉ!Â&£‡¢$°Yƒ‡’ÀØ@ら#D}ð(8aÀ”€¤b³Á>äÈ1Ëc‡° ;maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/linkext7.gif000066400000000000000000000002461164564726100305310ustar00rootroot00000000000000GIF89aÄD™Ì™@Ä*ApAÿÿÌwhÞFïVRÏ7xN~N‹ö\\Ö=FÉ/vçNEÈ/ÿÿÿ!ù,# T$ %ò ÒCá)P,Q”/Hœ ˆ2;maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/logo.png000066400000000000000000000351171164564726100277500ustar00rootroot00000000000000‰PNG  IHDR¥?´Ÿ¨[iCCPICC Profilexœ•Xy8Ôo÷>Ÿ™aLvB™È¾“}ß³ïK„ƒ±Ž±/¥B¢D”¤¤B!’D”Dˆd©H)’%%Ê’/²4¿?ôí{]¿÷zß÷zÏ_÷s®û>÷yžÎu6^o %!¡‘T{S‚ë7ö 0 tÞÄо­­%üÛX`@Æ›B ~|[ü2¡‹­ã¢é{¿™Ó´¯<Õõ€" œþÛX8}¶±#pÆDR"à$xû ‰ Mu´7@Êï¿ï³»Mô@Þг‡ú’C°sô:¾¤"^|}#ˆ!øl”lHH˜/k ˆ)ÔHÖ/ ãzÀ°Ý²7@ÍëúOŽbp'@(럜È1€rr?ì„»?ÂOIfº4ÚQlÀÖYmã:¶U €h &FQ£¿‚ôü·óö@À. Á+$eŽÞa ¦?ˆ½Ë¸WËìÇï`»ÂAâ’æþÆ{…ψlWÐîïâž>a…½é"cb â‡%º¤ðÒ2¹²/ätC”.ìkRUYQcQߥ!¡©¤¥ª­¡£¡«ª§¤/k a(dÄgÌiÂlŠ1ýµÕlÞü‹Å¸åˆÕõK›^Ûn».ûN‡NÇN§.çn—×þnoÜGNxÌx.x­yƒ#‘Ãw7IÒOÅß À†ìœ’ZVEyÞE}19µƒeˆKOT=¬{Ä8Éü¨Í1ûãNÉÎ).©.'œÓOÚ§ÛfX2?mšixF/K;[ó¬ZŽj®Ê9åóÊy*TóÕ/jè\2¸l\hvŲÈöªã5×닽J|Jýno—…•‡WDÞŠªŒ©Š½Ww'®&öntmä½ðºÐzò}bƒG£ó«‡†Mêdš³¶@Ë·Öá'mmíYáOí:åºp]SÏšº³Ÿûö(÷Òõôõ¾Pz±ùòÉ«´óA–Á¾×§‡Ìß0¼i{dXmxé]Å{Ÿ¾‘W£ >ü«ù0N;‘5i:I›ªÿ2-2=òùü›ÜLçד³–sœsßîÏ™ZðZ´[²üa³ìþWÈJÚê͵ޟk›Ž[¿Úi4èFüPâ¨Ïè>L/Ý V™áŽŽé"‹þ k»Ç×a.Þ>1þ‹»0»=ïhB¦Â©{[E6ÄdÅ=%2%¤>Ê e…ä4å­<}•öù)RqV5USQÔ`И×к¯] “¨ë©§«¿Ç1˜0l3*1>aB6µÚ/oÆm¶i>eÑkyߪØ:Çæ¨-ÅÎÛÞÁÁØQÍIÊy· «+ÚuåÀg·a÷çyÜö¼ê•}è˜7Õ‡Htô5!©ùIù8ɸ@TàzÐrð÷¯¡Óa“”ñð1êhÄûÈᨡè˜þØž¸®ø' M‰õ‡o¹™Tt4ïXæñääø”°TÒ‰ƒi'ÍÒõ3ÔO)œ–Ì9#˜Å—Íu–-ŸËtŽá<]*va+ýâjÁò¥…Ës…_®L]}wmðz_qWI[ióÆ›ue5åÕU·nWVWݽ}¿ºéN[Í󻃵£÷¦ëê×FÆ;r6ñ>âkæ{ÌÛÂÕÊú„± i[iŸí}Úßù¸«êYAwêsJk¯^Ÿh?Sÿü‹W/k_åPí^Ë ± ;yööæpê;Ò{“‰Qüè_ÆÆz>6WO”N^™*ø”?}ñó¥/E3%_+fk濵~ïž\ø°øuiuóçŠÈªêšùÏCë1g6olµü¥Ñ€¬á:ÂŽ”£¬PkèNL]}#ö#Εéó"ÞpÇiÖ!vnkÎx®+Ü <ݼC;ßñ½ãèÛÕ¶»^°ŒpaOŠP˜°Ë^-‘]"¢ƒbåâq&’xÉ—Rg¥­e°2eÃär½òq " =Š‘JüJ-ûHÊ8åÛ**+ªj:jãê)âÏ5ôصê´]µ×u uõt'õNèKè÷„r6™Œï™x™âLïï'™qšµ™GXˆX Y¦[iY-X—ذÅÛ¶Û%Ø+ÚÏ8\stsbwêqNuÑuùéZ{ ÄMÜm½ð «‡GŸg†—É!Ô¡fïuŸUboI™´ê×è8À€Ì@îÌò – ^ éÍ ó¦ÈSháýÔ«á‘Q\QŸ£Äœ‰õ‰SgŽOhHÌ:L:¢•Ä™4w´ãXáñ˜dÛÉTLê‡içO†§[eHžb85}º=³øLr–o¶ÉYñ¦œ…Ü×çšÎç¾è¢eÆ%ñË<… …WŠ>_¿6z}¤x¬dªtîÆZ¶œ·Bú–a¥{UôíÜêš;¯j~ÔrßÓ¨óªO»_Ý0üóP¡ÉëQvsÛãõVå'QmM¬OC;ß=óì^î¹Ù—ø"üÕéÁž7zÃoGJÇò'j?­ÎøÏ--D/ ¯.o,ÐhÛ³€^ oÀõ €/@†'€Øî2[Gu@d²P HPêŸùÁò`$8à<ƒ Ø@8ÄñF<¤éCfQŒ(qÔ~uu5„ÚB‹¢íÐGЕèQ +Æ“ˆ©Ç,ÒÉÒ…Ðݦ[¤W¦O¤oÇâ±îØrì:ƒC1Ã&£+c=Žw7ÍäÀÔÆ¬Â\Å"ÆR‚Á—íÝQϪÏÚÏæÉ¶ÀžÂ±“£†Ó‚ó3W ·0w;/Ž·z§ÓÎM¾R~[þ ò].»±»ƒ» ƒ{2„ „6„ëö†‹ÈˆÌŠVˆŠK‹ÏKÜ“Œ—Ò—ÆIÊ\• •Ó–ÇË+Ô)žR"îÓVÞ©¼¦òVõZ‘zšEó –…¶–޼®¨ž >Ÿ¯!¯¿1ÁDÌT~¿¦Ù~s ËX«SÖWmêlŸÛMÚo8r:É:›»ø¹¦¸îÖæ>åõ”ö²?ï]ìÓOÜ$Iú¹ûg´’Wƒä‚É!¥¡“ápµ"b1J3:-f(N,>1aà°Ì‘Œ¤Ùc6Çï§¥æ¤ÑŸLJß:u4w¦ [álnäyBÞ@þ™›Ë¼…_Š_+,>VrÓ»Üý–GU@u\ÍÙÚ;u¯à\“Os~Ë«6|‡UgÖ³Á¾€÷^»¾)ž‘øpàcüDúÔ‰iêë¯ü³ÃßNÍ+-¼Z"ÿøùWÊ*n-w{ãÜÖŽ_'~Ï%°… HƒkÐC°ˆ0#¢ˆ>âÄ!yH-òYD±¡QN¨8Tê)j͇6EÇ ËУŒ%& ÓN‡¡3¡Ë {A¿“Þ—þ°vØRì&ƒ3C-#'c,ã8Î ×̤ÄTÉ,É\É¢ÄòoÝAeű–²²M²§qHs¼æLâ’âæNçÑàùÆ{u§_+œ€¢ÀÜ®²Ý$Á½‚Ÿe{B„ö ýîÞ›/ ª)¶ClZ¼Eâ’d¬”‹´ªÌN™ Ù1¹vù …lÅ%¯}û•UTUWÔ>©iti>Òº§]¥S¦[ªwC¿Ì Ê°Î¨Ùø¹É;ÓÙý¿Ì9,¤,¬<­ãmòmëí†ìWw:i:{¹¤¸Vxéöó °‡µg‚Wù¡aQÇ7‚tËo*€@ö ,  %‡ÕPÖ©ÆÙ‘£Ñ’11±ñì ^‰•‡×’ŒŽž=6š,™›Ú™Æs20½ù×éÐÌçYRÙYgWs‰çòL/´\Ô.h¾lTØWtðê÷ë©%„Ò–›¾å,*ƒo UÖÖz×IÔ/7´=8×ä߬ÙÂÚ:ÙVבÒiûŒ§û}OAŸã ¦—Í¡¯ù‡ž¾¥¼ã}ß:JcûØ8á3Åü©î³× Ãך9·ïÈ|Ù¢ÍÒòrþŠæêØÏä ÑÍÎ_~4ƒøC:Ü‚^˜GØ%ĉGŠdÅÒG…¢® ^ éÑ:èôC4 c‚ÉÁŒÓí£Ë ›¢×§¿†¥Ãcß0˜2Ÿ1¢EŒ2Æ£ÑÁ¨ÃáÌ>ŒF£‹ÑÄ(cÔûæîÏý©jø§ŸŠS@ÿÿ׫ ø7P!HA0 Tñ"ÿGÛ»:=+Àeo€ýrˆ$ÅF†Qâ¨dÿ€H‚>…L"†…P¢"ITi‚Y(QVš (/¯ ðQØwÏ:(Y¥ IDATxœí}w˜UÕÕ÷ZkŸrûT¦ÒfdèE†"JDcÅhlÑĉš5ÑÄhäÕ|±D|+j4 F, A(]@@‡230…éíöS÷þþ8w.—d”!ß÷¼¯¿çþqÏ:»³öÚ{íµÖÞ…ÐÛ¨o V7wÖµ;"º`Œ²Ó¼…Ùþ9é9iÞ^¯î{ôR/–õåÞï¶såæ=_×µ¶G4Ûæ€„À0ær©Ù¾‘rÏ[|Öè¢ÑûôbÕߣ‡À^‘ïv=½pUÙæ=F\EA—Â$ÆCƉ€H ÚL‚ƒÏï>epáugŽºô”—ÌŽ¿ߣ‡8^~WÔµüîoï.üd+@¯[’$ rxŒŒ%ÿC%É{Íâ–€q'åßwñ„KÆŸÔ[Ïó=¾ÇÅïßYóÛ¿-iëcš1t˜J˜%D "P’IQ$&1D„ï1n ŽpÕ†=vÙ©Ù~W/>Øasn™†ªRç\!„@ÆŽ<ÁY¶ÍmKQÔ#ßµl]׈Èår!"$ DÂÔŠ€ˆ’ º•ƒˆNö‡ïÈoÍ0çÌ}ëùEŸ‚ÇÍT‰€ ³,S=¢¤@ ïÇ2|21Ź1LûÚDU+êÂí–T…A—ÐQgÜ[”óÚ gŽ(Èèõ'LÅÞŠýû+wO?û,¢ƒ“Èæ/¶µ4Ô;oÁíveeeŸTìóR3îØYÞÑÒ8åÌ©‡ðòìò]»êjjµx=÷Ð!ƒûµ´¶o\·¾° ÷äq㜔6矾ΈG'O>Ííõmݶ£©þA×û·lk\éÉy…'ðù¿›¾ŠjWüæ¹Wn… ?1ˆÑÖU’áC‚”†§°G*ªÏ Ì ä’ܺáþºYYü…þæÆèþ6Ëç…P Q–ßýU}çùϬxç¦é¥ý³zý!€ººÚŽöŽÖææœ¼ü$=‹…#‘¬¬LƤ`(ÔØÔ\W[7åŒÓ}4'eóúºÑPG°³#-=3™Ñ´ìuk7ÔÕT¾‚‚ÐØØh˜:X– 3ÓýkFµHذx< †iY–»DNÐ nøüÖ óÊß<ÿá¿¶@V€Ð tuÚȺ{Ï/Ÿ>,†.Ø~à>ˆÄâ‚âH1 ¸*yÆúÇûæÌ<·FûÛ§¡M¤yÈé.·ÒÖ.{qõ²[§ÍM;ÚÞìhk¤šêêT~Œ=yTfŸÜX,¾ù‹­jjª÷ï1úd'Assk8ä\ÔÕÔ¤ò{÷®=j«óóúLœtŠ×çMÓeYDdŒ9CwjEŒ%ÆBÀÇŽ•›_˜bN8¿éØIÅýcÙŠMá'@$²mÙÍðÉËW¬üåg Þ‰Z»vŠX»0[…Õ*¬V°Û„Ý&ìVa´‰x³6÷Q:~¡´êîœiC=špf-@ô¹”ú`ügo¬ iæ‰xÔšê‘‘‘ÑÐФÅbÝîr!Àãq÷ëß4MOÞÚ¿¿Z‘¥@ ½¶ö€eQ7Ìêýû]ªròØ“f€Ë¥&9 ©“±Äèð¹Y’#1sŸpvKù^ôñÆgÿ¾Ò„„¶-e¸¬·®~oæè}Aql D„H¦Ð€t`0 ¸Ä…iaHÞdzô&ï]K¤ç×i"@ x”M5|°ýÉKÇõîs†YWS›•™Þ¯è¤õŸ¯=PW{Òà!© >q!š›@¯7aŠÄâõúæ¦gç~±qCScca¿þ …£ÑhNvzFfæáÕ…"ѯ¿úZB€¡ëYŽ@Äöì©ôÔ5Ú¶íñ¸† Šø­ÅïÛâ[ð»µ#üë¿.UA†€È…ä–Ä?~¼dFñ~£H€¸’ ,<ÒC`€àL€ä,tåæ)*ÿÛ,Q~nH÷ `†W}yãþ G÷›V’Ó‹ÏÙÐØ ‡” ,(,PÝžššÚâ’’äûEÂòò=ªZ †ZZšý~¯#åPWw@ÇóòòÒûä2I©®®vø­†àÜívÃQ˜Ä…ÑÛw €ˆ²,ËÒAé'¢ÆÆ&!„móŒtÿ¡ƒVT/â[ðûÉ×Ëjö7af‘XÊ£ÓV̰?Þ(°mÐH¹tPo³4À1°4à&îFW)œ«xÂ_/É®ê OªXÀƒ€HŒPðG?Ùõƒâl…õÎó €êý5Š**²”—Ÿ_W½¯£µ5³O¢K!RSc3\–å‚#‡{ýà\ÔV×x½®¼‚|Yqe÷ÉijlŽ„‚¾@#¶ÍV©eÙùy}†É…@›Ã–/¶šZ<Ù&Û2'L:%;7OpN„Hÿ »SOùÝØœÿÎð¹…å:ÐÞÛGl‰A0 дA ¸ûôkÒ‹×ìÌþªQ†‚Zq }JÖîA®V†µ@hq«mw¼bwt˧i“Î}êG§Mˆ[(3D¯*¯¯îø ¼ñG# zå!ƒÁp[K‹"+••û˜$éZœ QS]“ä·°íñ§ŽKÏÌRdYu\·´¶;:<uWùDâ¶e˜V]míÐi[R”P(d™†$+‡W*„P%+;;q @8¸únËãq÷Ê3ö=å÷Â7¶4v`†K1ïý¹¥)ÂM6€Þ‚~ÁÌñ­´`]æˆ PbÀ$d”剟SøÕ=EïTê;¸3ÆÑÒи襢É{o™tíC«²ÒeÛÑ\£W7×\4¢€zC…©­©µLCU=uu„Œ1EUë†ëš¢º@x½¿ßß-cMM€ª«kcL–•ººƒ‡ ø½-M{ö1ÂI¯é·LO×ÜŸjÛ°mG2°ôÂã}ôˆß6ç —oUN7W4ð«RS8 È€8ØÂÀè3vŠ W?“¶u¿¢xÀç¶’d‘.ä7k'Ô<öéA . ¬í0[€Ðøñš‹O¦ùÙwG" #¢Ga¿n Ìé΃o Ó²ëêê$†§žzŠ?-ÝáÁ¦Í[«++ëX|!ãW*bq­á@½Û¥L™2ÙåöbíÚõÍ õÍy…}‡ÖÞں󫯣ÑXN^ž¦•^—<åÌ©p(³"IC ¤ªªýM­‚ àÜ8p@ZƉµ8õˆß»÷5nÙ] .1qeáv36I ,@Æü“/«‡û0ÖvJ^?G$Drú‡óc$ÒYL®ŸUÞ*÷7/P6uZ L6˜ ²¿XunŸq¯±sdÔ€ˆˆB_YÑzüü®ohììh›‘•$öëׯzß¾êýÕŠŠ¦ÍøSWw  T”4¼@aß¾õuµû÷ïÏ+,,ÈÏ™0é”Ûwì­¬Ú³·UEé›_ì¤BqH\p‘rÁ ÖÔÔ%û™e™Y™é'šß=²§¾úþÚëî}^dŒƒ\ä ®:e*›‚2@¢´©?• ;ûO±OË]>? :èãL’(Å}¢£«ù8çÞ,³]ÓÀÖë Æ`+¾®ÿS "D¢¨-fÎyë²±Çù„Ñh,‹y¼nç ëݶy0Dé‘HÔÐuÇÔ•š1Žèšæó{]®ƒS¬eÙÁ`'#JOODÐ ££½C×4Y–ÓÒ^Ÿ Ó Cªªøºæ!  rn§§¥cápÄ0ôÔñ\á÷ûŽf¢ï-ôH¾7µ‘@È'ûš¶å€€ Ó/RG”¾ûiã§å> ii>wİ-Ëöy$gnv“YËsæ‡ÎûƒüzÌ0AX q¤W 4ìó TÑDY¢ŠöxÔ´½Çç0õz=^¯§‘1ÊÌLH’ßï¿ïðŒ~¿Ï]’XVÖ!_UQòòr»%Sd9+ûdˆž~pœðû}G¨ôD£G žª­À  •(m ƒ­ƒ¥ß߸³!ÞôæDˆ€DH3¬’‚ÌwîºxÓŸ¯üðž‹/RÔ°‘€ÈÇô¬ÉM¦YÀmà&Xx4kHl¯ÅdglˆZãfcX?vû¾Gql~[6oìƒ$¡Ão†} fiÀãäI;ó2€p¤3úe,)N‡@Ó9é¾÷îùÑùãŠd¦ëûÛΙ6¢o̰‘eäõ˜³Ó ˜€&h™Ð/^/ÈéXHD:‡¶¸õx ÿ{pl~놊 8`D´9×Á gÔd9' Œ¶¶°Þ#‰¡3”k¦}áøA'å¦' a„??s„ B ""X(7ò\4!bûÂ<(W½z)aNGBK@Ô²Oäãÿ§ÑÒÒ …þ6àØó·ÃãÄtSâq’ì/F;ð(·cÈ‘]'ƒÇ-w+'Í­0"ìòxÐxY¹äMåüv–ʼn!1E6S<¶„H$‰€Èj]]ݪU«¶lÙ‡‰(//oôèÑ£F0`€ªöŽÞ$„hkkÛ¾}û† Ö­[·qãÆ—_~ùÜsÏ=ZúššÓ4‹‹‹OÐÒüØüVI–8‡„µfºeè5?CÄPDÓ”_åñ8“QUå²íÕQÝôª¹¾ôËjˆŒœHyë/H’ &18$rÄ|Ê ±2jšöÐC½ð ­­­Ýn)вxñâ .¸ W*jhh˜:uêÞ½{™²³³óæ›oþðÃ-Ë?~ü /¼0xðà^iC*Ž1žÿ{kÅ…wÌ«¬oc.¹KÊE¹§EÁÕ¯0ì(XÑ oÛ°¼n3Gz]ª\~ ãæ—?9Ѐ°f>Q¶ã•ÏöúÜJÒû)ˆT´]h*hË`Ë`+Â’€w-¥î[½YeGï>s[[ÛøÃG}ôpf@ZZÚ„ z«.Ã0êëëS)G\!ÄÝwßýü# Åb±5kÖ\sÍ5ñxüð”lj£Êw0ðÙ÷潽Ʋ9ó{qgDb7ä6ërŸ¬ð0ˆ°°£(…fÜU¶w ’át ¿G]¸~ïš=C 3›ÃzycÐëRˆ˜d˜v]‚cž”¹QfìË–ØõíYœùài}¥÷B€›mÛ7ÞxãªU«Ž–à’K.ÉËË;þŠ8n±c&kmm}ï½÷R)ëׯ߱cÇĉ{«%Ž,ß;öÖMûÙãO½ºÜ’%æw;Dˆ(!od[ínÙ;vìÄŸŒÚ8¦°>j¹’³¸×­¶GõÕ»*šC~·BŒ’²ë¨6fSԖ–1)n“ɺˆÑ-3Ÿ*-¯^ô~Å;•ÇÿÀ¯¾úê»ï¾Û8hР1cÆdgg#âUW]uüµ|[0Ɯ؇TN9~ß«7ïž~Ãã[Êk(3À!`R(»d‘>¤Q ƒˆ +î•Ûžš¾H&a“*K>·âR¤dv@4† ÔlÌòPi¾y^QÇåC:.*M,tgºÉä2I³VJˆi.9bñÛV×=ñeËñïØ4•w‚†8?£ïÞg§þý–Ï®‰pÕÏ L™“¿ˆý3ÙyÃÔsÓ¨¬ÎL©‘ñ°›Ë£[iÂþ ÿ쀵¼Fþ²ƒÈ#! Ub2ÒÜ­­é®Ñß1¦ñ³Ï>Û½{wòŸyæ™+®¸Â¹,,,,,<±á¡ß€¹sçZ–µxñbÃ0¦NúôÓO+ÊܬljCø]UÛ2ëWóZÃqòº!!Zh™ÂãfEù¾ò†¸¬0 b(âŠ÷ûÇ|ªmD<<ÊmÎu¸nÐçÅrëïwÌú<8<  !9$"zô‡Þ+K•,?-F̨°"`Ö‘¹2Ç=4'ïÖ‰ý2ïûWüÄvÏæv% ¢DD 1M¢¿loÏqK?-ù.1«W¯N½<ùä“ò“Ÿ×ûë=¸Ýîyóæ=ðÀ–e¸nwpîeLü烥n™ÙÂѧȭګ÷澺¾¨í`G„­ ¸ Z ÎÈÜ]6qîCE‹L Tö"DÔmô¹0+AÌZHXaa‡…; \Âíeö®_ñPC÷Ìæ’sC¿38™@]Ú"ùzh[ûÖ¶ïbgݵkWêåé§Ÿž^øÿrssOèsP¾y~éºM嘙–P’ í˜5~DÖ‡&zÁÖfOÉ|©¬]ö'ø§(ö=”N,Ø1"«–;QJ ":€aß_ð^ k¸µþÜ.´œÕ» øÛµ±yllnì0Øa°CÀ#ÀÉKûì³xë­·Þzë­·’—«W¯ž2eÊáÉÊÊÊþû¿ÿû“O>9ÜêóùN;í´ë¯¿þòË/?fKŽˆ¿üå/óçÏ?œ~饗.^¼ØùˆË—/ÿÓŸþ”šà‚ .x÷Ýw8>-Z´èÊ+¯´¬ƒ®‡Áƒ;sY‚ÿÏ_ªÇuì²€Û¦è›ëyûOó3]"fƒ0„*)Œß7dù\æŽæ~ç-ºý«æ…@XÀ-àNƒ m:œÅ¶?ê~Þ@ˆ9Ç>WW³v[ ¶#kš±Ê »<˜UÎfƒb0*–Y kQrtñÀȽ#;£6ƒÄb<2½º/Öa5\0‰ž&OÙÑÑqíµ×Μ9sÉ’%G´{G"‘²²²Ù³gÏœ9³ªªª‡õ¤y©tDüÝï~7mÚ´ÔK—.}ì±ÇÏXYYyë­·¦2[–åW^yÅ1*l-¯~Õ—à÷$,_$àÙ;O.îëq Ð…hô״΋›‰÷..mG[¿³—Þõ÷½“\*Þ%å`A» —‰5³Åаp'½ L¢—vø·Pï_?þ¬×L_}÷9ë={óKgoë®Ú¶DGxl Sh;^a “ý¢¤ó¬üxÔ–(1ºPuŒ/­?ÞÒººº3f,X° '‰ËÊÊfΜÙ»iÑ­(Šòâ‹/ææâhðÁ׬Y“J1Mó¿øE7»á#éëÖ,H,ç¼²ØÜœvÁ²)Ïì*­ŠfÛ d(µfßW;g_Ôò÷‡¢wȼöK£q'Ê.PÀ¯‡´»$à]ër•ÑÒÝ>VxÎái=I gÍšµyóæniÜnwß¾}ûöíëóuŸJ***fÍš {XÝ·m^QQѼyóR)¦iÞxãmmmIÊÃ?¼råÊÔ4çŸþ]wÝ•¼$M7?ú|'¸p–ÚªGþíì°¸a‚~âCví‹yõaE–»|þ $Eâ>E_Ö2næö¶†x8ØV‚ëqxŒËFÅc–c2sÜhDéªá’¸ã@a$T2Ó¥Cñ„yûÍð7CgÖžå@ CØ4*=>#7³›ÈU‰¾ó=‘c8LKKK—/_^VV¶bÅŠ]¤fÍšµråʲ²²²²²åË—=:yëÎ;ïܰaCjâÁƒ?÷Üs_~ùåŽ;vîܹcÇŽ… Nž<95ÍöíÛ|ðÁonO7Ì™3ç£>Z¹råÑ”ŒT\z饷Ýv[*eÏž=·Ür‹ó¿¬¬ìÑGM½[XXøÜsÏ¥nc“¾®ª¯¨kEqøÇu>ybÎÉ%é [<<‚Jø½ ÖÝ ªd EÒXF‡˜H3äx£•ycíïçýÁk…’\,›UÒ6›ƒÌºFu"Hmv]ÎVF"›:?’ÎÏq×=\õ’˜$pÿÌîÛùak†p¢! C7tXÃüß´¦ÊÊÊš1c†ó?óн?ÅÅÅÝ&EŸ~úé+¯¼’J™4iÒ’%KR‡Ó´´´^xá…W_}õÛo¿¤¿ð ·ÝvÛ Aƒ¾¡I©>|øðáÃà7ÞèIú¹sç~öÙgÛ¶mKR-ZtÖYgýøÇ?¾é¦›LóàÖ;D|öÙg»­îhÇž:K3%| ð¼SrAB!¸ <‚ £¿^è†;ÈÍ´Cq#¤[&]‚ŽIûÚ*úkç¥nžÐݸ † òڇeFLÁ€0i`GD±DÐäKð.׸@L‡à¢ôkÿ-ÂöJd]þŽãÒbÅ^Ó¬+æw„z:€m2¤¾T<õÔS©aœ@`Á‚ÝæN.—ëÙgŸÍÏ?¸Û4‹ýóŸÿìy“’HÕ°¾^¯÷¥—^ê6›Üwß}çwÞ¾}ûR‰sæÌ¹ð »e§]5Í}”€¨² CÒÁâxìÈ‘ÅùÞÙíJšE)nòSÜsÑÄ[gŒÉô»c¦ða#ùY|‰1e¿ž)9òm¸TÕŸ58Cì:‚È@Déó» ¸|xD4Eb·$°%õm×Å¢µ’Ñ@·d h&8Á¯(3¬Š «WO˜ª®®þä“OR)?ûÙϾÁÝm1ÖM‡êu”––vÓÌ[[[×®]›J™4iÒ#]?^N^^Þá«óÆÆÆÃ—ïUUUG ‘|>€H$0jðH<’®DÁv~1·Ü90#VÞ’ŽÈÑ­H;ëÚ[úÅ}'‚¼¢†5÷Ãm¶@JƧ ²jÍ(x‹!P¢‰h+Ê,®Y «h"x韻[g Ë““Øæ³­%övE§GNX^9IiFçÞØà îÚdÉŽ±ÇI¦2tõÊ&Ò.tó:3ÆJJJ$IêáAVœó3fôr<ÊËËo½õÖõŠM›6Í™3çÕW_=b.©o^&:ÁCDÔçu­}ÓãŽ| ;‚Røì’Úv÷2­ØãRzwCEsðœ“Ftë•Ïöl®ió'b‰“”ÑÒÈvÛ9§×€‰dVG|¨.ŠuŦQ§aÏ~×U#sGd{wwèoîmZà’™£®Kî“ßtéÌá7€€=q/ÄÏÓeúÆå÷·Fvvvê%cìÍ7ß>|xÏù}¢gnÐ4í†nHµ¬¥bÁ‚S¦L¹þúë¿% é›Ýå„@F¨k°­*8©ÄHÎß k³GmýËç£Û4¿Ê cn†¯¯Ýóúú RdÉïRº”>ˆ’÷Gñ•ƒôzÏ4`^°¢€–ÎaÎB¬K§C£˜%žÚÒèl%ô*’*±„1‡Hqió,û‘Ür€"bI»ã^EJ„5Z@ýÝèîU~w3•†QQQ1vìñn[ì]ÜÿýÝ`Ýð«_ýj„ £FêF§Q%…äRD×” {KLØQäQ°#À#ÂŒçjÿ0å#Ýr3#aÀ£¥È’i„C·Ä­ÇbÿgìˆÌ+ B[É„uícviÅ*YޱÅq´b”í* ƒ®ìQí笻Ï5z0ðN°ZÀê®òwÚr,`DD‚PexJZ/ó{èСÝÄâƒ>8&Ë{®å†ñ[555·ÜrKê䂈ýë__ýõqã9ÔjóæÍ÷ÜsO·ìäs«g†å,¥)ù^{¹ÓZ»½:Šð°° ¡Á§,üÓ¸wl¤ í³QJ(ÉD™Aj¦ˆ¶—ÅC}¡ÀŠ‚­ƒ­ƒ0€kðbóe%ì’KALCw ½‚›„H¤É¾°š1­~ÙýëÊL·¦Žî±z°ÚÀjEÞT¶Wvf{$ç¸#0•xi”·—ù­(Ê7Þ˜JBüâ¿xê©§ŽÈªÖÖÖ›o¾ùŽ;îèaù ß¹mŽC¬[ ·ß~ûE]$IÒüùó»I2oÞ¼n6€ŸÎ/¹N)’ýNZóT]ç»»FQ‰ .,,~7|éÊÓ·6]ÖtPâÂC·`l6ý¾§Þ5-ûË0‚®×Á6ÀgÀòÎÓVÄN÷±8a =£äòü¿šÌ60ä1æ‹Jþ8óÈh•×?²åÆ?¯ý©§½Å}úp9  ½ì6´Û€7?ÓÐ?ÄFŽvI:ÐyY¨œ€#¬®»îºÒÒÒTЦisæÌ9å”SxàÅ‹øá‡Ë–-{饗~þóŸ—––>÷Üs ,øúë¯{RøgŸ}ö6wîܲ²²TÊ„ æÎëü/--ýóŸÿÜ-Ëí·ßžj“‘à´§O(Y¾i¯ä“@FÞîJL\øÔk¯¶m¡¬3„w › ®ÃÄ´ª×F<[J¯ç57èet „†,IÓ„t@ ˆ—A0pqh²üEéŒÙŽíÝBõ§®EçãŠi|E…^TeÇm—Kõ UåwV³ãÀòÝY§gA´ÀB¹íýÖ)K;ûe˱ÕX@.¼øÄœ™ïr¹^|ñųÎ:«½½=•¾mÛ¶TÇT*4M{ì±Ç_ù|>·Ûº ^ºtéÎ;¿ClùÊ•+ÿøÇ?v+¼›Ýô¶Ûn[µjÕ;3¤´´´\ýõ+V¬pÖ™ŽqîÿÉ4I’¸Ççá}¹Ü ÙgãN¾¾Øû4ÔýÚ7B¤Z÷CK x;K[ËÏhÙ2¥}ËÐØ>ÉÐ: Ð4à:pllÈÔñ×ÑßîâƒÜd8ŠX<”m°²°ºŒ}Ó#+Ïmÿ`JÛ§‘j݆ œcþ%9L £¬vû7…sl:_a<á?%Š ¼"ûôžµÆŽ»lÙ²¢¢¢žgY°`ÁÎ;»322º)üÁ`ðÒK/ýøã¿U{š››þóŸwóï=þøãcÆŒé–ò™gžéßuX ƒ5kÖ$½ò‰ÑðôÑE?;w‚ÕË*BOe_ôZæÌFhßMeÐð´|mk¡m;´ìƒö6Æ!¦ƒ¥'ðÄ0®ƒ¬Óð^ó×ïó™KÎôHpçIÅ2,lt "6„9D9è6Øpò/’¼'ÅD´­f䟇ßÚxG\*qÇè8‹WÁ?y tÓªŽæqpê©§®^½úÊ+¯ì‰q433óÞ{ï=<”˜ˆ®¹æšnÄ={ölß¾½±›rz©ëúu×]×->îŠ+®¸é¦›oI^^ÞóÏ?ß8wî\'ú1%ùúk¾ª)¯o÷yÝÈT´)¸¢EN»¥i™,ñ¸‚·ñ`Ø:vâü5ìú èPxý>“†Ñ®ƒšH÷ïü©¸¾ÓL„5:ra7ÁŽœicLˆ´"–H{5:çÉÈ]6Énf9Ç9'´Ý;½ß~Ùí(ÞΊˆs~Lñíׯßo¼ñË_þòÍ7ß\½zõ¾}ûRÕ<O^^ÞàÁƒgΜyÉ%—t“ª$®¹æšòòòùóç;n·’’’;ï¼ópV•””Œ7Îi›bèСÉ[+V¬8pàÀøñãK!DVVÖ“O>y´fŸsÎ9?üð»ï¾›\ûqÎßxãéÓ§r>ÓÆ=fþþ¨É]Žý„H0)*{N —ߨ¸lR¤$0T2 ”8JÏùƒ0 $\‚ÕþÉI¿¹B. ` º>a"H"ÿå{èb{Æ!ª¡åü¢Àã dBÖðäpqòÚ×ÙÓ|,&1ÄH…8ýv ÝXð]ÔrçSÉ·FDÝŽ¬þ˜¦ÙØØØØØèŒ ’$egggggcæ€ÊÊʆ†·Û=dÈ#Z×9çœó$¿SÛ¦išäœ§Ò…žl“°,+5‹iš’$u?kÙ¦½—=öO)Ér$ŒI^‰Ä_^Öô¯1±Ý4A.2@ $ $\Wúæ´ñ寧»Á;žÝd‚s0— ÉHd k¼´íRsÉÄè¿ûDQ2pçƒÜlš o›úÌ^'¦Û¤x¥89åQˆÓÕìÁ¢ÿô±„ÿcp„ó×–nª¸òÉ¥q‹{=jòS3ÀXLòÈ(NÒ”†w WçX- 3A¢vWv£§àëÀà¯|#šÔ\FèFÓ‰Eëö™‡sym&ç@[‘U•)ª‹¤„ÄÚ0{\EC[(Ÿˆ¼L#‚äðÀ‘‚®*`(¢^õüï‘ÏÛû¬¼îêyík §ùÝä°ª‹g¦¤š’ŠDFŒÙ$s&K*ZðdJb̈۠Ȓ[‘ Y"2²I±˜K0…Ȉˆ$â*™ t¾~ÓÅl ‰në/ÝÒý?G=_±¶-ü«×W¿»¹JQd¯KɯLuœŒ9ìsb/ X"MÄ~·rÕ¨¼MMÑMQ¿KV$GøHUò’¥œ¶‘¢‚ûÙýÅòéßËõñâçiþýó]}¸mg}§,3Ka¬k>>ʇňÆl$6ý¤ìßLPšçö‹_6½úukCÌr«’*K”òq"ê* Ñïê:˜ë’./”¯ïËÒ¤ï™Ý 8öù©Ý\¼©rᦪMÕmAÝ’SY’1æˆ& q"ÐHŒrüîÓ‹2:¦pêÀCŽ~mŠšÿØÓ¾d_°"l™e™ÉŒIŒˆ1èŠmåH’ä–Ù ¿tnžrIž”§~Ïé^÷øþØWõ«÷6nÜßZÙm™q‹;_h“K÷ªyiîa9É3'öM/ðÕá¯ÛbSsl}S|K»^·;-0"1bäQX–K*òIcÒåÒ yt€Ûøÿr|—ïÍq!ÚcFH3¹ 2Êôªßá ´˜Å[4;fa@¦,…äïy|"ñÑc8>¥vIEND®B`‚maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/mail_small.gif000066400000000000000000000003121164564726100310700ustar00rootroot00000000000000GIF89a ÄfffÓÑÓ™™™€€€ÿÿÿ¶¶¶íìístsààቈˆ¡¡ øøø¢¢¡äâãÚØÚ}~}™™™åääÿÿÿ!ù, G "Žä( Ä¢®ê jÌ31/QoA‚ÐØ!~ BâAp0v7†ƒð8žX!Ë O‚x¬cÎètZÂn»ßð¸¼;maven-bundle-plugin-2.3.5/doc/apache-felix-maven-bundle-plugin-bnd_files/site.css000066400000000000000000000030471164564726100277550ustar00rootroot00000000000000/* @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: normal; color: #000000; line-height: 100%; margin-top: 0px} h1 { font-size: 200% } h2 { font-size: 175% } h3 { font-size: 150% } h4 { font-size: 140% } h5 { font-size: 130% } h6 { font-size: 120% } 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 }maven-bundle-plugin-2.3.5/doc/changelog.txt000066400000000000000000000311051164564726100206430ustar00rootroot00000000000000Changes 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) maven-bundle-plugin-2.3.5/doc/site/000077500000000000000000000000001164564726100171175ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/ant-mojo.html000066400000000000000000000273711164564726100215430ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:ant

bundle:ant

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
buildDirectory String - The directory for the generated JAR.
outputDirectory File - The directory for the generated bundles.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use.
classifier String - Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.
dumpClasspath File - File where the BND class-path will be dumped
dumpInstructions File - File where the BND instructions will be dumped
excludeDependencies String - Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
instructions Map - The BND instructions for the bundle.
manifestLocation File - Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
supportedProjectTypes List - Project types which this plugin supports.
unpackBundle boolean - When true, unpack the bundle contents to the outputDirectory

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
  • Expression: ${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
  • Expression: ${dumpClasspath}

dumpInstructions:

File where the BND instructions will be dumped
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${excludeDependencies}

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
  • Expression: ${manifestLocation}
  • Default: ${project.build.outputDirectory}/META-INF

outputDirectory:

The directory for the generated bundles.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.outputDirectory}

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
  • Expression: ${unpackBundle}

maven-bundle-plugin-2.3.5/doc/site/bundle-mojo.html000066400000000000000000000273451164564726100222330ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:bundle

bundle:bundle

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
buildDirectory String - The directory for the generated JAR.
outputDirectory File - The directory for the generated bundles.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use.
classifier String - Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.
dumpClasspath File - File where the BND class-path will be dumped
dumpInstructions File - File where the BND instructions will be dumped
excludeDependencies String - Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
instructions Map - The BND instructions for the bundle.
manifestLocation File - Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
supportedProjectTypes List - Project types which this plugin supports.
unpackBundle boolean - When true, unpack the bundle contents to the outputDirectory

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
  • Expression: ${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
  • Expression: ${dumpClasspath}

dumpInstructions:

File where the BND instructions will be dumped
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${excludeDependencies}

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
  • Expression: ${manifestLocation}
  • Default: ${project.build.outputDirectory}/META-INF

outputDirectory:

The directory for the generated bundles.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.outputDirectory}

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
  • Expression: ${unpackBundle}

maven-bundle-plugin-2.3.5/doc/site/bundleall-mojo.html000066400000000000000000000332531164564726100227170ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:bundleall

bundle:bundleall

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
buildDirectory String - The directory for the generated JAR.
outputDirectory File - The directory for the generated bundles.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use.
classifier String - Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.
depth int - Process up to some depth
dumpClasspath File - File where the BND class-path will be dumped
dumpInstructions File - File where the BND instructions will be dumped
excludeDependencies String - Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
ignoreMissingArtifacts boolean - Ignore missing artifacts that are not required by current project but are required by the transitive dependencies.
instructions Map - The BND instructions for the bundle.
manifestLocation File - Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
supportedProjectTypes List - Project types which this plugin supports.
unpackBundle boolean - When true, unpack the bundle contents to the outputDirectory
wrapImportPackage String - Import-Package to be used when wrapping dependencies.
Default value is: *.

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
  • Expression: ${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
  • Expression: ${dumpClasspath}

dumpInstructions:

File where the BND instructions will be dumped
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${excludeDependencies}

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
  • Expression: ${manifestLocation}
  • Default: ${project.build.outputDirectory}/META-INF

outputDirectory:

The directory for the generated bundles.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.outputDirectory}

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
  • Expression: ${unpackBundle}

wrapImportPackage:

Import-Package to be used when wrapping dependencies.
  • Type: java.lang.String
  • Required: No
  • Expression: ${wrapImportPackage}
  • Default: *

maven-bundle-plugin-2.3.5/doc/site/clean-mojo.html000066400000000000000000000123131164564726100220310ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:clean

bundle:clean

Full name:

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

Description:

Clean an OBR repository by finding and removing missing resources.

Attributes:

  • Binds by default to the lifecycle phase: clean.

Optional Parameters

Name Type Since Description
obrRepository String - OBR Repository.

Parameter Details

obrRepository:

OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

maven-bundle-plugin-2.3.5/doc/site/cleanVersions-mojo.html000066400000000000000000000123001164564726100235560ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:cleanVersions

bundle:cleanVersions

Full name:

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

Description:

(no description)

Attributes:

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

Optional Parameters

Name Type Since Description
versions Map - The BND instructions for the bundle.

Parameter Details

versions:

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

maven-bundle-plugin-2.3.5/doc/site/css/000077500000000000000000000000001164564726100177075ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/css/maven-base.css000066400000000000000000000044071164564726100224440ustar00rootroot00000000000000body { 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; } maven-bundle-plugin-2.3.5/doc/site/css/maven-theme.css000066400000000000000000000051441164564726100226330ustar00rootroot00000000000000body { 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: normal; } 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; } #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); } maven-bundle-plugin-2.3.5/doc/site/css/print.css000066400000000000000000000003271164564726100215570ustar00rootroot00000000000000#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn { display: none !important; } #bodyColumn, body.docs div.docs { margin: 0 !important; border: none !important } maven-bundle-plugin-2.3.5/doc/site/css/site.css000066400000000000000000000000651164564726100213660ustar00rootroot00000000000000/* You can override this file with your own styles */maven-bundle-plugin-2.3.5/doc/site/dependencies.html000066400000000000000000003211751164564726100224440ustar00rootroot00000000000000 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.aQutebndlib1.43.0jarAll files contained in this JAR are licensed under the Apache 2.0 license, unless noted differently in their source (see swing2swt).
org.apache.felixorg.apache.felix.bundlerepository1.6.7-SNAPSHOTjarThe Apache Software License, Version 2.0
org.apache.mavenmaven-archiver2.4.1jarThe Apache Software License, Version 2.0
org.apache.mavenmaven-core2.0.7jarThe Apache Software License, Version 2.0
org.apache.maven.sharedmaven-dependency-tree1.2jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-utils2.1jarApache Public License 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-
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-sink-api1.0-alpha-7jar-
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.codehaus.plexusplexus-archiver1.0jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-container-default1.0-alpha-9-stable-1jar-
org.codehaus.plexusplexus-interactivity-api1.0-alpha-4jar-
org.codehaus.plexusplexus-interpolation1.13jarThe Apache Software License, Version 2.0
org.codehaus.plexusplexus-io1.0jarThe Apache Software License, Version 2.0
org.osgiorg.osgi.core4.1.0jar-

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

  • org.apache.felix:maven-bundle-plugin:maven-plugin:2.3.5 Information
    • biz.aQute:bndlib:jar:1.43.0 (compile) Information
    • org.apache.felix:org.apache.felix.bundlerepository:jar:1.6.7-SNAPSHOT (compile) Information
      • org.osgi:org.osgi.core:jar:4.1.0 (compile) Information
      • org.easymock:easymock:jar:2.4 (compile) Information
    • org.apache.maven:maven-core:jar:2.0.7 (compile) Information
      • org.apache.maven:maven-settings:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-model:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • org.apache.maven.wagon:wagon-file:jar:1.0-beta-2 (runtime) Information
      • org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2 (runtime) Information
      • org.apache.maven.reporting:maven-reporting-api:jar:2.0.7 (compile) Information
        • org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7 (compile) Information
      • org.apache.maven:maven-profile:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-model:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • org.apache.maven:maven-model:jar:2.0.7 (compile) Information
      • org.apache.maven:maven-artifact:jar:2.0.7 (compile) Information
      • org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2 (compile) Information
      • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • org.apache.maven:maven-repository-metadata:jar:2.0.7 (compile) Information
      • org.apache.maven:maven-error-diagnostics:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • org.apache.maven:maven-project:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-settings:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-profile:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-model:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-artifact-manager:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-plugin-registry:jar:2.0.7 (compile) Information
          • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
        • org.apache.maven:maven-artifact:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • commons-cli:commons-cli:jar:1.0 (compile) Information
      • org.apache.maven:maven-plugin-api:jar:2.0.7 (compile) Information
      • org.apache.maven.wagon:wagon-ssh-external:jar:1.0-beta-2 (runtime) Information
      • org.apache.maven:maven-plugin-descriptor:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-plugin-api:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-artifact:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
      • org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 (compile) Information
      • org.apache.maven:maven-artifact-manager:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-repository-metadata:jar:2.0.7 (compile) Information
        • org.apache.maven:maven-artifact:jar:2.0.7 (compile) Information
        • org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 (compile) Information
        • org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2 (compile) Information
      • org.apache.maven:maven-monitor:jar:2.0.7 (compile) Information
      • org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-2 (runtime) Information
      • classworlds:classworlds:jar:1.1 (compile) Information
    • org.apache.maven:maven-archiver:jar:2.4.1 (compile) Information
    • org.apache.maven.shared:maven-dependency-tree:jar:1.2 (compile) Information
    • org.codehaus.plexus:plexus-utils:jar:2.1 (compile) Information
    • org.apache.maven.shared:maven-plugin-testing-harness:jar:1.1 (test) Information
    • junit:junit:jar:4.0 (test) Information
    • org.easymock:easymock:jar:2.4 (test) Information
    • org.mockito:mockito-all:jar:1.7 (test) Information

Licenses

Apache Public License 2.0: Plexus Common Utilities

Java HTML Tidy License: JTidy

Unknown: CLI, Default Plexus Container, Doxia Sink API, Plexus Default Interactivity Handler, classworlds, junit, org.osgi.core

BSD: JSch

All files contained in this JAR are licensed under the Apache 2.0 license, unless noted differently in their source (see swing2swt).: aQute Bundle Tool Library

MIT License: EasyMock

The Apache Software License, Version 2.0: Apache Felix Bundle Repository, 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 Archiver Component, Plexus IO Components, Plexus Interpolation API, XML Commons External Components XML APIs

The MIT License: Mockito

Dependency File Details

FilenameSizeEntriesClassesPackagesJDK RevDebug
bndlib-1.43.0.jar663.85 kB423197421.5debug
classworlds-1.1.jar36.97 kB332331.3debug
jsch-0.1.27.jar119.15 kB979431.2release
commons-cli-1.0.jar29.41 kB272011.1debug
jtidy-4aug2000r7-dev.jar134.60 kB12911931.1release
junit-4.0.jar103.13 kB11992111.5debug
org.apache.felix.bundlerepository-1.6.7-SNAPSHOT.jar164.36 kB11284111.4debug
maven-archiver-2.4.1.jar19.63 kB19511.4debug
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-sink-api-1.0-alpha-7.jar5.80 kB19321.1debug
maven-reporting-api-2.0.7.jar9.71 kB18411.1debug
maven-dependency-tree-1.2.jar33.75 kB402131.4debug
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
plexus-archiver-1.0.jar173.01 kB132107121.4debug
plexus-container-default-1.0-alpha-9-stable-1.jar189.63 kB215175281.1debug
plexus-interactivity-api-1.0-alpha-4.jar13.09 kB251111.1debug
plexus-interpolation-1.13.jar59.63 kB604461.4debug
plexus-io-1.0.jar49.61 kB614251.4debug
plexus-utils-2.1.jar219.24 kB1239891.4debug
easymock-2.4.jar79.23 kB837131.5debug
mockito-all-1.7.jar943.04 kB846469481.5debug
org.osgi.core-4.1.0.jar159.63 kB1324961.2debug
xml-apis-1.0.b2.jar106.76 kB217184171.2release
TotalSizeEntriesClassesPackagesJDK RevDebug
434.10 MB3,7852,3472991.540
compile: 30compile: 2.53 MBcompile: 2,130compile: 1,276compile: 203-compile: 30
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
apache.snapshotshttp://repository.apache.org/snapshots-Yes-
snapshotshttp://snapshots.maven.codehaus.org/maven2-YesYes
centralhttp://repo1.maven.org/maven2Yes--

Repository locations for each of the Dependencies.

Artifactapache.snapshotscentral
biz.aQute:bndlib:jar:1.43.0-Found at http://repo1.maven.org/maven2
classworlds:classworlds:jar:1.1-Found at http://repo1.maven.org/maven2
com.jcraft:jsch:jar:0.1.27-Found at http://repo1.maven.org/maven2
commons-cli:commons-cli:jar:1.0-Found at http://repo1.maven.org/maven2
jtidy:jtidy:jar:4aug2000r7-dev-Found at http://repo1.maven.org/maven2
junit:junit:jar:4.0-Found at http://repo1.maven.org/maven2
org.apache.felix:org.apache.felix.bundlerepository:jar:1.6.7-SNAPSHOT--
org.apache.maven:maven-archiver:jar:2.4.1-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-artifact:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-artifact-manager:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-core:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-error-diagnostics:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-model:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-monitor:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-plugin-api:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-plugin-descriptor:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-plugin-registry:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-profile:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-project:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-repository-metadata:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven:maven-settings:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7-Found at http://repo1.maven.org/maven2
org.apache.maven.reporting:maven-reporting-api:jar:2.0.7-Found at http://repo1.maven.org/maven2
org.apache.maven.shared:maven-dependency-tree:jar:1.2-Found at http://repo1.maven.org/maven2
org.apache.maven.shared:maven-plugin-testing-harness:jar:1.1-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-file:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-http-shared:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-ssh-common:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.apache.maven.wagon:wagon-ssh-external:jar:1.0-beta-2-Found at http://repo1.maven.org/maven2
org.codehaus.plexus:plexus-archiver:jar:1.0-Found at http://repo1.maven.org/maven2
org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1-Found at http://repo1.maven.org/maven2
org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4-Found at http://repo1.maven.org/maven2
org.codehaus.plexus:plexus-interpolation:jar:1.13-Found at http://repo1.maven.org/maven2
org.codehaus.plexus:plexus-io:jar:1.0-Found at http://repo1.maven.org/maven2
org.codehaus.plexus:plexus-utils:jar:2.1-Found at http://repo1.maven.org/maven2
org.easymock:easymock:jar:2.4-Found at http://repo1.maven.org/maven2
org.mockito:mockito-all:jar:1.7-Found at http://repo1.maven.org/maven2
org.osgi:org.osgi.core:jar:4.1.0-Found at http://repo1.maven.org/maven2
xml-apis:xml-apis:jar:1.0.b2-Found at http://repo1.maven.org/maven2
Totalapache.snapshotscentral
43 (compile: 30, test: 4, runtime: 9)042

maven-bundle-plugin-2.3.5/doc/site/deploy-file-mojo.html000066400000000000000000000326631164564726100231720ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:deploy-file

bundle:deploy-file

Full name:

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

Description:

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

Attributes:

  • Binds by default to the lifecycle phase: deploy.

Required Parameters

Name Type Since Description
repositoryId String - Remote repository id, used to lookup authentication settings.
Default value is: remote-repository.
url String - Remote OBR repository URL, where the bundle details are to be uploaded.

Optional Parameters

Name Type Since Description
artifactId String - ArtifactId of the bundle. Retrieved from POM file if specified.
bundleUrl String - Optional public URL where the bundle has been deployed.
classifier String - Classifier type of the bundle. Defaults to none.
file File - Bundle file, defaults to the artifact in the local Maven repository.
groupId String - GroupId of the bundle. Retrieved from POM file if specified.
ignoreLock boolean - When true, ignore remote locking.
obrRepository String - Local OBR Repository.
obrXml String - Optional XML file describing additional requirements and capabilities.
packaging String - Packaging type of the bundle. Retrieved from POM file if specified.
pomFile File - Location of an existing POM file.
remoteOBR String - Remote OBR Repository.
supportedProjectTypes List - Project types which this plugin supports.
version String - Version of the bundle. Retrieved from POM file if specified.

Parameter Details

artifactId:

ArtifactId of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${artifactId}

bundleUrl:

Optional public URL where the bundle has been deployed.
  • Type: java.lang.String
  • Required: No
  • Expression: ${bundleUrl}

classifier:

Classifier type of the bundle. Defaults to none.
  • Type: java.lang.String
  • Required: No
  • Expression: ${classifier}

file:

Bundle file, defaults to the artifact in the local Maven repository.
  • Type: java.io.File
  • Required: No
  • Expression: ${file}

groupId:

GroupId of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${groupId}

ignoreLock:

When true, ignore remote locking.
  • Type: boolean
  • Required: No
  • Expression: ${ignoreLock}

obrRepository:

Local OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

obrXml:

Optional XML file describing additional requirements and capabilities.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrXml}

packaging:

Packaging type of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${packaging}

pomFile:

Location of an existing POM file.
  • Type: java.io.File
  • Required: No
  • Expression: ${pomFile}

remoteOBR:

Remote OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${remoteOBR}

repositoryId:

Remote repository id, used to lookup authentication settings.
  • Type: java.lang.String
  • Required: Yes
  • Expression: ${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
  • Expression: ${url}

version:

Version of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${version}

maven-bundle-plugin-2.3.5/doc/site/deploy-mojo.html000066400000000000000000000225751164564726100222560ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:deploy

bundle:deploy

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
altDeploymentRepository String - Alternative deployment repository. Format: id::layout::url
bundleUrl String - Optional public URL where the bundle has been deployed.
ignoreLock boolean - When true, ignore remote locking.
obrDeploymentRepository String - OBR specific deployment repository. Format: id::layout::url
obrRepository String - Local OBR Repository.
prefixUrl String - Optional public URL prefix for the remote repository.
remoteOBR String - Remote OBR Repository.
Default value is: NONE.
supportedProjectTypes List - Project types which this plugin supports.

Parameter Details

altDeploymentRepository:

Alternative deployment repository. Format: id::layout::url
  • Type: java.lang.String
  • Required: No
  • Expression: ${altDeploymentRepository}

bundleUrl:

Optional public URL where the bundle has been deployed.
  • Type: java.lang.String
  • Required: No
  • Expression: ${bundleUrl}

ignoreLock:

When true, ignore remote locking.
  • Type: boolean
  • Required: No
  • Expression: ${ignoreLock}

obrDeploymentRepository:

OBR specific deployment repository. Format: id::layout::url
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrDeploymentRepository}

obrRepository:

Local OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

prefixUrl:

Optional public URL prefix for the remote repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${prefixUrl}

remoteOBR:

Remote OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${remoteOBR}
  • Default: NONE

supportedProjectTypes:

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

maven-bundle-plugin-2.3.5/doc/site/images/000077500000000000000000000000001164564726100203645ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/images/close.gif000066400000000000000000000004271164564726100221630ustar00rootroot00000000000000GIF89a¥ÿÿÿðððïïïàààßßßÐÐÐÏÏÏÀÀÀ¿¿¿°°°¯¯¯   ŸŸŸ€€€pppooo```___PPPOOO@@@???000/// ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,<@€pH,Šˆ¤r©„™Ð¤™‰–VéS™EtS¦õ Þb¯Ë𙬮¢¿mr·mšëZdÏï÷Ç€A;maven-bundle-plugin-2.3.5/doc/site/images/collapsed.gif000066400000000000000000000000651164564726100230220ustar00rootroot00000000000000GIF89a€!ù , DŽ`ºçžcŠ5 ;maven-bundle-plugin-2.3.5/doc/site/images/expanded.gif000066400000000000000000000000641164564726100226430ustar00rootroot00000000000000GIF89a€!ù , „j œ´Î;maven-bundle-plugin-2.3.5/doc/site/images/external.png000066400000000000000000000003461164564726100227170ustar00rootroot00000000000000‰PNG  IHDR Óº&gAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< PLTEuuuÿÿÿ™ÿÿÿÑðPtRNSÿÿÿ@*©ôPIDATxÚb`&& @ P6#@ `ÀÄÄäX˜Ć2™Ê« ›‰d@AÔ3ƒ (± *‡½ÜtIEND®B`‚maven-bundle-plugin-2.3.5/doc/site/images/icon_error_sml.gif000066400000000000000000000017621164564726100240750ustar00rootroot00000000000000GIF89a÷ÿÿÿ ²±«£ q x v m¸;@’GJf46éÒÓ_ Á· œ › ‚ i [ ¾½¹·«¦ ˜ — – “ Š ˆ ~ } s q p n X V L ž  … ƒ  v l ¾~ ®Â"±",¢9?‚6;{6:Ždfå³¶ðàáÂ$¿'¿)©OWͱ³ÞÐÑÅ-Å/«*Ç"4À"3Øs}ôÖÙñÕØðÖÙúðñûòóÇ%8Ç&:È(=È*@È+AÃ*?É5H½=MÀM\ùñòÄ+BÉ.FÉ/GÉ0IË2MË3OÈ2NÇ%9J.F¯p«±r®N3O²v´³x·µ{»@-EL6RO8V08G3O1:bGm3=4>7 C5AgOx?2ME7TmW†|d™}gŽu²š„Á^Vƒøððèààöððýýýûûûúúúôôôÿÿÿ!ù,Ï; H° AJýéÃg’ÁN’Þ´YcŒ—* FrÃM™/]¨HI‚h $5iÎŒ³å “%B€øéTÉ ™0P8ÁÒ$À“2,Êã…‹•,Z(µ¤D‡ŒðL‰¢É¥¨@¡€¢;GŒÉák$<Hd‡ >`ê'‘!\2ƒ†?v°hp‰‡  uÚ@‹ .¨Xñà = q˜0 )f$Tp„"F¼ˆQƒ´ÁGrểCÇÁ€;maven-bundle-plugin-2.3.5/doc/site/images/icon_info_sml.gif000066400000000000000000000011361164564726100236720ustar00rootroot00000000000000GIF89aæÿÿÿýýþùúüøùûÚàërƒžÑÙæÕÜè×ÞéÖÝè 'SG]}]y¢Vp–OgŠLc…J`EYxCWtI^~FZyeªh„¬gƒ«j…­l‡®mˆ¯pаXl‹t²v´dy˜w´|”·~•¸w­€—¹uŠ©nž„š»ƒ™º…›¼zŽ¬ŠŸ¿w‰¤‹ ¿¡À¤Â…—²™¬Ç˜«Æ‚’©’¢º†•«¡²Ë¦¶Î©¹Ð­¼Ò¬»ÑŸ¬À±¿Ô°¾ÓµÂ֏Ũ¼ÈÚÁÌÝÃÎÞÂÍݲ¼ËÉÓâÆÐßËÔâÍÖäÌÕãÓÛçÒÚæÈÏÙéíóãçíõ÷úôöùóõø@TpAUqyŽ«}ަ•©Åž°É§´Å¹ÆØÀÉÕàæîßåíáçïåêñäéððó÷ïòöÝäíÜãìÛâëçìòæëñìðõëïôêîóØßçâèïñô÷öøúûüýúûüþþþÿÿÿ!ùr,»€r‚ƒ„…‚`fg`l\d LGƒ^qqopnQmbj.‡™MObhNg r\oP6 [igŒ%‚d›mE4k_^eL‚ PRah YcHB‚ËjfV ‚FØ`\- 5Z=97‚D`] I' 1ì30‚@KICA@,¨"‹éøcÇ $X ñA‚ ?tàÀrå…Š!8h 2è† @ Pa†b ;maven-bundle-plugin-2.3.5/doc/site/images/icon_success_sml.gif000066400000000000000000000017361164564726100244150ustar00rootroot00000000000000GIF89a÷ÿÿÿ„™º¦¶Î§·Î¼ÈÚÇÑà¿ÈÕc~¢¡±Çßåíw¬™´¦¸Ë—®¿³Ã©½ËSq‚*/‚¡­%(#8='*!37,/(CH'AF&>B/2*,)FI"!Prkœ¼´¢À¸j•†„¬œtœ‹¢Å²FcOƒ­7G;ÅÖÈÈ£¬Ö©·Û´¸ß²2B.²á¥³â¦·ã«¸ä¬¸ä­ºå¯¼å±Â€¶ã©²à¢²à£œÎˆ¬Þ˜«Ü™©Ù—«Û—]•BÎ…¢Ô‹©Û‘Í„­Õ—]”>¡Ô„çñሻf“Çr¿mˆ¶jÐæÂøûöbœ7Jw*U‡0WŠ2•ÑiÔäÈmª;Ag$r³?o¬=ež8fž8b›7ZŽ2YŠ1S‚.Jt)Qy1‰ËW…½Yu¤Qe‹FcˆE—¹{›½{“h­Î×Çîóê„ÊGv·@uµ?k¥:hž7`’3Jr(ÃE^‘3Q|,S~-Dh%}¼DEi&‹ÎQ²Å¢ÖàÍÏ×ÈãëÜIm&Qx+Ot)Mo(êïåLl&Ig%Gc$õ÷òþþþûûû÷÷÷ÿÿÿ!ù‹,» H° A!,X E aCF5pAÆ *01#†"NT0è‡A˜ ¡ =†Y²&€ NR¤I’1ÅÁbà€JðÃ'À:oŒ8bŠ˜3‡ˆ-ÃeË“‹„у™>Ô|‰Â¥ (ØÌq£Å‹•4häÔ±(Ћm®TÉ"Jž;*d(Å"4l¨p ,Pø°( ;maven-bundle-plugin-2.3.5/doc/site/images/icon_warning_sml.gif000066400000000000000000000011001164564726100243730ustar00rootroot00000000000000GIF89aæÿÿÿ¸œ§º¡«b`awr}“ޤ˜ º¡¨¿¬²Æ~ް„’²j| £¯ÇfsŠ„™º§·Î·Ä×ÄÏßËÔ⣴ÌÜãì[M@Kƒ? àk®T£N ”G J$ùwñsïrêpÛi×fÖfÔeÎcÍbÇ_¿[¼Z°T©Q¤OšJ E D E ƒ? i2 çnämÃ]¹X·WµV•H ‰A €= h2 ]-Ëbùzù{ìz&«Z¿i&×iù(Ëj&ùƒ1ùƒ2ú†7Ìm-D2%Ìp4úŠBúŽIØ|DÌu@ú”Yú˜aæ\Ì}R׈[¦v[úmI:2̓`û¡vû¤û§ƒÙ‘s=.()ûª‹+*û­‘ç ….!Ó—<,&é¤5&!:*%²‡y*Švp묜*,-¨‡‚š~zÇŸžÿÿÿ!ùv,€v‚ƒ„…† †…oae‹ƒd][s’v iT ‹u^PW†\Z¥MI…gXU¥GAD„SRQ¥?4ƒVONK¥)#C‚nJHFE0=7'6*v B@%¥+8, l !5"9¥.:/Lt"$&(-3:øc‡ Yìø‚f3càÄ‘#¦ ;;maven-bundle-plugin-2.3.5/doc/site/images/logos/000077500000000000000000000000001164564726100215075ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/images/logos/build-by-maven-black.png000066400000000000000000000043661164564726100261130ustar00rootroot00000000000000‰PNG  IHDRZ#ž/ pHYs.#.#x¥?vtIME×úļ•IDATXÃíXiLTY>ï½* ( ±J¶BZ@–€Š›ˆ†%‚‡?hÆ?"jb‚Qd~(„d\ÆA $ &Œ2™¸1 ›€ »‘"R`UJ-¼Zîü8Ìm„žîÎ4É´NêÇ©sÏ}ïÞï~ïœsÀš¬É𬒤¦¦ÖÔÔÔÔÔTWWzxx¬ôQ(‡bY¶¤¤ÄÕÕU&“‰Å⥣¹¹¹ßÄfÙ_ôغu+!¤ªªª¶¶6<<¼¼¼|¥ÏÜÜÜøø8˲™™™NNNçÎKMM¥£~~~1118`rrR©T¶¶¶ÖÔÔ@II‰D"€ôôô¤¤$www???tÞ¶m[JJJ^^µÀúõë¯_¿^__Ÿ””ÄqÜ… eáááÇ …çÏŸ_J¨ß5‰‰‰gÏž---­¨¨(++€ýû÷;;;@TTTxxx@@Àž={Ðùýû÷ÝÝݳ³³K¿¸ºººòòòêêjOOOooï´´4ÈÍÍ%„0 # ¿vhµÚáááööö“'Or÷3Î&“É`0LOOó>þÕ«W‹¥¹¹ùÒ¥K·oߎãöíÛçääô °czz:;;;>>¦¦¦<¸°°PQQQUU¥ÑhZ[[ggg ÃÄÄ!dppÐn·777·µµ€Á`P*•>ôðð¸|ùòÔÔܽ{÷ðáà  :;;—~_ߘ–ý¯äZ9Äqœ@ð#úiii•••ke@~~~___ppðïma̯ôsvvvssC]¯×B‚‚‚<==­Vëàààüü<ùøø2 £R©&''†Y‡Ãáp|«çyæÌÜ€ÕjÝ»wï³gÏìv;!„2<<ìçç'•J¯^½j2™Ðh2™²²²þ°ônllÄ}Z­V£ÑH¾–G-3~;ðue·H¹/A„”“:3Ëø‚‚ù{‘º CíK7lسk×®àààeC,Ë¢?G®®®[¶l‰ˆˆXÍ´%ÆÇÇé>5MSSÓ‡–nÞh4>}ú´»»›ZL&“H$Â'ämsžøóúù<©-_fË—Yóe†¤ÿø^âïÆâz{{µZ­V«MNN¦ï½xñ"ëëë¦ÈÈÈÐó°ÙlCCCééétJQQN¹víÚéÓ§ÕjµÃá°ÛíoÞ¼ùî»ïV???‡Ã+¸qã^.ÂÂÂèÎ{{{7n܈)“ÒD§ÓÑüÒô½X8*CthnnÆYGŽAKPPÐüü~ü6›Íf³¡q``€Ë·ZûÁ~ñ­Ö‰þ¦õ¼¡«z»X¤†x,Öû£££¨ÈårTŠ‹‹÷ÊÊʾ¾¾ºº:±X<33£P(¶o߈e‹H$ÊÎÎÆr122§÷ôô;vìèÑ£´hÆ[…"=..³Ùüöí[Ô#""¨CWW½¹Ò‹,5Àé—&r1»}ƒ@.f‹à¾7Ø…B‘““ƒE`II œ:uÊÝÝjkkœœ°c€F ‘Éd Óéñ0ÒÓÓ322@¥R­2£££z½uÚ „tww£Fó1…Ãß=©pÉ ròwc™¯3{‡Æ¶–eKKK1øÎÍ͉D"Ú@)(((((X¶BäæÎ;‘Å”˜¾¾¾¨tvv® ÃÄÆÆRÒ×PŒT*ÕÌÌÌ2#…#̃{šå.³Ð3ck›²M|¶ĸø¸² üccc‡ƒeY¹\¾{÷n<Ï—/_ÖÕÕ€D"Á]Y,–'OžB–-òñãÇþU*•”­´Ø£Æß$¡¡¡4åååÑ\£R©ÐØÐÐ@oݺ…F­V‹ukŸFÍ¿'‰9`ƒ3cøAŠaUâÄÐuùò…¢V«ÛÚÚ!<ÏÓíyyya™c4×­[·l…Ø+á8n``ßN/– 42 ³ ¡tåcõéïᅩ„ÇEGG£Ž—e Æk‘€½Ÿìv, ‰… ¼ÓÚ¾ð„¶±]äë뛀1‚ž§^¯Ÿ˜˜À:¢²²™Â²lllìµk×JKKÀÓÓsóæÍØCèééÁ‰;vì ÔXɩ߇^¯Y™k(F2™ D„€~aq‰®ÿÚï>œëñ×Ý‹M@ú¥, 0;;[TTDÿò<_VV†ûÉÉÉQ«ÕƒÁb±tuuåååõ÷÷c,Ãp344DåW{{ûêô; Ïó<Ï¿{÷îóçÏhŒŽŽFãüüüëׯi——Îó  VD„Oj© ´½÷ìG>»’ø|aÒ?æÎ™3÷ÎïÌ™™sJ!„`&‰^€`Ž/ƒãùóç&)--­»»{¶ŽÑhÌÈÈ€üüüW¯^1 óîÝ;2j0²²²~!pô÷÷wtt>|øÐ¡C"‘h÷îݳuø|~`` |8::ZRR‚•%É–-[ÂÃÃW¬XA,hµÚÀÀÀœœœÜÜÜššš¦‹ŠŠ ªªJ¯×ÛÙÙY­Ö¯^ææ ‡£££R©ô÷÷ß°aÃ¥K—ŒFãg”íìì\]]¥R©D"!ÂÕ«WÇÇÇûùù%&&VWWïÚµëîÝ»¡[·n%$$À±cÇ”Jå×…Ã~Žzr¹<66óuuuµµµ€slll.„B!fx<EQnnnµµµ­­­*•êËØ€€‰DÒÙÙi³Ù***fëS5>>>]ÒÔÔÔÝÝm±X***Ö­[ )))ÑÑÑ)FóöíÛo‰DÂ0L\\\\\ÜÙ³góóó ERRRaaáúõë—.]êééÉãñüýýÀÇÇG,‡„„ÔÔÔTVV’º£V«=„áØ¹sg{{û¾}û°Î•+WH2þj„¾€l6›Ífû±Q–e9Ž›!™˜˜ }}}aaa3t¾.Á×zqUUU``à½{÷Ðω¨/©mcccÃÃÃ|>ßÅÅ…¢(,´Z­ƒ¢(™Lfoÿ£©šã8Žã>£ðsß,¥¥¥A“ÔÖÖ–žžîææ†óÂÞ½{ÇÇÇ-ËåË—hš¦i:44´«« }Sô?À‘œœLªÆì!55uãÆ$F0ÅÆÆÎ2á 3{l–/ùnƒ&“é'S˲ ÃÌ1CÍŽãBCC§7Z …ÂÁÁaFquww—J¥Dâáá1e¡ö{6w‡íO+lô¶ð´¥úÚþº«.@¬ !ôæÍ›èèh•Jc6›ÉKU*•J¥*..ÆB­V»gϹ\.‹%‰R©ÌÌÌ$z||\­V«Tªèè覦¦'Nxzz:99)•ÊŠŠŠyƒÃd2‘3&&w†„ƒR©Ôh4V«upp âëë;U†þ¼ÎvT6ûÇÕN·oooßÝݧ”——cû^^^&“ !tîÜ9‡¡wtt$¸9rOimm¥ihš–ÉdÓWËÅÅeddd~ਫ«#vËË˱°§§ÇÎÎ O:E–çؾ}ûdp³÷qÿ¾Ä½~‚Þ¾â^ü‡ýËz û}2VY¾|9žU__×9(({^RR‚º~ý:v5** CVSS#ÀÁÁãUPP@zß­[·ž>}:22’D´N§›8rss?ôm4Ý×ׇ…ÓÏì·o߯B½^OúñÌÌÌ÷± 1îM+×vŸ-øÝ8nŸÅƒjµÏ*++C]¼x?nÞ¼™ã8³ÙìããƒýÔjµ}“„¡'®8pÏ:sæ 6‹Ïø”`4?ïæ\ë\}}=f¼¼¼/^Lún’5BBB0ÿôéSÒž!{¹šBÔúOêÖúQÆñú fHtôõõ™L&|]$ ÏŸ?OQTcc#îY­Vë”ÙIâñx2™Œã8Ÿñ€¡¡!²s§çµÿÿDzlcc#æW­ZEš…ÇcÆÓÓ“`D€ãóù+W®Ôó„ûûoad( ܃)_ƒØý+l°ãQ+±¾ŸŸfôz}^^^OO¤¤¤à*†ïVÀÝÝGH¡PH¥Òþþþ®®.Œ¬¡¡3áááós¢5/^¼À<©/V«µ¹¹y†p:ÞÞÞ#ôS02”ú;z〢ÑëfTõ7€_yƒÄuFt444`# …"--¼3QQQ7nܘÝ:@ss3Ìàà`±XŒG=z4w8æt„klldYv†çƒƒƒ¯_¿þiŒ&FQÿ³©}AÑ`³ úb@(ï©°÷ññÁqWUUe4)ŠÊÎÎ&åŒÜ$•––a·M&ÓÍ›7###ñõ-¹|#ž›Íæ––ÌGDDÌOthµZ̈D"òYÓ1Z³f fzzzôzýGpØóAà£Fà ÷Snè0†)¦àX¶l™H$b/µZ­Þ±cˆˆØ´iSee¥ÅbÙ¿ÿÁƒE"Ñèè(BhÉ’% …â“pèt:|i “ÉÈfüÒèÐétb±X,“lôäÉ,tvvÆÂ––¡Pˆå0²ãÑ[¿¾`ì=Ò?£"~2w°€½¼C§§C???@ œ³³³qY%e²¸¸8)) ·,ËŽŒŒP%—Ë?Ž¡££C …BGCCŸÏk×®Ñ1’æt„{ÿþ½ÅbÁÙÑÉÉ GFFpÄÒ4íââBu£££¤í™òçÝÔ÷x"Êc%ˆóÞ,à´¦}¥Á`˜˜˜Àиºº~òc C{{»Á`îîî¾¾¾¸®s700€Ëœ\.ÇÎ3 Ã0 ˆÅâE‹Í ;-À±@ÿ§wýí¿ƒIEND®B`‚maven-bundle-plugin-2.3.5/doc/site/images/logos/maven-feather.png000066400000000000000000000064021164564726100247410ustar00rootroot00000000000000‰PNG  IHDRZ#ž/ pHYs.#.#x¥?vgAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅF xIDATxÚb`H €øÿÿÿ£ FF€blnÚ³gÏ÷ïß!ìß¿?xüä8û÷ïߟ?´¶ €XˆQtãÆ®®.[LL,##CAAMÍû÷ï'Ož\WW7eÊooo g„„„ ²oß¾1cFuu5A»øøøBCCýýý£££&ì=q†ñߟß7¿j›%ôó7£™»¾º€¾§²<· Õƒ €ˆJÏŸ?¿yófZZZJJ ''gpp0¦666mmm cß¾}oÞ¼Ù°aCoo/\öÛ·oÀh'Æ.33³ ­366^½zõ›W¯ž<{sbá‘['>>¿ðú׌}ßÒ'|vJzdt9&çî’Ÿ^=§bp±™E@@ÀÂÂÂÊÊ*;;ûÉ“'@‘Ù³g_¿~ȸzõêÂ… 1y÷î]ˆâ>½´uëÖcÇŽÁMøóçO}}½¯¯ïâÅ‹¥Õ¤I“._¾ ÿüùsUUÕß¿ÉçÖ­[@`Ê&F ™Ë–-›ÒѼ}ãªÝOžïgU:̪¾•Mú›øÍŸ"oo3².?ÚÕþÌ)ôJzÖU ßݽýÿÿ? ƒ €XˆTwçÎÖÖV £8P^^2”••555¡søða`d–••¥xyy½¼¼€Ztuuá&œ>}:77˜¢¢¢ää䘘˜€îééÙµk׳gϘ™™ /Ô²&&&ÁÑ «7lxóàÉž›[ÿ1òK3+J2‰>eggaýÿAýï3ÁŸœ|×~‹Þ9ùgñÑÇš3«©ý7Va××ááã–•eçæáæ$)8ˆØààááQWW:èî9sæ$&&âQ T#** Ì2Àp XXÔ ÊÔÔT`vww¯[·...( ,¸b`¨\¸|åç¿á1Ñúg]¾±ã*ËŸÓ ïþy|÷?';#?ûFAvVN=–Ï\JýýÌzñŸäõK_÷ß`ý¸ö×ï÷r|ÿy9ÿëè y™0É*°rˆ ÉK±rpã÷&@!!!ö‰'Ž= ¯¡á~ÀÁÁa°²²«4)))`šÌ2ööö˜õ¿ž¶–¢œÜ?†ÿ?ï­ÿs;èày>•Íìò/~ýþø÷Å“ßOÖÿ}ÉÈÀ´•]މ_ŒEÒœé;ëqÖ,² _¾~ù÷å:»ÜïZGÜÙpùàY¡GLºÂL"¼R&¬œŒŒX €"68~þüùâÅ X@= ¥¥Œy`VúdóæÍ@ïaÖá?~ü@9wî܃€¡T_\\ ‰ŒŒ,**rtt„„° QUU&+¨ËXX@V%=ú÷yúµgO}þ{ýãï;v¡ïìo¾ÿþ÷öü¿ï/þ¾½ÿëìq†?ŒŒ‚BŒüŒlߘ$¤™lÙYßþ[÷ÞÀéïÃ{ßEïüÐT8÷ºðÒu/NWÍÿ‚*†üÒpGQÁô9°ÀÖŠX•*))S{zzúòåËXÁXŽ nnnSSÓ &ìܹÓÝÝRïkßœœ`1±³³  æ©S§Bl™?~rr2<8à€]>5ó½¯çûƒ[¥Vï×:rùínŽ_ìŸþ³²³ü÷bz΢øŸUæ1Ãÿwÿ¾?ÿÿëÝ`ûäþ­¿ÿÿÿõ‘‘Møÿ¡Íÿ¿=þ%æËðòòC.‘»¿¬Å?2~øûñÍ3Öoûï=ãc°“SòçÚ@µJ%+¤¤À* l71‚²°~ „ ` L˜‰ »uÿþ}ýòñãÝóßoÿ³ü—ãï½ïØt˜þúýå?#+'3Ã'&.&¶L,Ϲÿ1ü8Ä .Êð‘õß÷Ûÿ9˜þ}øÏ$ðë,»fì.qfIvvF†ÿ~þäÒõŠ™t@ X#}÷îÝ………ÀšÅÃÃT½¿ÿüùöéãßï~ðëùß½çî¾öÿÝŽŸ‹ýá~ø‡…õϯŸ9¿ü}ÃÆñô¿€îï·¹9Y¿þüÍÎÅõó÷/A®2Ìì‘L?M¹þ}aüøƒ]XÂÅÒ!DQp Q`ÛÀÖ'<†õ%° ä ó?.½ÿÀ"ÐñÀTóû÷/†ÿÿ|ÿñíÝ›¿?~þ{ûö˯ÿ‡nþåÿ÷—‡ùïN%A†/Œllßò‰sÈÊ1üøóçý‡?ÊÜl¼¼\\<À4t3@AM$¬]»V€M/`› X.BÊ`kXpþúõkÞ¼yÀR– €íË{÷îý:è€"!8€Å¼Ö¶AÐb Ø6sssC+€u3†1ÿþÿüöÿû§ÿ~QâtHüøñ#0‰áW ,à€õAeà bƒh0¶‘ZÀÊ…‹‹ ­r•••6çá"À–„£‹þNôÿS£û§TñO‰üŸr•?]ÎÿÌþÿ÷PöñãÇÀXm»ºº;8pKm6{0X±bDغ ¶ƒ€õ°ÊFLKK °‘&R`T4 Xµ—””ÈËËkC 2`O08ˆØàƼ‰ t1°Å¬#+ }@.0Ò^¾| ¸ Úíþäc¢‡æ"›,M€Íˆ–7BÌv  €"ÀôÀ†2<Ülˆ`›˜O!Í|`á…[ÀîË—/øƒ €ˆ `Kn.ЕÁGÁkY`×¥2üüü`‰ûÇß™1ÿÎù÷ðÂÿ×÷ÿÝ>ò·Ó eC”Û`]§N‚Ä3°‚øØŠ,]ºâUH:tØ*ŠÓ)$¼€KxÛ×Çǧ¡¡ÁÚÚž¢Ý(üÁ@ÄÇĉá«§OŸB‘ûì[¶l[ðö80£æã?ÿ?¿ý÷øò¿«{þÎŽƒÇ–6ˆ$0‘CtmذÈ9s&„ ¬‰A ÌAÀÄŸÀüò A÷jRRDWcc#ÄXHÒKxÿþ=þà bë9`ŒAÀt+&&owÃK `3¾rå ¼ydxÿ”).ï`xó€áïo”GÁ€§ 'Q ì@CülÝÍ?{ö,d˜ÆÂ0Œ€YjðT iø°' ϹÈåV@,D¶>®°ŒŒà…“'OBÀâ Fð€VÀ Ô÷è¿é _ÞƒAVQÎ[èÿÞ) ~10³2Ê@Ô«©©Á[«“&MæD Ø©Ôb± –Öð€ƒ`¹ôêóçÏU;$tàAvæÌÃÒÒ’ Oˆ¨à¦±Û·oÃG«àÍ­óçÏ£ "‡¢¢"$Œþ¯¯…0!xW2¹002ýxþÿ®~"E^Q´ÔôÄ '+**àÖAÀ‚cÙ²eh-1HRº’0õôô€õDöøñãÄ@5Lî ²Ï5ÈÇ ‡ÑϯÿŸ_Gä `·Øâ8µ‚ìFED² t·k×.`3° ¯Îà#IÀÖàÂ… !Þæ©U«V ËàáeøàÜçÀçÒ¥K¶••AŸQ©XtAœœœpg!‡‘¹¹9„LáÀ¤Ž,l ì< _߃æs¥´þ¿ºÃðù-4€”Á!##4Ød‚D5°dõ÷÷‡Ë=ì »ÈÀ¶oBB°ï TüõëW bqqq`:ÂÀòõõë×@°dgF< €ˆJ@C¹Á˜á¥Ñ…  ‚‚‚‚@qˆ 0*€…DF̬L>• lœàNΧÿÏ®3ZÅ3Ë2°°ƒ¢rqt1;Í& Hµ ¯&-±ÔÔTHsÀF0Ûcyyy„póæM ^ àÁÌwÀ" (hkkKL¿ €ˆêÂ}úô 'ÒØÂƒ]I±@GÃ'€:`ŒÁ›=ÿ¼{üÿé`Tprò3|~É, |â H®¶»íKHÐ`|ÀÕ\»v H= ,Võ¤^V+*HA<ÿ € `ôðóóœv ÑY8”à ¦ÑP@4ŠP@€„Z¤':ævrIEND®B`‚maven-bundle-plugin-2.3.5/doc/site/images/newwindow.png000066400000000000000000000003341164564726100231130ustar00rootroot00000000000000‰PNG  IHDR Óº&gAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< PLTEuuu™ÿÿÿÿÿÿ€8ÉÙtRNSÿÿÿ@*©ôFIDATxÚb`fff„f€b±™@€‘ €€Æ „8@!³™ @`6Ô€±L€Ø& ±´Â^IEND®B`‚maven-bundle-plugin-2.3.5/doc/site/index-mojo.html000066400000000000000000000141711164564726100220620ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:index

bundle:index

Full name:

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

Description:

Index the content of a maven repository using OBR

Attributes:

Optional Parameters

Name Type Since Description
mavenRepository String - The repository to index
obrRepository String - OBR Repository.
urlTemplate String - Template for urls

Parameter Details

mavenRepository:

The repository to index
  • Type: java.lang.String
  • Required: No
  • Expression: ${mavenRepository}

obrRepository:

OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

urlTemplate:

Template for urls
  • Type: java.lang.String
  • Required: No
  • Expression: ${urlTemplate}

maven-bundle-plugin-2.3.5/doc/site/index.html000066400000000000000000000241001164564726100211110ustar00rootroot00000000000000 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!

maven-bundle-plugin-2.3.5/doc/site/install-file-mojo.html000066400000000000000000000244061164564726100233400ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:install-file

bundle:install-file

Full name:

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

Description:

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

Attributes:

  • Binds by default to the lifecycle phase: install.

Optional Parameters

Name Type Since Description
artifactId String - ArtifactId of the bundle. Retrieved from POM file if specified.
classifier String - Classifier type of the bundle. Defaults to none.
file File - Bundle file, defaults to the artifact in the local Maven repository.
groupId String - GroupId of the bundle. Retrieved from POM file if specified.
obrRepository String - OBR Repository.
obrXml String - Optional XML file describing additional requirements and capabilities.
packaging String - Packaging type of the bundle. Retrieved from POM file if specified.
pomFile File - Location of an existing POM file.
supportedProjectTypes List - Project types which this plugin supports.
version String - Version of the bundle. Retrieved from POM file if specified.

Parameter Details

artifactId:

ArtifactId of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${artifactId}

classifier:

Classifier type of the bundle. Defaults to none.
  • Type: java.lang.String
  • Required: No
  • Expression: ${classifier}

file:

Bundle file, defaults to the artifact in the local Maven repository.
  • Type: java.io.File
  • Required: No
  • Expression: ${file}

groupId:

GroupId of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${groupId}

obrRepository:

OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

obrXml:

Optional XML file describing additional requirements and capabilities.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrXml}

packaging:

Packaging type of the bundle. Retrieved from POM file if specified.
  • Type: java.lang.String
  • Required: No
  • Expression: ${packaging}

pomFile:

Location of an existing POM file.
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${version}

maven-bundle-plugin-2.3.5/doc/site/install-mojo.html000066400000000000000000000135571164564726100224300ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:install

bundle:install

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
obrRepository String - OBR Repository.
supportedProjectTypes List - Project types which this plugin supports.

Parameter Details

obrRepository:

OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

supportedProjectTypes:

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

maven-bundle-plugin-2.3.5/doc/site/instructions-mojo.html000066400000000000000000000273771164564726100235330ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:instructions

bundle:instructions

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
buildDirectory String - The directory for the generated JAR.
outputDirectory File - The directory for the generated bundles.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use.
classifier String - Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.
dumpClasspath File - File where the BND class-path will be dumped
dumpInstructions File - File where the BND instructions will be dumped
excludeDependencies String - Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
instructions Map - The BND instructions for the bundle.
manifestLocation File - Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
supportedProjectTypes List - Project types which this plugin supports.
unpackBundle boolean - When true, unpack the bundle contents to the outputDirectory

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
  • Expression: ${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
  • Expression: ${dumpClasspath}

dumpInstructions:

File where the BND instructions will be dumped
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${excludeDependencies}

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
  • Expression: ${manifestLocation}
  • Default: ${project.build.outputDirectory}/META-INF

outputDirectory:

The directory for the generated bundles.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.outputDirectory}

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
  • Expression: ${unpackBundle}

maven-bundle-plugin-2.3.5/doc/site/issue-tracking.html000066400000000000000000000130231164564726100227340ustar00rootroot00000000000000 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.


maven-bundle-plugin-2.3.5/doc/site/jira-report.html000066400000000000000000000755001164564726100222520ustar00rootroot00000000000000 Maven Bundle Plugin - JIRA Report

JIRA Report

KeySummaryStatusResolutionBy
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 bndtoolsResolvedFixedStuart McCulloch
FELIX-2934Bundle-ClassPath contains "." despite using _wab instructionResolvedFixedStuart McCulloch
FELIX-2884The multiplicity isn't taken into account by the maven bundle plugin and bundlerepository when generating the repository xmlClosedFixedGuillaume Nodet
FELIX-2820Provide a default value when using <_wab/>ResolvedFixedStuart McCulloch
FELIX-2819packageinfo files in src/main/java are ignoredResolvedFixedStuart 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-2765bundle plugin throw IllegalArgumentException while do the installResolvedFixedUnassigned
FELIX-2722With an empty organization like this <organization/>, maven bundle plugin raises a NPE.ResolvedFixedStuart McCulloch
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-2657Maven-bundle-plugin uses old version of BndLibClosedFixedStuart McCulloch
FELIX-2656Maven-bundle-plugin identified as not thread-safe in Maven 3.0ResolvedFixedStuart McCulloch
FELIX-2449Resource filtering does not use Maven properties specified on the mvn command line via -D command line switchesResolvedFixedStuart McCulloch
FELIX-2435<supportedProjectType> on a WAR file will switch the project to generate jar artifactsResolvedFixedStuart McCulloch
FELIX-2427maven site crashesResolvedFixedStuart McCulloch
FELIX-2346mvn bundle:clean removes all, even the existing resourcesResolvedFixedStuart McCulloch
FELIX-2215Refactor bundlerepository and maven bundle plugin obr data modelClosedFixedGuillaume Nodet
FELIX-2210Bogus import entriesResolvedFixedStuart McCulloch
FELIX-2194The manifest and bundle goals seem to generate different manifest informationsResolvedFixedStuart 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 filenamesResolvedFixedStuart McCulloch
FELIX-1985Error when Include-Resource instruction contains duplicate paths.ResolvedFixedStuart McCulloch
FELIX-1951The SchemaObr.xsd in bundleplugin is incompleteClosedFixedGuillaume Nodet
FELIX-1936Create Output Directory for Resource-Only WARsResolvedFixedStuart McCulloch
FELIX-1836Maven resource filtering support for obr.xmlResolvedFixedStuart McCulloch
FELIX-1820Fragment-Host version not convertedResolvedFixedStuart McCulloch
FELIX-1734The _donotcopy is ignoredResolvedFixedStuart McCulloch
FELIX-1634Maven Bundle Plugin disables transitive dependenciesClosedFixedStuart McCulloch
FELIX-1571Bundle-ClassPath without "." while using maven-bundle-plugin in a war project confuses the pluginResolvedFixedStuart 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-1290Missing dependencies silently ignoredClosedFixedStuart 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. typeResolvedFixedStuart 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-984site's <Bundle-Version> documentation is wrongClosedFixedStuart McCulloch
FELIX-981Warning about split packages even with -split-package directive [maven-bundle-plugin-2.0.0]ClosedFixedStuart McCulloch
FELIX-954Import-Package should include packages from optional Maven dependencies with resolution=optionalResolvedFixedUnassigned
FELIX-941Support singleton & fragment-attachment directive generationClosedFixedStuart McCulloch
FELIX-912Improve default Export-Package / Private-Package settings by scanning the project sourceClosedFixedStuart 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-850Wrong symbolic name computed when groupId is a single segment string.ClosedFixedStuart 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-807conversion of JAR into bundle fails if there are classes is the default name spaceClosedFixedPeter Kriens
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 (<,>)ResolvedFixedStuart McCulloch
FELIX-699manifest goal does not interprete _include instruction correctlyClosedFixedStuart McCulloch
FELIX-684Enable excludeDependencies to check groupId, version, etc. rather than only artifactIdClosedFixedStuart McCulloch
FELIX-677Parser throws error when DynamicImport-Package contains attributesClosedFixedStuart McCulloch
FELIX-661maven bundle plugin does not close the accessed fie /jar streamsClosedFixedStuart 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
FELIX-561Use same level of Bnd in script generated by bundle:ant as in the bundleplugin itselfClosedFixedStuart McCulloch
FELIX-560bundle:install and bundle:deploy goals check artifact type is "bundle" instead of using the supportedProjectTypes listClosedFixedStuart McCulloch
FELIX-556Filtering mechanims to <Embed-Dependency/>ClosedFixedStuart McCulloch
FELIX-554allow removing a bundle from a remote OBRClosedFixedStuart McCulloch
FELIX-553allow cleaning a remote OBRClosedFixedStuart McCulloch
FELIX-549Import-Package should not include "snapshot" from snapshot dependenciesClosedFixedStuart McCulloch
FELIX-548Import-Package version qualifiers vary depending on dependency scope.ClosedFixedStuart McCulloch
FELIX-547OBR portion of the plugin balks on singular version range of [1.0.0,1.0.0].ClosedFixedStuart McCulloch
FELIX-546Import-Package version inconsistencies.ClosedFixedStuart McCulloch
FELIX-545Export-Package version inconsistencies.ClosedFixedStuart McCulloch
FELIX-543add switch to prevent classifier being appended to Bundle-VersionClosedFixedStuart McCulloch
FELIX-541allow repository.xml to reference to xsl fileClosedFixedStuart McCulloch
FELIX-531Allow the import package scope to be set for the bundleall goal in the maven-bundle-pluginClosedFixedStuart McCulloch
FELIX-526Allow a mechanism to give preference to local resources over the ones from embedded jarsClosedFixedStuart McCulloch
FELIX-523Update bundleplugin to use BND 0.0.249ClosedFixedStuart McCulloch
FELIX-519maven-bundle-plugin should issue a WARNING for unsupported packaging typesClosedFixedStuart McCulloch
FELIX-517Replacement of {maven-dependencies} in Include-Resource and Bundle-ClassPath can strip Windows path separatorsClosedFixedStuart McCulloch
FELIX-505maven-bundle-plugin:bundleall modifies dependencies that are already bundlesClosedFixedStuart McCulloch
FELIX-499Enhance "excludeDependencies" configuration parameter to also support comma-separated list of artifactIdsClosedFixedStuart McCulloch
FELIX-498Enable javadoc deployment on OBR repositoryClosedFixedStuart McCulloch
FELIX-493maven-bundle-plugin bundle:install goal install too many artifactClosedFixedStuart McCulloch
FELIX-492Add support to classifier: enable bunlde:bundle goal to generate classified artifactClosedFixedStuart McCulloch
FELIX-491Merge the maven-obr-plugin and the bundleplugin into a single pluginClosedFixedStuart McCulloch
FELIX-477BND: Versions with fourth section all numbers are truncatedClosedFixedStuart McCulloch
FELIX-476Improve default Export-Package (used when no Export-Package and Private-Package is set)ClosedFixedStuart McCulloch
FELIX-472Embed-Dependency, Include-Resource and inlineClosedFixedStuart McCulloch
FELIX-462Support removal of manifest headers added by the bundlepluginClosedFixedStuart McCulloch
FELIX-461Ensure manifest goal creates same manifest as bundle goal when project packaging is "bundle"ClosedFixedStuart McCulloch
FELIX-460Remove "." from the Bundle-ClassPath when embedding dependencies in a bundle with no local classesClosedFixedStuart McCulloch
FELIX-459BND: allow customization of the "uses" clause in the generated Export-PackageClosedFixedStuart McCulloch
FELIX-458BND: -split-package:=merge-first behaves like merge-lastClosedFixedStuart McCulloch
FELIX-344Generate standard maven documentation for the maven-bundle-pluginResolvedFixedStuart McCulloch
FELIX-247Add ant goal to maven-bundle-plugin which creates a build.xml and MANIFEST.MF with bundle headersClosedFixedStuart McCulloch

maven-bundle-plugin-2.3.5/doc/site/license.html000066400000000000000000000413221164564726100214310ustar00rootroot00000000000000 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.

maven-bundle-plugin-2.3.5/doc/site/mail-lists.html000066400000000000000000000140161164564726100220650ustar00rootroot00000000000000 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

maven-bundle-plugin-2.3.5/doc/site/manifest-mojo.html000066400000000000000000000273671164564726100225740ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:manifest

bundle:manifest

Full name:

org.apache.felix:maven-bundle-plugin:2.3.5: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

Name Type Since Description
buildDirectory String - The directory for the generated JAR.
outputDirectory File - The directory for the generated bundles.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use.
classifier String - Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.
dumpClasspath File - File where the BND class-path will be dumped
dumpInstructions File - File where the BND instructions will be dumped
excludeDependencies String - Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
instructions Map - The BND instructions for the bundle.
manifestLocation File - Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
supportedProjectTypes List - Project types which this plugin supports.
unpackBundle boolean - When true, unpack the bundle contents to the outputDirectory

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
  • Expression: ${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
  • Expression: ${dumpClasspath}

dumpInstructions:

File where the BND instructions will be dumped
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${excludeDependencies}

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
  • Expression: ${manifestLocation}
  • Default: ${project.build.outputDirectory}/META-INF

outputDirectory:

The directory for the generated bundles.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.outputDirectory}

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
  • Expression: ${unpackBundle}

maven-bundle-plugin-2.3.5/doc/site/plugin-info.html000066400000000000000000000210121164564726100222300ustar00rootroot00000000000000 Maven Bundle Plugin - Plugin Documentation

Plugin Documentation

Goals available for this plugin:

GoalDescription
bundle:antGenerate Ant script to create the bundle (you should run ant:ant first).
bundle:bundleCreate an OSGi bundle from Maven project
bundle:bundleallDeprecated. The bundleall goal is no longer supported and may be removed in a future release
bundle:cleanClean an OBR repository by finding and removing missing resources.
bundle:cleanVersionsNo description.
bundle:deployDeploys bundle details to a remote OBR repository (life-cycle goal)
bundle:deploy-fileDeploys bundle details to a remote OBR repository (command-line goal)
bundle:indexIndex the content of a maven repository using OBR
bundle:installInstalls bundle details in the local OBR repository (life-cycle goal)
bundle:install-fileInstalls bundle details in the local OBR repository (command-line goal)
bundle:instructionsGenerate BND instructions for this project
bundle:manifestGenerate an OSGi manifest for this project
bundle:remote-cleanClean a remote repository file. It just looks for every resources and check that pointed file exists.
bundle:wrapDeprecated. 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.3.5</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.3.5</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

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


maven-bundle-plugin-2.3.5/doc/site/project-info.html000066400000000000000000000154641164564726100224160ustar00rootroot00000000000000 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.

maven-bundle-plugin-2.3.5/doc/site/project-reports.html000066400000000000000000000134001164564726100231450ustar00rootroot00000000000000 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.

maven-bundle-plugin-2.3.5/doc/site/remote-clean-mojo.html000066400000000000000000000213631164564726100233270ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:remote-clean

bundle:remote-clean

Full name:

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

Description:

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

Attributes:

  • Binds by default to the lifecycle phase: clean.

Optional Parameters

Name Type Since Description
altDeploymentRepository String - Alternative deployment repository. Format: id::layout::url
ignoreLock boolean - When true, ignore remote locking.
obrDeploymentRepository String - OBR specific deployment repository. Format: id::layout::url
obrRepository String - Local OBR Repository.
prefixUrl String - Optional public URL prefix for the remote repository.
remoteOBR String - Remote OBR Repository.
Default value is: NONE.
supportedProjectTypes List - Project types which this plugin supports.

Parameter Details

altDeploymentRepository:

Alternative deployment repository. Format: id::layout::url
  • Type: java.lang.String
  • Required: No
  • Expression: ${altDeploymentRepository}

ignoreLock:

When true, ignore remote locking.
  • Type: boolean
  • Required: No
  • Expression: ${ignoreLock}

obrDeploymentRepository:

OBR specific deployment repository. Format: id::layout::url
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrDeploymentRepository}

obrRepository:

Local OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${obrRepository}

prefixUrl:

Optional public URL prefix for the remote repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${prefixUrl}

remoteOBR:

Remote OBR Repository.
  • Type: java.lang.String
  • Required: No
  • Expression: ${remoteOBR}
  • Default: NONE

supportedProjectTypes:

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

maven-bundle-plugin-2.3.5/doc/site/source-repository.html000066400000000000000000000175411164564726100235320ustar00rootroot00000000000000 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

maven-bundle-plugin-2.3.5/doc/site/surefire-report.html000066400000000000000000000220531164564726100231440ustar00rootroot00000000000000 Maven Bundle Plugin - Surefire Report

Surefire Report

Summary


TestsErrors FailuresSkippedSuccess RateTime
9000100%1.764

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

Package List


PackageTestsErrors FailuresSkippedSuccess RateTime
org.apache.felix.bundleplugin9000100%1.764

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

org.apache.felix.bundleplugin

ClassTestsErrors FailuresSkippedSuccess RateTime
BlueprintComponentTest1000100%0.497
BundleAllPluginTest2000100%0.771
BundlePluginTest6000100%0.496

Test Cases

BlueprintComponentTest

testBlueprint0.463

BundleAllPluginTest

testSnapshotMatch0.319
testNoReBundling0.449

BundlePluginTest

testConvertVersionToOsgi0.059
testReadExportedModules0.153
testTransformDirectives0.069
testDefaultPropertiesIncludeOrganization0.06
testVersion0.069
testPackageInfoDetection0.083



maven-bundle-plugin-2.3.5/doc/site/team-list.html000066400000000000000000000144261164564726100217130ustar00rootroot00000000000000 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.


maven-bundle-plugin-2.3.5/doc/site/wrap-mojo.html000066400000000000000000000331441164564726100217250ustar00rootroot00000000000000 Maven Bundle Plugin - bundle:wrap

bundle:wrap

Full name:

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

This plugin goal has been deprecated:

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

Description:

(no description)

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

Name Type Since Description
buildDirectory String - The directory for the generated JAR.
outputDirectory File - The directory for the generated bundles.

Optional Parameters

Name Type Since Description
archive MavenArchiveConfiguration - The archive configuration to use.
classifier String - Classifier type of the bundle to be installed. For example, "jdk14". Defaults to none which means this is the project's main bundle.
depth int - Process up to some depth
dumpClasspath File - File where the BND class-path will be dumped
dumpInstructions File - File where the BND instructions will be dumped
excludeDependencies String - Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
ignoreMissingArtifacts boolean - Ignore missing artifacts that are not required by current project but are required by the transitive dependencies.
instructions Map - The BND instructions for the bundle.
manifestLocation File - Directory where the manifest will be written
Default value is: ${project.build.outputDirectory}/META-INF.
supportedProjectTypes List - Project types which this plugin supports.
unpackBundle boolean - When true, unpack the bundle contents to the outputDirectory
wrapImportPackage String - Import-Package to be used when wrapping dependencies.
Default value is: *.

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
  • Expression: ${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
  • Expression: ${dumpClasspath}

dumpInstructions:

File where the BND instructions will be dumped
  • Type: java.io.File
  • Required: No
  • Expression: ${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
  • Expression: ${excludeDependencies}

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
  • Expression: ${manifestLocation}
  • Default: ${project.build.outputDirectory}/META-INF

outputDirectory:

The directory for the generated bundles.
  • Type: java.io.File
  • Required: Yes
  • Expression: ${project.build.outputDirectory}

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
  • Expression: ${unpackBundle}

wrapImportPackage:

Import-Package to be used when wrapping dependencies.
  • Type: java.lang.String
  • Required: No
  • Expression: ${wrapImportPackage}
  • Default: *

maven-bundle-plugin-2.3.5/doc/site/xref-test/000077500000000000000000000000001164564726100210405ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref-test/allclasses-frame.html000066400000000000000000000016731164564726100251530ustar00rootroot00000000000000 All Classes

All Classes

maven-bundle-plugin-2.3.5/doc/site/xref-test/index.html000066400000000000000000000014231164564726100230350ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference <body> <h1>Frame Alert</h1> <p> You don't have frames. Go <a href="overview-summary.html">here</a> </p> </body> maven-bundle-plugin-2.3.5/doc/site/xref-test/org/000077500000000000000000000000001164564726100216275ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/000077500000000000000000000000001164564726100230505ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/000077500000000000000000000000001164564726100241575ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin/000077500000000000000000000000001164564726100266475ustar00rootroot00000000000000AbstractBundlePluginTest.html000066400000000000000000000127701164564726100344010ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin 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.codehaus.plexus.PlexusTestCase;
27  
28  
29  /**
30   * Common methods for bundle plugin testing
31   * 
32   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
33   * @version $Id: AbstractBundlePluginTest.html 1143000 2011-07-05 11:50:48Z mcculls $
34   */
35  public abstract class AbstractBundlePluginTest extends PlexusTestCase
36  {
37  
38      protected ArtifactStub getArtifactStub()
39      {
40          ArtifactStub artifact = new ArtifactStub();
41          artifact.setGroupId( "group" );
42          artifact.setArtifactId( "artifact" );
43          artifact.setVersion( "1.0" );
44          return artifact;
45      }
46  
47  
48      protected File getTestBundle()
49      {
50          String osgiBundleFileName = "org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar";
51          return getTestFile( getBasedir(), "src/test/resources/" + osgiBundleFileName );
52      }
53  
54  }

BlueprintComponentTest.html000066400000000000000000000245641164564726100341600ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin 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 junit.framework.TestCase;
32  
33  import org.apache.maven.model.Resource;
34  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
35  import org.osgi.framework.Constants;
36  
37  import aQute.lib.osgi.Builder;
38  
39  
40  public class BlueprintComponentTest extends TestCase
41  {
42  
43      public void testBlueprint() throws Exception
44      {
45          MavenProjectStub project = new MavenProjectStub()
46          {
47              private final List resources = new ArrayList();
48  
49  
50              @Override
51              public void addResource( Resource resource )
52              {
53                  resources.add( resource );
54              }
55  
56  
57              @Override
58              public List getResources()
59              {
60                  return resources;
61              }
62  
63  
64              @Override
65              public File getBasedir()
66              {
67                  return new File( "target/tmp/basedir" );
68              }
69          };
70          project.setGroupId( "group" );
71          project.setArtifactId( "artifact" );
72          project.setVersion( "1.1.0.0" );
73          Resource r = new Resource();
74          r.setDirectory( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
75          r.setIncludes( Arrays.asList( "**/*.*" ) );
76          project.addResource( r );
77          project.addCompileSourceRoot( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
78  
79          ManifestPlugin plugin = new ManifestPlugin();
80          plugin.setBuildDirectory( "target/tmp/basedir/target" );
81          plugin.setOutputDirectory( new File( "target/tmp/basedir/target/classes" ) );
82  
83          Map instructions = new HashMap();
84          instructions.put( "Test", "Foo" );
85  
86          instructions.put( "nsh_interface", "foo.bar.Namespace" );
87          instructions.put( "nsh_namespace", "ns" );
88  
89          instructions.put( "Export-Service", "p7.Foo;mk=mv" );
90          instructions.put( "Import-Service", "org.osgi.service.cm.ConfigurationAdmin;availability:=optional" );
91  
92          Properties props = new Properties();
93          Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
94  
95          Manifest manifest = builder.getJar().getManifest();
96          String expSvc = manifest.getMainAttributes().getValue( Constants.EXPORT_SERVICE );
97          String impSvc = manifest.getMainAttributes().getValue( Constants.IMPORT_SERVICE );
98          assertNotNull( expSvc );
99          assertNotNull( impSvc );
100 
101         String impPkg = manifest.getMainAttributes().getValue( Constants.IMPORT_PACKAGE );
102         List<String> pkgs = Arrays.asList( impPkg.split( "," ) );
103         for ( int i = 1; i <= 13; i++ )
104         {
105             assertTrue( pkgs.contains( "p" + i ) );
106         }
107     }
108 
109 }

maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html000066400000000000000000000332021164564726100334160ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin/BundlePluginTest.html000066400000000000000000000516511164564726100327750ustar00rootroot00000000000000 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.util.Map;
25  import java.util.Properties;
26  import java.util.TreeMap;
27  
28  import org.apache.maven.model.Organization;
29  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
30  import org.apache.maven.project.MavenProject;
31  import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
32  
33  import aQute.lib.osgi.Analyzer;
34  import aQute.lib.osgi.Builder;
35  import aQute.lib.osgi.Jar;
36  
37  
38  /**
39   * Test for {@link BundlePlugin}.
40   * 
41   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
42   */
43  public class BundlePluginTest extends AbstractBundlePluginTest
44  {
45  
46      private BundlePlugin plugin;
47  
48  
49      protected void setUp() throws Exception
50      {
51          super.setUp();
52          plugin = new BundlePlugin();
53          plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
54          plugin.setBuildDirectory( "." );
55          plugin.setOutputDirectory( new File( "." ) );
56      }
57  
58  
59      public void testConvertVersionToOsgi()
60      {
61          String osgiVersion;
62  
63          osgiVersion = plugin.convertVersionToOsgi( "2.1.0-SNAPSHOT" );
64          assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
65  
66          osgiVersion = plugin.convertVersionToOsgi( "2.1-SNAPSHOT" );
67          assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
68  
69          osgiVersion = plugin.convertVersionToOsgi( "2-SNAPSHOT" );
70          assertEquals( "2.0.0.SNAPSHOT", osgiVersion );
71  
72          osgiVersion = plugin.convertVersionToOsgi( "2" );
73          assertEquals( "2.0.0", osgiVersion );
74  
75          osgiVersion = plugin.convertVersionToOsgi( "2.1" );
76          assertEquals( "2.1.0", osgiVersion );
77  
78          osgiVersion = plugin.convertVersionToOsgi( "2.1.3" );
79          assertEquals( "2.1.3", osgiVersion );
80  
81          osgiVersion = plugin.convertVersionToOsgi( "2.1.3.4" );
82          assertEquals( "2.1.3.4", osgiVersion );
83  
84          osgiVersion = plugin.convertVersionToOsgi( "4aug2000r7-dev" );
85          assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion );
86  
87          osgiVersion = plugin.convertVersionToOsgi( "1.1-alpha-2" );
88          assertEquals( "1.1.0.alpha-2", osgiVersion );
89  
90          osgiVersion = plugin.convertVersionToOsgi( "1.0-alpha-16-20070122.203121-13" );
91          assertEquals( "1.0.0.alpha-16-20070122_203121-13", osgiVersion );
92  
93          osgiVersion = plugin.convertVersionToOsgi( "1.0-20070119.021432-1" );
94          assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
95  
96          osgiVersion = plugin.convertVersionToOsgi( "1-20070119.021432-1" );
97          assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
98  
99          osgiVersion = plugin.convertVersionToOsgi( "1.4.1-20070217.082013-7" );
100         assertEquals( "1.4.1.20070217_082013-7", osgiVersion );
101     }
102 
103 
104     public void testReadExportedModules() throws Exception
105     {
106         File osgiBundleFile = getTestBundle();
107 
108         assertTrue( osgiBundleFile.exists() );
109 
110         MavenProject project = new MavenProjectStub();
111         project.setGroupId( "group" );
112         project.setArtifactId( "artifact" );
113         project.setVersion( "1.1.0.0" );
114 
115         //        PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
116         Builder analyzer = new Builder();
117         Jar jar = new Jar( "name", osgiBundleFile );
118         analyzer.setJar( jar );
119         analyzer.setClasspath( new Jar[]
120             { jar } );
121 
122         analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "*" );
123         analyzer.calcManifest();
124 
125         assertEquals( 3, analyzer.getExports().size() );
126 
127         analyzer.close();
128     }
129 
130 
131     public void testTransformDirectives() throws Exception
132     {
133         Map instructions = new TreeMap();
134 
135         instructions.put( "a", "1" );
136         instructions.put( "-a", "2" );
137         instructions.put( "_a", "3" );
138         instructions.put( "A", "3" );
139         instructions.put( "_A", "1" );
140         instructions.put( "_b", "4" );
141         instructions.put( "b", "6" );
142         instructions.put( "_B", "6" );
143         instructions.put( "-B", "5" );
144         instructions.put( "B", "4" );
145 
146         instructions.put( "z", null );
147         instructions.put( "_z", null );
148 
149         Map transformedInstructions = BundlePlugin.transformDirectives( instructions );
150 
151         assertEquals( "1", transformedInstructions.get( "a" ) );
152         assertEquals( "3", transformedInstructions.get( "-a" ) );
153         assertEquals( null, transformedInstructions.get( "_a" ) );
154         assertEquals( "3", transformedInstructions.get( "A" ) );
155         assertEquals( "1", transformedInstructions.get( "-A" ) );
156         assertEquals( null, transformedInstructions.get( "_A" ) );
157         assertEquals( null, transformedInstructions.get( "_b" ) );
158         assertEquals( "4", transformedInstructions.get( "-b" ) );
159         assertEquals( "6", transformedInstructions.get( "b" ) );
160         assertEquals( null, transformedInstructions.get( "_B" ) );
161         assertEquals( "6", transformedInstructions.get( "-B" ) );
162         assertEquals( "4", transformedInstructions.get( "B" ) );
163 
164         assertEquals( "", transformedInstructions.get( "z" ) );
165         assertEquals( "", transformedInstructions.get( "-z" ) );
166     }
167 
168 
169     public void testDefaultPropertiesIncludeOrganization()
170     {
171         final Organization organization = new Organization();
172         organization.setName( "Example Organization" );
173         organization.setUrl( "http://example.org" );
174 
175         // MavenProjectStub.setOrganization(Organization) doesn't do anything, so we have to make it work this way
176         MavenProject project = new MavenProjectStub()
177         {
178             @Override
179             public Organization getOrganization()
180             {
181                 return organization;
182             }
183         };
184         project.setGroupId( "group" );
185         project.setArtifactId( "artifact" );
186         project.setVersion( "1.1.0.0" );
187 
188         Properties properties = plugin.getDefaultProperties( project );
189         assertEquals( organization.getName(), properties.getProperty( "project.organization.name" ) );
190         assertEquals( organization.getName(), properties.getProperty( "pom.organization.name" ) );
191         assertEquals( organization.getUrl(), properties.getProperty( "project.organization.url" ) );
192         assertEquals( organization.getUrl(), properties.getProperty( "pom.organization.url" ) );
193     }
194 
195 
196     public void testVersion() throws Exception
197     {
198         String cleanupVersion = Builder.cleanupVersion( "0.0.0.4aug2000r7-dev" );
199         assertEquals( "0.0.0.4aug2000r7-dev", cleanupVersion );
200     }
201 
202 
203     public void testPackageInfoDetection() throws Exception
204     {
205         MavenProject project = new MavenProjectStub();
206         project.addCompileSourceRoot( getBasedir() + "/src/test/java" );
207 
208         String resourcePaths = plugin.getMavenResourcePaths( project );
209 
210         assertEquals( "org/apache/felix/bundleplugin/packageinfo="
211             + "src/test/java/org/apache/felix/bundleplugin/packageinfo", resourcePaths );
212     }
213 }

maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin/package-frame.html000066400000000000000000000022041164564726100322160ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.felix.bundleplugin

org.apache.felix.bundleplugin

Classes

maven-bundle-plugin-2.3.5/doc/site/xref-test/org/apache/felix/bundleplugin/package-summary.html000066400000000000000000000047651164564726100326370ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.felix.bundleplugin

Package org.apache.felix.bundleplugin

Class Summary
AbstractBundlePluginTest
BlueprintComponentTest
BundleAllPluginTest
BundlePluginTest

Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref-test/overview-frame.html000066400000000000000000000012101164564726100246560ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference

All Classes

Packages

maven-bundle-plugin-2.3.5/doc/site/xref-test/overview-summary.html000066400000000000000000000031321164564726100252660ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference
  • Overview
  • Package

Maven Bundle Plugin 2.3.5 Reference

Packages
org.apache.felix.bundleplugin
  • Overview
  • Package

Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref-test/stylesheet.css000066400000000000000000000030431164564726100237430ustar00rootroot00000000000000/* 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; } maven-bundle-plugin-2.3.5/doc/site/xref/000077500000000000000000000000001164564726100200635ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/allclasses-frame.html000066400000000000000000000110341164564726100241660ustar00rootroot00000000000000 All Classes

All Classes

maven-bundle-plugin-2.3.5/doc/site/xref/index.html000066400000000000000000000014231164564726100220600ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference <body> <h1>Frame Alert</h1> <p> You don't have frames. Go <a href="overview-summary.html">here</a> </p> </body> maven-bundle-plugin-2.3.5/doc/site/xref/org/000077500000000000000000000000001164564726100206525ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/000077500000000000000000000000001164564726100220735ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/000077500000000000000000000000001164564726100232025ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/000077500000000000000000000000001164564726100256725ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/AbstractDependencyFilter.html000066400000000000000000000552771164564726100335100ustar00rootroot00000000000000 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.HashSet;
24  import java.util.Iterator;
25  import java.util.Map;
26  
27  import org.apache.maven.artifact.Artifact;
28  import org.apache.maven.plugin.MojoExecutionException;
29  
30  import aQute.lib.osgi.Instruction;
31  
32  
33  /**
34   * Apply clause-based filter over given dependencies
35   * 
36   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
37   */
38  public abstract class AbstractDependencyFilter
39  {
40      /**
41       * Dependency artifacts.
42       */
43      private final Collection m_dependencyArtifacts;
44  
45  
46      public AbstractDependencyFilter( Collection dependencyArtifacts )
47      {
48          m_dependencyArtifacts = dependencyArtifacts;
49      }
50  
51      private static abstract class DependencyFilter
52      {
53          private final Instruction m_instruction;
54          private final String m_defaultValue;
55  
56  
57          public DependencyFilter( String expression )
58          {
59              this( expression, "" );
60          }
61  
62  
63          public DependencyFilter( String expression, String defaultValue )
64          {
65              m_instruction = Instruction.getPattern( expression );
66              m_defaultValue = defaultValue;
67          }
68  
69  
70          public void filter( Collection dependencies )
71          {
72              for ( Iterator i = dependencies.iterator(); i.hasNext(); )
73              {
74                  if ( false == matches( ( Artifact ) i.next() ) )
75                  {
76                      i.remove();
77                  }
78              }
79          }
80  
81  
82          abstract boolean matches( Artifact dependency );
83  
84  
85          boolean matches( String text )
86          {
87              boolean result;
88  
89              if ( null == text )
90              {
91                  result = m_instruction.matches( m_defaultValue );
92              }
93              else
94              {
95                  result = m_instruction.matches( text );
96              }
97  
98              return m_instruction.isNegated() ? !result : result;
99          }
100     }
101 
102 
103     protected final void processInstructions( Map instructions ) throws MojoExecutionException
104     {
105         DependencyFilter filter;
106         for ( Iterator clauseIterator = instructions.entrySet().iterator(); clauseIterator.hasNext(); )
107         {
108             String inline = "false";
109 
110             // must use a fresh *modifiable* collection for each unique clause
111             Collection filteredDependencies = new HashSet( m_dependencyArtifacts );
112 
113             // CLAUSE: REGEXP --> { ATTRIBUTE MAP }
114             Map.Entry clause = ( Map.Entry ) clauseIterator.next();
115             StringBuilder tag = new StringBuilder();
116             tag.append( clause.getKey() );
117 
118             if ( !( ( String ) clause.getKey() ).matches( "\\*~*" ) )
119             {
120                 filter = new DependencyFilter( ( String ) clause.getKey() )
121                 {
122                     boolean matches( Artifact dependency )
123                     {
124                         return super.matches( dependency.getArtifactId() );
125                     }
126                 };
127                 // FILTER ON MAIN CLAUSE
128                 filter.filter( filteredDependencies );
129             }
130 
131             for ( Iterator attrIterator = ( ( Map ) clause.getValue() ).entrySet().iterator(); attrIterator.hasNext(); )
132             {
133                 // ATTRIBUTE: KEY --> REGEXP
134                 Map.Entry attr = ( Map.Entry ) attrIterator.next();
135                 tag.append( ';' ).append( attr );
136 
137                 if ( "groupId".equals( attr.getKey() ) )
138                 {
139                     filter = new DependencyFilter( ( String ) attr.getValue() )
140                     {
141                         boolean matches( Artifact dependency )
142                         {
143                             return super.matches( dependency.getGroupId() );
144                         }
145                     };
146                 }
147                 else if ( "artifactId".equals( attr.getKey() ) )
148                 {
149                     filter = new DependencyFilter( ( String ) attr.getValue() )
150                     {
151                         boolean matches( Artifact dependency )
152                         {
153                             return super.matches( dependency.getArtifactId() );
154                         }
155                     };
156                 }
157                 else if ( "version".equals( attr.getKey() ) )
158                 {
159                     filter = new DependencyFilter( ( String ) attr.getValue() )
160                     {
161                         boolean matches( Artifact dependency )
162                         {
163                             try
164                             {
165                                 // use the symbolic version if available (ie. 1.0.0-SNAPSHOT)
166                                 return super.matches( dependency.getSelectedVersion().toString() );
167                             }
168                             catch ( Exception e )
169                             {
170                                 return super.matches( dependency.getVersion() );
171                             }
172                         }
173                     };
174                 }
175                 else if ( "scope".equals( attr.getKey() ) )
176                 {
177                     filter = new DependencyFilter( ( String ) attr.getValue(), "compile" )
178                     {
179                         boolean matches( Artifact dependency )
180                         {
181                             return super.matches( dependency.getScope() );
182                         }
183                     };
184                 }
185                 else if ( "type".equals( attr.getKey() ) )
186                 {
187                     filter = new DependencyFilter( ( String ) attr.getValue(), "jar" )
188                     {
189                         boolean matches( Artifact dependency )
190                         {
191                             return super.matches( dependency.getType() );
192                         }
193                     };
194                 }
195                 else if ( "classifier".equals( attr.getKey() ) )
196                 {
197                     filter = new DependencyFilter( ( String ) attr.getValue() )
198                     {
199                         boolean matches( Artifact dependency )
200                         {
201                             return super.matches( dependency.getClassifier() );
202                         }
203                     };
204                 }
205                 else if ( "optional".equals( attr.getKey() ) )
206                 {
207                     filter = new DependencyFilter( ( String ) attr.getValue(), "false" )
208                     {
209                         boolean matches( Artifact dependency )
210                         {
211                             return super.matches( "" + dependency.isOptional() );
212                         }
213                     };
214                 }
215                 else if ( "inline".equals( attr.getKey() ) )
216                 {
217                     inline = ( String ) attr.getValue();
218                     continue;
219                 }
220                 else
221                 {
222                     throw new MojoExecutionException( "Unexpected attribute " + attr.getKey() );
223                 }
224 
225                 // FILTER ON EACH ATTRIBUTE
226                 filter.filter( filteredDependencies );
227             }
228 
229             processDependencies( tag.toString(), inline, filteredDependencies );
230         }
231     }
232 
233 
234     protected abstract void processDependencies( String clause, String inline, Collection dependencies );
235 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/AntPlugin.html000066400000000000000000000231441164564726100304650ustar00rootroot00000000000000 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.lib.osgi.Builder;
35  import aQute.lib.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  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/BlueprintPlugin.html000066400000000000000000001113141164564726100317040ustar00rootroot00000000000000 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.HashSet;
30  import java.util.Iterator;
31  import java.util.List;
32  import java.util.Map;
33  import java.util.Set;
34  import java.util.TreeSet;
35  import java.util.regex.Pattern;
36  
37  import javax.xml.transform.Transformer;
38  import javax.xml.transform.TransformerFactory;
39  import javax.xml.transform.stream.StreamResult;
40  import javax.xml.transform.stream.StreamSource;
41  
42  import aQute.bnd.service.AnalyzerPlugin;
43  import aQute.lib.osgi.Analyzer;
44  import aQute.lib.osgi.Jar;
45  import aQute.lib.osgi.Processor;
46  import aQute.lib.osgi.Resource;
47  import aQute.libg.generics.Create;
48  import aQute.libg.qtokens.QuotedTokenizer;
49  import aQute.libg.reporter.Reporter;
50  
51  
52  public class BlueprintPlugin implements AnalyzerPlugin
53  {
54  
55      static Pattern QN = Pattern.compile( "[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*" );
56      static Pattern PATHS = Pattern.compile( ".*\\.xml" );
57  
58      Transformer transformer;
59  
60  
61      public BlueprintPlugin() throws Exception
62      {
63          transformer = getTransformer( getClass().getResource( "blueprint.xsl" ) );
64      }
65  
66  
67      public boolean analyzeJar( Analyzer analyzer ) throws Exception
68      {
69          transformer.setParameter( "nsh_interface",
70              analyzer.getProperty( "nsh_interface" ) != null ? analyzer.getProperty( "nsh_interface" ) : "" );
71          transformer.setParameter( "nsh_namespace",
72              analyzer.getProperty( "nsh_namespace" ) != null ? analyzer.getProperty( "nsh_namespace" ) : "" );
73  
74          Set<String> headers = Create.set();
75  
76          String bpHeader = analyzer.getProperty( "Bundle-Blueprint", "OSGI-INF/blueprint" );
77          Map<String, Map<String, String>> map = Processor.parseHeader( bpHeader, null );
78          for ( String root : map.keySet() )
79          {
80              Jar jar = analyzer.getJar();
81              Map<String, Resource> dir = jar.getDirectories().get( root );
82              if ( dir == null || dir.isEmpty() )
83              {
84                  Resource resource = jar.getResource( root );
85                  if ( resource != null )
86                      process( analyzer, root, resource, headers );
87                  return false;
88              }
89              for ( Map.Entry<String, Resource> entry : dir.entrySet() )
90              {
91                  String path = entry.getKey();
92                  Resource resource = entry.getValue();
93                  if ( PATHS.matcher( path ).matches() )
94                      process( analyzer, path, resource, headers );
95              }
96  
97          }
98  
99          // Group and analyze
100         Map<String, Set<Attribute>> hdrs = Create.map();
101         for ( String str : headers )
102         {
103             int idx = str.indexOf( ':' );
104             if ( idx < 0 )
105             {
106                 analyzer.warning( ( new StringBuilder( "Error analyzing services in blueprint resource: " ) ).append(
107                     str ).toString() );
108                 continue;
109             }
110             String h = str.substring( 0, idx ).trim();
111             String v = str.substring( idx + 1 ).trim();
112             Set<Attribute> att = hdrs.get( h );
113             if ( att == null )
114             {
115                 att = new TreeSet<Attribute>();
116                 hdrs.put( h, att );
117             }
118             att.addAll( parseHeader( v, null ) );
119         }
120         // Merge
121         for ( String header : hdrs.keySet() )
122         {
123             if ( "Import-Class".equals( header ) || "Import-Package".equals( header ) )
124             {
125                 Set<Attribute> newAttr = hdrs.get( header );
126                 for ( Attribute a : newAttr )
127                 {
128                     String pkg = a.getName();
129                     if ( "Import-Class".equals( header ) )
130                     {
131                         int n = a.getName().lastIndexOf( '.' );
132                         if ( n > 0 )
133                         {
134                             pkg = pkg.subSequence( 0, n ).toString();
135                         }
136                         else
137                         {
138                             continue;
139                         }
140                     }
141                     if ( !analyzer.getReferred().containsKey( pkg ) )
142                     {
143                         analyzer.getReferred().put( pkg, a.getProperties() );
144                     }
145                 }
146             }
147             else
148             {
149                 Set<Attribute> orgAttr = parseHeader( analyzer.getProperty( header ), null );
150                 Set<Attribute> newAttr = hdrs.get( header );
151                 for ( Iterator<Attribute> it = newAttr.iterator(); it.hasNext(); )
152                 {
153                     Attribute a = it.next();
154                     for ( Attribute b : orgAttr )
155                     {
156                         if ( b.getName().equals( a.getName() ) )
157                         {
158                             it.remove();
159                             break;
160                         }
161                     }
162                 }
163                 orgAttr.addAll( newAttr );
164                 // Rebuild from orgAttr
165                 StringBuilder sb = new StringBuilder();
166                 for ( Attribute a : orgAttr )
167                 {
168                     if ( sb.length() > 0 )
169                     {
170                         sb.append( "," );
171                     }
172                     sb.append( a.getName() );
173                     for ( Map.Entry<String, String> prop : a.getProperties().entrySet() )
174                     {
175                         sb.append( ';' ).append( prop.getKey() ).append( "=" );
176                         if ( prop.getValue().matches( "[0-9a-zA-Z_-]+" ) )
177                         {
178                             sb.append( prop.getValue() );
179                         }
180                         else
181                         {
182                             sb.append( "\"" );
183                             sb.append( prop.getValue().replace( "\"", "\\\"" ) );
184                             sb.append( "\"" );
185                         }
186                     }
187                 }
188                 analyzer.setProperty( header, sb.toString() );
189             }
190         }
191         return false;
192     }
193 
194 
195     private void process( Analyzer analyzer, String path, Resource resource, Set<String> headers )
196     {
197         InputStream in = null;
198         try
199         {
200             in = resource.openInputStream();
201 
202             // Retrieve headers
203             Set<String> set = analyze( in );
204             headers.addAll( set );
205         }
206         catch ( Exception e )
207         {
208             analyzer.error( ( new StringBuilder( "Unexpected exception in processing spring resources(" ) )
209                 .append( path ).append( "): " ).append( e ).toString() );
210         }
211         finally
212         {
213             try
214             {
215                 if ( in != null )
216                 {
217                     in.close();
218                 }
219             }
220             catch ( IOException e )
221             {
222             }
223         }
224     }
225 
226 
227     public Set<String> analyze( InputStream in ) throws Exception
228     {
229         Set<String> refers = new HashSet<String>();
230         ByteArrayOutputStream bout = new ByteArrayOutputStream();
231         javax.xml.transform.Result r = new StreamResult( bout );
232         javax.xml.transform.Source s = new StreamSource( in );
233         transformer.transform( s, r );
234         ByteArrayInputStream bin = new ByteArrayInputStream( bout.toByteArray() );
235         bout.close();
236         BufferedReader br = new BufferedReader( new InputStreamReader( bin ) );
237         for ( String line = br.readLine(); line != null; line = br.readLine() )
238         {
239             line = line.trim();
240             line = line.replace( ";availability:=mandatory", "" );
241             if ( line.length() > 0 )
242             {
243                 refers.add( line );
244             }
245         }
246 
247         br.close();
248         return refers;
249     }
250 
251 
252     protected Transformer getTransformer( URL url ) throws Exception
253     {
254         TransformerFactory tf = TransformerFactory.newInstance();
255         javax.xml.transform.Source source = new StreamSource( url.openStream() );
256         return tf.newTransformer( source );
257     }
258 
259     public static class Attribute implements Comparable<Attribute>
260     {
261         private final String name;
262         private final Map<String, String> properties;
263 
264 
265         public Attribute( String name, Map<String, String> properties )
266         {
267             this.name = name;
268             this.properties = properties;
269         }
270 
271 
272         public String getName()
273         {
274             return name;
275         }
276 
277 
278         public Map<String, String> getProperties()
279         {
280             return properties;
281         }
282 
283 
284         public int compareTo( Attribute a )
285         {
286             int c = name.compareTo( a.name );
287             if ( c == 0 )
288             {
289                 c = properties.equals( a.properties ) ? 0 : properties.size() < a.properties.size() ? -1 : properties
290                     .hashCode() < a.properties.hashCode() ? -1 : +1;
291             }
292             return c;
293         }
294 
295 
296         @Override
297         public boolean equals( Object o )
298         {
299             if ( this == o )
300                 return true;
301             if ( o == null || getClass() != o.getClass() )
302                 return false;
303 
304             Attribute attribute = ( Attribute ) o;
305 
306             if ( name != null ? !name.equals( attribute.name ) : attribute.name != null )
307                 return false;
308             if ( properties != null ? !properties.equals( attribute.properties ) : attribute.properties != null )
309                 return false;
310 
311             return true;
312         }
313 
314 
315         @Override
316         public int hashCode()
317         {
318             int result = name != null ? name.hashCode() : 0;
319             result = 31 * result + ( properties != null ? properties.hashCode() : 0 );
320             return result;
321         }
322     }
323 
324 
325     public static Set<Attribute> parseHeader( String value, Reporter logger )
326     {
327         if ( ( value == null ) || ( value.trim().length() == 0 ) )
328         {
329             return new TreeSet<Attribute>();
330         }
331         Set<Attribute> result = new TreeSet<Attribute>();
332         QuotedTokenizer qt = new QuotedTokenizer( value, ";=," );
333         char del = '\0';
334         do
335         {
336             boolean hadAttribute = false;
337             Map<String, String> clause = Create.map();
338             List<String> aliases = Create.list();
339             String name = qt.nextToken( ",;" );
340 
341             del = qt.getSeparator();
342             if ( ( name == null ) || ( name.length() == 0 ) )
343             {
344                 if ( ( logger != null ) && ( logger.isPedantic() ) )
345                 {
346                     logger
347                         .warning( "Empty clause, usually caused by repeating a comma without any name field or by having "
348                             + "spaces after the backslash of a property file: " + value );
349                 }
350 
351                 if ( name != null )
352                     continue;
353                 break;
354             }
355             name = name.trim();
356 
357             aliases.add( name );
358             String advalue;
359             while ( del == ';' )
360             {
361                 String adname = qt.nextToken();
362                 if ( ( del = qt.getSeparator() ) != '=' )
363                 {
364                     if ( ( hadAttribute ) && ( logger != null ) )
365                     {
366                         logger.error( "Header contains name field after attribute or directive: " + adname + " from "
367                             + value + ". Name fields must be consecutive, separated by a ';' like a;b;c;x=3;y=4" );
368                     }
369 
370                     if ( ( adname != null ) && ( adname.length() > 0 ) )
371                         aliases.add( adname.trim() );
372                 }
373                 else
374                 {
375                     advalue = qt.nextToken();
376                     if ( ( clause.containsKey( adname ) ) && ( logger != null ) && ( logger.isPedantic() ) )
377                     {
378                         logger.warning( "Duplicate attribute/directive name " + adname + " in " + value
379                             + ". This attribute/directive will be ignored" );
380                     }
381 
382                     if ( advalue == null )
383                     {
384                         if ( logger != null )
385                         {
386                             logger.error( "No value after '=' sign for attribute " + adname );
387                         }
388                         advalue = "";
389                     }
390                     clause.put( adname.trim(), advalue.trim() );
391                     del = qt.getSeparator();
392                     hadAttribute = true;
393                 }
394             }
395 
396             for ( String clauseName : aliases )
397             {
398                 result.add( new Attribute( clauseName, clause ) );
399             }
400         }
401         while ( del == ',' );
402         return result;
403     }
404 
405 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/BundleAllPlugin.html000066400000000000000000001556741164564726100316230ustar00rootroot00000000000000 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.lib.osgi.Analyzer;
57  import aQute.lib.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 ( ProjectBuildingException e )
275             {
276                 throw new MojoExecutionException( "Unable to build project object for artifact " + artifact, e );
277             }
278             catch ( InvalidDependencyVersionException e )
279             {
280                 throw new MojoExecutionException( "Invalid dependency version for artifact " + artifact );
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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/BundleInfo.html000066400000000000000000000247171164564726100306200ustar00rootroot00000000000000 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.html 1143000 2011-07-05 11:50:48Z 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/BundlePlugin.html000066400000000000000000003647741164564726100311750ustar00rootroot00000000000000 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.IOException;
27  import java.io.InputStream;
28  import java.lang.reflect.Method;
29  import java.util.ArrayList;
30  import java.util.Arrays;
31  import java.util.Collection;
32  import java.util.Collections;
33  import java.util.Enumeration;
34  import java.util.HashSet;
35  import java.util.Iterator;
36  import java.util.LinkedHashMap;
37  import java.util.LinkedHashSet;
38  import java.util.List;
39  import java.util.Map;
40  import java.util.Properties;
41  import java.util.Set;
42  import java.util.jar.Attributes;
43  import java.util.jar.Manifest;
44  
45  import org.apache.maven.archiver.ManifestSection;
46  import org.apache.maven.archiver.MavenArchiveConfiguration;
47  import org.apache.maven.archiver.MavenArchiver;
48  import org.apache.maven.artifact.Artifact;
49  import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
50  import org.apache.maven.execution.MavenSession;
51  import org.apache.maven.model.License;
52  import org.apache.maven.model.Model;
53  import org.apache.maven.model.Resource;
54  import org.apache.maven.plugin.AbstractMojo;
55  import org.apache.maven.plugin.MojoExecutionException;
56  import org.apache.maven.plugin.MojoFailureException;
57  import org.apache.maven.plugin.logging.Log;
58  import org.apache.maven.project.MavenProject;
59  import org.apache.maven.project.MavenProjectHelper;
60  import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
61  import org.apache.maven.shared.osgi.Maven2OsgiConverter;
62  import org.codehaus.plexus.archiver.UnArchiver;
63  import org.codehaus.plexus.archiver.manager.ArchiverManager;
64  import org.codehaus.plexus.util.DirectoryScanner;
65  import org.codehaus.plexus.util.FileUtils;
66  import org.codehaus.plexus.util.StringUtils;
67  
68  import aQute.lib.osgi.Analyzer;
69  import aQute.lib.osgi.Builder;
70  import aQute.lib.osgi.Constants;
71  import aQute.lib.osgi.EmbeddedResource;
72  import aQute.lib.osgi.FileResource;
73  import aQute.lib.osgi.Jar;
74  import aQute.lib.osgi.Processor;
75  import aQute.lib.spring.SpringXMLType;
76  
77  
78  /**
79   * Create an OSGi bundle from Maven project
80   *
81   * @goal bundle
82   * @phase package
83   * @requiresDependencyResolution test
84   * @description build an OSGi bundle jar
85   * @threadSafe
86   */
87  public class BundlePlugin extends AbstractMojo
88  {
89      /**
90       * Directory where the manifest will be written
91       *
92       * @parameter expression="${manifestLocation}" default-value="${project.build.outputDirectory}/META-INF"
93       */
94      protected File manifestLocation;
95  
96      /**
97       * File where the BND instructions will be dumped
98       *
99       * @parameter expression="${dumpInstructions}"
100      */
101     protected File dumpInstructions;
102 
103     /**
104      * File where the BND class-path will be dumped
105      *
106      * @parameter expression="${dumpClasspath}"
107      */
108     protected File dumpClasspath;
109 
110     /**
111      * When true, unpack the bundle contents to the outputDirectory
112      *
113      * @parameter expression="${unpackBundle}"
114      */
115     protected boolean unpackBundle;
116 
117     /**
118      * Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything)
119      *
120      * @parameter expression="${excludeDependencies}"
121      */
122     protected String excludeDependencies;
123 
124     /**
125      * Classifier type of the bundle to be installed.  For example, "jdk14".
126      * Defaults to none which means this is the project's main bundle.
127      *
128      * @parameter
129      */
130     protected String classifier;
131 
132     /**
133      * @component
134      */
135     private MavenProjectHelper m_projectHelper;
136 
137     /**
138      * @component
139      */
140     private ArchiverManager m_archiverManager;
141 
142     /**
143      * @component
144      */
145     private ArtifactHandlerManager m_artifactHandlerManager;
146 
147     /**
148      * Project types which this plugin supports.
149      *
150      * @parameter
151      */
152     protected List supportedProjectTypes = Arrays.asList( new String[]
153         { "jar", "bundle" } );
154 
155     /**
156      * The directory for the generated bundles.
157      *
158      * @parameter expression="${project.build.outputDirectory}"
159      * @required
160      */
161     private File outputDirectory;
162 
163     /**
164      * The directory for the generated JAR.
165      *
166      * @parameter expression="${project.build.directory}"
167      * @required
168      */
169     private String buildDirectory;
170 
171     /**
172      * The Maven project.
173      *
174      * @parameter expression="${project}"
175      * @required
176      * @readonly
177      */
178     private MavenProject project;
179 
180     /**
181      * The BND instructions for the bundle.
182      *
183      * @parameter
184      */
185     private Map instructions = new LinkedHashMap();
186 
187     /**
188      * Use locally patched version for now.
189      */
190     private Maven2OsgiConverter m_maven2OsgiConverter = new DefaultMaven2OsgiConverter();
191 
192     /**
193      * The archive configuration to use.
194      *
195      * @parameter
196      */
197     private MavenArchiveConfiguration archive; // accessed indirectly in JarPluginConfiguration
198 
199     /**
200      * @parameter default-value="${session}"
201      * @required
202      * @readonly
203      */
204     private MavenSession m_mavenSession;
205 
206     private static final String MAVEN_SYMBOLICNAME = "maven-symbolicname";
207     private static final String MAVEN_RESOURCES = "{maven-resources}";
208     private static final String LOCAL_PACKAGES = "{local-packages}";
209 
210     private static final String[] EMPTY_STRING_ARRAY =
211         {};
212     private static final String[] DEFAULT_INCLUDES =
213         { "**/**" };
214 
215     private static final String NL = System.getProperty( "line.separator" );
216 
217 
218     protected Maven2OsgiConverter getMaven2OsgiConverter()
219     {
220         return m_maven2OsgiConverter;
221     }
222 
223 
224     protected void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter )
225     {
226         m_maven2OsgiConverter = maven2OsgiConverter;
227     }
228 
229 
230     protected MavenProject getProject()
231     {
232         return project;
233     }
234 
235 
236     /**
237      * @see org.apache.maven.plugin.AbstractMojo#execute()
238      */
239     public void execute() throws MojoExecutionException
240     {
241         Properties properties = new Properties();
242         String projectType = getProject().getArtifact().getType();
243 
244         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
245         if ( !supportedProjectTypes.contains( projectType ) )
246         {
247             getLog().warn(
248                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
249             return;
250         }
251 
252         execute( getProject(), instructions, properties );
253     }
254 
255 
256     protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties )
257         throws MojoExecutionException
258     {
259         try
260         {
261             execute( currentProject, originalInstructions, properties, getClasspath( currentProject ) );
262         }
263         catch ( IOException e )
264         {
265             throw new MojoExecutionException( "Error calculating classpath for project " + currentProject, e );
266         }
267     }
268 
269 
270     /* transform directives from their XML form to the expected BND syntax (eg. _include becomes -include) */
271     protected static Map transformDirectives( Map originalInstructions )
272     {
273         Map transformedInstructions = new LinkedHashMap();
274         for ( Iterator i = originalInstructions.entrySet().iterator(); i.hasNext(); )
275         {
276             Map.Entry e = ( Map.Entry ) i.next();
277 
278             String key = ( String ) e.getKey();
279             if ( key.startsWith( "_" ) )
280             {
281                 key = "-" + key.substring( 1 );
282             }
283 
284             String value = ( String ) e.getValue();
285             if ( null == value )
286             {
287                 value = "";
288             }
289             else
290             {
291                 value = value.replaceAll( "\\p{Blank}*[\r\n]\\p{Blank}*", "" );
292             }
293 
294             if ( Analyzer.WAB.equals( key ) && value.length() == 0 )
295             {
296                 // provide useful default
297                 value = "src/main/webapp/";
298             }
299 
300             transformedInstructions.put( key, value );
301         }
302         return transformedInstructions;
303     }
304 
305 
306     protected boolean reportErrors( String prefix, Analyzer analyzer )
307     {
308         List errors = analyzer.getErrors();
309         List warnings = analyzer.getWarnings();
310 
311         for ( Iterator w = warnings.iterator(); w.hasNext(); )
312         {
313             String msg = ( String ) w.next();
314             getLog().warn( prefix + " : " + msg );
315         }
316 
317         boolean hasErrors = false;
318         String fileNotFound = "Input file does not exist: ";
319         for ( Iterator e = errors.iterator(); e.hasNext(); )
320         {
321             String msg = ( String ) e.next();
322             if ( msg.startsWith( fileNotFound ) && msg.endsWith( "~" ) )
323             {
324                 // treat as warning; this error happens when you have duplicate entries in Include-Resource
325                 String duplicate = Processor.removeDuplicateMarker( msg.substring( fileNotFound.length() ) );
326                 getLog().warn( prefix + " : Duplicate path '" + duplicate + "' in Include-Resource" );
327             }
328             else
329             {
330                 getLog().error( prefix + " : " + msg );
331                 hasErrors = true;
332             }
333         }
334         return hasErrors;
335     }
336 
337 
338     protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties,
339         Jar[] classpath ) throws MojoExecutionException
340     {
341         try
342         {
343             File jarFile = new File( getBuildDirectory(), getBundleName( currentProject ) );
344             Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties, classpath );
345             boolean hasErrors = reportErrors( "Bundle " + currentProject.getArtifact(), builder );
346             if ( hasErrors )
347             {
348                 String failok = builder.getProperty( "-failok" );
349                 if ( null == failok || "false".equalsIgnoreCase( failok ) )
350                 {
351                     jarFile.delete();
352 
353                     throw new MojoFailureException( "Error(s) found in bundle configuration" );
354                 }
355             }
356 
357             // attach bundle to maven project
358             jarFile.getParentFile().mkdirs();
359             builder.getJar().write( jarFile );
360 
361             Artifact mainArtifact = currentProject.getArtifact();
362 
363             if ( "bundle".equals( mainArtifact.getType() ) )
364             {
365                 // workaround for MNG-1682: force maven to install artifact using the "jar" handler
366                 mainArtifact.setArtifactHandler( m_artifactHandlerManager.getArtifactHandler( "jar" ) );
367             }
368 
369             if ( null == classifier || classifier.trim().length() == 0 )
370             {
371                 mainArtifact.setFile( jarFile );
372             }
373             else
374             {
375                 m_projectHelper.attachArtifact( currentProject, jarFile, classifier );
376             }
377 
378             if ( unpackBundle )
379             {
380                 unpackBundle( jarFile );
381             }
382 
383             if ( manifestLocation != null )
384             {
385                 File outputFile = new File( manifestLocation, "MANIFEST.MF" );
386 
387                 try
388                 {
389                     Manifest manifest = builder.getJar().getManifest();
390                     ManifestPlugin.writeManifest( manifest, outputFile );
391                 }
392                 catch ( IOException e )
393                 {
394                     getLog().error( "Error trying to write Manifest to file " + outputFile, e );
395                 }
396             }
397 
398             // cleanup...
399             builder.close();
400         }
401         catch ( MojoFailureException e )
402         {
403             getLog().error( e.getLocalizedMessage() );
404             throw new MojoExecutionException( "Error(s) found in bundle configuration", e );
405         }
406         catch ( Exception e )
407         {
408             getLog().error( "An internal error occurred", e );
409             throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
410         }
411     }
412 
413 
414     protected Builder getOSGiBuilder( MavenProject currentProject, Map originalInstructions, Properties properties,
415         Jar[] classpath ) throws Exception
416     {
417         properties.putAll( getDefaultProperties( currentProject ) );
418         properties.putAll( transformDirectives( originalInstructions ) );
419 
420         Builder builder = new Builder();
421         builder.setBase( getBase( currentProject ) );
422         builder.setProperties( properties );
423         if ( classpath != null )
424         {
425             builder.setClasspath( classpath );
426         }
427 
428         return builder;
429     }
430 
431 
432     protected void addMavenInstructions( MavenProject currentProject, Builder builder ) throws Exception
433     {
434         if ( currentProject.getBasedir() != null )
435         {
436             // update BND instructions to add included Maven resources
437             includeMavenResources( currentProject, builder, getLog() );
438 
439             // calculate default export/private settings based on sources
440             addLocalPackages( outputDirectory, builder );
441         }
442 
443         // update BND instructions to embed selected Maven dependencies
444         Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, builder );
445         new DependencyEmbedder( getLog(), embeddableArtifacts ).processHeaders( builder );
446 
447         if ( dumpInstructions != null || getLog().isDebugEnabled() )
448         {
449             StringBuilder buf = new StringBuilder();
450             getLog().debug( "BND Instructions:" + NL + dumpInstructions( builder.getProperties(), buf ) );
451             if ( dumpInstructions != null )
452             {
453                 getLog().info( "Writing BND instructions to " + dumpInstructions );
454                 dumpInstructions.getParentFile().mkdirs();
455                 FileUtils.fileWrite( dumpInstructions, "# BND instructions" + NL + buf );
456             }
457         }
458 
459         if ( dumpClasspath != null || getLog().isDebugEnabled() )
460         {
461             StringBuilder buf = new StringBuilder();
462             getLog().debug( "BND Classpath:" + NL + dumpClasspath( builder.getClasspath(), buf ) );
463             if ( dumpClasspath != null )
464             {
465                 getLog().info( "Writing BND classpath to " + dumpClasspath );
466                 dumpClasspath.getParentFile().mkdirs();
467                 FileUtils.fileWrite( dumpClasspath, "# BND classpath" + NL + buf );
468             }
469         }
470     }
471 
472 
473     protected Builder buildOSGiBundle( MavenProject currentProject, Map originalInstructions, Properties properties,
474         Jar[] classpath ) throws Exception
475     {
476         Builder builder = getOSGiBuilder( currentProject, originalInstructions, properties, classpath );
477 
478         addMavenInstructions( currentProject, builder );
479 
480         builder.build();
481 
482         mergeMavenManifest( currentProject, builder );
483 
484         return builder;
485     }
486 
487 
488     protected static StringBuilder dumpInstructions( Properties properties, StringBuilder buf )
489     {
490         try
491         {
492             buf.append( "#-----------------------------------------------------------------------" + NL );
493             Properties stringProperties = new Properties();
494             for ( Enumeration e = properties.propertyNames(); e.hasMoreElements(); )
495             {
496                 // we can only store String properties
497                 String key = ( String ) e.nextElement();
498                 String value = properties.getProperty( key );
499                 if ( value != null )
500                 {
501                     stringProperties.setProperty( key, value );
502                 }
503             }
504             ByteArrayOutputStream out = new ByteArrayOutputStream();
505             stringProperties.store( out, null ); // properties encoding is 8859_1
506             buf.append( out.toString( "8859_1" ) );
507             buf.append( "#-----------------------------------------------------------------------" + NL );
508         }
509         catch ( Throwable e )
510         {
511             // ignore...
512         }
513         return buf;
514     }
515 
516 
517     protected static StringBuilder dumpClasspath( List classpath, StringBuilder buf )
518     {
519         try
520         {
521             buf.append( "#-----------------------------------------------------------------------" + NL );
522             buf.append( "-classpath:\\" + NL );
523             for ( Iterator i = classpath.iterator(); i.hasNext(); )
524             {
525                 File path = ( ( Jar ) i.next() ).getSource();
526                 if ( path != null )
527                 {
528                     buf.append( ' ' + path.toString() + ( i.hasNext() ? ",\\" : "" ) + NL );
529                 }
530             }
531             buf.append( "#-----------------------------------------------------------------------" + NL );
532         }
533         catch ( Throwable e )
534         {
535             // ignore...
536         }
537         return buf;
538     }
539 
540 
541     protected static StringBuilder dumpManifest( Manifest manifest, StringBuilder buf )
542     {
543         try
544         {
545             buf.append( "#-----------------------------------------------------------------------" + NL );
546             ByteArrayOutputStream out = new ByteArrayOutputStream();
547             manifest.write( out ); // manifest encoding is UTF8
548             buf.append( out.toString( "UTF8" ) );
549             buf.append( "#-----------------------------------------------------------------------" + NL );
550         }
551         catch ( Throwable e )
552         {
553             // ignore...
554         }
555         return buf;
556     }
557 
558 
559     protected static void includeMavenResources( MavenProject currentProject, Analyzer analyzer, Log log )
560     {
561         // pass maven resource paths onto BND analyzer
562         final String mavenResourcePaths = getMavenResourcePaths( currentProject );
563         final String includeResource = ( String ) analyzer.getProperty( Analyzer.INCLUDE_RESOURCE );
564         if ( includeResource != null )
565         {
566             if ( includeResource.indexOf( MAVEN_RESOURCES ) >= 0 )
567             {
568                 // if there is no maven resource path, we do a special treatment and replace
569                 // every occurance of MAVEN_RESOURCES and a following comma with an empty string
570                 if ( mavenResourcePaths.length() == 0 )
571                 {
572                     String cleanedResource = removeTagFromInstruction( includeResource, MAVEN_RESOURCES );
573                     if ( cleanedResource.length() > 0 )
574                     {
575                         analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, cleanedResource );
576                     }
577                     else
578                     {
579                         analyzer.unsetProperty( Analyzer.INCLUDE_RESOURCE );
580                     }
581                 }
582                 else
583                 {
584                     String combinedResource = StringUtils
585                         .replace( includeResource, MAVEN_RESOURCES, mavenResourcePaths );
586                     analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, combinedResource );
587                 }
588             }
589             else if ( mavenResourcePaths.length() > 0 )
590             {
591                 log.warn( Analyzer.INCLUDE_RESOURCE + ": overriding " + mavenResourcePaths + " with " + includeResource
592                     + " (add " + MAVEN_RESOURCES + " if you want to include the maven resources)" );
593             }
594         }
595         else if ( mavenResourcePaths.length() > 0 )
596         {
597             analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths );
598         }
599     }
600 
601 
602     protected void mergeMavenManifest( MavenProject currentProject, Builder builder ) throws Exception
603     {
604         Jar jar = builder.getJar();
605 
606         if ( getLog().isDebugEnabled() )
607         {
608             getLog().debug( "BND Manifest:" + NL + dumpManifest( jar.getManifest(), new StringBuilder() ) );
609         }
610 
611         boolean addMavenDescriptor = currentProject.getBasedir() != null;
612 
613         try
614         {
615             /*
616              * Grab customized manifest entries from the maven-jar-plugin configuration
617              */
618             MavenArchiveConfiguration archiveConfig = JarPluginConfiguration.getArchiveConfiguration( currentProject );
619             String mavenManifestText = new MavenArchiver().getManifest( currentProject, archiveConfig ).toString();
620             addMavenDescriptor = addMavenDescriptor && archiveConfig.isAddMavenDescriptor();
621 
622             Manifest mavenManifest = new Manifest();
623 
624             // First grab the external manifest file (if specified)
625             File externalManifestFile = archiveConfig.getManifestFile();
626             if ( null != externalManifestFile && externalManifestFile.exists() )
627             {
628                 InputStream mis = new FileInputStream( externalManifestFile );
629                 mavenManifest.read( mis );
630                 mis.close();
631             }
632 
633             // Then apply customized entries from the jar plugin; note: manifest encoding is UTF8
634             mavenManifest.read( new ByteArrayInputStream( mavenManifestText.getBytes( "UTF8" ) ) );
635 
636             if ( !archiveConfig.isManifestSectionsEmpty() )
637             {
638                 /*
639                  * Add customized manifest sections (for some reason MavenArchiver doesn't do this for us)
640                  */
641                 List sections = archiveConfig.getManifestSections();
642                 for ( Iterator i = sections.iterator(); i.hasNext(); )
643                 {
644                     ManifestSection section = ( ManifestSection ) i.next();
645                     Attributes attributes = new Attributes();
646 
647                     if ( !section.isManifestEntriesEmpty() )
648                     {
649                         Map entries = section.getManifestEntries();
650                         for ( Iterator j = entries.entrySet().iterator(); j.hasNext(); )
651                         {
652                             Map.Entry entry = ( Map.Entry ) j.next();
653                             attributes.putValue( ( String ) entry.getKey(), ( String ) entry.getValue() );
654                         }
655                     }
656 
657                     mavenManifest.getEntries().put( section.getName(), attributes );
658                 }
659             }
660 
661             Attributes mainMavenAttributes = mavenManifest.getMainAttributes();
662             mainMavenAttributes.putValue( "Created-By", "Apache Maven Bundle Plugin" );
663 
664             String[] removeHeaders = builder.getProperty( Constants.REMOVEHEADERS, "" ).split( "," );
665 
666             // apply -removeheaders to the custom manifest
667             for ( int i = 0; i < removeHeaders.length; i++ )
668             {
669                 for ( Iterator j = mainMavenAttributes.keySet().iterator(); j.hasNext(); )
670                 {
671                     if ( j.next().toString().matches( removeHeaders[i].trim() ) )
672                     {
673                         j.remove();
674                     }
675                 }
676             }
677 
678             /*
679              * Overlay generated bundle manifest with customized entries
680              */
681             Manifest bundleManifest = jar.getManifest();
682             bundleManifest.getMainAttributes().putAll( mainMavenAttributes );
683             bundleManifest.getEntries().putAll( mavenManifest.getEntries() );
684 
685             // adjust the import package attributes so that optional dependencies use
686             // optional resolution.
687             String importPackages = bundleManifest.getMainAttributes().getValue( "Import-Package" );
688             if ( importPackages != null )
689             {
690                 Set optionalPackages = getOptionalPackages( currentProject );
691 
692                 Map<String, Map<String, String>> values = new Analyzer().parseHeader( importPackages );
693                 for ( Map.Entry<String, Map<String, String>> entry : values.entrySet() )
694                 {
695                     String pkg = entry.getKey();
696                     Map<String, String> options = entry.getValue();
697                     if ( !options.containsKey( "resolution:" ) && optionalPackages.contains( pkg ) )
698                     {
699                         options.put( "resolution:", "optional" );
700                     }
701                 }
702                 String result = Processor.printClauses( values, "resolution:" );
703                 bundleManifest.getMainAttributes().putValue( "Import-Package", result );
704             }
705 
706             jar.setManifest( bundleManifest );
707         }
708         catch ( Exception e )
709         {
710             getLog().warn( "Unable to merge Maven manifest: " + e.getLocalizedMessage() );
711         }
712 
713         if ( addMavenDescriptor )
714         {
715             doMavenMetadata( currentProject, jar );
716         }
717 
718         if ( getLog().isDebugEnabled() )
719         {
720             getLog().debug( "Final Manifest:" + NL + dumpManifest( jar.getManifest(), new StringBuilder() ) );
721         }
722 
723         builder.setJar( jar );
724     }
725 
726 
727     protected Set getOptionalPackages( MavenProject currentProject ) throws IOException, MojoExecutionException
728     {
729         ArrayList inscope = new ArrayList();
730         final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() );
731         for ( Iterator it = artifacts.iterator(); it.hasNext(); )
732         {
733             Artifact artifact = ( Artifact ) it.next();
734             if ( artifact.getArtifactHandler().isAddedToClasspath() )
735             {
736                 if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
737                 {
738                     inscope.add( artifact );
739                 }
740             }
741         }
742 
743         HashSet optionalArtifactIds = new HashSet();
744         for ( Iterator it = inscope.iterator(); it.hasNext(); )
745         {
746             Artifact artifact = ( Artifact ) it.next();
747             if ( artifact.isOptional() )
748             {
749                 String id = artifact.toString();
750                 if ( artifact.getScope() != null )
751                 {
752                     // strip the scope...
753                     id = id.replaceFirst( ":[^:]*$", "" );
754                 }
755                 optionalArtifactIds.add( id );
756             }
757 
758         }
759 
760         HashSet required = new HashSet();
761         HashSet optional = new HashSet();
762         for ( Iterator it = inscope.iterator(); it.hasNext(); )
763         {
764             Artifact artifact = ( Artifact ) it.next();
765             File file = getFile( artifact );
766             if ( file == null )
767             {
768                 continue;
769             }
770 
771             Jar jar = new Jar( artifact.getArtifactId(), file );
772             if ( isTransitivelyOptional( optionalArtifactIds, artifact ) )
773             {
774                 optional.addAll( jar.getPackages() );
775             }
776             else
777             {
778                 required.addAll( jar.getPackages() );
779             }
780             jar.close();
781         }
782 
783         optional.removeAll( required );
784         return optional;
785     }
786 
787 
788     /**
789      * Check to see if any dependency along the dependency trail of
790      * the artifact is optional.
791      *
792      * @param artifact
793      */
794     protected boolean isTransitivelyOptional( HashSet optionalArtifactIds, Artifact artifact )
795     {
796         List trail = artifact.getDependencyTrail();
797         for ( Iterator iterator = trail.iterator(); iterator.hasNext(); )
798         {
799             String next = ( String ) iterator.next();
800             if ( optionalArtifactIds.contains( next ) )
801             {
802                 return true;
803             }
804         }
805         return false;
806     }
807 
808 
809     private void unpackBundle( File jarFile )
810     {
811         File outputDir = getOutputDirectory();
812         if ( null == outputDir )
813         {
814             outputDir = new File( getBuildDirectory(), "classes" );
815         }
816 
817         try
818         {
819             /*
820              * this directory must exist before unpacking, otherwise the plexus
821              * unarchiver decides to use the current working directory instead!
822              */
823             if ( !outputDir.exists() )
824             {
825                 outputDir.mkdirs();
826             }
827 
828             UnArchiver unArchiver = m_archiverManager.getUnArchiver( "jar" );
829             unArchiver.setDestDirectory( outputDir );
830             unArchiver.setSourceFile( jarFile );
831             unArchiver.extract();
832         }
833         catch ( Exception e )
834         {
835             getLog().error( "Problem unpacking " + jarFile + " to " + outputDir, e );
836         }
837     }
838 
839 
840     protected static String removeTagFromInstruction( String instruction, String tag )
841     {
842         StringBuffer buf = new StringBuffer();
843 
844         String[] clauses = instruction.split( "," );
845         for ( int i = 0; i < clauses.length; i++ )
846         {
847             String clause = clauses[i].trim();
848             if ( !tag.equals( clause ) )
849             {
850                 if ( buf.length() > 0 )
851                 {
852                     buf.append( ',' );
853                 }
854                 buf.append( clause );
855             }
856         }
857 
858         return buf.toString();
859     }
860 
861 
862     private static Map getProperties( Model projectModel, String prefix )
863     {
864         Map properties = new LinkedHashMap();
865         Method methods[] = Model.class.getDeclaredMethods();
866         for ( int i = 0; i < methods.length; i++ )
867         {
868             String name = methods[i].getName();
869             if ( name.startsWith( "get" ) )
870             {
871                 try
872                 {
873                     Object v = methods[i].invoke( projectModel, null );
874                     if ( v != null )
875                     {
876                         name = prefix + Character.toLowerCase( name.charAt( 3 ) ) + name.substring( 4 );
877                         if ( v.getClass().isArray() )
878                             properties.put( name, Arrays.asList( ( Object[] ) v ).toString() );
879                         else
880                             properties.put( name, v );
881 
882                     }
883                 }
884                 catch ( Exception e )
885                 {
886                     // too bad
887                 }
888             }
889         }
890         return properties;
891     }
892 
893 
894     private static StringBuffer printLicenses( List licenses )
895     {
896         if ( licenses == null || licenses.size() == 0 )
897             return null;
898         StringBuffer sb = new StringBuffer();
899         String del = "";
900         for ( Iterator i = licenses.iterator(); i.hasNext(); )
901         {
902             License l = ( License ) i.next();
903             String url = l.getUrl();
904             if ( url == null )
905                 continue;
906             sb.append( del );
907             sb.append( url );
908             del = ", ";
909         }
910         if ( sb.length() == 0 )
911             return null;
912         return sb;
913     }
914 
915 
916     /**
917      * @param jar
918      * @throws IOException
919      */
920     private void doMavenMetadata( MavenProject currentProject, Jar jar ) throws IOException
921     {
922         String path = "META-INF/maven/" + currentProject.getGroupId() + "/" + currentProject.getArtifactId();
923         File pomFile = new File( currentProject.getBasedir(), "pom.xml" );
924         jar.putResource( path + "/pom.xml", new FileResource( pomFile ) );
925 
926         Properties p = new Properties();
927         p.put( "version", currentProject.getVersion() );
928         p.put( "groupId", currentProject.getGroupId() );
929         p.put( "artifactId", currentProject.getArtifactId() );
930         ByteArrayOutputStream out = new ByteArrayOutputStream();
931         p.store( out, "Generated by org.apache.felix.bundleplugin" );
932         jar.putResource( path + "/pom.properties", new EmbeddedResource( out.toByteArray(), System.currentTimeMillis() ) );
933     }
934 
935 
936     protected Jar[] getClasspath( MavenProject currentProject ) throws IOException, MojoExecutionException
937     {
938         List list = new ArrayList();
939 
940         if ( getOutputDirectory() != null && getOutputDirectory().exists() )
941         {
942             list.add( new Jar( ".", getOutputDirectory() ) );
943         }
944 
945         final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() );
946         for ( Iterator it = artifacts.iterator(); it.hasNext(); )
947         {
948             Artifact artifact = ( Artifact ) it.next();
949             if ( artifact.getArtifactHandler().isAddedToClasspath() )
950             {
951                 if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
952                 {
953                     File file = getFile( artifact );
954                     if ( file == null )
955                     {
956                         getLog().warn(
957                             "File is not available for artifact " + artifact + " in project "
958                                 + currentProject.getArtifact() );
959                         continue;
960                     }
961                     Jar jar = new Jar( artifact.getArtifactId(), file );
962                     list.add( jar );
963                 }
964             }
965         }
966         Jar[] cp = new Jar[list.size()];
967         list.toArray( cp );
968         return cp;
969     }
970 
971 
972     private Collection getSelectedDependencies( Collection artifacts ) throws MojoExecutionException
973     {
974         if ( null == excludeDependencies || excludeDependencies.length() == 0 )
975         {
976             return artifacts;
977         }
978         else if ( "true".equalsIgnoreCase( excludeDependencies ) )
979         {
980             return Collections.EMPTY_LIST;
981         }
982 
983         Collection selectedDependencies = new LinkedHashSet( artifacts );
984         DependencyExcluder excluder = new DependencyExcluder( artifacts );
985         excluder.processHeaders( excludeDependencies );
986         selectedDependencies.removeAll( excluder.getExcludedArtifacts() );
987 
988         return selectedDependencies;
989     }
990 
991 
992     /**
993      * Get the file for an Artifact
994      *
995      * @param artifact
996      */
997     protected File getFile( Artifact artifact )
998     {
999         return artifact.getFile();
1000     }
1001 
1002 
1003     private static void header( Properties properties, String key, Object value )
1004     {
1005         if ( value == null )
1006             return;
1007 
1008         if ( value instanceof Collection && ( ( Collection ) value ).isEmpty() )
1009             return;
1010 
1011         properties.put( key, value.toString().replaceAll( "[\r\n]", "" ) );
1012     }
1013 
1014 
1015     /**
1016      * Convert a Maven version into an OSGi compliant version
1017      *
1018      * @param version Maven version
1019      * @return the OSGi version
1020      */
1021     protected String convertVersionToOsgi( String version )
1022     {
1023         return getMaven2OsgiConverter().getVersion( version );
1024     }
1025 
1026 
1027     /**
1028      * TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() )
1029      */
1030     protected String getBundleName( MavenProject currentProject )
1031     {
1032         String extension;
1033         try
1034         {
1035             extension = currentProject.getArtifact().getArtifactHandler().getExtension();
1036         }
1037         catch ( Throwable e )
1038         {
1039             extension = currentProject.getArtifact().getType();
1040         }
1041         if ( StringUtils.isEmpty( extension ) || "bundle".equals( extension ) || "pom".equals( extension ) )
1042         {
1043             extension = "jar"; // just in case maven gets confused
1044         }
1045         String finalName = currentProject.getBuild().getFinalName();
1046         if ( null != classifier && classifier.trim().length() > 0 )
1047         {
1048             return finalName + '-' + classifier + '.' + extension;
1049         }
1050         return finalName + '.' + extension;
1051     }
1052 
1053 
1054     protected String getBuildDirectory()
1055     {
1056         return buildDirectory;
1057     }
1058 
1059 
1060     protected void setBuildDirectory( String _buildirectory )
1061     {
1062         buildDirectory = _buildirectory;
1063     }
1064 
1065 
1066     protected Properties getDefaultProperties( MavenProject currentProject )
1067     {
1068         Properties properties = new Properties();
1069 
1070         String bsn;
1071         try
1072         {
1073             bsn = getMaven2OsgiConverter().getBundleSymbolicName( currentProject.getArtifact() );
1074         }
1075         catch ( Exception e )
1076         {
1077             bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
1078         }
1079 
1080         // Setup defaults
1081         properties.put( MAVEN_SYMBOLICNAME, bsn );
1082         properties.put( Analyzer.BUNDLE_SYMBOLICNAME, bsn );
1083         properties.put( Analyzer.IMPORT_PACKAGE, "*" );
1084         properties.put( Analyzer.BUNDLE_VERSION, getMaven2OsgiConverter().getVersion( currentProject.getVersion() ) );
1085 
1086         // remove the extraneous Include-Resource and Private-Package entries from generated manifest
1087         properties.put( Constants.REMOVEHEADERS, Analyzer.INCLUDE_RESOURCE + ',' + Analyzer.PRIVATE_PACKAGE );
1088 
1089         header( properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription() );
1090         StringBuffer licenseText = printLicenses( currentProject.getLicenses() );
1091         if ( licenseText != null )
1092         {
1093             header( properties, Analyzer.BUNDLE_LICENSE, licenseText );
1094         }
1095         header( properties, Analyzer.BUNDLE_NAME, currentProject.getName() );
1096 
1097         if ( currentProject.getOrganization() != null )
1098         {
1099             if ( currentProject.getOrganization().getName() != null )
1100             {
1101                 String organizationName = currentProject.getOrganization().getName();
1102                 header( properties, Analyzer.BUNDLE_VENDOR, organizationName );
1103                 properties.put( "project.organization.name", organizationName );
1104                 properties.put( "pom.organization.name", organizationName );
1105             }
1106             if ( currentProject.getOrganization().getUrl() != null )
1107             {
1108                 String organizationUrl = currentProject.getOrganization().getUrl();
1109                 header( properties, Analyzer.BUNDLE_DOCURL, organizationUrl );
1110                 properties.put( "project.organization.url", organizationUrl );
1111                 properties.put( "pom.organization.url", organizationUrl );
1112             }
1113         }
1114 
1115         properties.putAll( currentProject.getProperties() );
1116         properties.putAll( currentProject.getModel().getProperties() );
1117         if ( m_mavenSession != null )
1118         {
1119             properties.putAll( m_mavenSession.getExecutionProperties() );
1120         }
1121 
1122         properties.putAll( getProperties( currentProject.getModel(), "project.build." ) );
1123         properties.putAll( getProperties( currentProject.getModel(), "pom." ) );
1124         properties.putAll( getProperties( currentProject.getModel(), "project." ) );
1125 
1126         properties.put( "project.baseDir", getBase( currentProject ) );
1127         properties.put( "project.build.directory", getBuildDirectory() );
1128         properties.put( "project.build.outputdirectory", getOutputDirectory() );
1129 
1130         properties.put( "classifier", classifier == null ? "" : classifier );
1131 
1132         // Add default plugins
1133         header( properties, Analyzer.PLUGIN, BlueprintPlugin.class.getName() + "," + SpringXMLType.class.getName() );
1134 
1135         return properties;
1136     }
1137 
1138 
1139     protected static File getBase( MavenProject currentProject )
1140     {
1141         return currentProject.getBasedir() != null ? currentProject.getBasedir() : new File( "" );
1142     }
1143 
1144 
1145     protected File getOutputDirectory()
1146     {
1147         return outputDirectory;
1148     }
1149 
1150 
1151     protected void setOutputDirectory( File _outputDirectory )
1152     {
1153         outputDirectory = _outputDirectory;
1154     }
1155 
1156 
1157     private static void addLocalPackages( File outputDirectory, Analyzer analyzer )
1158     {
1159         Collection packages = new LinkedHashSet();
1160 
1161         if ( outputDirectory != null && outputDirectory.isDirectory() )
1162         {
1163             // scan classes directory for potential packages
1164             DirectoryScanner scanner = new DirectoryScanner();
1165             scanner.setBasedir( outputDirectory );
1166             scanner.setIncludes( new String[]
1167                 { "**/*.class" } );
1168 
1169             scanner.addDefaultExcludes();
1170             scanner.scan();
1171 
1172             String[] paths = scanner.getIncludedFiles();
1173             for ( int i = 0; i < paths.length; i++ )
1174             {
1175                 packages.add( getPackageName( paths[i] ) );
1176             }
1177         }
1178 
1179         StringBuffer exportedPkgs = new StringBuffer();
1180         StringBuffer privatePkgs = new StringBuffer();
1181 
1182         boolean noprivatePackages = "!*".equals( analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) );
1183 
1184         for ( Iterator i = packages.iterator(); i.hasNext(); )
1185         {
1186             String pkg = ( String ) i.next();
1187 
1188             // mark all source packages as private by default (can be overridden by export list)
1189             privatePkgs.append( pkg ).append( ";-split-package:=merge-first," );
1190 
1191             // we can't export the default package (".") and we shouldn't export internal packages 
1192             if ( noprivatePackages || !( ".".equals( pkg ) || pkg.contains( ".internal" ) || pkg.contains( ".impl" ) ) )
1193             {
1194                 if ( exportedPkgs.length() > 0 )
1195                 {
1196                     exportedPkgs.append( ';' );
1197                 }
1198                 exportedPkgs.append( pkg );
1199             }
1200         }
1201 
1202         if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null )
1203         {
1204             if ( analyzer.getProperty( Analyzer.EXPORT_CONTENTS ) == null )
1205             {
1206                 // no -exportcontents overriding the exports, so use our computed list
1207                 analyzer.setProperty( Analyzer.EXPORT_PACKAGE, exportedPkgs.toString() );
1208             }
1209             else
1210             {
1211                 // leave Export-Package empty (but non-null) as we have -exportcontents
1212                 analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "" );
1213             }
1214         }
1215         else
1216         {
1217             String exported = analyzer.getProperty( Analyzer.EXPORT_PACKAGE );
1218             if ( exported.indexOf( LOCAL_PACKAGES ) >= 0 )
1219             {
1220                 String newExported = StringUtils.replace( exported, LOCAL_PACKAGES, exportedPkgs.toString() );
1221                 analyzer.setProperty( Analyzer.EXPORT_PACKAGE, newExported );
1222 
1223             }
1224         }
1225 
1226         if ( analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) == null )
1227         {
1228             // if there are really no private packages then use "!*" as this will keep the Bnd Tool happy
1229             analyzer.setProperty( Analyzer.PRIVATE_PACKAGE, privatePkgs.length() == 0 ? "!*" : privatePkgs.toString() );
1230         }
1231     }
1232 
1233 
1234     private static String getPackageName( String filename )
1235     {
1236         int n = filename.lastIndexOf( File.separatorChar );
1237         return n < 0 ? "." : filename.substring( 0, n ).replace( File.separatorChar, '.' );
1238     }
1239 
1240 
1241     private static List getMavenResources( MavenProject currentProject )
1242     {
1243         List resources = new ArrayList( currentProject.getResources() );
1244 
1245         if ( currentProject.getCompileSourceRoots() != null )
1246         {
1247             // also scan for any "packageinfo" files lurking in the source folders
1248             List packageInfoIncludes = Collections.singletonList( "**/packageinfo" );
1249             for ( Iterator i = currentProject.getCompileSourceRoots().iterator(); i.hasNext(); )
1250             {
1251                 String sourceRoot = ( String ) i.next();
1252                 Resource packageInfoResource = new Resource();
1253                 packageInfoResource.setDirectory( sourceRoot );
1254                 packageInfoResource.setIncludes( packageInfoIncludes );
1255                 resources.add( packageInfoResource );
1256             }
1257         }
1258 
1259         return resources;
1260     }
1261 
1262 
1263     protected static String getMavenResourcePaths( MavenProject currentProject )
1264     {
1265         final String basePath = currentProject.getBasedir().getAbsolutePath();
1266 
1267         Set pathSet = new LinkedHashSet();
1268         for ( Iterator i = getMavenResources( currentProject ).iterator(); i.hasNext(); )
1269         {
1270             Resource resource = ( Resource ) i.next();
1271 
1272             final String sourcePath = resource.getDirectory();
1273             final String targetPath = resource.getTargetPath();
1274 
1275             // ignore empty or non-local resources
1276             if ( new File( sourcePath ).exists() && ( ( targetPath == null ) || ( targetPath.indexOf( ".." ) < 0 ) ) )
1277             {
1278                 DirectoryScanner scanner = new DirectoryScanner();
1279 
1280                 scanner.setBasedir( sourcePath );
1281                 if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
1282                 {
1283                     scanner.setIncludes( ( String[] ) resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) );
1284                 }
1285                 else
1286                 {
1287                     scanner.setIncludes( DEFAULT_INCLUDES );
1288                 }
1289 
1290                 if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
1291                 {
1292                     scanner.setExcludes( ( String[] ) resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) );
1293                 }
1294 
1295                 scanner.addDefaultExcludes();
1296                 scanner.scan();
1297 
1298                 List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
1299 
1300                 for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
1301                 {
1302                     String name = ( String ) j.next();
1303                     String path = sourcePath + '/' + name;
1304 
1305                     // make relative to project
1306                     if ( path.startsWith( basePath ) )
1307                     {
1308                         if ( path.length() == basePath.length() )
1309                         {
1310                             path = ".";
1311                         }
1312                         else
1313                         {
1314                             path = path.substring( basePath.length() + 1 );
1315                         }
1316                     }
1317 
1318                     // replace windows backslash with a slash
1319                     // this is a workaround for a problem with bnd 0.0.189
1320                     if ( File.separatorChar != '/' )
1321                     {
1322                         name = name.replace( File.separatorChar, '/' );
1323                         path = path.replace( File.separatorChar, '/' );
1324                     }
1325 
1326                     // copy to correct place
1327                     path = name + '=' + path;
1328                     if ( targetPath != null )
1329                     {
1330                         path = targetPath + '/' + path;
1331                     }
1332 
1333                     // use Bnd filtering?
1334                     if ( resource.isFiltering() )
1335                     {
1336                         path = '{' + path + '}';
1337                     }
1338 
1339                     pathSet.add( path );
1340                 }
1341             }
1342         }
1343 
1344         StringBuffer resourcePaths = new StringBuffer();
1345         for ( Iterator i = pathSet.iterator(); i.hasNext(); )
1346         {
1347             resourcePaths.append( i.next() );
1348             if ( i.hasNext() )
1349             {
1350                 resourcePaths.append( ',' );
1351             }
1352         }
1353 
1354         return resourcePaths.toString();
1355     }
1356 
1357 
1358     protected Collection getEmbeddableArtifacts( MavenProject currentProject, Analyzer analyzer )
1359         throws MojoExecutionException
1360     {
1361         final Collection artifacts;
1362 
1363         String embedTransitive = analyzer.getProperty( DependencyEmbedder.EMBED_TRANSITIVE );
1364         if ( Boolean.valueOf( embedTransitive ).booleanValue() )
1365         {
1366             // includes transitive dependencies
1367             artifacts = currentProject.getArtifacts();
1368         }
1369         else
1370         {
1371             // only includes direct dependencies
1372             artifacts = currentProject.getDependencyArtifacts();
1373         }
1374 
1375         return getSelectedDependencies( artifacts );
1376     }
1377 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/DependencyEmbedder.html000066400000000000000000000661531164564726100323010ustar00rootroot00000000000000 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  import java.util.Map;
27  
28  import org.apache.maven.artifact.Artifact;
29  import org.apache.maven.plugin.MojoExecutionException;
30  import org.apache.maven.plugin.logging.Log;
31  import org.codehaus.plexus.util.StringUtils;
32  
33  import aQute.lib.osgi.Analyzer;
34  import aQute.libg.header.OSGiHeader;
35  
36  
37  /**
38   * Add BND directives to embed selected dependencies inside a bundle
39   * 
40   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
41   */
42  public final class DependencyEmbedder extends AbstractDependencyFilter
43  {
44      public static final String EMBED_DEPENDENCY = "Embed-Dependency";
45      public static final String EMBED_DIRECTORY = "Embed-Directory";
46      public static final String EMBED_STRIP_GROUP = "Embed-StripGroup";
47      public static final String EMBED_STRIP_VERSION = "Embed-StripVersion";
48      public static final String EMBED_TRANSITIVE = "Embed-Transitive";
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  
88          m_inlinedPaths.clear();
89          m_embeddedArtifacts.clear();
90  
91          String embedDependencyHeader = analyzer.getProperty( EMBED_DEPENDENCY );
92          if ( null != embedDependencyHeader && embedDependencyHeader.length() > 0 )
93          {
94              m_embedDirectory = analyzer.getProperty( EMBED_DIRECTORY );
95              m_embedStripGroup = analyzer.getProperty( EMBED_STRIP_GROUP, "true" );
96              m_embedStripVersion = analyzer.getProperty( EMBED_STRIP_VERSION );
97  
98              Map embedInstructions = OSGiHeader.parseHeader( embedDependencyHeader );
99              processInstructions( embedInstructions );
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 );
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     }
123 
124 
125     @Override
126     protected void processDependencies( String tag, String inline, Collection dependencies )
127     {
128         if ( dependencies.isEmpty() )
129         {
130             m_log.warn( EMBED_DEPENDENCY + ": clause \"" + tag + "\" did not match any dependencies" );
131         }
132 
133         if ( null == inline || "false".equalsIgnoreCase( inline ) )
134         {
135             m_embeddedArtifacts.addAll( dependencies );
136         }
137         else
138         {
139             for ( Iterator i = dependencies.iterator(); i.hasNext(); )
140             {
141                 addInlinedPaths( ( Artifact ) i.next(), inline, m_inlinedPaths );
142             }
143         }
144     }
145 
146 
147     private static void addInlinedPaths( Artifact dependency, String inline, Collection inlinedPaths )
148     {
149         File path = dependency.getFile();
150         if ( null != path && path.exists() )
151         {
152             if ( "true".equalsIgnoreCase( inline ) || inline.length() == 0 )
153             {
154                 inlinedPaths.add( path.getPath() );
155             }
156             else
157             {
158                 String[] filters = inline.split( "\\|" );
159                 for ( int i = 0; i < filters.length; i++ )
160                 {
161                     if ( filters[i].length() > 0 )
162                     {
163                         inlinedPaths.add( path + "!/" + filters[i] );
164                     }
165                 }
166             }
167         }
168     }
169 
170 
171     private void embedDependency( Artifact dependency, StringBuffer includeResource, StringBuffer bundleClassPath )
172     {
173         File sourceFile = dependency.getFile();
174         if ( null != sourceFile && sourceFile.exists() )
175         {
176             String embedDirectory = m_embedDirectory;
177             if ( "".equals( embedDirectory ) || ".".equals( embedDirectory ) )
178             {
179                 embedDirectory = null;
180             }
181 
182             if ( false == Boolean.valueOf( m_embedStripGroup ).booleanValue() )
183             {
184                 embedDirectory = new File( embedDirectory, dependency.getGroupId() ).getPath();
185             }
186 
187             File targetFile;
188             if ( Boolean.valueOf( m_embedStripVersion ).booleanValue() )
189             {
190                 String extension = dependency.getArtifactHandler().getExtension();
191                 if ( extension != null )
192                 {
193                     targetFile = new File( embedDirectory, dependency.getArtifactId() + "." + extension );
194                 }
195                 else
196                 {
197                     targetFile = new File( embedDirectory, dependency.getArtifactId() );
198                 }
199             }
200             else
201             {
202                 targetFile = new File( embedDirectory, sourceFile.getName() );
203             }
204 
205             String targetFilePath = targetFile.getPath();
206 
207             // replace windows backslash with a slash
208             if ( File.separatorChar != '/' )
209             {
210                 targetFilePath = targetFilePath.replace( File.separatorChar, '/' );
211             }
212 
213             if ( includeResource.length() > 0 )
214             {
215                 includeResource.append( ',' );
216             }
217 
218             includeResource.append( targetFilePath );
219             includeResource.append( '=' );
220             includeResource.append( sourceFile );
221 
222             if ( bundleClassPath.length() > 0 )
223             {
224                 bundleClassPath.append( ',' );
225             }
226 
227             bundleClassPath.append( targetFilePath );
228         }
229     }
230 
231 
232     private static void inlineDependency( String path, StringBuffer includeResource )
233     {
234         if ( includeResource.length() > 0 )
235         {
236             includeResource.append( ',' );
237         }
238 
239         includeResource.append( '@' );
240         includeResource.append( path );
241     }
242 
243 
244     public Collection getInlinedPaths()
245     {
246         return m_inlinedPaths;
247     }
248 
249 
250     public Collection getEmbeddedArtifacts()
251     {
252         return m_embeddedArtifacts;
253     }
254 
255 
256     private static void appendDependencies( Analyzer analyzer, String directiveName, String mavenDependencies )
257     {
258         /*
259          * similar algorithm to {maven-resources} but default behaviour here is to append rather than override
260          */
261         final String instruction = analyzer.getProperty( directiveName );
262         if ( instruction != null && instruction.length() > 0 )
263         {
264             if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 )
265             {
266                 // if there are no embeddded dependencies, we do a special treatment and replace
267                 // every occurance of MAVEN_DEPENDENCIES and a following comma with an empty string
268                 if ( mavenDependencies.length() == 0 )
269                 {
270                     String cleanInstruction = BundlePlugin.removeTagFromInstruction( instruction, MAVEN_DEPENDENCIES );
271                     analyzer.setProperty( directiveName, cleanInstruction );
272                 }
273                 else
274                 {
275                     String mergedInstruction = StringUtils.replace( instruction, MAVEN_DEPENDENCIES, mavenDependencies );
276                     analyzer.setProperty( directiveName, mergedInstruction );
277                 }
278             }
279             else if ( mavenDependencies.length() > 0 )
280             {
281                 if ( Analyzer.INCLUDE_RESOURCE.equalsIgnoreCase( directiveName ) )
282                 {
283                     // dependencies should be prepended so they can be overwritten by local resources
284                     analyzer.setProperty( directiveName, mavenDependencies + ',' + instruction );
285                 }
286                 else
287                 // Analyzer.BUNDLE_CLASSPATH
288                 {
289                     // for the classpath we want dependencies to be appended after local entries
290                     analyzer.setProperty( directiveName, instruction + ',' + mavenDependencies );
291                 }
292             }
293             // otherwise leave instruction unchanged
294         }
295         else if ( mavenDependencies.length() > 0 )
296         {
297             analyzer.setProperty( directiveName, mavenDependencies );
298         }
299         // otherwise leave instruction unchanged
300     }
301 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/DependencyExcluder.html000066400000000000000000000155461164564726100323450ustar00rootroot00000000000000 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  import aQute.libg.header.OSGiHeader;
28  
29  
30  /**
31   * Exclude selected dependencies from the classpath passed to BND.
32   * 
33   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
34   */
35  public final class DependencyExcluder extends AbstractDependencyFilter
36  {
37      /**
38       * Excluded artifacts.
39       */
40      private final Collection m_excludedArtifacts;
41  
42  
43      public DependencyExcluder( Collection dependencyArtifacts )
44      {
45          super( dependencyArtifacts );
46  
47          m_excludedArtifacts = new HashSet();
48      }
49  
50  
51      public void processHeaders( String excludeDependencies ) throws MojoExecutionException
52      {
53          m_excludedArtifacts.clear();
54  
55          if ( null != excludeDependencies && excludeDependencies.length() > 0 )
56          {
57              processInstructions( OSGiHeader.parseHeader( excludeDependencies ) );
58          }
59      }
60  
61  
62      @Override
63      protected void processDependencies( String tag, String inline, Collection dependencies )
64      {
65          m_excludedArtifacts.addAll( dependencies );
66      }
67  
68  
69      public Collection getExcludedArtifacts()
70      {
71          return m_excludedArtifacts;
72      }
73  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/InstructionsPlugin.html000066400000000000000000000172101164564726100324440ustar00rootroot00000000000000 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.lib.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  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/JarPluginConfiguration.html000066400000000000000000000234651164564726100332150ustar00rootroot00000000000000 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  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/ManifestPlugin.html000066400000000000000000000426241164564726100315150ustar00rootroot00000000000000 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.util.LinkedHashMap;
27  import java.util.Map;
28  import java.util.Properties;
29  import java.util.jar.Manifest;
30  
31  import org.apache.maven.plugin.MojoExecutionException;
32  import org.apache.maven.plugin.MojoFailureException;
33  import org.apache.maven.project.MavenProject;
34  
35  import aQute.lib.osgi.Analyzer;
36  import aQute.lib.osgi.Builder;
37  import aQute.lib.osgi.Jar;
38  
39  
40  /**
41   * Generate an OSGi manifest for this project
42   * 
43   * @goal manifest
44   * @phase process-classes
45   * @requiresDependencyResolution test
46   * @threadSafe
47   */
48  public class ManifestPlugin extends BundlePlugin
49  {
50      protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
51          throws MojoExecutionException
52      {
53          Manifest manifest;
54          try
55          {
56              if ( supportedProjectTypes.contains( getProject().getArtifact().getType() ) )
57              {
58                  Builder builder = buildOSGiBundle( project, instructions, properties, classpath );
59                  manifest = builder.getJar().getManifest();
60                  builder.close();
61              }
62              else
63              {
64                  manifest = getManifest( project, instructions, properties, classpath );
65              }
66          }
67          catch ( FileNotFoundException e )
68          {
69              throw new MojoExecutionException( "Cannot find " + e.getMessage()
70                  + " (manifest goal must be run after compile phase)", e );
71          }
72          catch ( IOException e )
73          {
74              throw new MojoExecutionException( "Error trying to generate Manifest", e );
75          }
76          catch ( MojoFailureException e )
77          {
78              getLog().error( e.getLocalizedMessage() );
79              throw new MojoExecutionException( "Error(s) found in manifest configuration", e );
80          }
81          catch ( Exception e )
82          {
83              getLog().error( "An internal error occurred", e );
84              throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e );
85          }
86  
87          File outputFile = new File( manifestLocation, "MANIFEST.MF" );
88  
89          try
90          {
91              writeManifest( manifest, outputFile );
92          }
93          catch ( IOException e )
94          {
95              throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e );
96          }
97      }
98  
99  
100     public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException, MojoFailureException,
101         MojoExecutionException, Exception
102     {
103         return getManifest( project, new LinkedHashMap(), new Properties(), classpath );
104     }
105 
106 
107     public Manifest getManifest( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
108         throws IOException, MojoFailureException, MojoExecutionException, Exception
109     {
110         Analyzer analyzer = getAnalyzer( project, instructions, properties, classpath );
111         boolean hasErrors = reportErrors( "Manifest " + project.getArtifact(), analyzer );
112         if ( hasErrors )
113         {
114             String failok = analyzer.getProperty( "-failok" );
115             if ( null == failok || "false".equalsIgnoreCase( failok ) )
116             {
117                 throw new MojoFailureException( "Error(s) found in manifest configuration" );
118             }
119         }
120 
121         Manifest manifest = analyzer.getJar().getManifest();
122 
123         // cleanup...
124         analyzer.close();
125 
126         return manifest;
127     }
128 
129 
130     protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath ) throws IOException, MojoExecutionException,
131         Exception
132     {
133         return getAnalyzer( project, new LinkedHashMap(), new Properties(), classpath );
134     }
135 
136 
137     protected Analyzer getAnalyzer( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
138         throws IOException, MojoExecutionException, Exception
139     {
140         File file = project.getArtifact().getFile();
141         if ( file == null )
142         {
143             file = getOutputDirectory();
144         }
145 
146         if ( !file.exists() )
147         {
148             throw new FileNotFoundException( file.getPath() );
149         }
150 
151         Builder analyzer = getOSGiBuilder( project, instructions, properties, classpath );
152 
153         analyzer.setJar( file );
154 
155         if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null
156             && analyzer.getProperty( Analyzer.EXPORT_CONTENTS ) == null
157             && analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) == null )
158         {
159             String export = analyzer.calculateExportsFromContents( analyzer.getJar() );
160             analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
161         }
162 
163         addMavenInstructions( project, analyzer );
164 
165         analyzer.mergeManifest( analyzer.getJar().getManifest() );
166         analyzer.calcManifest();
167 
168         mergeMavenManifest( project, analyzer );
169 
170         return analyzer;
171     }
172 
173 
174     public static void writeManifest( Manifest manifest, File outputFile ) throws IOException
175     {
176         outputFile.getParentFile().mkdirs();
177 
178         FileOutputStream os;
179         os = new FileOutputStream( outputFile );
180         try
181         {
182             manifest.write( os );
183         }
184         finally
185         {
186             try
187             {
188                 os.close();
189             }
190             catch ( IOException e )
191             {
192                 // nothing we can do here
193             }
194         }
195     }
196 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/PackageVersionAnalyzer.html000066400000000000000000000156211164564726100331740ustar00rootroot00000000000000 PackageVersionAnalyzer 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 aQute.lib.osgi.Builder;
23  
24  
25  /**
26   * Extension of {@link aQute.lib.osgi.Builder} to handle package versions
27   * 
28   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
29   */
30  public final class PackageVersionAnalyzer extends Builder
31  {
32      /*
33       * Remove META-INF subfolders from exports and set package versions to bundle version.
34       */
35      /*
36          public Map analyzeBundleClasspath( Jar dot, Map bundleClasspath, Map contained, Map referred, Map uses )
37              throws IOException
38          {
39              Map classSpace = super.analyzeBundleClasspath( dot, bundleClasspath, contained, referred, uses );
40              String bundleVersion = getProperty( BUNDLE_VERSION );
41              for ( Iterator it = contained.entrySet().iterator(); it.hasNext(); )
42              {
43                  Map.Entry entry = ( Map.Entry ) it.next();
44  
45                  // remove packages under META-INF
46                  String packageName = ( String ) entry.getKey();
47                  if ( packageName.startsWith( "META-INF." ) )
48                  {
49                      it.remove();
50                  }
51  
52                  // set package versions to bundle version values
53                  if ( bundleVersion != null )
54                  {
55                      Map values = ( Map ) entry.getValue();
56                      if ( values.get( "version" ) == null )
57                      {
58                          values.put( "version", bundleVersion );
59                      }
60                  }
61              }
62              return classSpace;
63          }
64      */
65  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/VersionCleanerPlugin.html000066400000000000000000000171771164564726100326730ustar00rootroot00000000000000 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   * @goal cleanVersions
35   * @description clean OSGi versions
36   * @threadSafe
37   */
38  public class VersionCleanerPlugin extends AbstractMojo
39  {
40  
41      /**
42       * The BND instructions for the bundle.
43       *
44       * @parameter
45       */
46      private Map versions = new LinkedHashMap();
47  
48      /**
49       * The Maven project.
50       *
51       * @parameter expression="${project}"
52       * @required
53       * @readonly
54       */
55      private MavenProject project;
56  
57      private Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
58  
59  
60      public Maven2OsgiConverter getMaven2OsgiConverter()
61      {
62          return maven2OsgiConverter;
63      }
64  
65  
66      public void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter )
67      {
68          this.maven2OsgiConverter = maven2OsgiConverter;
69      }
70  
71  
72      public void execute() throws MojoExecutionException, MojoFailureException
73      {
74          for ( Object key : versions.keySet() )
75          {
76              String name = ( String ) key;
77              String version = ( String ) versions.get( key );
78              String osgi = maven2OsgiConverter.getVersion( version );
79              project.getProperties().put( name, osgi );
80          }
81      }
82  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/WrapPlugin.html000066400000000000000000000120271164564726100306520ustar00rootroot00000000000000 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   * @goal wrap
27   * @phase package
28   * @requiresDependencyResolution test
29   * @description build an OSGi bundle jar for direct dependencies
30   * @deprecated The wrap goal is no longer supported and may be removed in a future release
31   */
32  @Deprecated
33  public final class WrapPlugin extends BundleAllPlugin
34  {
35      public void execute() throws MojoExecutionException
36      {
37          getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
38          getLog().warn( "! The wrap goal is no longer supported and may be removed in a future release !" );
39          getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
40  
41          BundleInfo bundleInfo = bundleAll( getProject(), 1 );
42          logDuplicatedPackages( bundleInfo );
43      }
44  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/package-frame.html000066400000000000000000000052001164564726100312400ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.felix.bundleplugin

org.apache.felix.bundleplugin

Classes

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/bundleplugin/package-summary.html000066400000000000000000000110151164564726100316440ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.felix.bundleplugin

Package org.apache.felix.bundleplugin

Class Summary
AbstractDependencyFilter
AntPlugin
Attribute
BlueprintPlugin
BundleAllPlugin
BundleInfo
BundlePlugin
DependencyEmbedder
DependencyExcluder
DependencyFilter
InstructionsPlugin
JarPluginConfiguration
ManifestPlugin
PackageVersionAnalyzer
VersionCleanerPlugin
WrapPlugin

Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/000077500000000000000000000000001164564726100252035ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/AbstractFileMojo.html000066400000000000000000000306211164564726100312630ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/Config.html000066400000000000000000000217021164564726100273000ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrCleanRepo.html000066400000000000000000000741271164564726100304170ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrDeploy.html000066400000000000000000001005451164564726100277750ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrDeployFile.html000066400000000000000000000527351164564726100306040ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrIndex.html000066400000000000000000000562751164564726100276220ustar00rootroot00000000000000 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             String dir = path.getParentFile().toURI().toURL().toString();
213             if ( dir.endsWith( "/" ) )
214                 dir = dir.substring( 0, dir.length() - 1 );
215 
216             if ( dir.startsWith( root.toString() ) )
217                 dir = dir.substring( root.toString().length() );
218 
219             String url = urlTemplate.replaceAll( "%v", "" + resource.getVersion() );
220             url = url.replaceAll( "%s", resource.getSymbolicName() );
221             url = url.replaceAll( "%f", path.getName() );
222             url = url.replaceAll( "%p", dir );
223             finalUri = url;
224         }
225         resource.put( Resource.URI, finalUri, Property.URI );
226     }
227 
228     private final FileFilter filter = new FileFilter()
229     {
230 
231         public boolean accept( File pathname )
232         {
233             return pathname.getName().endsWith( "ar" );
234         }
235     };
236 
237 
238     private void findAllJars( File mainRoot, List<File> files )
239     {
240         List<File> roots = new ArrayList<File>();
241         roots.add( mainRoot );
242         while ( !roots.isEmpty() )
243         {
244             File root = roots.remove( 0 );
245             File[] children = root.listFiles();
246             if ( children != null )
247             {
248                 for ( File child : children )
249                 {
250                     if ( child.isFile() && filter.accept( child ) )
251                     {
252                         files.add( child );
253                     }
254                     else if ( child.isDirectory() )
255                     {
256                         roots.add( child );
257                     }
258                 }
259             }
260         }
261     }
262 
263 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrInstall.html000066400000000000000000000414241164564726100301470ustar00rootroot00000000000000 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             update.parseRepositoryXml();
142 
143             updateLocalBundleMetadata( project.getArtifact(), update );
144             for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
145             {
146                 updateLocalBundleMetadata( ( Artifact ) i.next(), update );
147             }
148 
149             update.writeRepositoryXml();
150         }
151         catch ( Exception e )
152         {
153             log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e );
154         }
155     }
156 
157 
158     private void updateLocalBundleMetadata( Artifact artifact, ObrUpdate update ) throws MojoExecutionException
159     {
160         if ( !supportedProjectTypes.contains( artifact.getType() ) )
161         {
162             return;
163         }
164         else if ( null == artifact.getFile() || artifact.getFile().isDirectory() )
165         {
166             getLog().error( "No artifact found, try \"mvn install bundle:install\"" );
167             return;
168         }
169 
170         URI bundleJar = ObrUtils.getArtifactURI( localRepository, artifact );
171 
172         URI sourceJar = null;
173         if ( null != m_sourceArtifact )
174         {
175             sourceJar = ObrUtils.getArtifactURI( localRepository, m_sourceArtifact );
176         }
177 
178         URI docJar = null;
179         if ( null != m_docArtifact )
180         {
181             docJar = ObrUtils.getArtifactURI( localRepository, m_docArtifact );
182         }
183 
184         update.updateRepository( bundleJar, sourceJar, docJar );
185     }
186 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrInstallFile.html000066400000000000000000000254451164564726100307540ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrRemoteClean.html000066400000000000000000001341041164564726100307350ustar00rootroot00000000000000 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      * The Maven project.
135      * 
136      * @parameter expression="${project}"
137      * @required
138      * @readonly
139      */
140     private MavenProject project;
141 
142     /**
143      * Local Maven settings.
144      * 
145      * @parameter expression="${settings}"
146      * @required
147      * @readonly
148      */
149     private Settings settings;
150 
151     /**
152      * The Wagon manager.
153      * 
154      * @component
155      */
156     private WagonManager m_wagonManager;
157 
158 
159     public void execute() throws MojoExecutionException
160     {
161         String projectType = project.getPackaging();
162 
163         // ignore unsupported project types, useful when bundleplugin is configured in parent pom
164         if ( !supportedProjectTypes.contains( projectType ) )
165         {
166             getLog().warn(
167                 "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes );
168             return;
169         }
170         else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) )
171         {
172             getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" );
173             return;
174         }
175 
176         // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead
177         if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) )
178         {
179             remoteOBR = obrRepository;
180         }
181 
182         URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR );
183         String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName();
184 
185         Log log = getLog();
186 
187         RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log );
188         openRepositoryConnection( remoteFile );
189         if ( null == prefixUrl )
190         {
191             prefixUrl = remoteFile.toString();
192         }
193 
194         // ======== LOCK REMOTE OBR ========
195         log.info( "LOCK " + remoteFile + '/' + repositoryName );
196         remoteFile.lockFile( repositoryName, ignoreLock );
197         File downloadedRepositoryXml = null;
198 
199         try
200         {
201             // ======== DOWNLOAD REMOTE OBR ========
202             log.info( "Downloading " + repositoryName );
203             downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" );
204 
205             URI repositoryXml = downloadedRepositoryXml.toURI();
206 
207             Config userConfig = new Config();
208             userConfig.setRemoteFile( true );
209 
210             // Clean the downloaded file.
211             Document doc = parseFile( new File( repositoryXml ), initConstructor() );
212             Node finalDocument = cleanDocument( doc.getDocumentElement() );
213 
214             if ( finalDocument == null )
215             {
216                 getLog().info( "Nothing to clean in " + repositoryName );
217             }
218             else
219             {
220                 writeToFile( repositoryXml, finalDocument ); // Write the new file
221                 getLog().info( "Repository " + repositoryName + " cleaned" );
222                 // ======== UPLOAD MODIFIED OBR ========
223                 log.info( "Uploading " + repositoryName );
224                 remoteFile.put( downloadedRepositoryXml, repositoryName );
225             }
226         }
227         catch ( Exception e )
228         {
229             log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e );
230         }
231         finally
232         {
233             // ======== UNLOCK REMOTE OBR ========
234             log.info( "UNLOCK " + remoteFile + '/' + repositoryName );
235             remoteFile.unlockFile( repositoryName );
236             remoteFile.disconnect();
237 
238             if ( null != downloadedRepositoryXml )
239             {
240                 downloadedRepositoryXml.delete();
241             }
242         }
243     }
244 
245     private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" );
246 
247 
248     private void openRepositoryConnection( RemoteFileManager remoteFile ) throws MojoExecutionException
249     {
250         // use OBR specific deployment location?
251         if ( obrDeploymentRepository != null )
252         {
253             altDeploymentRepository = obrDeploymentRepository;
254         }
255 
256         if ( deploymentRepository == null && altDeploymentRepository == null )
257         {
258             String msg = "Deployment failed: repository element was not specified in the pom inside"
259                 + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter";
260 
261             throw new MojoExecutionException( msg );
262         }
263 
264         if ( altDeploymentRepository != null )
265         {
266             getLog().info( "Using alternate deployment repository " + altDeploymentRepository );
267 
268             Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( altDeploymentRepository );
269             if ( !matcher.matches() )
270             {
271                 throw new MojoExecutionException( "Invalid syntax for alternative repository \""
272                     + altDeploymentRepository + "\". Use \"id::layout::url\"." );
273             }
274 
275             remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() );
276         }
277         else
278         {
279             remoteFile.connect( deploymentRepository.getId(), deploymentRepository.getUrl() );
280         }
281     }
282 
283 
284     /**
285      * Analyze the given XML tree (DOM of the repository file) and remove missing resources.
286      * This method ask the user before deleting the resources from the repository.
287      * @param elem : the input XML tree
288      * @return the cleaned XML tree
289      */
290     private Element cleanDocument( Element elem )
291     {
292         NodeList nodes = elem.getElementsByTagName( "resource" );
293         List toRemove = new ArrayList();
294 
295         // First, look for missing resources
296         for ( int i = 0; i < nodes.getLength(); i++ )
297         {
298             Element n = ( Element ) nodes.item( i );
299             String value = n.getAttribute( "uri" );
300 
301             URL url;
302             try
303             {
304                 url = new URL( new URL( prefixUrl + '/' ), value );
305             }
306             catch ( MalformedURLException e )
307             {
308                 getLog().error( "Malformed URL when creating the resource absolute URI : " + e.getMessage() );
309                 return null;
310             }
311 
312             try
313             {
314                 url.openConnection().getContent();
315             }
316             catch ( IOException e )
317             {
318                 getLog().info(
319                     "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" )
320                         + " will be removed : " + e.getMessage() );
321                 toRemove.add( n );
322             }
323         }
324 
325         Date d = new Date();
326         if ( toRemove.size() > 0 )
327         {
328             System.out.println( "Do you want to remove these bundles from the repository file [y/N]:" );
329             BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
330             String answer = null;
331 
332             try
333             {
334                 answer = br.readLine();
335             }
336             catch ( IOException ioe )
337             {
338                 getLog().error( "IO error trying to read the user confirmation" );
339                 return null;
340             }
341 
342             if ( answer != null && answer.trim().equalsIgnoreCase( "y" ) )
343             {
344                 // Then remove missing resources.
345                 for ( int i = 0; i < toRemove.size(); i++ )
346                 {
347                     elem.removeChild( ( Node ) toRemove.get( i ) );
348                 }
349 
350                 // If we have to remove resources, we need to update 'lastmodified' attribute
351                 SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" );
352                 d.setTime( System.currentTimeMillis() );
353                 elem.setAttribute( "lastmodified", format.format( d ) );
354                 return elem;
355             }
356             else
357             {
358                 return null;
359             }
360         }
361 
362         return null;
363     }
364 
365 
366     /**
367      * Initialize the document builder from Xerces.
368      * 
369      * @return DocumentBuilder ready to create new document
370      * @throws MojoExecutionException : occurs when the instantiation of the document builder fails
371      */
372     private DocumentBuilder initConstructor() throws MojoExecutionException
373     {
374         DocumentBuilder constructor = null;
375         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
376         try
377         {
378             constructor = factory.newDocumentBuilder();
379         }
380         catch ( ParserConfigurationException e )
381         {
382             getLog().error( "Unable to create a new xml document" );
383             throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() );
384         }
385         return constructor;
386     }
387 
388 
389     /**
390      * Open an XML file.
391      * 
392      * @param file : XML file
393      * @param constructor DocumentBuilder get from xerces
394      * @return Document which describes this file
395      * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file.
396      */
397     private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException
398     {
399         if ( constructor == null )
400         {
401             return null;
402         }
403         // The document is the root of the DOM tree.
404         File targetFile = file.getAbsoluteFile();
405         getLog().info( "Parsing " + targetFile );
406         Document doc = null;
407         try
408         {
409             doc = constructor.parse( targetFile );
410         }
411         catch ( SAXException e )
412         {
413             getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() );
414             throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() );
415         }
416         catch ( IOException e )
417         {
418             getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() );
419             throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() );
420         }
421         return doc;
422     }
423 
424 
425     /**
426      * write a Node in a xml file.
427      * 
428      * @param outputFilename URI to the output file
429      * @param treeToBeWrite Node root of the tree to be write in file
430      * @throws MojoExecutionException if the plugin failed
431      */
432     private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException
433     {
434         // init the transformer
435         Transformer transformer = null;
436         TransformerFactory tfabrique = TransformerFactory.newInstance();
437         try
438         {
439             transformer = tfabrique.newTransformer();
440         }
441         catch ( TransformerConfigurationException e )
442         {
443             getLog().error( "Unable to write to file: " + outputFilename.toString() );
444             throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "
445                 + e.getMessage() );
446         }
447         Properties proprietes = new Properties();
448         proprietes.put( "method", "xml" );
449         proprietes.put( "version", "1.0" );
450         proprietes.put( "encoding", "ISO-8859-1" );
451         proprietes.put( "standalone", "yes" );
452         proprietes.put( "indent", "yes" );
453         proprietes.put( "omit-xml-declaration", "no" );
454         transformer.setOutputProperties( proprietes );
455 
456         DOMSource input = new DOMSource( treeToBeWrite );
457 
458         File fichier = new File( outputFilename );
459         FileOutputStream flux = null;
460         try
461         {
462             flux = new FileOutputStream( fichier );
463         }
464         catch ( FileNotFoundException e )
465         {
466             getLog().error( "Unable to write to file: " + fichier.getName() );
467             throw new MojoExecutionException( "Unable to write to file: " + fichier.getName() + " : " + e.getMessage() );
468         }
469         Result output = new StreamResult( flux );
470         try
471         {
472             transformer.transform( input, output );
473         }
474         catch ( TransformerException e )
475         {
476             throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "
477                 + e.getMessage() );
478         }
479 
480         try
481         {
482             flux.flush();
483             flux.close();
484         }
485         catch ( IOException e )
486         {
487             throw new MojoExecutionException( "IOException when closing file : " + e.getMessage() );
488         }
489     }
490 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrUpdate.html000066400000000000000000000753051164564726100277700ustar00rootroot00000000000000 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.net.URI;
30  
31  import org.apache.felix.bundlerepository.Resource;
32  import org.apache.felix.bundlerepository.impl.DataModelHelperImpl;
33  import org.apache.felix.bundlerepository.impl.PullParser;
34  import org.apache.felix.bundlerepository.impl.RepositoryImpl;
35  import org.apache.felix.bundlerepository.impl.RepositoryParser;
36  import org.apache.felix.bundlerepository.impl.ResourceImpl;
37  import org.apache.maven.plugin.MojoExecutionException;
38  import org.apache.maven.plugin.logging.Log;
39  import org.apache.maven.project.MavenProject;
40  import org.codehaus.plexus.util.FileUtils;
41  import org.kxml2.io.KXmlParser;
42  import org.xmlpull.v1.XmlPullParser;
43  
44  
45  /**
46   * this class parse the old repository.xml file build the bundle resource description and update the repository.
47   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
48   */
49  public class ObrUpdate
50  {
51      /**
52       * logger for this plugin.
53       */
54      private Log m_logger;
55  
56      /**
57       * name and path to the repository descriptor file.
58       */
59      private URI m_repositoryXml;
60  
61      /**
62       * name and path to the obr.xml file.
63       */
64      private URI m_obrXml;
65  
66      /**
67       * maven project description.
68       */
69      private MavenProject m_project;
70  
71      /**
72       * user configuration information.
73       */
74      private Config m_userConfig;
75  
76      /**
77       * root on parent document.
78       */
79      private RepositoryImpl m_repository;
80  
81      /**
82       * used to store bundle information.
83       */
84      private ResourceImpl m_resourceBundle;
85  
86      /**
87       * base URI used to relativize bundle URIs.
88       */
89      private URI m_baseURI;
90  
91  
92      /**
93       * initialize information.
94       * @param repositoryXml path to the repository descriptor file
95       * @param obrXml path and filename to the obr.xml file
96       * @param project maven project description
97       * @param mavenRepositoryPath path to the local maven repository
98       * @param userConfig user information
99       * @param logger plugin logger
100      */
101     public ObrUpdate( URI repositoryXml, URI obrXml, MavenProject project, String mavenRepositoryPath,
102         Config userConfig, Log logger )
103     {
104         m_repositoryXml = repositoryXml;
105         m_obrXml = obrXml;
106         m_project = project;
107         m_logger = logger;
108 
109         m_userConfig = userConfig;
110 
111         if ( userConfig.isRemoteFile() )
112         {
113             m_baseURI = ObrUtils.toFileURI( mavenRepositoryPath );
114         }
115         else
116         {
117             m_baseURI = m_repositoryXml;
118         }
119     }
120 
121 
122     /**
123      * update the repository descriptor file. parse the old repository descriptor file,
124      * get the old reference of the bundle or determine the id for a new bundle, extract
125      * information from bindex set the new information in descriptor file and save it.
126      * 
127      * @param bundleJar path to the bundle jar file
128      * @param sourceJar path to the source jar file
129      * @param docJar path to the docs jar file
130      * 
131      * @throws MojoExecutionException if the plugin failed
132      */
133     public void updateRepository( URI bundleJar, URI sourceJar, URI docJar ) throws MojoExecutionException
134     {
135         m_logger.debug( " (f) repositoryXml = " + m_repositoryXml );
136         m_logger.debug( " (f) bundleJar = " + bundleJar );
137         m_logger.debug( " (f) sourceJar = " + sourceJar );
138         m_logger.debug( " (f) obrXml = " + m_obrXml );
139 
140         if ( m_repository == null )
141         {
142             return;
143         }
144 
145         // get the file size
146         File bundleFile = new File( bundleJar );
147         if ( bundleFile.exists() )
148         {
149             URI resourceURI = m_userConfig.getRemoteBundle();
150             if ( null == resourceURI )
151             {
152                 resourceURI = bundleJar;
153                 if ( m_userConfig.isPathRelative() )
154                 {
155                     resourceURI = ObrUtils.getRelativeURI( m_baseURI, resourceURI );
156                 }
157             }
158 
159             if ( m_userConfig.isRemoteFile() )
160             {
161                 m_logger.info( "Deploying " + resourceURI );
162             }
163             else
164             {
165                 m_logger.info( "Installing " + resourceURI );
166             }
167 
168             try
169             {
170                 m_resourceBundle = ( ResourceImpl ) new DataModelHelperImpl().createResource( bundleJar.toURL() );
171                 if ( m_resourceBundle == null )
172                 {
173                     return;
174                 }
175             }
176             catch ( IOException e )
177             {
178                 throw new MojoExecutionException( "Unable to load resource information", e );
179             }
180 
181             m_resourceBundle.put( Resource.SIZE, String.valueOf( bundleFile.length() ) );
182             m_resourceBundle.put( Resource.URI, resourceURI.toASCIIString() );
183         }
184         else
185         {
186             m_logger.error( "file doesn't exist: " + bundleJar );
187             return;
188         }
189 
190         // parse the obr.xml file
191         if ( m_obrXml != null )
192         {
193             m_logger.info( "Adding " + m_obrXml );
194 
195             // URL url = getClass().getResource("/SchemaObr.xsd");
196             // TODO validate obr.xml file
197 
198             // add contents to resource bundle
199             parseObrXml();
200         }
201 
202         String sourcePath = relativisePath( sourceJar );
203         String docPath = relativisePath( docJar );
204 
205         //        m_resourceBundle.construct( m_project, bindexExtractor, sourcePath, docPath );
206         //         TODO: rebuild wrt m_project
207 
208         m_repository.addResource( m_resourceBundle );
209         m_repository.setLastModified( System.currentTimeMillis() );
210     }
211 
212 
213     private String relativisePath( URI uri )
214     {
215         if ( null != uri )
216         {
217             if ( m_userConfig.isPathRelative() )
218             {
219                 return ObrUtils.getRelativeURI( m_baseURI, uri ).toASCIIString();
220             }
221 
222             return uri.toASCIIString();
223         }
224 
225         return null;
226     }
227 
228 
229     public void writeRepositoryXml() throws MojoExecutionException
230     {
231         m_logger.info( "Writing OBR metadata" );
232 
233         File file = null;
234         Writer writer;
235         try
236         {
237             file = File.createTempFile( "repository", ".xml" );
238             writer = new OutputStreamWriter( new FileOutputStream( file ) );
239         }
240         catch ( IOException e )
241         {
242             m_logger.error( "Unable to write to file: " + file.getName() );
243             e.printStackTrace();
244             throw new MojoExecutionException( "Unable to write to file: " + file.getName() + " : " + e.getMessage() );
245         }
246 
247         try
248         {
249             new DataModelHelperImpl().writeRepository( m_repository, writer );
250         }
251         catch ( IOException e )
252         {
253             throw new MojoExecutionException( "Unable to write repository xml", e );
254         }
255 
256         try
257         {
258             writer.flush();
259             writer.close();
260 
261             File outputFile = new File( m_repositoryXml );
262             outputFile.getParentFile().mkdirs();
263             FileUtils.rename( file, outputFile );
264         }
265         catch ( IOException e )
266         {
267             e.printStackTrace();
268             throw new MojoExecutionException( "IOException" );
269         }
270 
271     }
272 
273 
274     /**
275       * Parse the repository descriptor file.
276       *
277       * @throws MojoExecutionException if the plugin failed
278       */
279     public void parseRepositoryXml() throws MojoExecutionException
280     {
281         File fout = new File( m_repositoryXml );
282         if ( !fout.exists() )
283         {
284             m_repository = new RepositoryImpl();
285             writeRepositoryXml();
286         }
287         else
288         {
289             try
290             {
291                 m_repository = ( RepositoryImpl ) new DataModelHelperImpl().repository( m_repositoryXml.toURL() );
292             }
293             catch ( Exception e )
294             {
295                 throw new MojoExecutionException( "Unable to read repository xml: " + m_repositoryXml, e );
296             }
297         }
298     }
299 
300 
301     /**
302      * put the information from obr.xml into ressourceBundle object.
303      */
304     private void parseObrXml() throws MojoExecutionException
305     {
306         try
307         {
308             InputStream is = new FileInputStream( new File( m_obrXml ) );
309             try
310             {
311                 KXmlParser kxp = new KXmlParser();
312                 kxp.setInput( is, null );
313                 kxp.nextTag(); // skip top level element
314                 kxp.nextTag(); // go to first child element
315                 parseObrXml( kxp );
316             }
317             finally
318             {
319                 is.close();
320             }
321         }
322         catch ( Exception e )
323         {
324             throw new MojoExecutionException( "Unable to parse obr xml: " + m_obrXml, e );
325         }
326     }
327 
328 
329     private void parseObrXml( KXmlParser kxp ) throws Exception
330     {
331         PullParser parser = new PullParser();
332         while ( kxp.getEventType() == XmlPullParser.START_TAG )
333         {
334             if ( RepositoryParser.CATEGORY.equals( kxp.getName() ) )
335             {
336                 m_resourceBundle.addCategory( parser.parseCategory( kxp ) );
337             }
338             else if ( RepositoryParser.REQUIRE.equals( kxp.getName() ) )
339             {
340                 m_resourceBundle.addRequire( parser.parseRequire( kxp ) );
341             }
342             else if ( RepositoryParser.CAPABILITY.equals( kxp.getName() ) )
343             {
344                 m_resourceBundle.addCapability( parser.parseCapability( kxp ) );
345             }
346             else
347             {
348                 kxp.nextTag();
349                 parseObrXml( kxp );
350             }
351             kxp.nextTag();
352         }
353     }
354 
355 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/ObrUtils.html000066400000000000000000000374031164564726100276430ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/PomHelper.html000066400000000000000000000204001164564726100277600ustar00rootroot00000000000000 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  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/RemoteFileManager.html000066400000000000000000001012321164564726100314160ustar00rootroot00000000000000 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.WagonConfigurationException;
29  import org.apache.maven.artifact.manager.WagonManager;
30  import org.apache.maven.plugin.MojoExecutionException;
31  import org.apache.maven.plugin.logging.Log;
32  import org.apache.maven.settings.Proxy;
33  import org.apache.maven.settings.Settings;
34  import org.apache.maven.wagon.ConnectionException;
35  import org.apache.maven.wagon.ResourceDoesNotExistException;
36  import org.apache.maven.wagon.TransferFailedException;
37  import org.apache.maven.wagon.UnsupportedProtocolException;
38  import org.apache.maven.wagon.Wagon;
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 ( WagonConfigurationException 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/XmlHelper.html000066400000000000000000000246521164564726100300020ustar00rootroot00000000000000 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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/package-frame.html000066400000000000000000000043441164564726100305610ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.felix.obrplugin

org.apache.felix.obrplugin

Classes

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/felix/obrplugin/package-summary.html000066400000000000000000000100271164564726100311570ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 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-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/000077500000000000000000000000001164564726100232015ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/000077500000000000000000000000001164564726100244475ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/dependency/000077500000000000000000000000001164564726100265655ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/dependency/tree/000077500000000000000000000000001164564726100275245ustar00rootroot00000000000000DependencyTreeResolutionListener.html000066400000000000000000001423321164564726100370300ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/dependency/tree 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.html 1143000 2011-07-05 11:50:48Z mcculls $
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 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/dependency/tree/package-frame.html000066400000000000000000000014261164564726100331000ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.maven.shared.dependency.tree

org.apache.maven.shared.dependency.tree

Classes

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/dependency/tree/package-summary.html000066400000000000000000000040301164564726100334750ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.maven.shared.dependency.tree

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

Class Summary
DependencyTreeResolutionListener

Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/osgi/000077500000000000000000000000001164564726100254105ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.html000066400000000000000000000732321164564726100334540ustar00rootroot00000000000000 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.lib.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.html 1143000 2011-07-05 11:50:48Z mcculls $
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       * </ul>
72       */
73      public String getBundleSymbolicName( Artifact artifact )
74      {
75          if ( ( artifact.getFile() != null ) && artifact.getFile().isFile() )
76          {
77              Analyzer analyzer = new Analyzer();
78  
79              JarFile jar = null;
80              try
81              {
82                  jar = new JarFile( artifact.getFile(), false );
83  
84                  if ( jar.getManifest() != null )
85                  {
86                      String symbolicNameAttribute = jar.getManifest().getMainAttributes()
87                          .getValue( Analyzer.BUNDLE_SYMBOLICNAME );
88                      Map bundleSymbolicNameHeader = analyzer.parseHeader( symbolicNameAttribute );
89  
90                      Iterator it = bundleSymbolicNameHeader.keySet().iterator();
91                      if ( it.hasNext() )
92                      {
93                          return ( String ) it.next();
94                      }
95                  }
96              }
97              catch ( IOException e )
98              {
99                  throw new ManifestReadingException( "Error reading manifest in jar "
100                     + artifact.getFile().getAbsolutePath(), e );
101             }
102             finally
103             {
104                 if ( jar != null )
105                 {
106                     try
107                     {
108                         jar.close();
109                     }
110                     catch ( IOException e )
111                     {
112                     }
113                 }
114             }
115         }
116 
117         int i = artifact.getGroupId().lastIndexOf( '.' );
118         if ( ( i < 0 ) && ( artifact.getFile() != null ) && artifact.getFile().isFile() )
119         {
120             String groupIdFromPackage = getGroupIdFromPackage( artifact.getFile() );
121             if ( groupIdFromPackage != null )
122             {
123                 return groupIdFromPackage;
124             }
125         }
126         String lastSection = artifact.getGroupId().substring( ++i );
127         if ( artifact.getArtifactId().equals( lastSection ) )
128         {
129             return artifact.getGroupId();
130         }
131         if ( artifact.getArtifactId().startsWith( lastSection ) )
132         {
133             String artifactId = artifact.getArtifactId().substring( lastSection.length() );
134             if ( Character.isLetterOrDigit( artifactId.charAt( 0 ) ) )
135             {
136                 return getBundleSymbolicName( artifact.getGroupId(), artifactId );
137             }
138             else
139             {
140                 return getBundleSymbolicName( artifact.getGroupId(), artifactId.substring( 1 ) );
141             }
142         }
143         return getBundleSymbolicName( artifact.getGroupId(), artifact.getArtifactId() );
144     }
145 
146 
147     private String getGroupIdFromPackage( File artifactFile )
148     {
149         try
150         {
151             /* get package names from jar */
152             Set packageNames = new HashSet();
153             JarFile jar = new JarFile( artifactFile, false );
154             Enumeration entries = jar.entries();
155             while ( entries.hasMoreElements() )
156             {
157                 ZipEntry entry = ( ZipEntry ) entries.nextElement();
158                 if ( entry.getName().endsWith( ".class" ) )
159                 {
160                     File f = new File( entry.getName() );
161                     String packageName = f.getParent();
162                     if ( packageName != null )
163                     {
164                         packageNames.add( packageName );
165                     }
166                 }
167             }
168             jar.close();
169 
170             /* find the top package */
171             String[] groupIdSections = null;
172             for ( Iterator it = packageNames.iterator(); it.hasNext(); )
173             {
174                 String packageName = ( String ) it.next();
175 
176                 String[] packageNameSections = packageName.split( "\\" + FILE_SEPARATOR );
177                 if ( groupIdSections == null )
178                 {
179                     /* first candidate */
180                     groupIdSections = packageNameSections;
181                 }
182                 else
183                 // if ( packageNameSections.length < groupIdSections.length )
184                 {
185                     /*
186                      * find the common portion of current package and previous selected groupId
187                      */
188                     int i;
189                     for ( i = 0; ( i < packageNameSections.length ) && ( i < groupIdSections.length ); i++ )
190                     {
191                         if ( !packageNameSections[i].equals( groupIdSections[i] ) )
192                         {
193                             break;
194                         }
195                     }
196                     groupIdSections = new String[i];
197                     System.arraycopy( packageNameSections, 0, groupIdSections, 0, i );
198                 }
199             }
200 
201             if ( ( groupIdSections == null ) || ( groupIdSections.length == 0 ) )
202             {
203                 return null;
204             }
205 
206             /* only one section as id doesn't seem enough, so ignore it */
207             if ( groupIdSections.length == 1 )
208             {
209                 return null;
210             }
211 
212             StringBuffer sb = new StringBuffer();
213             for ( int i = 0; i < groupIdSections.length; i++ )
214             {
215                 sb.append( groupIdSections[i] );
216                 if ( i < groupIdSections.length - 1 )
217                 {
218                     sb.append( '.' );
219                 }
220             }
221             return sb.toString();
222         }
223         catch ( IOException e )
224         {
225             /* we took all the precautions to avoid this */
226             throw new RuntimeException( e );
227         }
228     }
229 
230 
231     public String getBundleFileName( Artifact artifact )
232     {
233         return getBundleSymbolicName( artifact ) + "_" + getVersion( artifact.getVersion() ) + ".jar";
234     }
235 
236 
237     public String getVersion( Artifact artifact )
238     {
239         return getVersion( artifact.getVersion() );
240     }
241 
242 
243     public String getVersion( String version )
244     {
245         return cleanupVersion( version );
246     }
247 
248     /**
249      * Clean up version parameters. Other builders use more fuzzy definitions of
250      * the version syntax. This method cleans up such a version to match an OSGi
251      * version.
252      *
253      * @param VERSION_STRING
254      * @return
255      */
256     static final Pattern FUZZY_VERSION = Pattern.compile( "(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?",
257         Pattern.DOTALL );
258 
259 
260     static public String cleanupVersion( String version )
261     {
262         StringBuffer result = new StringBuffer();
263         Matcher m = FUZZY_VERSION.matcher( version );
264         if ( m.matches() )
265         {
266             String major = m.group( 1 );
267             String minor = m.group( 3 );
268             String micro = m.group( 5 );
269             String qualifier = m.group( 7 );
270 
271             if ( major != null )
272             {
273                 result.append( major );
274                 if ( minor != null )
275                 {
276                     result.append( "." );
277                     result.append( minor );
278                     if ( micro != null )
279                     {
280                         result.append( "." );
281                         result.append( micro );
282                         if ( qualifier != null )
283                         {
284                             result.append( "." );
285                             cleanupModifier( result, qualifier );
286                         }
287                     }
288                     else if ( qualifier != null )
289                     {
290                         result.append( ".0." );
291                         cleanupModifier( result, qualifier );
292                     }
293                     else
294                     {
295                         result.append( ".0" );
296                     }
297                 }
298                 else if ( qualifier != null )
299                 {
300                     result.append( ".0.0." );
301                     cleanupModifier( result, qualifier );
302                 }
303                 else
304                 {
305                     result.append( ".0.0" );
306                 }
307             }
308         }
309         else
310         {
311             result.append( "0.0.0." );
312             cleanupModifier( result, version );
313         }
314         return result.toString();
315     }
316 
317 
318     static void cleanupModifier( StringBuffer result, String modifier )
319     {
320         for ( int i = 0; i < modifier.length(); i++ )
321         {
322             char c = modifier.charAt( i );
323             if ( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || c == '_'
324                 || c == '-' )
325                 result.append( c );
326             else
327                 result.append( '_' );
328         }
329     }
330 
331 }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/osgi/ManifestReadingException.html000066400000000000000000000126561164564726100332270ustar00rootroot00000000000000 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.html 1143000 2011-07-05 11:50:48Z mcculls $
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  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/osgi/Maven2OsgiConverter.html000066400000000000000000000137121164564726100321440ustar00rootroot00000000000000 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.html 1143000 2011-07-05 11:50:48Z mcculls $
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  }

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/osgi/package-frame.html000066400000000000000000000020131164564726100307550ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.maven.shared.osgi

org.apache.maven.shared.osgi

Classes

maven-bundle-plugin-2.3.5/doc/site/xref/org/apache/maven/shared/osgi/package-summary.html000066400000000000000000000045331164564726100313710ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference Package org.apache.maven.shared.osgi

Package org.apache.maven.shared.osgi

Class Summary
DefaultMaven2OsgiConverter
ManifestReadingException
Maven2OsgiConverter

Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref/overview-frame.html000066400000000000000000000020651164564726100237120ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference

All Classes

Packages

maven-bundle-plugin-2.3.5/doc/site/xref/overview-summary.html000066400000000000000000000043151164564726100243150ustar00rootroot00000000000000 Maven Bundle Plugin 2.3.5 Reference
  • Overview
  • Package

Maven Bundle Plugin 2.3.5 Reference

Packages
org.apache.felix.bundleplugin
org.apache.felix.obrplugin
org.apache.maven.shared.dependency.tree
org.apache.maven.shared.osgi
  • Overview
  • Package

Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved. maven-bundle-plugin-2.3.5/doc/site/xref/stylesheet.css000066400000000000000000000030431164564726100227660ustar00rootroot00000000000000/* 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; } maven-bundle-plugin-2.3.5/pom.xml000066400000000000000000000076361164564726100167370ustar00rootroot00000000000000 felix-parent org.apache.felix 2.1 ../pom/pom.xml 4.0.0 maven-bundle-plugin 2.3.5 maven-plugin Maven Bundle Plugin Provides 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) scm:svn:http://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.3.5 scm:svn:https://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.3.5 http://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.3.5 org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 biz.aQute bndlib 1.43.0 org.apache.felix org.apache.felix.bundlerepository 1.6.6 org.apache.maven maven-core 2.0.7 org.apache.maven maven-archiver 2.4.1 org.apache.maven.shared maven-dependency-tree 1.2 org.codehaus.plexus plexus-utils 2.1 org.apache.maven.shared maven-plugin-testing-harness 1.1 test org.apache.maven.plugins maven-plugin-plugin 2.8 org.apache.maven.plugins maven-changes-plugin 2.4 12311143 maven-bundle-plugin- Resolved,Closed 1000 JIRA maven-bundle-plugin-2.3.5/src/000077500000000000000000000000001164564726100161755ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/000077500000000000000000000000001164564726100171215ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/000077500000000000000000000000001164564726100200425ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/000077500000000000000000000000001164564726100206315ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/000077500000000000000000000000001164564726100220525ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/000077500000000000000000000000001164564726100231615ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/000077500000000000000000000000001164564726100256515ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java000066400000000000000000000177701164564726100334400ustar00rootroot00000000000000/* * 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.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import aQute.lib.osgi.Instruction; /** * Apply clause-based filter over given dependencies * * @author Felix Project Team */ public abstract class AbstractDependencyFilter { /** * Dependency artifacts. */ private final Collection m_dependencyArtifacts; public AbstractDependencyFilter( Collection dependencyArtifacts ) { m_dependencyArtifacts = dependencyArtifacts; } private static abstract class DependencyFilter { private final Instruction m_instruction; private final String m_defaultValue; public DependencyFilter( String expression ) { this( expression, "" ); } public DependencyFilter( String expression, String defaultValue ) { m_instruction = Instruction.getPattern( expression ); m_defaultValue = defaultValue; } public void filter( Collection dependencies ) { for ( Iterator i = dependencies.iterator(); i.hasNext(); ) { if ( false == matches( ( Artifact ) i.next() ) ) { i.remove(); } } } abstract boolean matches( Artifact dependency ); boolean matches( String text ) { boolean result; if ( null == text ) { result = m_instruction.matches( m_defaultValue ); } else { result = m_instruction.matches( text ); } return m_instruction.isNegated() ? !result : result; } } protected final void processInstructions( Map instructions ) throws MojoExecutionException { DependencyFilter filter; for ( Iterator clauseIterator = instructions.entrySet().iterator(); clauseIterator.hasNext(); ) { String inline = "false"; // must use a fresh *modifiable* collection for each unique clause Collection filteredDependencies = new HashSet( m_dependencyArtifacts ); // CLAUSE: REGEXP --> { ATTRIBUTE MAP } Map.Entry clause = ( Map.Entry ) clauseIterator.next(); StringBuilder tag = new StringBuilder(); tag.append( clause.getKey() ); if ( !( ( String ) clause.getKey() ).matches( "\\*~*" ) ) { filter = new DependencyFilter( ( String ) clause.getKey() ) { boolean matches( Artifact dependency ) { return super.matches( dependency.getArtifactId() ); } }; // FILTER ON MAIN CLAUSE filter.filter( filteredDependencies ); } for ( Iterator attrIterator = ( ( Map ) clause.getValue() ).entrySet().iterator(); attrIterator.hasNext(); ) { // ATTRIBUTE: KEY --> REGEXP Map.Entry attr = ( Map.Entry ) attrIterator.next(); tag.append( ';' ).append( attr ); if ( "groupId".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue() ) { boolean matches( Artifact dependency ) { return super.matches( dependency.getGroupId() ); } }; } else if ( "artifactId".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue() ) { boolean matches( Artifact dependency ) { return super.matches( dependency.getArtifactId() ); } }; } else if ( "version".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue() ) { boolean matches( Artifact dependency ) { try { // use the symbolic version if available (ie. 1.0.0-SNAPSHOT) return super.matches( dependency.getSelectedVersion().toString() ); } catch ( Exception e ) { return super.matches( dependency.getVersion() ); } } }; } else if ( "scope".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue(), "compile" ) { boolean matches( Artifact dependency ) { return super.matches( dependency.getScope() ); } }; } else if ( "type".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue(), "jar" ) { boolean matches( Artifact dependency ) { return super.matches( dependency.getType() ); } }; } else if ( "classifier".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue() ) { boolean matches( Artifact dependency ) { return super.matches( dependency.getClassifier() ); } }; } else if ( "optional".equals( attr.getKey() ) ) { filter = new DependencyFilter( ( String ) attr.getValue(), "false" ) { boolean matches( Artifact dependency ) { return super.matches( "" + dependency.isOptional() ); } }; } else if ( "inline".equals( attr.getKey() ) ) { inline = ( String ) attr.getValue(); continue; } else { throw new MojoExecutionException( "Unexpected attribute " + attr.getKey() ); } // FILTER ON EACH ATTRIBUTE filter.filter( filteredDependencies ); } processDependencies( tag.toString(), inline, filteredDependencies ); } } protected abstract void processDependencies( String clause, String inline, Collection dependencies ); } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java000066400000000000000000000070041164564726100304160ustar00rootroot00000000000000/* * 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.FileOutputStream; import java.io.OutputStream; import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; import aQute.lib.osgi.Builder; import aQute.lib.osgi.Jar; /** * Generate Ant script to create the bundle (you should run ant:ant first). * * @goal ant * @requiresDependencyResolution test * @description generate Ant script to create the bundle */ public class AntPlugin extends BundlePlugin { static final String BUILD_XML = "/build.xml"; static final String BUILD_BND = "/maven-build.bnd"; protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { final String artifactId = getProject().getArtifactId(); final String baseDir = getProject().getBasedir().getPath(); 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 ); Properties bndProperties = builder.getProperties(); // cleanup and remove all non-strings from the builder properties for ( Iterator i = bndProperties.values().iterator(); i.hasNext(); ) { if ( !( i.next() instanceof String ) ) { i.remove(); } } // 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 ); bndProperties.store( out, " Merged BND Instructions" ); IOUtil.close( out ); // modify build template String buildXml = IOUtil.toString( getClass().getResourceAsStream( BUILD_XML ) ); buildXml = StringUtils.replace( buildXml, "BND_VERSION", builder.getVersion() ); buildXml = StringUtils.replace( buildXml, "ARTIFACT_ID", artifactId ); FileUtils.fileWrite( baseDir + BUILD_XML, buildXml ); // cleanup... builder.close(); } catch ( Exception e ) { throw new MojoExecutionException( "Problem creating Ant script", e ); } getLog().info( "Wrote Ant bundle project for " + artifactId + " to " + baseDir ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/BlueprintPlugin.java000066400000000000000000000330001164564726100316330ustar00rootroot00000000000000/* * 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.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.regex.Pattern; 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.service.AnalyzerPlugin; import aQute.lib.osgi.Analyzer; import aQute.lib.osgi.Jar; import aQute.lib.osgi.Processor; import aQute.lib.osgi.Resource; import aQute.libg.generics.Create; import aQute.libg.qtokens.QuotedTokenizer; import aQute.libg.reporter.Reporter; public class BlueprintPlugin implements AnalyzerPlugin { static Pattern QN = Pattern.compile( "[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*" ); static Pattern PATHS = Pattern.compile( ".*\\.xml" ); Transformer transformer; public BlueprintPlugin() throws Exception { transformer = getTransformer( getClass().getResource( "blueprint.xsl" ) ); } public boolean analyzeJar( Analyzer analyzer ) throws Exception { transformer.setParameter( "nsh_interface", analyzer.getProperty( "nsh_interface" ) != null ? analyzer.getProperty( "nsh_interface" ) : "" ); transformer.setParameter( "nsh_namespace", analyzer.getProperty( "nsh_namespace" ) != null ? analyzer.getProperty( "nsh_namespace" ) : "" ); Set headers = Create.set(); String bpHeader = analyzer.getProperty( "Bundle-Blueprint", "OSGI-INF/blueprint" ); Map> map = Processor.parseHeader( bpHeader, null ); for ( String root : map.keySet() ) { Jar jar = analyzer.getJar(); Map dir = jar.getDirectories().get( root ); if ( dir == null || dir.isEmpty() ) { Resource resource = jar.getResource( root ); if ( resource != null ) process( analyzer, root, resource, headers ); return false; } for ( Map.Entry entry : dir.entrySet() ) { String path = entry.getKey(); Resource resource = entry.getValue(); if ( PATHS.matcher( path ).matches() ) process( analyzer, path, resource, headers ); } } // Group and analyze Map> hdrs = Create.map(); for ( String str : headers ) { int idx = str.indexOf( ':' ); if ( idx < 0 ) { analyzer.warning( ( new StringBuilder( "Error analyzing services in blueprint resource: " ) ).append( str ).toString() ); continue; } String h = str.substring( 0, idx ).trim(); String v = str.substring( idx + 1 ).trim(); Set att = hdrs.get( h ); if ( att == null ) { att = new TreeSet(); hdrs.put( h, att ); } att.addAll( parseHeader( v, null ) ); } // Merge for ( String header : hdrs.keySet() ) { if ( "Import-Class".equals( header ) || "Import-Package".equals( header ) ) { Set newAttr = hdrs.get( header ); for ( Attribute a : newAttr ) { String pkg = a.getName(); if ( "Import-Class".equals( header ) ) { int n = a.getName().lastIndexOf( '.' ); if ( n > 0 ) { pkg = pkg.subSequence( 0, n ).toString(); } else { continue; } } if ( !analyzer.getReferred().containsKey( pkg ) ) { analyzer.getReferred().put( pkg, a.getProperties() ); } } } else { Set orgAttr = parseHeader( analyzer.getProperty( header ), null ); Set newAttr = hdrs.get( header ); for ( Iterator it = newAttr.iterator(); it.hasNext(); ) { Attribute a = it.next(); for ( Attribute b : orgAttr ) { if ( b.getName().equals( a.getName() ) ) { it.remove(); break; } } } orgAttr.addAll( newAttr ); // Rebuild from orgAttr StringBuilder sb = new StringBuilder(); for ( Attribute a : orgAttr ) { if ( sb.length() > 0 ) { sb.append( "," ); } sb.append( a.getName() ); for ( Map.Entry prop : a.getProperties().entrySet() ) { sb.append( ';' ).append( prop.getKey() ).append( "=" ); if ( prop.getValue().matches( "[0-9a-zA-Z_-]+" ) ) { sb.append( prop.getValue() ); } else { sb.append( "\"" ); sb.append( prop.getValue().replace( "\"", "\\\"" ) ); sb.append( "\"" ); } } } analyzer.setProperty( header, 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 ); 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(); line = line.replace( ";availability:=mandatory", "" ); 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 ); } public static class Attribute implements Comparable { private final String name; private final Map properties; public Attribute( String name, Map properties ) { this.name = name; this.properties = properties; } public String getName() { return name; } public Map getProperties() { return properties; } public int compareTo( Attribute a ) { int c = name.compareTo( a.name ); if ( c == 0 ) { c = properties.equals( a.properties ) ? 0 : properties.size() < a.properties.size() ? -1 : properties .hashCode() < a.properties.hashCode() ? -1 : +1; } return c; } @Override public boolean equals( Object o ) { if ( this == o ) return true; if ( o == null || getClass() != o.getClass() ) return false; Attribute attribute = ( Attribute ) o; if ( name != null ? !name.equals( attribute.name ) : attribute.name != null ) return false; if ( properties != null ? !properties.equals( attribute.properties ) : attribute.properties != null ) return false; return true; } @Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + ( properties != null ? properties.hashCode() : 0 ); return result; } } public static Set parseHeader( String value, Reporter logger ) { if ( ( value == null ) || ( value.trim().length() == 0 ) ) { return new TreeSet(); } Set result = new TreeSet(); QuotedTokenizer qt = new QuotedTokenizer( value, ";=," ); char del = '\0'; do { boolean hadAttribute = false; Map clause = Create.map(); List aliases = Create.list(); String name = qt.nextToken( ",;" ); del = qt.getSeparator(); if ( ( name == null ) || ( name.length() == 0 ) ) { if ( ( logger != null ) && ( logger.isPedantic() ) ) { logger .warning( "Empty clause, usually caused by repeating a comma without any name field or by having " + "spaces after the backslash of a property file: " + value ); } if ( name != null ) continue; break; } name = name.trim(); aliases.add( name ); String advalue; while ( del == ';' ) { String adname = qt.nextToken(); if ( ( del = qt.getSeparator() ) != '=' ) { if ( ( hadAttribute ) && ( logger != null ) ) { logger.error( "Header contains name field after attribute or directive: " + adname + " from " + value + ". Name fields must be consecutive, separated by a ';' like a;b;c;x=3;y=4" ); } if ( ( adname != null ) && ( adname.length() > 0 ) ) aliases.add( adname.trim() ); } else { advalue = qt.nextToken(); if ( ( clause.containsKey( adname ) ) && ( logger != null ) && ( logger.isPedantic() ) ) { logger.warning( "Duplicate attribute/directive name " + adname + " in " + value + ". This attribute/directive will be ignored" ); } if ( advalue == null ) { if ( logger != null ) { logger.error( "No value after '=' sign for attribute " + adname ); } advalue = ""; } clause.put( adname.trim(), advalue.trim() ); del = qt.getSeparator(); hadAttribute = true; } } for ( String clauseName : aliases ) { result.add( new Attribute( clauseName, clause ) ); } } while ( del == ',' ); return result; } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java000066400000000000000000000472431164564726100315470ustar00rootroot00000000000000/* * 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.FilenameFilter; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.jar.Manifest; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; 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; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.ProjectBuildingException; 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.codehaus.plexus.util.FileUtils; import aQute.lib.osgi.Analyzer; import aQute.lib.osgi.Jar; /** * Create OSGi bundles from all dependencies in the Maven project * * @goal bundleall * @phase package * @requiresDependencyResolution test * @description 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 public class BundleAllPlugin extends ManifestPlugin { private static final String LS = System.getProperty( "line.separator" ); private static final Pattern SNAPSHOT_VERSION_PATTERN = Pattern.compile( "[0-9]{8}_[0-9]{6}_[0-9]+" ); /** * Local repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; /** * Remote repositories. * * @parameter expression="${project.remoteArtifactRepositories}" * @required * @readonly */ private List remoteRepositories; /** * Import-Package to be used when wrapping dependencies. * * @parameter expression="${wrapImportPackage}" default-value="*" */ 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; /** * Ignore missing artifacts that are not required by current project but are required by the * transitive dependencies. * * @parameter */ private boolean ignoreMissingArtifacts; private Set m_artifactsBeingProcessed = new HashSet(); /** * Process up to some depth * * @parameter */ private int depth = Integer.MAX_VALUE; public void execute() throws MojoExecutionException { getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ); getLog().warn( "! The bundleall goal is no longer supported and may be removed in a future release !" ); getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ); BundleInfo bundleInfo = bundleAll( getProject() ); logDuplicatedPackages( bundleInfo ); } /** * Bundle a project and all its dependencies * * @param project * @throws MojoExecutionException */ private BundleInfo bundleAll( MavenProject project ) throws MojoExecutionException { return bundleAll( project, depth ); } /** * 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 */ protected BundleInfo bundleAll( MavenProject project, int maxDepth ) throws MojoExecutionException { if ( alreadyBundled( project.getArtifact() ) ) { getLog().debug( "Ignoring project already processed " + project.getArtifact() ); return null; } if ( m_artifactsBeingProcessed.contains( project.getArtifact() ) ) { getLog().warn( "Ignoring artifact due to dependency cycle " + project.getArtifact() ); return null; } m_artifactsBeingProcessed.add( project.getArtifact() ); DependencyNode dependencyTree; try { dependencyTree = m_dependencyTreeBuilder.buildDependencyTree( project, localRepository, m_factory, m_artifactMetadataSource, null, m_collector ); } catch ( DependencyTreeBuilderException e ) { throw new MojoExecutionException( "Unable to build dependency tree", e ); } BundleInfo bundleInfo = new BundleInfo(); if ( !dependencyTree.hasChildren() ) { /* no need to traverse the tree */ return bundleRoot( project, bundleInfo ); } getLog().debug( "Will bundle the following dependency tree" + LS + dependencyTree ); for ( Iterator it = dependencyTree.inverseIterator(); it.hasNext(); ) { DependencyNode node = ( DependencyNode ) it.next(); if ( !it.hasNext() ) { /* this is the root, current project */ break; } if ( node.getState() != DependencyNode.INCLUDED ) { continue; } if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) ) { getLog().debug( "Ignoring system scoped artifact " + node.getArtifact() ); continue; } Artifact artifact; try { artifact = resolveArtifact( node.getArtifact() ); } catch ( ArtifactNotFoundException e ) { if ( ignoreMissingArtifacts ) { continue; } throw new MojoExecutionException( "Artifact was not found in the repo" + node.getArtifact(), e ); } node.getArtifact().setFile( artifact.getFile() ); int nodeDepth = node.getDepth(); if ( nodeDepth > maxDepth ) { /* node is deeper than we want */ getLog().debug( "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + maxDepth ); continue; } MavenProject childProject; try { childProject = m_mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository, true ); if ( childProject.getDependencyArtifacts() == null ) { childProject.setDependencyArtifacts( childProject.createArtifacts( m_factory, null, null ) ); } } catch ( ProjectBuildingException e ) { throw new MojoExecutionException( "Unable to build project object for artifact " + artifact, e ); } catch ( InvalidDependencyVersionException e ) { throw new MojoExecutionException( "Invalid dependency version for artifact " + artifact ); } childProject.setArtifact( artifact ); getLog().debug( "Child project artifact location: " + childProject.getArtifact().getFile() ); if ( ( Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) ) || ( Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) ) ) { BundleInfo subBundleInfo = bundleAll( childProject, maxDepth - 1 ); if ( subBundleInfo != null ) { bundleInfo.merge( subBundleInfo ); } } else { getLog().debug( "Not processing due to scope (" + childProject.getArtifact().getScope() + "): " + childProject.getArtifact() ); } } return bundleRoot( project, bundleInfo ); } /** * Bundle the root of a dependency tree after all its children have been bundled * * @param project * @param bundleInfo * @return * @throws MojoExecutionException */ private BundleInfo bundleRoot( MavenProject project, BundleInfo bundleInfo ) throws MojoExecutionException { /* do not bundle the project the mojo was called on */ if ( getProject() != project ) { getLog().debug( "Project artifact location: " + project.getArtifact().getFile() ); BundleInfo subBundleInfo = bundle( project ); if ( subBundleInfo != null ) { bundleInfo.merge( subBundleInfo ); } } return bundleInfo; } /** * Bundle one project only without building its childre * * @param project * @throws MojoExecutionException */ protected BundleInfo bundle( MavenProject project ) throws MojoExecutionException { Artifact artifact = project.getArtifact(); getLog().info( "Bundling " + artifact ); try { Map instructions = new LinkedHashMap(); instructions.put( Analyzer.IMPORT_PACKAGE, wrapImportPackage ); project.getArtifact().setFile( getFile( artifact ) ); File outputFile = getOutputFile( artifact ); if ( project.getArtifact().getFile().equals( outputFile ) ) { /* TODO find the cause why it's getting here */ return null; // getLog().error( // "Trying to read and write " + artifact + " to the same file, try cleaning: " // + outputFile ); // throw new IllegalStateException( "Trying to read and write " + artifact // + " to the same file, try cleaning: " + outputFile ); } Analyzer analyzer = getAnalyzer( project, instructions, new Properties(), getClasspath( project ) ); Jar osgiJar = new Jar( project.getArtifactId(), project.getArtifact().getFile() ); outputFile.getAbsoluteFile().getParentFile().mkdirs(); Collection exportedPackages; if ( isOsgi( osgiJar ) ) { /* if it is already an OSGi jar copy it as is */ getLog().info( "Using existing OSGi bundle for " + project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion() ); String exportHeader = osgiJar.getManifest().getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE ); exportedPackages = analyzer.parseHeader( exportHeader ).keySet(); FileUtils.copyFile( project.getArtifact().getFile(), outputFile ); } else { /* else generate the manifest from the packages */ exportedPackages = analyzer.getExports().keySet(); Manifest manifest = analyzer.getJar().getManifest(); osgiJar.setManifest( manifest ); osgiJar.write( outputFile ); } BundleInfo bundleInfo = addExportedPackages( project, exportedPackages ); // cleanup... analyzer.close(); osgiJar.close(); return bundleInfo; } /* too bad Jar.write throws Exception */ catch ( Exception e ) { throw new MojoExecutionException( "Error generating OSGi bundle for project " + getArtifactKey( project.getArtifact() ), e ); } } private boolean isOsgi( Jar jar ) throws Exception { if ( jar.getManifest() != null ) { return jar.getManifest().getMainAttributes().getValue( Analyzer.BUNDLE_NAME ) != null; } return false; } private BundleInfo addExportedPackages( MavenProject project, Collection packages ) { BundleInfo bundleInfo = new BundleInfo(); for ( Iterator it = packages.iterator(); it.hasNext(); ) { String packageName = ( String ) it.next(); bundleInfo.addExportedPackage( packageName, project.getArtifact() ); } return bundleInfo; } private String getArtifactKey( Artifact artifact ) { return artifact.getGroupId() + ":" + artifact.getArtifactId(); } private String getBundleName( Artifact artifact ) { return getMaven2OsgiConverter().getBundleFileName( artifact ); } private boolean alreadyBundled( Artifact artifact ) { return getBuiltFile( artifact ) != null; } /** * Use previously built bundles when available. * * @param artifact */ protected File getFile( final Artifact artifact ) { File bundle = getBuiltFile( artifact ); if ( bundle != null ) { getLog().debug( "Using previously built OSGi bundle for " + artifact + " in " + bundle ); return bundle; } return super.getFile( artifact ); } private File getBuiltFile( final Artifact artifact ) { File bundle = null; /* if bundle was already built use it instead of jar from repo */ File outputFile = getOutputFile( artifact ); if ( outputFile.exists() ) { bundle = outputFile; } /* * 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 */ if ( ( bundle == null ) && artifact.isSnapshot() ) { final File buildDirectory = new File( getBuildDirectory() ); if ( !buildDirectory.exists() ) { buildDirectory.mkdirs(); } File[] files = buildDirectory.listFiles( new FilenameFilter() { public boolean accept( File dir, String name ) { if ( dir.equals( buildDirectory ) && snapshotMatch( artifact, name ) ) { return true; } return false; } } ); if ( files.length > 1 ) { throw new RuntimeException( "More than one previously built bundle matches for artifact " + artifact + " : " + Arrays.asList( files ) ); } if ( files.length == 1 ) { bundle = files[0]; } } return bundle; } /** * 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 * @return if both represent the same artifact and version, forgetting about the snapshot timestamp */ protected boolean snapshotMatch( Artifact artifact, String bundleName ) { String artifactBundleName = getBundleName( artifact ); int i = artifactBundleName.indexOf( "SNAPSHOT" ); if ( i < 0 ) { return false; } artifactBundleName = artifactBundleName.substring( 0, i ); if ( bundleName.startsWith( artifactBundleName ) ) { /* it's the same artifact groupId and artifactId */ String timestamp = bundleName.substring( artifactBundleName.length(), bundleName.lastIndexOf( ".jar" ) ); Matcher m = SNAPSHOT_VERSION_PATTERN.matcher( timestamp ); return m.matches(); } return false; } protected File getOutputFile( Artifact artifact ) { return new File( getOutputDirectory(), getBundleName( artifact ) ); } private Artifact resolveArtifact( Artifact artifact ) throws MojoExecutionException, ArtifactNotFoundException { VersionRange versionRange; if ( artifact.getVersion() != null ) { versionRange = VersionRange.createFromVersion( artifact.getVersion() ); } else { versionRange = artifact.getVersionRange(); } /* * there's a bug with ArtifactFactory#createDependencyArtifact(String, String, VersionRange, * String, String, String) that ignores the scope parameter, that's why we use the one with * the extra null parameter */ Artifact resolvedArtifact = m_factory.createDependencyArtifact( artifact.getGroupId(), artifact.getArtifactId(), versionRange, artifact.getType(), artifact.getClassifier(), artifact.getScope(), null ); try { m_artifactResolver.resolve( resolvedArtifact, remoteRepositories, localRepository ); } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException( "Error resolving artifact " + resolvedArtifact, e ); } return resolvedArtifact; } /** * Log what packages are exported in more than one bundle */ protected void logDuplicatedPackages( BundleInfo bundleInfo ) { Map duplicatedExports = bundleInfo.getDuplicatedExports(); for ( Iterator it = duplicatedExports.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = ( Map.Entry ) it.next(); String packageName = ( String ) entry.getKey(); Collection artifacts = ( Collection ) entry.getValue(); getLog().warn( "Package " + packageName + " is exported in more than a bundle: " ); for ( Iterator it2 = artifacts.iterator(); it2.hasNext(); ) { Artifact artifact = ( Artifact ) it2.next(); getLog().warn( " " + artifact ); } } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/BundleInfo.java000066400000000000000000000076211164564726100305470ustar00rootroot00000000000000/* * 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.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.maven.artifact.Artifact; /** * Information result of the bundling process * * @author Carlos Sanchez * @version $Id: BundleInfo.java 616192 2008-01-29 07:45:57Z mcculls $ */ public class BundleInfo { /** * {@link Map} < {@link String}, {@link Set} < {@link Artifact} > > * Used to check for duplicated exports. Key is package name and value list of artifacts where it's exported. */ private Map m_exportedPackages = new HashMap(); public void addExportedPackage( String packageName, Artifact artifact ) { Set artifacts = ( Set ) getExportedPackages().get( packageName ); if ( artifacts == null ) { artifacts = new HashSet(); m_exportedPackages.put( packageName, artifacts ); } artifacts.add( artifact ); } protected Map getExportedPackages() { return m_exportedPackages; } /** * 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} > > */ public Map getDuplicatedExports() { Map duplicatedExports = new HashMap(); for ( Iterator it = getExportedPackages().entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = ( Map.Entry ) it.next(); Set artifacts = ( Set ) entry.getValue(); if ( artifacts.size() > 1 ) { /* remove warnings caused by different versions of same artifact */ Set artifactKeys = new HashSet(); String packageName = ( String ) entry.getKey(); for ( Iterator it2 = artifacts.iterator(); it2.hasNext(); ) { Artifact artifact = ( Artifact ) it2.next(); artifactKeys.add( artifact.getGroupId() + "." + artifact.getArtifactId() ); } if ( artifactKeys.size() > 1 ) { duplicatedExports.put( packageName, artifacts ); } } } return duplicatedExports; } public void merge( BundleInfo bundleInfo ) { for ( Iterator it = bundleInfo.getExportedPackages().entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = ( Map.Entry ) it.next(); String packageName = ( String ) entry.getKey(); Collection artifacts = ( Collection ) entry.getValue(); Collection artifactsWithPackage = ( Collection ) getExportedPackages().get( packageName ); if ( artifactsWithPackage == null ) { artifactsWithPackage = new HashSet(); getExportedPackages().put( packageName, artifactsWithPackage ); } artifactsWithPackage.addAll( artifacts ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java000066400000000000000000001355251164564726100311170ustar00rootroot00000000000000/* * 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.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.jar.Attributes; import java.util.jar.Manifest; 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.handler.manager.ArtifactHandlerManager; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.License; import org.apache.maven.model.Model; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; import org.apache.maven.shared.osgi.Maven2OsgiConverter; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.manager.ArchiverManager; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; import aQute.lib.osgi.Analyzer; import aQute.lib.osgi.Builder; import aQute.lib.osgi.Constants; import aQute.lib.osgi.EmbeddedResource; import aQute.lib.osgi.FileResource; import aQute.lib.osgi.Jar; import aQute.lib.osgi.Processor; import aQute.lib.spring.SpringXMLType; /** * Create an OSGi bundle from Maven project * * @goal bundle * @phase package * @requiresDependencyResolution test * @description build an OSGi bundle jar * @threadSafe */ public class BundlePlugin extends AbstractMojo { /** * Directory where the manifest will be written * * @parameter expression="${manifestLocation}" default-value="${project.build.outputDirectory}/META-INF" */ protected File manifestLocation; /** * File where the BND instructions will be dumped * * @parameter expression="${dumpInstructions}" */ protected File dumpInstructions; /** * File where the BND class-path will be dumped * * @parameter expression="${dumpClasspath}" */ protected File dumpClasspath; /** * When true, unpack the bundle contents to the outputDirectory * * @parameter expression="${unpackBundle}" */ protected boolean unpackBundle; /** * Comma separated list of artifactIds to exclude from the dependency classpath passed to BND (use "true" to exclude everything) * * @parameter expression="${excludeDependencies}" */ protected String excludeDependencies; /** * Classifier type of the bundle to be installed. For example, "jdk14". * Defaults to none which means this is the project's main bundle. * * @parameter */ protected String classifier; /** * @component */ private MavenProjectHelper m_projectHelper; /** * @component */ private ArchiverManager m_archiverManager; /** * @component */ private ArtifactHandlerManager m_artifactHandlerManager; /** * Project types which this plugin supports. * * @parameter */ protected List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); /** * The directory for the generated bundles. * * @parameter expression="${project.build.outputDirectory}" * @required */ private File outputDirectory; /** * The directory for the generated JAR. * * @parameter expression="${project.build.directory}" * @required */ private String buildDirectory; /** * The Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * The BND instructions for the bundle. * * @parameter */ private Map instructions = new LinkedHashMap(); /** * Use locally patched version for now. */ private Maven2OsgiConverter m_maven2OsgiConverter = new DefaultMaven2OsgiConverter(); /** * The archive configuration to use. * * @parameter */ private MavenArchiveConfiguration archive; // accessed indirectly in JarPluginConfiguration /** * @parameter default-value="${session}" * @required * @readonly */ private MavenSession m_mavenSession; private static final String MAVEN_SYMBOLICNAME = "maven-symbolicname"; private static final String MAVEN_RESOURCES = "{maven-resources}"; private static final String LOCAL_PACKAGES = "{local-packages}"; private static final String[] EMPTY_STRING_ARRAY = {}; private static final String[] DEFAULT_INCLUDES = { "**/**" }; private static final String NL = System.getProperty( "line.separator" ); protected Maven2OsgiConverter getMaven2OsgiConverter() { return m_maven2OsgiConverter; } protected void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter ) { m_maven2OsgiConverter = maven2OsgiConverter; } protected MavenProject getProject() { return project; } /** * @see org.apache.maven.plugin.AbstractMojo#execute() */ public void execute() throws MojoExecutionException { Properties properties = new Properties(); String projectType = getProject().getArtifact().getType(); // ignore unsupported project types, useful when bundleplugin is configured in parent pom if ( !supportedProjectTypes.contains( projectType ) ) { getLog().warn( "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes ); return; } execute( getProject(), instructions, properties ); } protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties ) throws MojoExecutionException { try { execute( currentProject, originalInstructions, properties, getClasspath( currentProject ) ); } catch ( IOException e ) { throw new MojoExecutionException( "Error calculating classpath for project " + currentProject, e ); } } /* transform directives from their XML form to the expected BND syntax (eg. _include becomes -include) */ protected static Map transformDirectives( Map originalInstructions ) { Map transformedInstructions = new LinkedHashMap(); for ( Iterator i = originalInstructions.entrySet().iterator(); i.hasNext(); ) { Map.Entry e = ( Map.Entry ) i.next(); String key = ( String ) e.getKey(); if ( key.startsWith( "_" ) ) { key = "-" + key.substring( 1 ); } String value = ( String ) e.getValue(); if ( null == value ) { value = ""; } else { value = value.replaceAll( "\\p{Blank}*[\r\n]\\p{Blank}*", "" ); } if ( Analyzer.WAB.equals( key ) && value.length() == 0 ) { // provide useful default value = "src/main/webapp/"; } transformedInstructions.put( key, value ); } return transformedInstructions; } protected boolean reportErrors( String prefix, Analyzer analyzer ) { List errors = analyzer.getErrors(); List warnings = analyzer.getWarnings(); for ( Iterator w = warnings.iterator(); w.hasNext(); ) { String msg = ( String ) w.next(); getLog().warn( prefix + " : " + msg ); } boolean hasErrors = false; String fileNotFound = "Input file does not exist: "; for ( Iterator e = errors.iterator(); e.hasNext(); ) { String msg = ( String ) e.next(); 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() ) ); getLog().warn( prefix + " : Duplicate path '" + duplicate + "' in Include-Resource" ); } else { getLog().error( prefix + " : " + msg ); hasErrors = true; } } return hasErrors; } protected void execute( MavenProject currentProject, Map originalInstructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { try { File jarFile = new File( getBuildDirectory(), getBundleName( currentProject ) ); Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties, classpath ); boolean hasErrors = reportErrors( "Bundle " + currentProject.getArtifact(), builder ); if ( hasErrors ) { String failok = builder.getProperty( "-failok" ); if ( null == failok || "false".equalsIgnoreCase( failok ) ) { jarFile.delete(); throw new MojoFailureException( "Error(s) found in bundle configuration" ); } } // attach bundle to maven project jarFile.getParentFile().mkdirs(); builder.getJar().write( jarFile ); Artifact mainArtifact = currentProject.getArtifact(); if ( "bundle".equals( mainArtifact.getType() ) ) { // workaround for MNG-1682: force maven to install artifact using the "jar" handler mainArtifact.setArtifactHandler( m_artifactHandlerManager.getArtifactHandler( "jar" ) ); } if ( null == classifier || classifier.trim().length() == 0 ) { mainArtifact.setFile( jarFile ); } else { m_projectHelper.attachArtifact( currentProject, jarFile, classifier ); } if ( unpackBundle ) { unpackBundle( jarFile ); } if ( manifestLocation != null ) { File outputFile = new File( manifestLocation, "MANIFEST.MF" ); try { Manifest manifest = builder.getJar().getManifest(); ManifestPlugin.writeManifest( manifest, outputFile ); } catch ( IOException e ) { getLog().error( "Error trying to write Manifest to file " + outputFile, e ); } } // cleanup... builder.close(); } catch ( MojoFailureException e ) { getLog().error( e.getLocalizedMessage() ); throw new MojoExecutionException( "Error(s) found in bundle configuration", e ); } catch ( Exception e ) { getLog().error( "An internal error occurred", e ); throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e ); } } protected Builder getOSGiBuilder( MavenProject currentProject, Map originalInstructions, Properties properties, Jar[] classpath ) throws Exception { properties.putAll( getDefaultProperties( currentProject ) ); properties.putAll( transformDirectives( originalInstructions ) ); Builder builder = new Builder(); builder.setBase( getBase( currentProject ) ); builder.setProperties( properties ); if ( classpath != null ) { builder.setClasspath( classpath ); } return builder; } protected void addMavenInstructions( MavenProject currentProject, Builder builder ) throws Exception { if ( currentProject.getBasedir() != null ) { // update BND instructions to add included Maven resources includeMavenResources( currentProject, builder, getLog() ); // calculate default export/private settings based on sources addLocalPackages( outputDirectory, builder ); } // update BND instructions to embed selected Maven dependencies Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, builder ); new DependencyEmbedder( getLog(), embeddableArtifacts ).processHeaders( builder ); if ( dumpInstructions != null || getLog().isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); getLog().debug( "BND Instructions:" + NL + dumpInstructions( builder.getProperties(), buf ) ); if ( dumpInstructions != null ) { getLog().info( "Writing BND instructions to " + dumpInstructions ); dumpInstructions.getParentFile().mkdirs(); FileUtils.fileWrite( dumpInstructions, "# BND instructions" + NL + buf ); } } if ( dumpClasspath != null || getLog().isDebugEnabled() ) { StringBuilder buf = new StringBuilder(); getLog().debug( "BND Classpath:" + NL + dumpClasspath( builder.getClasspath(), buf ) ); if ( dumpClasspath != null ) { getLog().info( "Writing BND classpath to " + dumpClasspath ); dumpClasspath.getParentFile().mkdirs(); FileUtils.fileWrite( dumpClasspath, "# BND classpath" + NL + buf ); } } } protected Builder buildOSGiBundle( MavenProject currentProject, Map originalInstructions, Properties properties, Jar[] classpath ) throws Exception { Builder builder = getOSGiBuilder( currentProject, originalInstructions, properties, classpath ); addMavenInstructions( currentProject, builder ); builder.build(); mergeMavenManifest( currentProject, builder ); return builder; } protected static StringBuilder dumpInstructions( Properties properties, StringBuilder buf ) { try { buf.append( "#-----------------------------------------------------------------------" + NL ); Properties stringProperties = new Properties(); for ( Enumeration e = properties.propertyNames(); e.hasMoreElements(); ) { // we can only store String properties String key = ( String ) e.nextElement(); String value = properties.getProperty( key ); if ( value != null ) { stringProperties.setProperty( key, value ); } } ByteArrayOutputStream out = new ByteArrayOutputStream(); stringProperties.store( out, null ); // properties encoding is 8859_1 buf.append( out.toString( "8859_1" ) ); buf.append( "#-----------------------------------------------------------------------" + NL ); } catch ( Throwable e ) { // ignore... } return buf; } protected static StringBuilder dumpClasspath( List classpath, StringBuilder buf ) { try { buf.append( "#-----------------------------------------------------------------------" + NL ); buf.append( "-classpath:\\" + NL ); for ( Iterator i = classpath.iterator(); i.hasNext(); ) { File path = ( ( Jar ) i.next() ).getSource(); if ( path != null ) { buf.append( ' ' + path.toString() + ( i.hasNext() ? ",\\" : "" ) + NL ); } } buf.append( "#-----------------------------------------------------------------------" + NL ); } catch ( Throwable e ) { // ignore... } return buf; } protected static StringBuilder dumpManifest( Manifest manifest, StringBuilder buf ) { try { buf.append( "#-----------------------------------------------------------------------" + NL ); ByteArrayOutputStream out = new ByteArrayOutputStream(); manifest.write( out ); // manifest encoding is UTF8 buf.append( out.toString( "UTF8" ) ); buf.append( "#-----------------------------------------------------------------------" + NL ); } catch ( Throwable e ) { // ignore... } return buf; } protected static void includeMavenResources( MavenProject currentProject, Analyzer analyzer, Log log ) { // pass maven resource paths onto BND analyzer final String mavenResourcePaths = getMavenResourcePaths( currentProject ); final String includeResource = ( String ) analyzer.getProperty( Analyzer.INCLUDE_RESOURCE ); if ( includeResource != null ) { if ( includeResource.indexOf( MAVEN_RESOURCES ) >= 0 ) { // if there is no maven resource path, we do a special treatment and replace // every occurance of MAVEN_RESOURCES and a following comma with an empty string if ( mavenResourcePaths.length() == 0 ) { String cleanedResource = removeTagFromInstruction( includeResource, MAVEN_RESOURCES ); if ( cleanedResource.length() > 0 ) { analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, cleanedResource ); } else { analyzer.unsetProperty( Analyzer.INCLUDE_RESOURCE ); } } else { String combinedResource = StringUtils .replace( includeResource, MAVEN_RESOURCES, mavenResourcePaths ); analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, combinedResource ); } } else if ( mavenResourcePaths.length() > 0 ) { log.warn( Analyzer.INCLUDE_RESOURCE + ": overriding " + mavenResourcePaths + " with " + includeResource + " (add " + MAVEN_RESOURCES + " if you want to include the maven resources)" ); } } else if ( mavenResourcePaths.length() > 0 ) { analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths ); } } protected void mergeMavenManifest( MavenProject currentProject, Builder builder ) throws Exception { Jar jar = builder.getJar(); if ( getLog().isDebugEnabled() ) { getLog().debug( "BND Manifest:" + NL + dumpManifest( jar.getManifest(), new StringBuilder() ) ); } boolean addMavenDescriptor = currentProject.getBasedir() != null; try { /* * Grab customized manifest entries from the maven-jar-plugin configuration */ MavenArchiveConfiguration archiveConfig = JarPluginConfiguration.getArchiveConfiguration( currentProject ); String mavenManifestText = new MavenArchiver().getManifest( currentProject, archiveConfig ).toString(); addMavenDescriptor = addMavenDescriptor && archiveConfig.isAddMavenDescriptor(); Manifest mavenManifest = new Manifest(); // First grab the external manifest file (if specified) File externalManifestFile = archiveConfig.getManifestFile(); if ( null != externalManifestFile && externalManifestFile.exists() ) { InputStream mis = new FileInputStream( externalManifestFile ); mavenManifest.read( mis ); mis.close(); } // Then apply customized entries from the jar plugin; note: manifest encoding is UTF8 mavenManifest.read( new ByteArrayInputStream( mavenManifestText.getBytes( "UTF8" ) ) ); if ( !archiveConfig.isManifestSectionsEmpty() ) { /* * Add customized manifest sections (for some reason MavenArchiver doesn't do this for us) */ List sections = archiveConfig.getManifestSections(); for ( Iterator i = sections.iterator(); i.hasNext(); ) { ManifestSection section = ( ManifestSection ) i.next(); Attributes attributes = new Attributes(); if ( !section.isManifestEntriesEmpty() ) { Map entries = section.getManifestEntries(); for ( Iterator j = entries.entrySet().iterator(); j.hasNext(); ) { Map.Entry entry = ( Map.Entry ) j.next(); attributes.putValue( ( String ) entry.getKey(), ( String ) entry.getValue() ); } } mavenManifest.getEntries().put( section.getName(), attributes ); } } Attributes mainMavenAttributes = mavenManifest.getMainAttributes(); mainMavenAttributes.putValue( "Created-By", "Apache Maven Bundle Plugin" ); String[] removeHeaders = builder.getProperty( Constants.REMOVEHEADERS, "" ).split( "," ); // apply -removeheaders to the custom manifest for ( int i = 0; i < removeHeaders.length; i++ ) { for ( Iterator j = mainMavenAttributes.keySet().iterator(); j.hasNext(); ) { if ( j.next().toString().matches( removeHeaders[i].trim() ) ) { j.remove(); } } } /* * Overlay generated bundle manifest with customized entries */ Manifest bundleManifest = jar.getManifest(); 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 ); Map> values = new Analyzer().parseHeader( importPackages ); for ( Map.Entry> entry : values.entrySet() ) { String pkg = entry.getKey(); Map options = entry.getValue(); if ( !options.containsKey( "resolution:" ) && optionalPackages.contains( pkg ) ) { options.put( "resolution:", "optional" ); } } String result = Processor.printClauses( values, "resolution:" ); bundleManifest.getMainAttributes().putValue( "Import-Package", result ); } jar.setManifest( bundleManifest ); } catch ( Exception e ) { getLog().warn( "Unable to merge Maven manifest: " + e.getLocalizedMessage() ); } if ( addMavenDescriptor ) { doMavenMetadata( currentProject, jar ); } if ( getLog().isDebugEnabled() ) { getLog().debug( "Final Manifest:" + NL + dumpManifest( jar.getManifest(), new StringBuilder() ) ); } builder.setJar( jar ); } protected Set getOptionalPackages( MavenProject currentProject ) throws IOException, MojoExecutionException { ArrayList inscope = new ArrayList(); final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() ); for ( Iterator it = artifacts.iterator(); it.hasNext(); ) { Artifact artifact = ( Artifact ) it.next(); if ( artifact.getArtifactHandler().isAddedToClasspath() ) { if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) ) { inscope.add( artifact ); } } } HashSet optionalArtifactIds = new HashSet(); for ( Iterator it = inscope.iterator(); it.hasNext(); ) { Artifact artifact = ( Artifact ) it.next(); if ( artifact.isOptional() ) { String id = artifact.toString(); if ( artifact.getScope() != null ) { // strip the scope... id = id.replaceFirst( ":[^:]*$", "" ); } optionalArtifactIds.add( id ); } } HashSet required = new HashSet(); HashSet optional = new HashSet(); for ( Iterator it = inscope.iterator(); it.hasNext(); ) { Artifact artifact = ( Artifact ) it.next(); File file = getFile( artifact ); if ( file == null ) { continue; } Jar jar = new Jar( artifact.getArtifactId(), file ); if ( isTransitivelyOptional( optionalArtifactIds, artifact ) ) { optional.addAll( jar.getPackages() ); } else { required.addAll( jar.getPackages() ); } jar.close(); } optional.removeAll( required ); return optional; } /** * Check to see if any dependency along the dependency trail of * the artifact is optional. * * @param artifact */ protected boolean isTransitivelyOptional( HashSet optionalArtifactIds, Artifact artifact ) { List trail = artifact.getDependencyTrail(); for ( Iterator iterator = trail.iterator(); iterator.hasNext(); ) { String next = ( String ) iterator.next(); if ( optionalArtifactIds.contains( next ) ) { return true; } } return false; } private void unpackBundle( File jarFile ) { File outputDir = getOutputDirectory(); if ( null == outputDir ) { outputDir = new File( getBuildDirectory(), "classes" ); } try { /* * this directory must exist before unpacking, otherwise the plexus * unarchiver decides to use the current working directory instead! */ if ( !outputDir.exists() ) { outputDir.mkdirs(); } UnArchiver unArchiver = m_archiverManager.getUnArchiver( "jar" ); unArchiver.setDestDirectory( outputDir ); unArchiver.setSourceFile( jarFile ); unArchiver.extract(); } catch ( Exception e ) { getLog().error( "Problem unpacking " + jarFile + " to " + outputDir, e ); } } protected static String removeTagFromInstruction( String instruction, String tag ) { StringBuffer buf = new StringBuffer(); String[] clauses = instruction.split( "," ); for ( int i = 0; i < clauses.length; i++ ) { String clause = clauses[i].trim(); if ( !tag.equals( clause ) ) { if ( buf.length() > 0 ) { buf.append( ',' ); } buf.append( clause ); } } return buf.toString(); } private static Map getProperties( Model projectModel, String prefix ) { Map properties = new LinkedHashMap(); Method methods[] = Model.class.getDeclaredMethods(); for ( int i = 0; i < methods.length; i++ ) { String name = methods[i].getName(); if ( name.startsWith( "get" ) ) { try { Object v = methods[i].invoke( projectModel, null ); if ( v != null ) { name = prefix + Character.toLowerCase( name.charAt( 3 ) ) + name.substring( 4 ); if ( v.getClass().isArray() ) properties.put( name, Arrays.asList( ( Object[] ) v ).toString() ); else properties.put( name, v ); } } catch ( Exception e ) { // too bad } } } return properties; } private static StringBuffer printLicenses( List licenses ) { if ( licenses == null || licenses.size() == 0 ) return null; StringBuffer sb = new StringBuffer(); String del = ""; for ( Iterator i = licenses.iterator(); i.hasNext(); ) { License l = ( License ) i.next(); String url = l.getUrl(); if ( url == null ) continue; sb.append( del ); sb.append( url ); del = ", "; } if ( sb.length() == 0 ) return null; return sb; } /** * @param jar * @throws IOException */ 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 ) ); Properties p = new Properties(); p.put( "version", currentProject.getVersion() ); p.put( "groupId", currentProject.getGroupId() ); p.put( "artifactId", currentProject.getArtifactId() ); ByteArrayOutputStream out = new ByteArrayOutputStream(); p.store( out, "Generated by org.apache.felix.bundleplugin" ); jar.putResource( path + "/pom.properties", new EmbeddedResource( out.toByteArray(), System.currentTimeMillis() ) ); } protected Jar[] getClasspath( MavenProject currentProject ) throws IOException, MojoExecutionException { List list = new ArrayList(); if ( getOutputDirectory() != null && getOutputDirectory().exists() ) { list.add( new Jar( ".", getOutputDirectory() ) ); } final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts() ); for ( Iterator it = artifacts.iterator(); it.hasNext(); ) { Artifact artifact = ( Artifact ) it.next(); if ( artifact.getArtifactHandler().isAddedToClasspath() ) { if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) ) { 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 ); } } } Jar[] cp = new Jar[list.size()]; list.toArray( cp ); return cp; } private Collection getSelectedDependencies( Collection artifacts ) throws MojoExecutionException { if ( null == excludeDependencies || excludeDependencies.length() == 0 ) { return artifacts; } else if ( "true".equalsIgnoreCase( excludeDependencies ) ) { return Collections.EMPTY_LIST; } Collection selectedDependencies = new LinkedHashSet( artifacts ); DependencyExcluder excluder = new DependencyExcluder( artifacts ); excluder.processHeaders( excludeDependencies ); selectedDependencies.removeAll( excluder.getExcludedArtifacts() ); return selectedDependencies; } /** * Get the file for an Artifact * * @param artifact */ protected File getFile( Artifact artifact ) { return artifact.getFile(); } private static void header( Properties properties, String key, Object value ) { if ( value == null ) return; if ( value instanceof Collection && ( ( Collection ) value ).isEmpty() ) return; properties.put( key, value.toString().replaceAll( "[\r\n]", "" ) ); } /** * Convert a Maven version into an OSGi compliant version * * @param version Maven version * @return the OSGi version */ protected String convertVersionToOsgi( String version ) { return getMaven2OsgiConverter().getVersion( version ); } /** * TODO this should return getMaven2Osgi().getBundleFileName( project.getArtifact() ) */ protected String getBundleName( MavenProject currentProject ) { String extension; try { extension = currentProject.getArtifact().getArtifactHandler().getExtension(); } catch ( Throwable e ) { extension = currentProject.getArtifact().getType(); } if ( StringUtils.isEmpty( extension ) || "bundle".equals( extension ) || "pom".equals( extension ) ) { extension = "jar"; // just in case maven gets confused } String finalName = currentProject.getBuild().getFinalName(); if ( null != classifier && classifier.trim().length() > 0 ) { return finalName + '-' + classifier + '.' + extension; } return finalName + '.' + extension; } protected String getBuildDirectory() { return buildDirectory; } protected void setBuildDirectory( String _buildirectory ) { buildDirectory = _buildirectory; } protected Properties getDefaultProperties( MavenProject currentProject ) { Properties properties = new Properties(); String bsn; try { bsn = getMaven2OsgiConverter().getBundleSymbolicName( currentProject.getArtifact() ); } catch ( Exception e ) { bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId(); } // Setup defaults properties.put( MAVEN_SYMBOLICNAME, bsn ); properties.put( Analyzer.BUNDLE_SYMBOLICNAME, bsn ); properties.put( Analyzer.IMPORT_PACKAGE, "*" ); properties.put( Analyzer.BUNDLE_VERSION, getMaven2OsgiConverter().getVersion( currentProject.getVersion() ) ); // remove the extraneous Include-Resource and Private-Package entries from generated manifest properties.put( Constants.REMOVEHEADERS, Analyzer.INCLUDE_RESOURCE + ',' + Analyzer.PRIVATE_PACKAGE ); header( properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription() ); StringBuffer licenseText = printLicenses( currentProject.getLicenses() ); if ( licenseText != null ) { header( properties, Analyzer.BUNDLE_LICENSE, licenseText ); } header( properties, Analyzer.BUNDLE_NAME, currentProject.getName() ); if ( currentProject.getOrganization() != null ) { if ( currentProject.getOrganization().getName() != null ) { String organizationName = currentProject.getOrganization().getName(); header( properties, Analyzer.BUNDLE_VENDOR, organizationName ); properties.put( "project.organization.name", organizationName ); properties.put( "pom.organization.name", organizationName ); } if ( currentProject.getOrganization().getUrl() != null ) { String organizationUrl = currentProject.getOrganization().getUrl(); header( properties, Analyzer.BUNDLE_DOCURL, organizationUrl ); properties.put( "project.organization.url", organizationUrl ); properties.put( "pom.organization.url", organizationUrl ); } } properties.putAll( currentProject.getProperties() ); properties.putAll( currentProject.getModel().getProperties() ); if ( m_mavenSession != null ) { properties.putAll( m_mavenSession.getExecutionProperties() ); } properties.putAll( getProperties( currentProject.getModel(), "project.build." ) ); properties.putAll( getProperties( currentProject.getModel(), "pom." ) ); properties.putAll( getProperties( currentProject.getModel(), "project." ) ); properties.put( "project.baseDir", getBase( currentProject ) ); properties.put( "project.build.directory", getBuildDirectory() ); properties.put( "project.build.outputdirectory", getOutputDirectory() ); properties.put( "classifier", classifier == null ? "" : classifier ); // Add default plugins header( properties, Analyzer.PLUGIN, BlueprintPlugin.class.getName() + "," + SpringXMLType.class.getName() ); return properties; } protected static File getBase( MavenProject currentProject ) { return currentProject.getBasedir() != null ? currentProject.getBasedir() : new File( "" ); } protected File getOutputDirectory() { return outputDirectory; } protected void setOutputDirectory( File _outputDirectory ) { outputDirectory = _outputDirectory; } private static void addLocalPackages( File outputDirectory, Analyzer analyzer ) { Collection packages = new LinkedHashSet(); if ( outputDirectory != null && outputDirectory.isDirectory() ) { // scan classes directory for potential packages DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( outputDirectory ); scanner.setIncludes( new String[] { "**/*.class" } ); scanner.addDefaultExcludes(); scanner.scan(); String[] paths = scanner.getIncludedFiles(); for ( int i = 0; i < paths.length; i++ ) { packages.add( getPackageName( paths[i] ) ); } } StringBuffer exportedPkgs = new StringBuffer(); StringBuffer privatePkgs = new StringBuffer(); boolean noprivatePackages = "!*".equals( analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) ); for ( Iterator i = packages.iterator(); i.hasNext(); ) { String pkg = ( String ) i.next(); // mark all source packages as private by default (can be overridden by export list) privatePkgs.append( pkg ).append( ";-split-package:=merge-first," ); // we can't export the default package (".") and we shouldn't export internal packages if ( noprivatePackages || !( ".".equals( pkg ) || pkg.contains( ".internal" ) || pkg.contains( ".impl" ) ) ) { if ( exportedPkgs.length() > 0 ) { exportedPkgs.append( ';' ); } exportedPkgs.append( pkg ); } } if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null ) { if ( analyzer.getProperty( Analyzer.EXPORT_CONTENTS ) == null ) { // no -exportcontents overriding the exports, so use our computed list analyzer.setProperty( Analyzer.EXPORT_PACKAGE, exportedPkgs.toString() ); } else { // leave Export-Package empty (but non-null) as we have -exportcontents analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "" ); } } else { String exported = analyzer.getProperty( Analyzer.EXPORT_PACKAGE ); if ( exported.indexOf( LOCAL_PACKAGES ) >= 0 ) { String newExported = StringUtils.replace( exported, LOCAL_PACKAGES, exportedPkgs.toString() ); analyzer.setProperty( Analyzer.EXPORT_PACKAGE, newExported ); } } if ( analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) == null ) { // if there are really no private packages then use "!*" as this will keep the Bnd Tool happy analyzer.setProperty( Analyzer.PRIVATE_PACKAGE, privatePkgs.length() == 0 ? "!*" : privatePkgs.toString() ); } } private static String getPackageName( String filename ) { int n = filename.lastIndexOf( File.separatorChar ); return n < 0 ? "." : filename.substring( 0, n ).replace( File.separatorChar, '.' ); } private static List getMavenResources( MavenProject currentProject ) { List resources = new ArrayList( currentProject.getResources() ); if ( currentProject.getCompileSourceRoots() != null ) { // also scan for any "packageinfo" files lurking in the source folders List packageInfoIncludes = Collections.singletonList( "**/packageinfo" ); for ( Iterator i = currentProject.getCompileSourceRoots().iterator(); i.hasNext(); ) { String sourceRoot = ( String ) i.next(); Resource packageInfoResource = new Resource(); packageInfoResource.setDirectory( sourceRoot ); packageInfoResource.setIncludes( packageInfoIncludes ); resources.add( packageInfoResource ); } } return resources; } protected static String getMavenResourcePaths( MavenProject currentProject ) { final String basePath = currentProject.getBasedir().getAbsolutePath(); Set pathSet = new LinkedHashSet(); for ( Iterator i = getMavenResources( currentProject ).iterator(); i.hasNext(); ) { Resource resource = ( Resource ) i.next(); final String sourcePath = resource.getDirectory(); final String targetPath = resource.getTargetPath(); // ignore empty or non-local resources if ( new File( sourcePath ).exists() && ( ( targetPath == null ) || ( targetPath.indexOf( ".." ) < 0 ) ) ) { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( sourcePath ); if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() ) { scanner.setIncludes( ( String[] ) resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) ); } else { scanner.setIncludes( DEFAULT_INCLUDES ); } if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() ) { scanner.setExcludes( ( String[] ) resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) ); } scanner.addDefaultExcludes(); scanner.scan(); List includedFiles = Arrays.asList( scanner.getIncludedFiles() ); for ( Iterator j = includedFiles.iterator(); j.hasNext(); ) { String name = ( String ) j.next(); String path = sourcePath + '/' + name; // make relative to project if ( path.startsWith( basePath ) ) { if ( path.length() == basePath.length() ) { path = "."; } else { path = path.substring( basePath.length() + 1 ); } } // replace windows backslash with a slash // this is a workaround for a problem with bnd 0.0.189 if ( File.separatorChar != '/' ) { name = name.replace( File.separatorChar, '/' ); path = path.replace( File.separatorChar, '/' ); } // copy to correct place path = name + '=' + path; if ( targetPath != null ) { path = targetPath + '/' + path; } // use Bnd filtering? if ( resource.isFiltering() ) { path = '{' + path + '}'; } pathSet.add( path ); } } } StringBuffer resourcePaths = new StringBuffer(); for ( Iterator i = pathSet.iterator(); i.hasNext(); ) { resourcePaths.append( i.next() ); if ( i.hasNext() ) { resourcePaths.append( ',' ); } } return resourcePaths.toString(); } protected Collection getEmbeddableArtifacts( MavenProject currentProject, Analyzer analyzer ) throws MojoExecutionException { final Collection artifacts; String embedTransitive = analyzer.getProperty( DependencyEmbedder.EMBED_TRANSITIVE ); if ( Boolean.valueOf( embedTransitive ).booleanValue() ) { // includes transitive dependencies artifacts = currentProject.getArtifacts(); } else { // only includes direct dependencies artifacts = currentProject.getDependencyArtifacts(); } return getSelectedDependencies( artifacts ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java000066400000000000000000000242061164564726100322260ustar00rootroot00000000000000/* * 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.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.codehaus.plexus.util.StringUtils; import aQute.lib.osgi.Analyzer; import aQute.libg.header.OSGiHeader; /** * Add BND directives to embed selected dependencies inside a bundle * * @author Felix Project Team */ public final class DependencyEmbedder extends AbstractDependencyFilter { public static final String EMBED_DEPENDENCY = "Embed-Dependency"; public static final String EMBED_DIRECTORY = "Embed-Directory"; public static final String EMBED_STRIP_GROUP = "Embed-StripGroup"; public static final String EMBED_STRIP_VERSION = "Embed-StripVersion"; public static final String EMBED_TRANSITIVE = "Embed-Transitive"; private static final String MAVEN_DEPENDENCIES = "{maven-dependencies}"; private String m_embedDirectory; private String m_embedStripGroup; private String m_embedStripVersion; /** * Maven logger. */ private final Log m_log; /** * Inlined paths. */ private final Collection m_inlinedPaths; /** * Embedded artifacts. */ private final Collection m_embeddedArtifacts; public DependencyEmbedder( Log log, Collection dependencyArtifacts ) { super( dependencyArtifacts ); m_log = log; m_inlinedPaths = new LinkedHashSet(); m_embeddedArtifacts = new LinkedHashSet(); } public void processHeaders( Analyzer analyzer ) throws MojoExecutionException { StringBuffer includeResource = new StringBuffer(); StringBuffer bundleClassPath = new StringBuffer(); m_inlinedPaths.clear(); m_embeddedArtifacts.clear(); String embedDependencyHeader = analyzer.getProperty( EMBED_DEPENDENCY ); if ( null != embedDependencyHeader && embedDependencyHeader.length() > 0 ) { m_embedDirectory = analyzer.getProperty( EMBED_DIRECTORY ); m_embedStripGroup = analyzer.getProperty( EMBED_STRIP_GROUP, "true" ); m_embedStripVersion = analyzer.getProperty( EMBED_STRIP_VERSION ); Map embedInstructions = OSGiHeader.parseHeader( embedDependencyHeader ); processInstructions( embedInstructions ); for ( Iterator i = m_inlinedPaths.iterator(); i.hasNext(); ) { inlineDependency( ( String ) i.next(), includeResource ); } for ( Iterator i = m_embeddedArtifacts.iterator(); i.hasNext(); ) { embedDependency( ( Artifact ) i.next(), includeResource, bundleClassPath ); } } if ( analyzer.getProperty( Analyzer.WAB ) == null && bundleClassPath.length() > 0 ) { // set explicit default before merging dependency classpath if ( analyzer.getProperty( Analyzer.BUNDLE_CLASSPATH ) == null ) { analyzer.setProperty( Analyzer.BUNDLE_CLASSPATH, "." ); } } appendDependencies( analyzer, Analyzer.INCLUDE_RESOURCE, includeResource.toString() ); appendDependencies( analyzer, Analyzer.BUNDLE_CLASSPATH, bundleClassPath.toString() ); } @Override protected void processDependencies( String tag, String inline, Collection dependencies ) { if ( dependencies.isEmpty() ) { m_log.warn( EMBED_DEPENDENCY + ": clause \"" + tag + "\" did not match any dependencies" ); } if ( null == inline || "false".equalsIgnoreCase( inline ) ) { m_embeddedArtifacts.addAll( dependencies ); } else { for ( Iterator i = dependencies.iterator(); i.hasNext(); ) { addInlinedPaths( ( Artifact ) i.next(), inline, m_inlinedPaths ); } } } private static void addInlinedPaths( Artifact dependency, String inline, Collection inlinedPaths ) { File path = dependency.getFile(); if ( null != path && path.exists() ) { if ( "true".equalsIgnoreCase( inline ) || inline.length() == 0 ) { inlinedPaths.add( path.getPath() ); } else { String[] filters = inline.split( "\\|" ); for ( int i = 0; i < filters.length; i++ ) { if ( filters[i].length() > 0 ) { inlinedPaths.add( path + "!/" + filters[i] ); } } } } } private void embedDependency( Artifact dependency, StringBuffer includeResource, StringBuffer bundleClassPath ) { File sourceFile = dependency.getFile(); if ( null != sourceFile && sourceFile.exists() ) { String embedDirectory = m_embedDirectory; if ( "".equals( embedDirectory ) || ".".equals( embedDirectory ) ) { embedDirectory = null; } if ( false == Boolean.valueOf( m_embedStripGroup ).booleanValue() ) { embedDirectory = new File( embedDirectory, dependency.getGroupId() ).getPath(); } File targetFile; if ( Boolean.valueOf( m_embedStripVersion ).booleanValue() ) { String extension = dependency.getArtifactHandler().getExtension(); if ( extension != null ) { targetFile = new File( embedDirectory, dependency.getArtifactId() + "." + extension ); } else { targetFile = new File( embedDirectory, dependency.getArtifactId() ); } } else { targetFile = new File( embedDirectory, sourceFile.getName() ); } String targetFilePath = targetFile.getPath(); // replace windows backslash with a slash if ( File.separatorChar != '/' ) { targetFilePath = targetFilePath.replace( File.separatorChar, '/' ); } if ( includeResource.length() > 0 ) { includeResource.append( ',' ); } includeResource.append( targetFilePath ); includeResource.append( '=' ); includeResource.append( sourceFile ); if ( bundleClassPath.length() > 0 ) { bundleClassPath.append( ',' ); } bundleClassPath.append( targetFilePath ); } } private static void inlineDependency( String path, StringBuffer includeResource ) { if ( includeResource.length() > 0 ) { includeResource.append( ',' ); } includeResource.append( '@' ); includeResource.append( path ); } public Collection getInlinedPaths() { return m_inlinedPaths; } public Collection getEmbeddedArtifacts() { return m_embeddedArtifacts; } private static void appendDependencies( Analyzer analyzer, String directiveName, String mavenDependencies ) { /* * similar algorithm to {maven-resources} but default behaviour here is to append rather than override */ final String instruction = analyzer.getProperty( directiveName ); if ( instruction != null && instruction.length() > 0 ) { if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 ) { // if there are no embeddded dependencies, we do a special treatment and replace // every occurance of MAVEN_DEPENDENCIES and a following comma with an empty string if ( mavenDependencies.length() == 0 ) { String cleanInstruction = BundlePlugin.removeTagFromInstruction( instruction, MAVEN_DEPENDENCIES ); analyzer.setProperty( directiveName, cleanInstruction ); } else { String mergedInstruction = StringUtils.replace( instruction, MAVEN_DEPENDENCIES, mavenDependencies ); analyzer.setProperty( directiveName, mergedInstruction ); } } else if ( mavenDependencies.length() > 0 ) { if ( Analyzer.INCLUDE_RESOURCE.equalsIgnoreCase( directiveName ) ) { // dependencies should be prepended so they can be overwritten by local resources analyzer.setProperty( directiveName, mavenDependencies + ',' + instruction ); } else // Analyzer.BUNDLE_CLASSPATH { // for the classpath we want dependencies to be appended after local entries analyzer.setProperty( directiveName, instruction + ',' + mavenDependencies ); } } // otherwise leave instruction unchanged } else if ( mavenDependencies.length() > 0 ) { analyzer.setProperty( directiveName, mavenDependencies ); } // otherwise leave instruction unchanged } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java000066400000000000000000000040311164564726100322640ustar00rootroot00000000000000/* * 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.util.Collection; import java.util.HashSet; import org.apache.maven.plugin.MojoExecutionException; import aQute.libg.header.OSGiHeader; /** * Exclude selected dependencies from the classpath passed to BND. * * @author Felix Project Team */ public final class DependencyExcluder extends AbstractDependencyFilter { /** * Excluded artifacts. */ private final Collection m_excludedArtifacts; public DependencyExcluder( Collection dependencyArtifacts ) { super( dependencyArtifacts ); m_excludedArtifacts = new HashSet(); } public void processHeaders( String excludeDependencies ) throws MojoExecutionException { m_excludedArtifacts.clear(); if ( null != excludeDependencies && excludeDependencies.length() > 0 ) { processInstructions( OSGiHeader.parseHeader( excludeDependencies ) ); } } @Override protected void processDependencies( String tag, String inline, Collection dependencies ) { m_excludedArtifacts.addAll( dependencies ); } public Collection getExcludedArtifacts() { return m_excludedArtifacts; } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/InstructionsPlugin.java000066400000000000000000000047071164564726100324070ustar00rootroot00000000000000/* * 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.FileNotFoundException; import java.io.IOException; import java.util.Map; import java.util.Properties; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import aQute.lib.osgi.Jar; /** * Generate BND instructions for this project * * @goal instructions * @requiresDependencyResolution test * @threadSafe */ public class InstructionsPlugin extends BundlePlugin { protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { if ( dumpInstructions == null ) { dumpInstructions = new File( getBuildDirectory(), "instructions.bnd" ); } try { addMavenInstructions( project, getOSGiBuilder( project, instructions, properties, classpath ) ); } catch ( FileNotFoundException e ) { throw new MojoExecutionException( "Cannot find " + e.getMessage(), e ); } catch ( IOException e ) { throw new MojoExecutionException( "Error trying to generate instructions", e ); } catch ( MojoFailureException e ) { getLog().error( e.getLocalizedMessage() ); throw new MojoExecutionException( "Error(s) found in instructions", e ); } catch ( Exception e ) { getLog().error( "An internal error occurred", e ); throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java000066400000000000000000000072661164564726100331520ustar00rootroot00000000000000/* * 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 org.apache.maven.archiver.MavenArchiveConfiguration; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter; import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup; import org.codehaus.plexus.component.configurator.converters.lookup.DefaultConverterLookup; import org.codehaus.plexus.component.configurator.expression.DefaultExpressionEvaluator; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.util.xml.Xpp3Dom; /** * Provide access to the archive configuration from the jar plugin * * @author Felix Project Team */ public final class JarPluginConfiguration { public static MavenArchiveConfiguration getArchiveConfiguration( MavenProject project ) { MavenArchiveConfiguration archiveConfig = new MavenArchiveConfiguration(); try { ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter(); ClassLoader loader = JarPluginConfiguration.class.getClassLoader(); ExpressionEvaluator evaluator = new DefaultExpressionEvaluator(); ConverterLookup converters = new DefaultConverterLookup(); PlexusConfiguration settings = null; try { // first look for bundle specific archive settings settings = getPluginConfiguration( project, "org.apache.felix", "maven-bundle-plugin" ); settings = settings.getChild( "archive" ); } catch ( Exception e ) { } // if it's empty fall back to the jar archive settings if ( null == settings || settings.getChildCount() == 0 ) { settings = getCorePluginConfiguration( project, "jar" ); settings = settings.getChild( "archive" ); } converter.processConfiguration( converters, archiveConfig, loader, settings, evaluator, null ); } catch ( Exception e ) { // ignore and return empty configuration... } return archiveConfig; } private static PlexusConfiguration getCorePluginConfiguration( MavenProject project, String pluginName ) { return getPluginConfiguration( project, "org.apache.maven.plugins", "maven-" + pluginName + "-plugin" ); } private static PlexusConfiguration getPluginConfiguration( MavenProject project, String groupId, String artifactId ) { Xpp3Dom pluginConfig = project.getGoalConfiguration( groupId, artifactId, null, null ); return new XmlPlexusConfiguration( pluginConfig ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java000066400000000000000000000142661164564726100314520ustar00rootroot00000000000000/* * 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.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; import java.util.jar.Manifest; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import aQute.lib.osgi.Analyzer; import aQute.lib.osgi.Builder; import aQute.lib.osgi.Jar; /** * Generate an OSGi manifest for this project * * @goal manifest * @phase process-classes * @requiresDependencyResolution test * @threadSafe */ public class ManifestPlugin extends BundlePlugin { protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) throws MojoExecutionException { Manifest manifest; try { if ( supportedProjectTypes.contains( getProject().getArtifact().getType() ) ) { Builder builder = buildOSGiBundle( project, instructions, properties, classpath ); manifest = builder.getJar().getManifest(); builder.close(); } else { manifest = getManifest( project, instructions, properties, classpath ); } } catch ( FileNotFoundException e ) { throw new MojoExecutionException( "Cannot find " + e.getMessage() + " (manifest goal must be run after compile phase)", e ); } catch ( IOException e ) { throw new MojoExecutionException( "Error trying to generate Manifest", e ); } catch ( MojoFailureException e ) { getLog().error( e.getLocalizedMessage() ); throw new MojoExecutionException( "Error(s) found in manifest configuration", e ); } catch ( Exception e ) { getLog().error( "An internal error occurred", e ); throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e ); } File outputFile = new File( manifestLocation, "MANIFEST.MF" ); try { writeManifest( manifest, outputFile ); } catch ( IOException e ) { throw new MojoExecutionException( "Error trying to write Manifest to file " + outputFile, e ); } } public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException, MojoFailureException, MojoExecutionException, Exception { return getManifest( project, new LinkedHashMap(), new Properties(), classpath ); } public Manifest getManifest( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) 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" ); } } Manifest manifest = analyzer.getJar().getManifest(); // cleanup... analyzer.close(); return manifest; } protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath ) throws IOException, MojoExecutionException, Exception { return getAnalyzer( project, new LinkedHashMap(), new Properties(), classpath ); } protected Analyzer getAnalyzer( MavenProject project, Map instructions, Properties properties, Jar[] classpath ) throws IOException, MojoExecutionException, Exception { File file = project.getArtifact().getFile(); if ( file == null ) { file = getOutputDirectory(); } if ( !file.exists() ) { throw new FileNotFoundException( file.getPath() ); } Builder analyzer = getOSGiBuilder( project, instructions, properties, classpath ); analyzer.setJar( file ); if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null && analyzer.getProperty( Analyzer.EXPORT_CONTENTS ) == null && analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) == null ) { String export = analyzer.calculateExportsFromContents( analyzer.getJar() ); analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export ); } addMavenInstructions( project, analyzer ); analyzer.mergeManifest( analyzer.getJar().getManifest() ); analyzer.calcManifest(); mergeMavenManifest( project, analyzer ); return analyzer; } public static void writeManifest( Manifest manifest, File outputFile ) throws IOException { outputFile.getParentFile().mkdirs(); FileOutputStream os; os = new FileOutputStream( outputFile ); try { manifest.write( os ); } finally { try { os.close(); } catch ( IOException e ) { // nothing we can do here } } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/PackageVersionAnalyzer.java000066400000000000000000000045131164564726100331260ustar00rootroot00000000000000/* * 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.lib.osgi.Builder; /** * Extension of {@link aQute.lib.osgi.Builder} to handle package versions * * @author Felix Project Team */ public final class PackageVersionAnalyzer extends Builder { /* * Remove META-INF subfolders from exports and set package versions to bundle version. */ /* public Map analyzeBundleClasspath( Jar dot, Map bundleClasspath, Map contained, Map referred, Map uses ) throws IOException { Map classSpace = super.analyzeBundleClasspath( dot, bundleClasspath, contained, referred, uses ); String bundleVersion = getProperty( BUNDLE_VERSION ); for ( Iterator it = contained.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = ( Map.Entry ) it.next(); // remove packages under META-INF String packageName = ( String ) entry.getKey(); if ( packageName.startsWith( "META-INF." ) ) { it.remove(); } // set package versions to bundle version values if ( bundleVersion != null ) { Map values = ( Map ) entry.getValue(); if ( values.get( "version" ) == null ) { values.put( "version", bundleVersion ); } } } return classSpace; } */ } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/VersionCleanerPlugin.java000066400000000000000000000045321164564726100326160ustar00rootroot00000000000000/* * 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.util.LinkedHashMap; import java.util.Map; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter; import org.apache.maven.shared.osgi.Maven2OsgiConverter; /** * @goal cleanVersions * @description clean OSGi versions * @threadSafe */ public class VersionCleanerPlugin extends AbstractMojo { /** * The BND instructions for the bundle. * * @parameter */ private Map versions = new LinkedHashMap(); /** * The Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; private Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter(); public Maven2OsgiConverter getMaven2OsgiConverter() { return maven2OsgiConverter; } public void setMaven2OsgiConverter( Maven2OsgiConverter maven2OsgiConverter ) { this.maven2OsgiConverter = maven2OsgiConverter; } public void execute() throws MojoExecutionException, MojoFailureException { for ( Object key : versions.keySet() ) { String name = ( String ) key; String version = ( String ) versions.get( key ); String osgi = maven2OsgiConverter.getVersion( version ); project.getProperties().put( name, osgi ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/bundleplugin/WrapPlugin.java000066400000000000000000000032561164564726100306120ustar00rootroot00000000000000/* * 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 org.apache.maven.plugin.MojoExecutionException; /** * @goal wrap * @phase package * @requiresDependencyResolution test * @description build an OSGi bundle jar for direct dependencies * @deprecated The wrap goal is no longer supported and may be removed in a future release */ @Deprecated public final class WrapPlugin extends BundleAllPlugin { public void execute() throws MojoExecutionException { getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ); getLog().warn( "! The wrap goal is no longer supported and may be removed in a future release !" ); getLog().warn( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ); BundleInfo bundleInfo = bundleAll( getProject(), 1 ); logDuplicatedPackages( bundleInfo ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/000077500000000000000000000000001164564726100251625ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/AbstractFileMojo.java000066400000000000000000000074011164564726100312170ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; /** * Base class for the command-line install-file and deploy-file goals. * * @author Felix Project Team */ public abstract class AbstractFileMojo extends AbstractMojo { /** * GroupId of the bundle. Retrieved from POM file if specified. * * @parameter expression="${groupId}" */ private String groupId; /** * ArtifactId of the bundle. Retrieved from POM file if specified. * * @parameter expression="${artifactId}" */ private String artifactId; /** * Version of the bundle. Retrieved from POM file if specified. * * @parameter expression="${version}" */ private String version; /** * Packaging type of the bundle. Retrieved from POM file if specified. * * @parameter expression="${packaging}" */ private String packaging; /** * Classifier type of the bundle. Defaults to none. * * @parameter expression="${classifier}" */ private String classifier; /** * Location of an existing POM file. * * @parameter expression="${pomFile}" */ private File pomFile; /** * Bundle file, defaults to the artifact in the local Maven repository. * * @parameter expression="${file}" */ protected File file; /** * Optional XML file describing additional requirements and capabilities. * * @parameter expression="${obrXml}" */ protected String obrXml; /** * Component factory for Maven artifacts * * @component */ private ArtifactFactory m_factory; /** * @return project based on command-line settings, with bundle attached * @throws MojoExecutionException */ public MavenProject getProject() throws MojoExecutionException { final MavenProject project; if ( pomFile != null && pomFile.exists() ) { project = PomHelper.readPom( pomFile ); groupId = project.getGroupId(); artifactId = project.getArtifactId(); version = project.getVersion(); packaging = project.getPackaging(); } else { project = PomHelper.buildPom( groupId, artifactId, version, packaging ); } if ( groupId == null || artifactId == null || version == null || packaging == null ) { throw new MojoExecutionException( "Missing group, artifact, version, or packaging information" ); } Artifact bundle = m_factory.createArtifactWithClassifier( groupId, artifactId, version, packaging, classifier ); project.setArtifact( bundle ); return project; } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/Config.java000066400000000000000000000046521164564726100272410ustar00rootroot00000000000000/* * 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.obrplugin; import java.net.URI; /** * this class is used to store some user information about configuration of the plugin. * @author Felix Project Team * */ public class Config { private boolean m_pathRelative; // use relative or absolute path in repository.xml private boolean m_remoteFile; // deploy file on remote server private URI m_remoteBundle; // public address of deployed bundle /** * constructor: set default configuration: use relative path and don't upload file. */ public Config() { // default configuration m_pathRelative = true; m_remoteFile = false; m_remoteBundle = null; } /** * @param value enable to use relative path */ public void setPathRelative( boolean value ) { m_pathRelative = value; } /** * @param value enable when uploading */ public void setRemoteFile( boolean value ) { m_remoteFile = value; } /** * @param value public address of deployed bundle */ public void setRemoteBundle( URI value ) { m_remoteBundle = value; } /** * @return true if plugin uses relative path, else false */ public boolean isPathRelative() { return m_pathRelative; } /** * @return true if the file will be uploaded, else false */ public boolean isRemoteFile() { return m_remoteFile; } /** * @return public address of deployed bundle */ public URI getRemoteBundle() { return m_remoteBundle; } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java000066400000000000000000000247551164564726100303550ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URI; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.plexus.util.FileUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; /** * Clean an OBR repository by finding and removing missing resources. * * @requiresProject false * @goal clean * @phase clean * * @author Felix Project Team */ public class ObrCleanRepo extends AbstractMojo { /** * OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Local Repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; public void execute() { if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) ) { getLog().info( "Local OBR clean disabled (enable with -DobrRepository)" ); return; } try { // Compute local repository location URI repositoryXml = ObrUtils.findRepositoryXml( localRepository.getBasedir(), obrRepository ); if ( !"file".equals( repositoryXml.getScheme() ) ) { getLog().error( "The repository URI " + repositoryXml + " is not a local file" ); return; } File repositoryFile = new File( repositoryXml ); // Check if the file exist if ( !repositoryFile.exists() ) { getLog().error( "The repository file " + repositoryFile + " does not exist" ); return; } getLog().info( "Cleaning..." ); Document doc = parseFile( repositoryFile, initConstructor() ); Node finalDocument = cleanDocument( doc.getDocumentElement() ); // Analyze existing repository. if ( finalDocument == null ) { getLog().info( "Nothing to clean in " + repositoryFile ); } else { writeToFile( repositoryXml, finalDocument ); // Write the new file getLog().info( "Repository " + repositoryFile + " cleaned" ); } } catch ( Exception e ) { getLog().error( "Exception while cleaning local OBR: " + e.getLocalizedMessage(), e ); } } /** * 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 */ private Element cleanDocument( Element elem ) { String localRepoPath = localRepository.getBasedir(); URI baseURI = new File( localRepoPath + '/' ).toURI(); NodeList nodes = elem.getElementsByTagName( "resource" ); List toRemove = new ArrayList(); // First, look for missing resources for ( int i = 0; i < nodes.getLength(); i++ ) { Element n = ( Element ) nodes.item( i ); String value = n.getAttribute( "uri" ); URI resource; try { resource = baseURI.resolve( value ); } catch ( IllegalArgumentException e ) { getLog().error( "Malformed URL when creating the resource absolute URI : " + e.getMessage() ); return null; } if ( "file".equals( resource.getScheme() ) && !new File( resource ).exists() ) { getLog().info( "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" ) + " will be removed" ); toRemove.add( n ); } } Date d = new Date(); if ( toRemove.size() > 0 ) { // Then remove missing resources. for ( int i = 0; i < toRemove.size(); i++ ) { elem.removeChild( ( Node ) toRemove.get( i ) ); } // If we have to remove resources, we need to update 'lastmodified' attribute SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" ); d.setTime( System.currentTimeMillis() ); elem.setAttribute( "lastmodified", format.format( d ) ); return elem; } return null; } /** * Initialize the document builder from Xerces. * * @return DocumentBuilder ready to create new document * @throws MojoExecutionException : occurs when the instantiation of the document builder fails */ private DocumentBuilder initConstructor() throws MojoExecutionException { DocumentBuilder constructor = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { constructor = factory.newDocumentBuilder(); } catch ( ParserConfigurationException e ) { getLog().error( "Unable to create a new xml document" ); throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() ); } return constructor; } /** * Open an XML file. * * @param file : XML file path * @param constructor DocumentBuilder get from xerces * @return Document which describes this file * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file. */ private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException { if ( constructor == null ) { return null; } // The document is the root of the DOM tree. File targetFile = file.getAbsoluteFile(); getLog().info( "Parsing " + targetFile ); Document doc = null; try { doc = constructor.parse( targetFile ); } catch ( SAXException e ) { getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() ); throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() ); } catch ( IOException e ) { getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() ); throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() ); } return doc; } /** * 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 */ private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException { // init the transformer Transformer transformer = null; TransformerFactory tfabrique = TransformerFactory.newInstance(); try { transformer = tfabrique.newTransformer(); } catch ( TransformerConfigurationException e ) { getLog().error( "Unable to write to file: " + outputFilename.toString() ); throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : " + e.getMessage() ); } Properties proprietes = new Properties(); proprietes.put( "method", "xml" ); proprietes.put( "version", "1.0" ); proprietes.put( "encoding", "ISO-8859-1" ); proprietes.put( "standalone", "yes" ); proprietes.put( "indent", "yes" ); proprietes.put( "omit-xml-declaration", "no" ); transformer.setOutputProperties( proprietes ); DOMSource input = new DOMSource( treeToBeWrite ); File fichier = null; FileOutputStream flux = null; try { fichier = File.createTempFile( "repository", ".xml" ); flux = new FileOutputStream( fichier ); } catch ( IOException e ) { getLog().error( "Unable to write to file: " + fichier.getName() ); throw new MojoExecutionException( "Unable to write to file: " + fichier.getName() + " : " + e.getMessage() ); } Result output = new StreamResult( flux ); try { transformer.transform( input, output ); } catch ( TransformerException e ) { throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : " + e.getMessage() ); } try { flux.flush(); flux.close(); FileUtils.rename( fichier, new File( outputFilename ) ); } catch ( IOException e ) { throw new MojoExecutionException( "IOException when closing file : " + e.getMessage() ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java000066400000000000000000000257521164564726100277370ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.net.URI; import java.net.URL; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Settings; /** * Deploys bundle details to a remote OBR repository (life-cycle goal) * * @goal deploy * @phase deploy * @threadSafe * * @author Felix Project Team */ public final class ObrDeploy extends AbstractMojo { /** * When true, ignore remote locking. * * @parameter expression="${ignoreLock}" */ private boolean ignoreLock; /** * Optional public URL prefix for the remote repository. * * @parameter expression="${prefixUrl}" */ private String prefixUrl; /** * Optional public URL where the bundle has been deployed. * * @parameter expression="${bundleUrl}" */ private String bundleUrl; /** * Remote OBR Repository. * * @parameter expression="${remoteOBR}" default-value="NONE" */ private String remoteOBR; /** * Local OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Project types which this plugin supports. * * @parameter */ private List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); /** * @parameter expression="${project.distributionManagementArtifactRepository}" * @readonly */ private ArtifactRepository deploymentRepository; /** * Alternative deployment repository. Format: id::layout::url * * @parameter expression="${altDeploymentRepository}" */ private String altDeploymentRepository; /** * OBR specific deployment repository. Format: id::layout::url * * @parameter expression="${obrDeploymentRepository}" */ private String obrDeploymentRepository; /** * Local Repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; /** * The Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * @parameter expression="${project.attachedArtifacts} * @required * @readonly */ private List attachedArtifacts; /** * Local Maven settings. * * @parameter expression="${settings}" * @required * @readonly */ private Settings settings; /** * The Wagon manager. * * @component */ private WagonManager m_wagonManager; /** * Attached source artifact */ private Artifact m_sourceArtifact; /** * Attached doc artifact */ private Artifact m_docArtifact; public void execute() throws MojoExecutionException { String projectType = project.getPackaging(); // ignore unsupported project types, useful when bundleplugin is configured in parent pom if ( !supportedProjectTypes.contains( projectType ) ) { getLog().warn( "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes ); return; } else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) ) { getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" ); return; } // check for any attached sources or docs for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); ) { Artifact artifact = ( Artifact ) i.next(); if ( "sources".equals( artifact.getClassifier() ) ) { m_sourceArtifact = artifact; } else if ( "javadoc".equals( artifact.getClassifier() ) ) { m_docArtifact = artifact; } } // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) ) { remoteOBR = obrRepository; } URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR ); String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName(); Log log = getLog(); ObrUpdate update; RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log ); openRepositoryConnection( remoteFile ); // ======== LOCK REMOTE OBR ======== log.info( "LOCK " + remoteFile + '/' + repositoryName ); remoteFile.lockFile( repositoryName, ignoreLock ); File downloadedRepositoryXml = null; try { // ======== DOWNLOAD REMOTE OBR ======== log.info( "Downloading " + repositoryName ); downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" ); String mavenRepository = localRepository.getBasedir(); URI repositoryXml = downloadedRepositoryXml.toURI(); URI obrXmlFile = ObrUtils.findObrXml( project ); Config userConfig = new Config(); userConfig.setRemoteFile( true ); if ( bundleUrl != null ) { // public URL differs from the bundle file location URI uri = URI.create( bundleUrl ); log.info( "Computed bundle uri: " + uri ); userConfig.setRemoteBundle( uri ); } else if ( prefixUrl != null ) { // support absolute bundle URLs based on given prefix URI bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() ); String relative = ObrUtils.getRelativeURI( ObrUtils.toFileURI( mavenRepository ), bundleJar ) .toASCIIString(); URL resourceURL = new URL( new URL( prefixUrl + '/' ), relative ); URI uri = URI.create( resourceURL.toString() ); log.info( "Computed bundle uri: " + uri ); userConfig.setRemoteBundle( uri ); } update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log ); update.parseRepositoryXml(); updateRemoteBundleMetadata( project.getArtifact(), update ); for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); ) { updateRemoteBundleMetadata( ( Artifact ) i.next(), update ); } update.writeRepositoryXml(); if ( downloadedRepositoryXml.exists() ) { // ======== UPLOAD MODIFIED OBR ======== log.info( "Uploading " + repositoryName ); remoteFile.put( downloadedRepositoryXml, repositoryName ); } } catch ( Exception e ) { log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e ); } finally { // ======== UNLOCK REMOTE OBR ======== log.info( "UNLOCK " + remoteFile + '/' + repositoryName ); remoteFile.unlockFile( repositoryName ); remoteFile.disconnect(); if ( null != downloadedRepositoryXml ) { downloadedRepositoryXml.delete(); } } } private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" ); private void openRepositoryConnection( RemoteFileManager remoteFile ) throws MojoExecutionException { // use OBR specific deployment location? if ( obrDeploymentRepository != null ) { altDeploymentRepository = obrDeploymentRepository; } if ( deploymentRepository == null && altDeploymentRepository == null ) { String msg = "Deployment failed: repository element was not specified in the pom inside" + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter"; throw new MojoExecutionException( msg ); } if ( altDeploymentRepository != null ) { getLog().info( "Using alternate deployment repository " + altDeploymentRepository ); Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( altDeploymentRepository ); if ( !matcher.matches() ) { throw new MojoExecutionException( "Invalid syntax for alternative repository \"" + altDeploymentRepository + "\". Use \"id::layout::url\"." ); } remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() ); } else { remoteFile.connect( deploymentRepository.getId(), deploymentRepository.getUrl() ); } } private void updateRemoteBundleMetadata( Artifact artifact, ObrUpdate update ) throws MojoExecutionException { if ( !supportedProjectTypes.contains( artifact.getType() ) ) { return; } else if ( null == artifact.getFile() || artifact.getFile().isDirectory() ) { getLog().error( "No artifact found, try \"mvn install bundle:deploy\"" ); return; } URI bundleJar = ObrUtils.getArtifactURI( localRepository, artifact ); URI sourceJar = null; if ( null != m_sourceArtifact ) { sourceJar = ObrUtils.getArtifactURI( localRepository, m_sourceArtifact ); } URI docJar = null; if ( null != m_docArtifact ) { docJar = ObrUtils.getArtifactURI( localRepository, m_docArtifact ); } update.updateRepository( bundleJar, sourceJar, docJar ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrDeployFile.java000066400000000000000000000160671164564726100305360ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.net.URI; import java.util.Arrays; import java.util.List; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Settings; /** * Deploys bundle details to a remote OBR repository (command-line goal) * * @requiresProject false * @goal deploy-file * @phase deploy * * @author Felix Project Team */ public final class ObrDeployFile extends AbstractFileMojo { /** * When true, ignore remote locking. * * @parameter expression="${ignoreLock}" */ private boolean ignoreLock; /** * Remote OBR Repository. * * @parameter expression="${remoteOBR}" */ private String remoteOBR; /** * Local OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Project types which this plugin supports. * * @parameter */ private List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); /** * Remote repository id, used to lookup authentication settings. * * @parameter expression="${repositoryId}" default-value="remote-repository" * @required */ private String repositoryId; /** * Remote OBR repository URL, where the bundle details are to be uploaded. * * @parameter expression="${url}" * @required */ private String url; /** * Optional public URL where the bundle has been deployed. * * @parameter expression="${bundleUrl}" */ private String bundleUrl; /** * Local Repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; /** * Local Maven settings. * * @parameter expression="${settings}" * @required * @readonly */ private Settings settings; /** * The Wagon manager. * * @component */ private WagonManager m_wagonManager; public void execute() throws MojoExecutionException { MavenProject project = getProject(); String projectType = project.getPackaging(); // ignore unsupported project types, useful when bundleplugin is configured in parent pom if ( !supportedProjectTypes.contains( projectType ) ) { getLog().warn( "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes ); return; } else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) ) { getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" ); return; } // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) ) { remoteOBR = obrRepository; } URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR ); String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName(); Log log = getLog(); ObrUpdate update; RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log ); remoteFile.connect( repositoryId, url ); // ======== LOCK REMOTE OBR ======== log.info( "LOCK " + remoteFile + '/' + repositoryName ); remoteFile.lockFile( repositoryName, ignoreLock ); File downloadedRepositoryXml = null; try { // ======== DOWNLOAD REMOTE OBR ======== log.info( "Downloading " + repositoryName ); downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" ); String mavenRepository = localRepository.getBasedir(); URI repositoryXml = downloadedRepositoryXml.toURI(); URI obrXmlFile = ObrUtils.toFileURI( obrXml ); URI bundleJar; if ( null == file ) { bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() ); } else { bundleJar = file.toURI(); } Config userConfig = new Config(); userConfig.setRemoteFile( true ); if ( null != bundleUrl ) { // public URL differs from the bundle file location URI uri = URI.create( bundleUrl ); log.info( "Computed bundle uri: " + uri ); userConfig.setRemoteBundle( uri ); } else if ( null != file ) { // assume file will be deployed in remote repository, so find the remote relative location URI uri = URI.create( localRepository.pathOf( project.getArtifact() ) ); log.info( "Computed bundle uri: " + uri ); userConfig.setRemoteBundle( uri ); } update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log ); update.parseRepositoryXml(); update.updateRepository( bundleJar, null, null ); update.writeRepositoryXml(); if ( downloadedRepositoryXml.exists() ) { // ======== UPLOAD MODIFIED OBR ======== log.info( "Uploading " + repositoryName ); remoteFile.put( downloadedRepositoryXml, repositoryName ); } } catch ( Exception e ) { log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e ); } finally { // ======== UNLOCK REMOTE OBR ======== log.info( "UNLOCK " + remoteFile + '/' + repositoryName ); remoteFile.unlockFile( repositoryName ); remoteFile.disconnect(); if ( null != downloadedRepositoryXml ) { downloadedRepositoryXml.delete(); } } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrIndex.java000066400000000000000000000205671164564726100275510ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.io.FileFilter; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import org.apache.felix.bundlerepository.Property; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.bundlerepository.impl.DataModelHelperImpl; import org.apache.felix.bundlerepository.impl.RepositoryImpl; import org.apache.felix.bundlerepository.impl.ResourceImpl; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; /** * Index the content of a maven repository using OBR * * @goal index * @requiresProject false * * @author Felix Project Team */ public final class ObrIndex extends AbstractMojo { /** * OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Template for urls * * @parameter expression="${urlTemplate}" */ private String urlTemplate; /** * The repository to index * * @parameter expression="${mavenRepository} */ private String mavenRepository; /** * Local Repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; public void execute() throws MojoExecutionException { Log log = getLog(); try { log.info( "Indexing..." ); String repo = mavenRepository; if ( repo == null ) { repo = localRepository.getBasedir(); } URI mavenRepoUri = new File( repo ).toURI(); URI repositoryXml = ObrUtils.findRepositoryXml( repo, obrRepository ); log.info( "Repository: " + mavenRepoUri ); log.info( "OBR xml: " + repositoryXml ); log.info( "URL template: " + urlTemplate ); List files = new ArrayList(); findAllJars( new File( repo ), files ); DataModelHelperImpl dmh = new DataModelHelperImpl(); RepositoryImpl repository; File obrRepoFile = new File( repositoryXml ); if ( obrRepoFile.isFile() ) { repository = ( RepositoryImpl ) dmh.repository( repositoryXml.toURL() ); } else { repository = new RepositoryImpl(); } for ( File file : files ) { try { ResourceImpl resource = ( ResourceImpl ) dmh.createResource( file.toURI().toURL() ); if ( resource != null ) { repository.addResource( resource ); doTemplate( mavenRepoUri, file, resource ); log.info( "Adding resource: " + file ); } else { log.info( "Ignoring non OSGi bundle: " + file ); } } catch ( Exception e ) { log.warn( "Error processing bundle: " + file + " " + e.getMessage() ); } } Writer writer = new FileWriter( obrRepoFile ); try { dmh.writeRepository( repository, writer ); } finally { writer.close(); } } catch ( Exception e ) { log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e ); } } protected void doTemplate( URI root, File path, ResourceImpl resource ) throws IOException, URISyntaxException { path = path.getAbsoluteFile().getCanonicalFile(); String finalUri = root.relativize( path.toURI() ).toString(); if ( "maven".equals( urlTemplate ) ) { String dir = root.relativize( path.toURI() ).toString(); String[] p = dir.split( "/" ); if ( p.length >= 4 && p[p.length - 1].startsWith( p[p.length - 3] + "-" + p[p.length - 2] ) ) { String artifactId = p[p.length - 3]; String version = p[p.length - 2]; String classifier; String type; String artifactIdVersion = artifactId + "-" + version; StringBuffer sb = new StringBuffer(); if ( p[p.length - 1].charAt( artifactIdVersion.length() ) == '-' ) { classifier = p[p.length - 1].substring( artifactIdVersion.length() + 1, p[p.length - 1].lastIndexOf( '.' ) ); } else { classifier = null; } type = p[p.length - 1].substring( p[p.length - 1].lastIndexOf( '.' ) + 1 ); sb.append( "mvn:" ); for ( int j = 0; j < p.length - 3; j++ ) { if ( j > 0 ) { sb.append( '.' ); } sb.append( p[j] ); } sb.append( '/' ).append( artifactId ).append( '/' ).append( version ); if ( !"jar".equals( type ) || classifier != null ) { sb.append( '/' ); if ( !"jar".equals( type ) ) { sb.append( type ); } if ( classifier != null ) { sb.append( '/' ).append( classifier ); } } finalUri = sb.toString(); } } else if ( urlTemplate != null ) { String dir = path.getParentFile().toURI().toURL().toString(); if ( dir.endsWith( "/" ) ) dir = dir.substring( 0, dir.length() - 1 ); if ( dir.startsWith( root.toString() ) ) dir = dir.substring( root.toString().length() ); String url = urlTemplate.replaceAll( "%v", "" + resource.getVersion() ); url = url.replaceAll( "%s", resource.getSymbolicName() ); url = url.replaceAll( "%f", path.getName() ); url = url.replaceAll( "%p", dir ); finalUri = url; } resource.put( Resource.URI, finalUri, Property.URI ); } private final FileFilter filter = new FileFilter() { public boolean accept( File pathname ) { return pathname.getName().endsWith( "ar" ); } }; private void findAllJars( File mainRoot, List files ) { List roots = new ArrayList(); roots.add( mainRoot ); while ( !roots.isEmpty() ) { File root = roots.remove( 0 ); File[] children = root.listFiles(); if ( children != null ) { for ( File child : children ) { if ( child.isFile() && filter.accept( child ) ) { files.add( child ); } else if ( child.isDirectory() ) { roots.add( child ); } } } } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrInstall.java000066400000000000000000000126041164564726100301010ustar00rootroot00000000000000/* * 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.obrplugin; import java.net.URI; import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; /** * Installs bundle details in the local OBR repository (life-cycle goal) * * @goal install * @phase install * @threadSafe * * @author Felix Project Team */ public final class ObrInstall extends AbstractMojo { /** * OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Project types which this plugin supports. * * @parameter */ private List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); /** * Local Repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; /** * The Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * @parameter expression="${project.attachedArtifacts} * @required * @readonly */ private List attachedArtifacts; /** * Attached source artifact */ private Artifact m_sourceArtifact; /** * Attached doc artifact */ private Artifact m_docArtifact; public void execute() { String projectType = project.getPackaging(); // ignore unsupported project types, useful when bundleplugin is configured in parent pom if ( !supportedProjectTypes.contains( projectType ) ) { getLog().warn( "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes ); return; } else if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) ) { getLog().info( "Local OBR update disabled (enable with -DobrRepository)" ); return; } // check for any attached sources or docs for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); ) { Artifact artifact = ( Artifact ) i.next(); if ( "sources".equals( artifact.getClassifier() ) ) { m_sourceArtifact = artifact; } else if ( "javadoc".equals( artifact.getClassifier() ) ) { m_docArtifact = artifact; } } Log log = getLog(); ObrUpdate update; try { String mavenRepository = localRepository.getBasedir(); URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository ); URI obrXmlFile = ObrUtils.findObrXml( project ); Config userConfig = new Config(); update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log ); update.parseRepositoryXml(); updateLocalBundleMetadata( project.getArtifact(), update ); for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); ) { updateLocalBundleMetadata( ( Artifact ) i.next(), update ); } update.writeRepositoryXml(); } catch ( Exception e ) { log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e ); } } private void updateLocalBundleMetadata( Artifact artifact, ObrUpdate update ) throws MojoExecutionException { if ( !supportedProjectTypes.contains( artifact.getType() ) ) { return; } else if ( null == artifact.getFile() || artifact.getFile().isDirectory() ) { getLog().error( "No artifact found, try \"mvn install bundle:install\"" ); return; } URI bundleJar = ObrUtils.getArtifactURI( localRepository, artifact ); URI sourceJar = null; if ( null != m_sourceArtifact ) { sourceJar = ObrUtils.getArtifactURI( localRepository, m_sourceArtifact ); } URI docJar = null; if ( null != m_docArtifact ) { docJar = ObrUtils.getArtifactURI( localRepository, m_docArtifact ); } update.updateRepository( bundleJar, sourceJar, docJar ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrInstallFile.java000066400000000000000000000065661164564726100307130ustar00rootroot00000000000000/* * 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.obrplugin; import java.net.URI; import java.util.Arrays; import java.util.List; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; /** * Installs bundle details in the local OBR repository (command-line goal) * * @requiresProject false * @goal install-file * @phase install * * @author Felix Project Team */ public final class ObrInstallFile extends AbstractFileMojo { /** * OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Project types which this plugin supports. * * @parameter */ private List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); /** * Local Repository. * * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; public void execute() throws MojoExecutionException { MavenProject project = getProject(); String projectType = project.getPackaging(); // ignore unsupported project types, useful when bundleplugin is configured in parent pom if ( !supportedProjectTypes.contains( projectType ) ) { getLog().warn( "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes ); return; } else if ( "NONE".equalsIgnoreCase( obrRepository ) || "false".equalsIgnoreCase( obrRepository ) ) { getLog().info( "Local OBR update disabled (enable with -DobrRepository)" ); return; } Log log = getLog(); ObrUpdate update; String mavenRepository = localRepository.getBasedir(); URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository ); URI obrXmlFile = ObrUtils.toFileURI( obrXml ); URI bundleJar; if ( null == file ) { bundleJar = ObrUtils.getArtifactURI( localRepository, project.getArtifact() ); } else { bundleJar = file.toURI(); } Config userConfig = new Config(); update = new ObrUpdate( repositoryXml, obrXmlFile, project, mavenRepository, userConfig, log ); update.parseRepositoryXml(); update.updateRepository( bundleJar, null, null ); update.writeRepositoryXml(); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java000066400000000000000000000376541164564726100307050ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Settings; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; /** * Clean a remote repository file. * It just looks for every resources and check that pointed file exists. * * @requiresProject false * @goal remote-clean * @phase clean * * @author Felix Project Team */ public final class ObrRemoteClean extends AbstractMojo { /** * When true, ignore remote locking. * * @parameter expression="${ignoreLock}" */ private boolean ignoreLock; /** * Optional public URL prefix for the remote repository. * * @parameter expression="${prefixUrl}" */ private String prefixUrl; /** * Remote OBR Repository. * * @parameter expression="${remoteOBR}" default-value="NONE" */ private String remoteOBR; /** * Local OBR Repository. * * @parameter expression="${obrRepository}" */ private String obrRepository; /** * Project types which this plugin supports. * * @parameter */ private List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle" } ); /** * @parameter expression="${project.distributionManagementArtifactRepository}" * @readonly */ private ArtifactRepository deploymentRepository; /** * Alternative deployment repository. Format: id::layout::url * * @parameter expression="${altDeploymentRepository}" */ private String altDeploymentRepository; /** * OBR specific deployment repository. Format: id::layout::url * * @parameter expression="${obrDeploymentRepository}" */ private String obrDeploymentRepository; /** * The Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * Local Maven settings. * * @parameter expression="${settings}" * @required * @readonly */ private Settings settings; /** * The Wagon manager. * * @component */ private WagonManager m_wagonManager; public void execute() throws MojoExecutionException { String projectType = project.getPackaging(); // ignore unsupported project types, useful when bundleplugin is configured in parent pom if ( !supportedProjectTypes.contains( projectType ) ) { getLog().warn( "Ignoring project type " + projectType + " - supportedProjectTypes = " + supportedProjectTypes ); return; } else if ( "NONE".equalsIgnoreCase( remoteOBR ) || "false".equalsIgnoreCase( remoteOBR ) ) { getLog().info( "Remote OBR update disabled (enable with -DremoteOBR)" ); return; } // if the user doesn't supply an explicit name for the remote OBR file, use the local name instead if ( null == remoteOBR || remoteOBR.trim().length() == 0 || "true".equalsIgnoreCase( remoteOBR ) ) { remoteOBR = obrRepository; } URI tempURI = ObrUtils.findRepositoryXml( "", remoteOBR ); String repositoryName = new File( tempURI.getSchemeSpecificPart() ).getName(); Log log = getLog(); RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log ); openRepositoryConnection( remoteFile ); if ( null == prefixUrl ) { prefixUrl = remoteFile.toString(); } // ======== LOCK REMOTE OBR ======== log.info( "LOCK " + remoteFile + '/' + repositoryName ); remoteFile.lockFile( repositoryName, ignoreLock ); File downloadedRepositoryXml = null; try { // ======== DOWNLOAD REMOTE OBR ======== log.info( "Downloading " + repositoryName ); downloadedRepositoryXml = remoteFile.get( repositoryName, ".xml" ); URI repositoryXml = downloadedRepositoryXml.toURI(); Config userConfig = new Config(); userConfig.setRemoteFile( true ); // Clean the downloaded file. Document doc = parseFile( new File( repositoryXml ), initConstructor() ); Node finalDocument = cleanDocument( doc.getDocumentElement() ); if ( finalDocument == null ) { getLog().info( "Nothing to clean in " + repositoryName ); } else { writeToFile( repositoryXml, finalDocument ); // Write the new file getLog().info( "Repository " + repositoryName + " cleaned" ); // ======== UPLOAD MODIFIED OBR ======== log.info( "Uploading " + repositoryName ); remoteFile.put( downloadedRepositoryXml, repositoryName ); } } catch ( Exception e ) { log.warn( "Exception while updating remote OBR: " + e.getLocalizedMessage(), e ); } finally { // ======== UNLOCK REMOTE OBR ======== log.info( "UNLOCK " + remoteFile + '/' + repositoryName ); remoteFile.unlockFile( repositoryName ); remoteFile.disconnect(); if ( null != downloadedRepositoryXml ) { downloadedRepositoryXml.delete(); } } } private static final Pattern ALT_REPO_SYNTAX_PATTERN = Pattern.compile( "(.+)::(.+)::(.+)" ); private void openRepositoryConnection( RemoteFileManager remoteFile ) throws MojoExecutionException { // use OBR specific deployment location? if ( obrDeploymentRepository != null ) { altDeploymentRepository = obrDeploymentRepository; } if ( deploymentRepository == null && altDeploymentRepository == null ) { String msg = "Deployment failed: repository element was not specified in the pom inside" + " distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter"; throw new MojoExecutionException( msg ); } if ( altDeploymentRepository != null ) { getLog().info( "Using alternate deployment repository " + altDeploymentRepository ); Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher( altDeploymentRepository ); if ( !matcher.matches() ) { throw new MojoExecutionException( "Invalid syntax for alternative repository \"" + altDeploymentRepository + "\". Use \"id::layout::url\"." ); } remoteFile.connect( matcher.group( 1 ).trim(), matcher.group( 3 ).trim() ); } else { remoteFile.connect( deploymentRepository.getId(), deploymentRepository.getUrl() ); } } /** * Analyze the given XML tree (DOM of the repository file) and remove missing resources. * This method ask the user before deleting the resources from the repository. * @param elem : the input XML tree * @return the cleaned XML tree */ private Element cleanDocument( Element elem ) { NodeList nodes = elem.getElementsByTagName( "resource" ); List toRemove = new ArrayList(); // First, look for missing resources for ( int i = 0; i < nodes.getLength(); i++ ) { Element n = ( Element ) nodes.item( i ); String value = n.getAttribute( "uri" ); URL url; try { url = new URL( new URL( prefixUrl + '/' ), value ); } catch ( MalformedURLException e ) { getLog().error( "Malformed URL when creating the resource absolute URI : " + e.getMessage() ); return null; } try { url.openConnection().getContent(); } catch ( IOException e ) { getLog().info( "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" ) + " will be removed : " + e.getMessage() ); toRemove.add( n ); } } Date d = new Date(); if ( toRemove.size() > 0 ) { System.out.println( "Do you want to remove these bundles from the repository file [y/N]:" ); BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) ); String answer = null; try { answer = br.readLine(); } catch ( IOException ioe ) { getLog().error( "IO error trying to read the user confirmation" ); return null; } if ( answer != null && answer.trim().equalsIgnoreCase( "y" ) ) { // Then remove missing resources. for ( int i = 0; i < toRemove.size(); i++ ) { elem.removeChild( ( Node ) toRemove.get( i ) ); } // If we have to remove resources, we need to update 'lastmodified' attribute SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" ); d.setTime( System.currentTimeMillis() ); elem.setAttribute( "lastmodified", format.format( d ) ); return elem; } else { return null; } } return null; } /** * Initialize the document builder from Xerces. * * @return DocumentBuilder ready to create new document * @throws MojoExecutionException : occurs when the instantiation of the document builder fails */ private DocumentBuilder initConstructor() throws MojoExecutionException { DocumentBuilder constructor = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { constructor = factory.newDocumentBuilder(); } catch ( ParserConfigurationException e ) { getLog().error( "Unable to create a new xml document" ); throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() ); } return constructor; } /** * Open an XML file. * * @param file : XML file * @param constructor DocumentBuilder get from xerces * @return Document which describes this file * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file. */ private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException { if ( constructor == null ) { return null; } // The document is the root of the DOM tree. File targetFile = file.getAbsoluteFile(); getLog().info( "Parsing " + targetFile ); Document doc = null; try { doc = constructor.parse( targetFile ); } catch ( SAXException e ) { getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() ); throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() ); } catch ( IOException e ) { getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() ); throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() ); } return doc; } /** * 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 */ private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException { // init the transformer Transformer transformer = null; TransformerFactory tfabrique = TransformerFactory.newInstance(); try { transformer = tfabrique.newTransformer(); } catch ( TransformerConfigurationException e ) { getLog().error( "Unable to write to file: " + outputFilename.toString() ); throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : " + e.getMessage() ); } Properties proprietes = new Properties(); proprietes.put( "method", "xml" ); proprietes.put( "version", "1.0" ); proprietes.put( "encoding", "ISO-8859-1" ); proprietes.put( "standalone", "yes" ); proprietes.put( "indent", "yes" ); proprietes.put( "omit-xml-declaration", "no" ); transformer.setOutputProperties( proprietes ); DOMSource input = new DOMSource( treeToBeWrite ); File fichier = new File( outputFilename ); FileOutputStream flux = null; try { flux = new FileOutputStream( fichier ); } catch ( FileNotFoundException e ) { getLog().error( "Unable to write to file: " + fichier.getName() ); throw new MojoExecutionException( "Unable to write to file: " + fichier.getName() + " : " + e.getMessage() ); } Result output = new StreamResult( flux ); try { transformer.transform( input, output ); } catch ( TransformerException e ) { throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : " + e.getMessage() ); } try { flux.flush(); flux.close(); } catch ( IOException e ) { throw new MojoExecutionException( "IOException when closing file : " + e.getMessage() ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrUpdate.java000066400000000000000000000246021164564726100277160ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URI; import org.apache.felix.bundlerepository.Resource; import org.apache.felix.bundlerepository.impl.DataModelHelperImpl; import org.apache.felix.bundlerepository.impl.PullParser; import org.apache.felix.bundlerepository.impl.RepositoryImpl; import org.apache.felix.bundlerepository.impl.RepositoryParser; import org.apache.felix.bundlerepository.impl.ResourceImpl; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils; import org.kxml2.io.KXmlParser; import org.xmlpull.v1.XmlPullParser; /** * this class parse the old repository.xml file build the bundle resource description and update the repository. * @author Felix Project Team */ public class ObrUpdate { /** * logger for this plugin. */ private Log m_logger; /** * name and path to the repository descriptor file. */ private URI m_repositoryXml; /** * name and path to the obr.xml file. */ private URI m_obrXml; /** * maven project description. */ private MavenProject m_project; /** * user configuration information. */ private Config m_userConfig; /** * root on parent document. */ private RepositoryImpl m_repository; /** * used to store bundle information. */ private ResourceImpl m_resourceBundle; /** * base URI used to relativize bundle URIs. */ private URI m_baseURI; /** * initialize information. * @param repositoryXml path to the repository descriptor file * @param obrXml path and filename to the obr.xml file * @param project maven project description * @param mavenRepositoryPath path to the local maven repository * @param userConfig user information * @param logger plugin logger */ public ObrUpdate( URI repositoryXml, URI obrXml, MavenProject project, String mavenRepositoryPath, Config userConfig, Log logger ) { m_repositoryXml = repositoryXml; m_obrXml = obrXml; m_project = project; m_logger = logger; m_userConfig = userConfig; if ( userConfig.isRemoteFile() ) { m_baseURI = ObrUtils.toFileURI( mavenRepositoryPath ); } else { m_baseURI = m_repositoryXml; } } /** * update the repository descriptor file. parse the old repository descriptor file, * get the old reference of the bundle or determine the id for a new bundle, extract * information from bindex set the new information in descriptor file and save it. * * @param bundleJar path to the bundle jar file * @param sourceJar path to the source jar file * @param docJar path to the docs jar file * * @throws MojoExecutionException if the plugin failed */ public void updateRepository( URI bundleJar, URI sourceJar, URI docJar ) throws MojoExecutionException { m_logger.debug( " (f) repositoryXml = " + m_repositoryXml ); m_logger.debug( " (f) bundleJar = " + bundleJar ); m_logger.debug( " (f) sourceJar = " + sourceJar ); m_logger.debug( " (f) obrXml = " + m_obrXml ); if ( m_repository == null ) { return; } // get the file size File bundleFile = new File( bundleJar ); if ( bundleFile.exists() ) { URI resourceURI = m_userConfig.getRemoteBundle(); if ( null == resourceURI ) { resourceURI = bundleJar; if ( m_userConfig.isPathRelative() ) { resourceURI = ObrUtils.getRelativeURI( m_baseURI, resourceURI ); } } if ( m_userConfig.isRemoteFile() ) { m_logger.info( "Deploying " + resourceURI ); } else { m_logger.info( "Installing " + resourceURI ); } try { m_resourceBundle = ( ResourceImpl ) new DataModelHelperImpl().createResource( bundleJar.toURL() ); if ( m_resourceBundle == null ) { return; } } catch ( IOException e ) { throw new MojoExecutionException( "Unable to load resource information", e ); } m_resourceBundle.put( Resource.SIZE, String.valueOf( bundleFile.length() ) ); m_resourceBundle.put( Resource.URI, resourceURI.toASCIIString() ); } else { m_logger.error( "file doesn't exist: " + bundleJar ); return; } // parse the obr.xml file if ( m_obrXml != null ) { m_logger.info( "Adding " + m_obrXml ); // URL url = getClass().getResource("/SchemaObr.xsd"); // TODO validate obr.xml file // add contents to resource bundle parseObrXml(); } String sourcePath = relativisePath( sourceJar ); String docPath = relativisePath( docJar ); // m_resourceBundle.construct( m_project, bindexExtractor, sourcePath, docPath ); // TODO: rebuild wrt m_project m_repository.addResource( m_resourceBundle ); m_repository.setLastModified( System.currentTimeMillis() ); } private String relativisePath( URI uri ) { if ( null != uri ) { if ( m_userConfig.isPathRelative() ) { return ObrUtils.getRelativeURI( m_baseURI, uri ).toASCIIString(); } return uri.toASCIIString(); } return null; } public void writeRepositoryXml() throws MojoExecutionException { m_logger.info( "Writing OBR metadata" ); File file = null; Writer writer; try { file = File.createTempFile( "repository", ".xml" ); writer = new OutputStreamWriter( new FileOutputStream( file ) ); } catch ( IOException e ) { m_logger.error( "Unable to write to file: " + file.getName() ); e.printStackTrace(); throw new MojoExecutionException( "Unable to write to file: " + file.getName() + " : " + e.getMessage() ); } try { new DataModelHelperImpl().writeRepository( m_repository, writer ); } catch ( IOException e ) { throw new MojoExecutionException( "Unable to write repository xml", e ); } try { writer.flush(); writer.close(); File outputFile = new File( m_repositoryXml ); outputFile.getParentFile().mkdirs(); FileUtils.rename( file, outputFile ); } catch ( IOException e ) { e.printStackTrace(); throw new MojoExecutionException( "IOException" ); } } /** * Parse the repository descriptor file. * * @throws MojoExecutionException if the plugin failed */ public void parseRepositoryXml() throws MojoExecutionException { File fout = new File( m_repositoryXml ); if ( !fout.exists() ) { m_repository = new RepositoryImpl(); writeRepositoryXml(); } else { try { m_repository = ( RepositoryImpl ) new DataModelHelperImpl().repository( m_repositoryXml.toURL() ); } catch ( Exception e ) { throw new MojoExecutionException( "Unable to read repository xml: " + m_repositoryXml, e ); } } } /** * put the information from obr.xml into ressourceBundle object. */ private void parseObrXml() throws MojoExecutionException { try { InputStream is = new FileInputStream( new File( m_obrXml ) ); try { KXmlParser kxp = new KXmlParser(); kxp.setInput( is, null ); kxp.nextTag(); // skip top level element kxp.nextTag(); // go to first child element parseObrXml( kxp ); } finally { is.close(); } } catch ( Exception e ) { throw new MojoExecutionException( "Unable to parse obr xml: " + m_obrXml, e ); } } private void parseObrXml( KXmlParser kxp ) throws Exception { PullParser parser = new PullParser(); while ( kxp.getEventType() == XmlPullParser.START_TAG ) { if ( RepositoryParser.CATEGORY.equals( kxp.getName() ) ) { m_resourceBundle.addCategory( parser.parseCategory( kxp ) ); } else if ( RepositoryParser.REQUIRE.equals( kxp.getName() ) ) { m_resourceBundle.addRequire( parser.parseRequire( kxp ) ); } else if ( RepositoryParser.CAPABILITY.equals( kxp.getName() ) ) { m_resourceBundle.addCapability( parser.parseCapability( kxp ) ); } else { kxp.nextTag(); parseObrXml( kxp ); } kxp.nextTag(); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/ObrUtils.java000066400000000000000000000120471164564726100275740ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.net.URI; import java.util.Iterator; import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.model.Resource; import org.apache.maven.project.MavenProject; /** * Various OBR utility methods * * @author Felix Project Team */ public class ObrUtils { private static final String DOT_XML = ".xml"; private static final String REPO_XML = "repository.xml"; private static final String OBR_XML = "obr.xml"; /** * @param mavenRepository path to local maven repository * @param obrRepository path to specific repository.xml * @return URI pointing to correct repository.xml */ public static URI findRepositoryXml( String mavenRepository, String obrRepository ) { String targetPath = obrRepository; Pattern ignoredNames = Pattern.compile( "^(true|false|none|null)?$", Pattern.CASE_INSENSITIVE ); // Combine location settings into a single repository location if ( null == targetPath || ignoredNames.matcher( targetPath ).matches() ) { targetPath = mavenRepository + '/' + REPO_XML; } else if ( !targetPath.toLowerCase().endsWith( DOT_XML ) ) { targetPath = targetPath + '/' + REPO_XML; } URI uri; try { uri = new URI( targetPath ); uri.toURL(); // check protocol } catch ( Exception e ) { uri = null; } // fall-back to file-system approach if ( null == uri || !uri.isAbsolute() ) { uri = new File( targetPath ).toURI(); } return uri; } /** * @param project current project * @return URI pointing to correct obr.xml, null if not found */ public static URI findObrXml( MavenProject project ) { File obrFile = new File( project.getBuild().getOutputDirectory(), OBR_XML ); if ( obrFile.exists() ) { return obrFile.toURI(); } for ( Iterator i = project.getResources().iterator(); i.hasNext(); ) { Resource resource = ( Resource ) i.next(); obrFile = new File( resource.getDirectory(), OBR_XML ); if ( obrFile.exists() ) { return obrFile.toURI(); } } return null; } /** * @param repository maven repository * @param artifact maven artifact * @return file URI pointing to artifact in repository */ public static URI getArtifactURI( ArtifactRepository repository, Artifact artifact ) { String baseDir = repository.getBasedir(); String artifactPath = repository.pathOf( artifact ); return toFileURI( baseDir + '/' + artifactPath ); } /** * @param path filesystem path * @return file URI for the path */ public static URI toFileURI( String path ) { if ( null == path ) { return null; } else if ( path.startsWith( "file:" ) ) { return URI.create( path ); } else { return new File( path ).toURI(); } } /** * @param repositoryXml URI pointing to repository.xml, or directory containing it * @param bundleJar URI pointing to bundle jarfile * @return relative URI to bundle jarfile */ public static URI getRelativeURI( URI repositoryXml, URI bundleJar ) { try { String repositoryPath = repositoryXml.getPath(); if ( repositoryPath.toLowerCase().endsWith( DOT_XML ) ) { // remove filename to get containing directory int dirnameIndex = repositoryPath.lastIndexOf( '/' ); repositoryPath = repositoryPath.substring( 0, dirnameIndex ); } URI rootURI = new URI( null, repositoryPath, null ); URI localURI = new URI( null, bundleJar.getPath(), null ); return rootURI.relativize( localURI ); } catch ( Exception e ) { return bundleJar; } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/PomHelper.java000066400000000000000000000052651164564726100277300ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * Maven POM helper methods. * * @author Felix Project Team */ public final class PomHelper { public static MavenProject readPom( File pomFile ) throws MojoExecutionException { Reader reader = null; try { reader = new FileReader( pomFile ); MavenXpp3Reader modelReader = new MavenXpp3Reader(); return new MavenProject( modelReader.read( reader ) ); } catch ( FileNotFoundException e ) { throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e ); } catch ( IOException e ) { throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e ); } catch ( XmlPullParserException e ) { throw new MojoExecutionException( "Error reading specified POM file: " + e.getMessage(), e ); } finally { IOUtil.close( reader ); } } public static MavenProject buildPom( String groupId, String artifactId, String version, String packaging ) { Model model = new Model(); model.setModelVersion( "4.0.0" ); model.setGroupId( groupId ); model.setArtifactId( artifactId ); model.setVersion( version ); model.setPackaging( packaging ); return new MavenProject( model ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/RemoteFileManager.java000066400000000000000000000251261164564726100313610ustar00rootroot00000000000000/* * 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.obrplugin; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import org.apache.maven.artifact.manager.WagonConfigurationException; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Settings; import org.apache.maven.wagon.ConnectionException; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.UnsupportedProtocolException; import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.authentication.AuthenticationException; import org.apache.maven.wagon.authorization.AuthorizationException; import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; /** * this class is used to manage all connections by wagon. * @author Felix Project Team */ public class RemoteFileManager { /** * save the connection. */ private Wagon m_wagon; /** * the wagon manager. */ private WagonManager m_wagonManager; /** * the project settings. */ private Settings m_settings; /** * logger instance. */ private Log m_log; /** * initialize main information. * @param wm WagonManager provides by maven * @param settings settings of the current project provides by maven * @param log logger */ public RemoteFileManager( WagonManager wm, Settings settings, Log log ) { m_wagonManager = wm; m_settings = settings; m_log = log; m_wagon = null; } /** * disconnect the current object. */ public void disconnect() { try { if ( m_wagon != null ) { m_wagon.disconnect(); } } catch ( ConnectionException e ) { m_log.error( "Error disconnecting Wagon", e ); } } /** * connect the current object to repository given in constructor. * @param id repository id * @param url repository url * @throws MojoExecutionException */ public void connect( String id, String url ) throws MojoExecutionException { Repository repository = new Repository( id, url ); try { m_wagon = m_wagonManager.getWagon( repository ); } catch ( UnsupportedProtocolException e ) { throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e ); } catch ( WagonConfigurationException e ) { throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e ); } try { ProxyInfo proxyInfo = getProxyInfo( m_settings ); if ( proxyInfo != null ) { m_wagon.connect( repository, m_wagonManager.getAuthenticationInfo( id ), proxyInfo ); } else { m_wagon.connect( repository, m_wagonManager.getAuthenticationInfo( id ) ); } } catch ( ConnectionException e ) { throw new MojoExecutionException( "Connection failed", e ); } catch ( AuthenticationException e ) { throw new MojoExecutionException( "Authentication failed", e ); } } /** * get a file from the current repository connected. * @param url url to the targeted file * @param suffix suggested file suffix * @return get a file descriptor on the required resource * @throws MojoExecutionException */ public File get( String url, String suffix ) throws MojoExecutionException { if ( m_wagon == null ) { m_log.error( "must be connected first!" ); return null; } File file = null; try { file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), suffix ); } catch ( IOException e ) { throw new MojoExecutionException( "I/O problem", e ); } try { m_wagon.get( url, file ); } catch ( TransferFailedException e ) { file.delete(); // cleanup on failure throw new MojoExecutionException( "Transfer failed", e ); } catch ( AuthorizationException e ) { file.delete(); // cleanup on failure throw new MojoExecutionException( "Authorization failed", e ); } catch ( ResourceDoesNotExistException e ) { file.delete(); // return non-existent file } return file; } /** * put a file on the current repository connected. * @param file file to upload * @param url url to copy file * @throws MojoExecutionException */ public void put( File file, String url ) throws MojoExecutionException { if ( m_wagon == null ) { m_log.error( "must be connected first!" ); return; } try { m_wagon.put( file, url ); } catch ( TransferFailedException e ) { throw new MojoExecutionException( "Transfer failed", e ); } catch ( AuthorizationException e ) { throw new MojoExecutionException( "Authorization failed", e ); } catch ( ResourceDoesNotExistException e ) { throw new MojoExecutionException( "Resource does not exist:" + file, e ); } } /** * Convenience method to map a Proxy object from the user system settings to a ProxyInfo object. * @param settings project settings given by maven * @return a proxyInfo object instancied or null if no active proxy is define in the settings.xml */ public static ProxyInfo getProxyInfo( Settings settings ) { ProxyInfo proxyInfo = null; if ( settings != null && settings.getActiveProxy() != null ) { Proxy settingsProxy = settings.getActiveProxy(); proxyInfo = new ProxyInfo(); proxyInfo.setHost( settingsProxy.getHost() ); proxyInfo.setType( settingsProxy.getProtocol() ); proxyInfo.setPort( settingsProxy.getPort() ); proxyInfo.setNonProxyHosts( settingsProxy.getNonProxyHosts() ); proxyInfo.setUserName( settingsProxy.getUsername() ); proxyInfo.setPassword( settingsProxy.getPassword() ); } return proxyInfo; } public void lockFile( String fileName, boolean ignoreLock ) throws MojoExecutionException { if ( !ignoreLock ) { int countError = 0; while ( isLockedFile( fileName ) && countError < 2 ) { countError++; m_log.warn( "File is currently locked, retry in 10s" ); try { Thread.sleep( 10000 ); } catch ( InterruptedException e ) { m_log.warn( "Sleep interrupted" ); } } if ( countError == 2 ) { m_log.error( "File " + fileName + " is locked. Use -DignoreLock to force uploading" ); throw new MojoExecutionException( "Remote file locked" ); } } File file = null; try { // create a non-empty file used to lock the remote file file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), ".lock" ); Writer writer = new BufferedWriter( new FileWriter( file ) ); writer.write( "LOCKED" ); writer.close(); put( file, fileName + ".lock" ); } catch ( IOException e ) { throw new MojoExecutionException( "I/O problem", e ); } finally { if ( null != file ) { file.delete(); } } } public void unlockFile( String fileName ) throws MojoExecutionException { File file = null; try { // clear the contents of the file used to lock the remote file file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), ".lock" ); Writer writer = new BufferedWriter( new FileWriter( file ) ); writer.write( " " ); // write 1 byte to force wagon upload writer.close(); put( file, fileName + ".lock" ); } catch ( IOException e ) { throw new MojoExecutionException( "I/O problem", e ); } finally { if ( null != file ) { file.delete(); } } } /** * this method indicates if the targeted file is locked or not. * @param fileName name targeted * @return true if the required file is locked, else false * @throws MojoExecutionException */ public boolean isLockedFile( String fileName ) throws MojoExecutionException { File file = null; try { file = get( fileName + ".lock", ".lock" ); // file is locked with contents "LOCKED" if ( null != file && file.length() <= 2 ) { return false; } } finally { if ( null != file ) { file.delete(); } } return true; } public String toString() { return m_wagon.getRepository().getUrl(); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/felix/obrplugin/XmlHelper.java000066400000000000000000000065761164564726100277430ustar00rootroot00000000000000/* * 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.obrplugin; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Provide XML helper methods to support pre-Java5 runtimes * * @author Felix Project Team */ public class XmlHelper { /** * based on public Java5 javadoc of org.w3c.dom.Node.getTextContent method */ public static String getTextContent( Node node ) { switch ( node.getNodeType() ) { case Node.ELEMENT_NODE: case Node.ATTRIBUTE_NODE: case Node.ENTITY_NODE: case Node.ENTITY_REFERENCE_NODE: case Node.DOCUMENT_FRAGMENT_NODE: return mergeTextContent( node.getChildNodes() ); case Node.TEXT_NODE: case Node.CDATA_SECTION_NODE: case Node.COMMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: return node.getNodeValue(); case Node.DOCUMENT_NODE: case Node.DOCUMENT_TYPE_NODE: case Node.NOTATION_NODE: default: return null; } } /** * based on the following quote from public Java5 javadoc of org.w3c.dom.Node.getTextContent method: * * "concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and * PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children" */ private static String mergeTextContent( NodeList nodes ) { StringBuffer buf = new StringBuffer(); for ( int i = 0; i < nodes.getLength(); i++ ) { Node n = nodes.item( i ); final String text; switch ( n.getNodeType() ) { case Node.COMMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: text = null; break; default: text = getTextContent( n ); break; } if ( text != null ) { buf.append( text ); } } return buf.toString(); } /** * based on public Java5 javadoc of org.w3c.dom.Node.setTextContent method */ public static void setTextContent( Node node, final String text ) { while ( node.hasChildNodes() ) { node.removeChild( node.getFirstChild() ); } if ( text != null && text.length() > 0 ) { Node textNode = node.getOwnerDocument().createTextNode( text ); node.appendChild( textNode ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/000077500000000000000000000000001164564726100231605ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/000077500000000000000000000000001164564726100244265ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/dependency/000077500000000000000000000000001164564726100265445ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/dependency/tree/000077500000000000000000000000001164564726100275035ustar00rootroot00000000000000DependencyTreeResolutionListener.java000066400000000000000000000411541164564726100367640ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/dependency/treepackage org.apache.maven.shared.dependency.tree; /* * 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.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.Map; import java.util.Stack; import org.apache.maven.artifact.Artifact; 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; /** * An artifact resolution listener that constructs a dependency tree. * * @author Edwin Punzalan * @author Mark Hobson * @version $Id: DependencyTreeResolutionListener.java 661727 2008-05-30 14:21:49Z bentmann $ */ public class DependencyTreeResolutionListener implements ResolutionListener, ResolutionListenerForDepMgmt { // fields ----------------------------------------------------------------- /** * The log to write debug messages to. */ private final Logger logger; /** * The parent dependency nodes of the current dependency node. */ private final Stack parentNodes; /** * A map of dependency nodes by their attached artifact. */ private final Map nodesByArtifact; /** * The root dependency node of the computed dependency tree. */ private DependencyNode rootNode; /** * The dependency node currently being processed by this listener. */ private DependencyNode currentNode; /** * Map < String replacementId, String premanaged version > */ private Map managedVersions = new HashMap(); /** * Map < String replacementId, String premanaged scope > */ private Map managedScopes = new HashMap(); // constructors ----------------------------------------------------------- /** * Creates a new dependency tree resolution listener that writes to the specified log. * * @param logger * the log to write debug messages to */ public DependencyTreeResolutionListener( Logger logger ) { this.logger = logger; parentNodes = new Stack(); nodesByArtifact = new IdentityHashMap(); rootNode = null; currentNode = null; } // ResolutionListener methods --------------------------------------------- /** * {@inheritDoc} */ public void testArtifact( Artifact artifact ) { log( "testArtifact: artifact=" + artifact ); } /** * {@inheritDoc} */ public void startProcessChildren( Artifact artifact ) { log( "startProcessChildren: artifact=" + artifact ); if ( !currentNode.getArtifact().equals( artifact ) ) { throw new IllegalStateException( "Artifact was expected to be " + currentNode.getArtifact() + " but was " + artifact ); } parentNodes.push( currentNode ); } /** * {@inheritDoc} */ public void endProcessChildren( Artifact artifact ) { DependencyNode node = ( DependencyNode ) parentNodes.pop(); log( "endProcessChildren: artifact=" + artifact ); if ( node == null ) { throw new IllegalStateException( "Parent dependency node was null" ); } if ( !node.getArtifact().equals( artifact ) ) { throw new IllegalStateException( "Parent dependency node artifact was expected to be " + node.getArtifact() + " but was " + artifact ); } } /** * {@inheritDoc} */ public void includeArtifact( Artifact artifact ) { log( "includeArtifact: artifact=" + artifact ); DependencyNode existingNode = getNode( artifact ); /* * Ignore duplicate includeArtifact calls since omitForNearer can be called prior to includeArtifact on the same * artifact, and we don't wish to include it twice. */ if ( existingNode == null && isCurrentNodeIncluded() ) { DependencyNode node = addNode( artifact ); /* * Add the dependency management information cached in any prior manageArtifact calls, since includeArtifact * is always called after manageArtifact. */ flushDependencyManagement( node ); } } /** * {@inheritDoc} */ public void omitForNearer( Artifact omitted, Artifact kept ) { log( "omitForNearer: omitted=" + omitted + " kept=" + kept ); if ( !omitted.getDependencyConflictId().equals( kept.getDependencyConflictId() ) ) { throw new IllegalArgumentException( "Omitted artifact dependency conflict id " + omitted.getDependencyConflictId() + " differs from kept artifact dependency conflict id " + kept.getDependencyConflictId() ); } if ( isCurrentNodeIncluded() ) { DependencyNode omittedNode = getNode( omitted ); if ( omittedNode != null ) { removeNode( omitted ); } else { omittedNode = createNode( omitted ); currentNode = omittedNode; } omittedNode.omitForConflict( kept ); /* * Add the dependency management information cached in any prior manageArtifact calls, since omitForNearer * is always called after manageArtifact. */ flushDependencyManagement( omittedNode ); DependencyNode keptNode = getNode( kept ); if ( keptNode == null ) { addNode( kept ); } } } /** * {@inheritDoc} */ public void updateScope( Artifact artifact, String scope ) { log( "updateScope: artifact=" + artifact + ", scope=" + scope ); DependencyNode node = getNode( artifact ); if ( node == null ) { // updateScope events can be received prior to includeArtifact events node = addNode( artifact ); } node.setOriginalScope( artifact.getScope() ); } /** * {@inheritDoc} */ public void manageArtifact( Artifact artifact, Artifact replacement ) { // TODO: remove when ResolutionListenerForDepMgmt merged into ResolutionListener log( "manageArtifact: artifact=" + artifact + ", replacement=" + replacement ); if ( replacement.getVersion() != null ) { manageArtifactVersion( artifact, replacement ); } if ( replacement.getScope() != null ) { manageArtifactScope( artifact, replacement ); } } /** * {@inheritDoc} */ public void omitForCycle( Artifact artifact ) { log( "omitForCycle: artifact=" + artifact ); if ( isCurrentNodeIncluded() ) { DependencyNode node = createNode( artifact ); node.omitForCycle(); } } /** * {@inheritDoc} */ public void updateScopeCurrentPom( Artifact artifact, String scopeIgnored ) { log( "updateScopeCurrentPom: artifact=" + artifact + ", scopeIgnored=" + scopeIgnored ); DependencyNode node = getNode( artifact ); if ( node == null ) { // updateScopeCurrentPom events can be received prior to includeArtifact events node = addNode( artifact ); // TODO remove the node that tried to impose its scope and add some info } node.setFailedUpdateScope( scopeIgnored ); } /** * {@inheritDoc} */ public void selectVersionFromRange( Artifact artifact ) { log( "selectVersionFromRange: artifact=" + artifact ); DependencyNode node = getNode( artifact ); /* * selectVersionFromRange is called before includeArtifact */ if ( node == null && isCurrentNodeIncluded() ) { node = addNode( artifact ); } node.setVersionSelectedFromRange( artifact.getVersionRange() ); node.setAvailableVersions( artifact.getAvailableVersions() ); } /** * {@inheritDoc} */ public void restrictRange( Artifact artifact, Artifact replacement, VersionRange versionRange ) { log( "restrictRange: artifact=" + artifact + ", replacement=" + replacement + ", versionRange=" + versionRange ); // TODO: track range restriction in node (MNG-3093) } // ResolutionListenerForDepMgmt methods ----------------------------------- /** * {@inheritDoc} */ public void manageArtifactVersion( Artifact artifact, Artifact replacement ) { log( "manageArtifactVersion: artifact=" + artifact + ", replacement=" + replacement ); /* * DefaultArtifactCollector calls manageArtifact twice: first with the change; then subsequently with no change. * We ignore the second call when the versions are equal. */ if ( isCurrentNodeIncluded() && !replacement.getVersion().equals( artifact.getVersion() ) ) { /* * Cache management information and apply in includeArtifact, since DefaultArtifactCollector mutates the * artifact and then calls includeArtifact after manageArtifact. */ managedVersions.put( getRangeId( replacement ), artifact.getVersion() ); } } /** * {@inheritDoc} */ public void manageArtifactScope( Artifact artifact, Artifact replacement ) { log( "manageArtifactScope: artifact=" + artifact + ", replacement=" + replacement ); /* * DefaultArtifactCollector calls manageArtifact twice: first with the change; then subsequently with no change. * We ignore the second call when the scopes are equal. */ if ( isCurrentNodeIncluded() && !replacement.getScope().equals( artifact.getScope() ) ) { /* * Cache management information and apply in includeArtifact, since DefaultArtifactCollector mutates the * artifact and then calls includeArtifact after manageArtifact. */ managedScopes.put( getRangeId( replacement ), artifact.getScope() ); } } // public methods --------------------------------------------------------- /** * 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 */ public Collection getNodes() { return Collections.unmodifiableCollection( nodesByArtifact.values() ); } /** * Gets the root dependency node of the computed dependency tree. * * @return the root node */ public DependencyNode getRootNode() { return rootNode; } // private methods -------------------------------------------------------- /** * Writes the specified message to the log at debug level with indentation for the current node's depth. * * @param message * the message to write to the log */ private void log( String message ) { int depth = parentNodes.size(); StringBuffer buffer = new StringBuffer(); for ( int i = 0; i < depth; i++ ) { buffer.append( " " ); } buffer.append( message ); logger.debug( buffer.toString() ); } /** * Creates a new dependency node for the specified artifact and appends it to the current parent dependency node. * * @param artifact * the attached artifact for the new dependency node * @return the new dependency node */ private DependencyNode createNode( Artifact artifact ) { DependencyNode node = new DependencyNode( artifact ); if ( !parentNodes.isEmpty() ) { DependencyNode parent = ( DependencyNode ) parentNodes.peek(); parent.addChild( node ); } return node; } /** * Creates a new dependency node for the specified artifact, appends it to the current parent dependency node and * puts it into the dependency node cache. * * @param artifact * the attached artifact for the new dependency node * @return the new dependency node */ // package protected for unit test DependencyNode addNode( Artifact artifact ) { DependencyNode node = createNode( artifact ); DependencyNode previousNode = ( DependencyNode ) nodesByArtifact.put( node.getArtifact(), node ); if ( previousNode != null ) { throw new IllegalStateException( "Duplicate node registered for artifact: " + node.getArtifact() ); } if ( rootNode == null ) { rootNode = node; } currentNode = node; return node; } /** * Gets the dependency node for the specified artifact from the dependency node cache. * * @param artifact * the artifact to find the dependency node for * @return the dependency node, or null if the specified artifact has no corresponding dependency * node */ private DependencyNode getNode( Artifact artifact ) { return ( DependencyNode ) nodesByArtifact.get( artifact ); } /** * Removes the dependency node for the specified artifact from the dependency node cache. * * @param artifact * the artifact to remove the dependency node for */ private void removeNode( Artifact artifact ) { DependencyNode node = ( DependencyNode ) nodesByArtifact.remove( artifact ); if ( !artifact.equals( node.getArtifact() ) ) { throw new IllegalStateException( "Removed dependency node artifact was expected to be " + artifact + " but was " + node.getArtifact() ); } } /** * Gets whether the all the ancestors of the dependency node currently being processed by this listener have an * included state. * * @return true if all the ancestors of the current dependency node have a state of * INCLUDED */ private boolean isCurrentNodeIncluded() { boolean included = true; for ( Iterator iterator = parentNodes.iterator(); included && iterator.hasNext(); ) { DependencyNode node = ( DependencyNode ) iterator.next(); if ( node.getState() != DependencyNode.INCLUDED ) { included = false; } } return included; } /** * Updates the specified node with any dependency management information cached in prior manageArtifact * calls. * * @param node * the node to update */ private void flushDependencyManagement( DependencyNode node ) { Artifact artifact = node.getArtifact(); String premanagedVersion = ( String ) managedVersions.get( getRangeId( artifact ) ); String premanagedScope = ( String ) managedScopes.get( getRangeId( artifact ) ); if ( premanagedVersion != null || premanagedScope != null ) { if ( premanagedVersion != null ) { node.setPremanagedVersion( premanagedVersion ); } if ( premanagedScope != null ) { node.setPremanagedScope( premanagedScope ); } premanagedVersion = null; premanagedScope = null; } } private static String getRangeId( Artifact artifact ) { return artifact.getDependencyConflictId() + ":" + artifact.getVersionRange(); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/osgi/000077500000000000000000000000001164564726100253675ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java000066400000000000000000000256361164564726100334150ustar00rootroot00000000000000/* * 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.maven.shared.osgi; import java.io.File; import java.io.IOException; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.jar.JarFile; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipEntry; import org.apache.maven.artifact.Artifact; import aQute.lib.osgi.Analyzer; /** * Default implementation of {@link Maven2OsgiConverter} * * @plexus.component * * @author Carlos Sanchez * @version $Id: DefaultMaven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $ */ public class DefaultMaven2OsgiConverter implements Maven2OsgiConverter { private static final String FILE_SEPARATOR = System.getProperty( "file.separator" ); private String getBundleSymbolicName( String groupId, String artifactId ) { return groupId + "." + artifactId; } /** * 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
  • *
*/ public String getBundleSymbolicName( Artifact artifact ) { if ( ( artifact.getFile() != null ) && artifact.getFile().isFile() ) { Analyzer analyzer = new Analyzer(); JarFile jar = null; try { jar = new JarFile( artifact.getFile(), false ); if ( jar.getManifest() != null ) { String symbolicNameAttribute = jar.getManifest().getMainAttributes() .getValue( Analyzer.BUNDLE_SYMBOLICNAME ); Map bundleSymbolicNameHeader = analyzer.parseHeader( symbolicNameAttribute ); Iterator it = bundleSymbolicNameHeader.keySet().iterator(); if ( it.hasNext() ) { return ( String ) it.next(); } } } catch ( IOException e ) { throw new ManifestReadingException( "Error reading manifest in jar " + artifact.getFile().getAbsolutePath(), e ); } finally { if ( jar != null ) { try { jar.close(); } catch ( IOException e ) { } } } } int i = artifact.getGroupId().lastIndexOf( '.' ); if ( ( i < 0 ) && ( artifact.getFile() != null ) && artifact.getFile().isFile() ) { String groupIdFromPackage = getGroupIdFromPackage( artifact.getFile() ); if ( groupIdFromPackage != null ) { return groupIdFromPackage; } } String lastSection = artifact.getGroupId().substring( ++i ); if ( artifact.getArtifactId().equals( lastSection ) ) { return artifact.getGroupId(); } if ( artifact.getArtifactId().startsWith( lastSection ) ) { String artifactId = artifact.getArtifactId().substring( lastSection.length() ); if ( Character.isLetterOrDigit( artifactId.charAt( 0 ) ) ) { return getBundleSymbolicName( artifact.getGroupId(), artifactId ); } else { return getBundleSymbolicName( artifact.getGroupId(), artifactId.substring( 1 ) ); } } return getBundleSymbolicName( artifact.getGroupId(), artifact.getArtifactId() ); } private String getGroupIdFromPackage( File artifactFile ) { try { /* get package names from jar */ Set packageNames = new HashSet(); JarFile jar = new JarFile( artifactFile, false ); Enumeration entries = jar.entries(); while ( entries.hasMoreElements() ) { ZipEntry entry = ( ZipEntry ) entries.nextElement(); if ( entry.getName().endsWith( ".class" ) ) { File f = new File( entry.getName() ); String packageName = f.getParent(); if ( packageName != null ) { packageNames.add( packageName ); } } } jar.close(); /* find the top package */ String[] groupIdSections = null; for ( Iterator it = packageNames.iterator(); it.hasNext(); ) { String packageName = ( String ) it.next(); String[] packageNameSections = packageName.split( "\\" + FILE_SEPARATOR ); if ( groupIdSections == null ) { /* first candidate */ groupIdSections = packageNameSections; } else // if ( packageNameSections.length < groupIdSections.length ) { /* * find the common portion of current package and previous selected groupId */ int i; for ( i = 0; ( i < packageNameSections.length ) && ( i < groupIdSections.length ); i++ ) { if ( !packageNameSections[i].equals( groupIdSections[i] ) ) { break; } } groupIdSections = new String[i]; System.arraycopy( packageNameSections, 0, groupIdSections, 0, i ); } } if ( ( groupIdSections == null ) || ( groupIdSections.length == 0 ) ) { return null; } /* only one section as id doesn't seem enough, so ignore it */ if ( groupIdSections.length == 1 ) { return null; } StringBuffer sb = new StringBuffer(); for ( int i = 0; i < groupIdSections.length; i++ ) { sb.append( groupIdSections[i] ); if ( i < groupIdSections.length - 1 ) { sb.append( '.' ); } } return sb.toString(); } catch ( IOException e ) { /* we took all the precautions to avoid this */ throw new RuntimeException( e ); } } public String getBundleFileName( Artifact artifact ) { return getBundleSymbolicName( artifact ) + "_" + getVersion( artifact.getVersion() ) + ".jar"; } public String getVersion( Artifact artifact ) { return getVersion( artifact.getVersion() ); } public String getVersion( String version ) { return cleanupVersion( version ); } /** * Clean up version parameters. Other builders use more fuzzy definitions of * the version syntax. This method cleans up such a version to match an OSGi * version. * * @param VERSION_STRING * @return */ static final Pattern FUZZY_VERSION = Pattern.compile( "(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?", Pattern.DOTALL ); static public String cleanupVersion( String version ) { StringBuffer result = new StringBuffer(); Matcher m = FUZZY_VERSION.matcher( version ); if ( m.matches() ) { String major = m.group( 1 ); String minor = m.group( 3 ); String micro = m.group( 5 ); String qualifier = m.group( 7 ); if ( major != null ) { result.append( major ); if ( minor != null ) { result.append( "." ); result.append( minor ); if ( micro != null ) { result.append( "." ); result.append( micro ); if ( qualifier != null ) { result.append( "." ); cleanupModifier( result, qualifier ); } } else if ( qualifier != null ) { result.append( ".0." ); cleanupModifier( result, qualifier ); } else { result.append( ".0" ); } } else if ( qualifier != null ) { result.append( ".0.0." ); cleanupModifier( result, qualifier ); } else { result.append( ".0.0" ); } } } else { result.append( "0.0.0." ); cleanupModifier( result, version ); } return result.toString(); } static void cleanupModifier( StringBuffer result, String modifier ) { for ( int i = 0; i < modifier.length(); i++ ) { char c = modifier.charAt( i ); if ( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || c == '_' || c == '-' ) result.append( c ); else result.append( '_' ); } } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/osgi/ManifestReadingException.java000066400000000000000000000030031164564726100331450ustar00rootroot00000000000000/* * 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.maven.shared.osgi; /** * Exception while reading the manifest. Encapsulates an IOException to make it runtime * * @author Carlos Sanchez * @version $Id: ManifestReadingException.java 661727 2008-05-30 14:21:49Z bentmann $ */ public class ManifestReadingException extends RuntimeException { public ManifestReadingException() { super(); } public ManifestReadingException( String message, Throwable cause ) { super( message, cause ); } public ManifestReadingException( String message ) { super( message ); } public ManifestReadingException( Throwable cause ) { super( cause ); } } maven-bundle-plugin-2.3.5/src/main/java/org/apache/maven/shared/osgi/Maven2OsgiConverter.java000066400000000000000000000034731164564726100321030ustar00rootroot00000000000000/* * 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.maven.shared.osgi; import org.apache.maven.artifact.Artifact; /** * Converter from Maven groupId,artifactId and versions to OSGi Bundle-SymbolicName and version * * @author Carlos Sanchez * @version $Id: Maven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $ */ public interface Maven2OsgiConverter { /** * Get the OSGi symbolic name for the artifact * * @param artifact * @return the Bundle-SymbolicName manifest property */ String getBundleSymbolicName( Artifact artifact ); String getBundleFileName( Artifact artifact ); /** * Convert a Maven version into an OSGi compliant version * * @param artifact Maven artifact * @return the OSGi version */ String getVersion( Artifact artifact ); /** * Convert a Maven version into an OSGi compliant version * * @param version Maven version * @return the OSGi version */ String getVersion( String version ); }maven-bundle-plugin-2.3.5/src/main/resources/000077500000000000000000000000001164564726100211335ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/META-INF/000077500000000000000000000000001164564726100222735ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/META-INF/plexus/000077500000000000000000000000001164564726100236135ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/META-INF/plexus/components.xml000066400000000000000000000055061164564726100265300ustar00rootroot00000000000000 org.apache.maven.lifecycle.mapping.LifecycleMapping bundle org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping default org.apache.maven.plugins:maven-resources-plugin:resources org.apache.maven.plugins:maven-compiler-plugin:compile org.apache.maven.plugins:maven-resources-plugin:testResources org.apache.maven.plugins:maven-compiler-plugin:testCompile org.apache.maven.plugins:maven-surefire-plugin:test org.apache.felix:maven-bundle-plugin:bundle org.apache.maven.plugins:maven-install-plugin:install, org.apache.felix:maven-bundle-plugin:install org.apache.maven.plugins:maven-deploy-plugin:deploy, org.apache.felix:maven-bundle-plugin:deploy org.apache.maven.artifact.handler.ArtifactHandler bundle org.apache.maven.artifact.handler.DefaultArtifactHandler bundle false java jar true bundle maven-bundle-plugin-2.3.5/src/main/resources/SchemaObr.xsd000066400000000000000000000074211164564726100235220ustar00rootroot00000000000000 maven-bundle-plugin-2.3.5/src/main/resources/build.xml000066400000000000000000000053511164564726100227600ustar00rootroot00000000000000 maven-bundle-plugin-2.3.5/src/main/resources/org/000077500000000000000000000000001164564726100217225ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/org/apache/000077500000000000000000000000001164564726100231435ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/org/apache/felix/000077500000000000000000000000001164564726100242525ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/org/apache/felix/bundleplugin/000077500000000000000000000000001164564726100267425ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/main/resources/org/apache/felix/bundleplugin/blueprint.xsl000066400000000000000000000161721164564726100315050ustar00rootroot00000000000000 Import-Package:org.osgi.service.blueprint;version="[1.0.0,2.0.0)" maven-bundle-plugin-2.3.5/src/site/000077500000000000000000000000001164564726100171415ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/site/apt/000077500000000000000000000000001164564726100177255ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/site/apt/index.apt000066400000000000000000000110231164564726100215370ustar00rootroot00000000000000 ------ Introduction ------ Stuart McCulloch ------ 2011-06-28 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html 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. * Goals Overview General Information about the goals. * {{{./bundle-mojo.html}bundle:bundle}} Create an OSGi bundle from Maven project. (life-cycle goal) * {{{./manifest-mojo.html}bundle:manifest}} Generate an OSGi manifest for this project. * {{{./cleanVersions-mojo.html}bundle:cleanVersions}} Convert a group of versions to OSGi format. * {{{./instructions-mojo.html}bundle:instructions}} Generate BND instructions for this project. * {{{./install-mojo.html}bundle:install}} Installs bundle details in the local OBR repository. (life-cycle goal) * {{{./deploy-mojo.html}bundle:deploy}} Deploys bundle details to a remote OBR repository. (life-cycle goal) * {{{./index-mojo.html}bundle:index}} Index the content of a maven repository using OBR. * {{{./install-file-mojo.html}bundle:install-file}} Installs bundle details in the local OBR repository. (command-line goal) * {{{./deploy-file-mojo.html}bundle:deploy-file}} Deploys bundle details to a remote OBR repository. (command-line goal) * {{{./clean-mojo.html}bundle:clean}} Clean a local OBR repository by finding and removing missing resources. * {{{./remote-clean-mojo.html}bundle:remote-clean}} Clean a remote OBR repository by finding and removing missing resources. * {{{./ant-mojo.html}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 {{{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. 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}}. 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}}. 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 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.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! maven-bundle-plugin-2.3.5/src/site/site.xml000066400000000000000000000024371164564726100206350ustar00rootroot00000000000000 maven-bundle-plugin-2.3.5/src/test/000077500000000000000000000000001164564726100171545ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/java/000077500000000000000000000000001164564726100200755ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/java/org/000077500000000000000000000000001164564726100206645ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/java/org/apache/000077500000000000000000000000001164564726100221055ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/000077500000000000000000000000001164564726100232145ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/bundleplugin/000077500000000000000000000000001164564726100257045ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java000066400000000000000000000033131164564726100334630ustar00rootroot00000000000000package 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 org.apache.maven.plugin.testing.stubs.ArtifactStub; import org.codehaus.plexus.PlexusTestCase; /** * Common methods for bundle plugin testing * * @author Carlos Sanchez * @version $Id: AbstractBundlePluginTest.java 616180 2008-01-29 06:22:10Z mcculls $ */ public abstract class AbstractBundlePluginTest extends PlexusTestCase { protected ArtifactStub getArtifactStub() { ArtifactStub artifact = new ArtifactStub(); artifact.setGroupId( "group" ); artifact.setArtifactId( "artifact" ); artifact.setVersion( "1.0" ); return artifact; } protected File getTestBundle() { String osgiBundleFileName = "org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar"; return getTestFile( getBasedir(), "src/test/resources/" + osgiBundleFileName ); } }maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/bundleplugin/BlueprintComponentTest.java000066400000000000000000000072141164564726100332420ustar00rootroot00000000000000/* * 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.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.jar.Manifest; import junit.framework.TestCase; import org.apache.maven.model.Resource; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.osgi.framework.Constants; import aQute.lib.osgi.Builder; public class BlueprintComponentTest extends TestCase { public void testBlueprint() throws Exception { MavenProjectStub project = new MavenProjectStub() { private final List resources = new ArrayList(); @Override public void addResource( Resource resource ) { resources.add( resource ); } @Override public List getResources() { return resources; } @Override public File getBasedir() { return new File( "target/tmp/basedir" ); } }; project.setGroupId( "group" ); project.setArtifactId( "artifact" ); project.setVersion( "1.1.0.0" ); 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() ); ManifestPlugin plugin = new ManifestPlugin(); plugin.setBuildDirectory( "target/tmp/basedir/target" ); plugin.setOutputDirectory( new File( "target/tmp/basedir/target/classes" ) ); Map instructions = new HashMap(); instructions.put( "Test", "Foo" ); instructions.put( "nsh_interface", "foo.bar.Namespace" ); instructions.put( "nsh_namespace", "ns" ); instructions.put( "Export-Service", "p7.Foo;mk=mv" ); 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 ) ); Manifest manifest = builder.getJar().getManifest(); String expSvc = manifest.getMainAttributes().getValue( Constants.EXPORT_SERVICE ); String impSvc = manifest.getMainAttributes().getValue( Constants.IMPORT_SERVICE ); assertNotNull( expSvc ); assertNotNull( impSvc ); String impPkg = manifest.getMainAttributes().getValue( Constants.IMPORT_PACKAGE ); List pkgs = Arrays.asList( impPkg.split( "," ) ); for ( int i = 1; i <= 13; i++ ) { assertTrue( pkgs.contains( "p" + i ) ); } } } maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java000066400000000000000000000116561164564726100324410ustar00rootroot00000000000000package 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.Collections; import java.util.Map; 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; /** * Test for {@link BundleAllPlugin} * * @author Felix Project Team */ public class BundleAllPluginTest extends AbstractBundlePluginTest { private BundleAllPlugin plugin; protected void setUp() throws Exception { super.setUp(); init(); } private void init() { plugin = new BundleAllPlugin(); File baseDirectory = new File( getBasedir() ); File buildDirectory = new File( baseDirectory, "target" ); plugin.setBuildDirectory( buildDirectory.getPath() ); File outputDirectory = new File( buildDirectory, "test-classes" ); plugin.setOutputDirectory( outputDirectory ); plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() ); } public void testSnapshotMatch() { ArtifactStub artifact = getArtifactStub(); String bundleName; artifact.setVersion( "2.1-SNAPSHOT" ); bundleName = "group.artifact_2.1.0.20070207_193904_2.jar"; assertTrue( plugin.snapshotMatch( artifact, bundleName ) ); artifact.setVersion( "2-SNAPSHOT" ); assertFalse( plugin.snapshotMatch( artifact, bundleName ) ); artifact.setArtifactId( "artifactx" ); artifact.setVersion( "2.1-SNAPSHOT" ); assertFalse( plugin.snapshotMatch( artifact, bundleName ) ); } public void testNoReBundling() throws Exception { File testFile = getTestFile( "target/test-classes/org.apache.maven.maven-model_1.0.0.0.jar" ); if ( testFile.exists() ) { testFile.delete(); } ArtifactStub artifact = new ArtifactStub(); artifact.setGroupId( "group" ); artifact.setArtifactId( "artifact" ); artifact.setVersion( "1.0.0.0" ); MavenProject project = new MavenProjectStub(); project.setGroupId( artifact.getGroupId() ); project.setArtifactId( artifact.getArtifactId() ); project.setVersion( artifact.getVersion() ); project.setArtifact( artifact ); project.setArtifacts( Collections.EMPTY_SET ); project.setDependencyArtifacts( Collections.EMPTY_SET ); File bundleFile = getTestFile( "src/test/resources/org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar" ); artifact.setFile( bundleFile ); BundleInfo bundleInfo = plugin.bundle( project ); Map exports = bundleInfo.getExportedPackages(); String[] packages = new String[] { "org.apache.maven.model.io.jdom", "org.apache.maven.model" }; for ( int i = 0; i < packages.length; i++ ) { assertTrue( "Bundle info does not contain a package that it is exported in the manifest: " + packages[i], exports.containsKey( packages[i] ) ); } assertFalse( "Bundle info contains a package that it is not exported in the manifest", exports.containsKey( "org.apache.maven.model.io.xpp3" ) ); } // public void testRewriting() // throws Exception // { // // MavenProjectStub project = new MavenProjectStub(); // project.setArtifact( getArtifactStub() ); // project.getArtifact().setFile( getTestBundle() ); // project.setDependencyArtifacts( Collections.EMPTY_SET ); // project.setVersion( project.getArtifact().getVersion() ); // // File output = new File( plugin.getBuildDirectory(), plugin.getBundleName( project ) ); // boolean delete = output.delete(); // // plugin.bundle( project ); // // init(); // try // { // plugin.bundle( project ); // fail(); // } // catch ( RuntimeException e ) // { // // expected // } // } } maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java000066400000000000000000000170441164564726100320050ustar00rootroot00000000000000package 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.Map; import java.util.Properties; import java.util.TreeMap; 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 aQute.lib.osgi.Analyzer; import aQute.lib.osgi.Builder; import aQute.lib.osgi.Jar; /** * Test for {@link BundlePlugin}. * * @author Felix Project Team */ public class BundlePluginTest extends AbstractBundlePluginTest { private BundlePlugin plugin; protected void setUp() throws Exception { super.setUp(); plugin = new BundlePlugin(); plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() ); plugin.setBuildDirectory( "." ); plugin.setOutputDirectory( new File( "." ) ); } public void testConvertVersionToOsgi() { String osgiVersion; osgiVersion = plugin.convertVersionToOsgi( "2.1.0-SNAPSHOT" ); assertEquals( "2.1.0.SNAPSHOT", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "2.1-SNAPSHOT" ); assertEquals( "2.1.0.SNAPSHOT", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "2-SNAPSHOT" ); assertEquals( "2.0.0.SNAPSHOT", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "2" ); assertEquals( "2.0.0", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "2.1" ); assertEquals( "2.1.0", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "2.1.3" ); assertEquals( "2.1.3", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "2.1.3.4" ); assertEquals( "2.1.3.4", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "4aug2000r7-dev" ); assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "1.1-alpha-2" ); assertEquals( "1.1.0.alpha-2", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "1.0-alpha-16-20070122.203121-13" ); assertEquals( "1.0.0.alpha-16-20070122_203121-13", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "1.0-20070119.021432-1" ); assertEquals( "1.0.0.20070119_021432-1", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "1-20070119.021432-1" ); assertEquals( "1.0.0.20070119_021432-1", osgiVersion ); osgiVersion = plugin.convertVersionToOsgi( "1.4.1-20070217.082013-7" ); assertEquals( "1.4.1.20070217_082013-7", osgiVersion ); } public void testReadExportedModules() throws Exception { File osgiBundleFile = getTestBundle(); assertTrue( osgiBundleFile.exists() ); MavenProject project = new MavenProjectStub(); project.setGroupId( "group" ); project.setArtifactId( "artifact" ); project.setVersion( "1.1.0.0" ); // PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer(); Builder analyzer = new Builder(); Jar jar = new Jar( "name", osgiBundleFile ); analyzer.setJar( jar ); analyzer.setClasspath( new Jar[] { jar } ); analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "*" ); analyzer.calcManifest(); assertEquals( 3, analyzer.getExports().size() ); analyzer.close(); } public void testTransformDirectives() throws Exception { Map instructions = new TreeMap(); instructions.put( "a", "1" ); instructions.put( "-a", "2" ); instructions.put( "_a", "3" ); instructions.put( "A", "3" ); instructions.put( "_A", "1" ); instructions.put( "_b", "4" ); instructions.put( "b", "6" ); instructions.put( "_B", "6" ); instructions.put( "-B", "5" ); instructions.put( "B", "4" ); instructions.put( "z", null ); instructions.put( "_z", null ); Map transformedInstructions = BundlePlugin.transformDirectives( instructions ); assertEquals( "1", transformedInstructions.get( "a" ) ); assertEquals( "3", transformedInstructions.get( "-a" ) ); assertEquals( null, transformedInstructions.get( "_a" ) ); assertEquals( "3", transformedInstructions.get( "A" ) ); assertEquals( "1", transformedInstructions.get( "-A" ) ); assertEquals( null, transformedInstructions.get( "_A" ) ); assertEquals( null, transformedInstructions.get( "_b" ) ); assertEquals( "4", transformedInstructions.get( "-b" ) ); assertEquals( "6", transformedInstructions.get( "b" ) ); assertEquals( null, transformedInstructions.get( "_B" ) ); assertEquals( "6", transformedInstructions.get( "-B" ) ); assertEquals( "4", transformedInstructions.get( "B" ) ); assertEquals( "", transformedInstructions.get( "z" ) ); assertEquals( "", transformedInstructions.get( "-z" ) ); } public void testDefaultPropertiesIncludeOrganization() { final Organization organization = new Organization(); organization.setName( "Example Organization" ); organization.setUrl( "http://example.org" ); // MavenProjectStub.setOrganization(Organization) doesn't do anything, so we have to make it work this way MavenProject project = new MavenProjectStub() { @Override public Organization getOrganization() { return organization; } }; project.setGroupId( "group" ); project.setArtifactId( "artifact" ); project.setVersion( "1.1.0.0" ); Properties properties = plugin.getDefaultProperties( project ); assertEquals( organization.getName(), properties.getProperty( "project.organization.name" ) ); assertEquals( organization.getName(), properties.getProperty( "pom.organization.name" ) ); assertEquals( organization.getUrl(), properties.getProperty( "project.organization.url" ) ); assertEquals( organization.getUrl(), properties.getProperty( "pom.organization.url" ) ); } public void testVersion() throws Exception { String cleanupVersion = Builder.cleanupVersion( "0.0.0.4aug2000r7-dev" ); assertEquals( "0.0.0.4aug2000r7-dev", cleanupVersion ); } public void testPackageInfoDetection() throws Exception { MavenProject project = new MavenProjectStub(); project.addCompileSourceRoot( getBasedir() + "/src/test/java" ); String resourcePaths = plugin.getMavenResourcePaths( project ); assertEquals( "org/apache/felix/bundleplugin/packageinfo=" + "src/test/java/org/apache/felix/bundleplugin/packageinfo", resourcePaths ); } } maven-bundle-plugin-2.3.5/src/test/java/org/apache/felix/bundleplugin/packageinfo000066400000000000000000000014601164564726100300770ustar00rootroot00000000000000# 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. packageinfo: version 888 maven-bundle-plugin-2.3.5/src/test/resources/000077500000000000000000000000001164564726100211665ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/resources/OSGI-INF/000077500000000000000000000000001164564726100223415ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/resources/OSGI-INF/blueprint/000077500000000000000000000000001164564726100243455ustar00rootroot00000000000000maven-bundle-plugin-2.3.5/src/test/resources/OSGI-INF/blueprint/bp.xml000066400000000000000000000043721164564726100254760ustar00rootroot00000000000000 p7.Foo maven-bundle-plugin-2.3.5/upgrade_local_poms.sh000077500000000000000000000013721164564726100216070ustar00rootroot00000000000000#!/bin/sh VERSION=$1 if [ "$VERSION" = "" ] then echo "Usage: $0 " exit fi cd ../pom for POM in `find .. -name .svn -prune -o -name pom.xml -print` do mvn "-DprojectFile=$POM" \ "-Dxpath=/project/build/plugins/plugin[artifactId[.='maven-bundle-plugin']]/version" \ "-DnewValue=$VERSION" \ org.apache.maven.plugins:maven-pom-plugin:1.0-SNAPSHOT:alter-by-xpath mvn "-DprojectFile=$POM" \ "-DskipXPath=/project/build/plugins/plugin[artifactId[.='maven-bundle-plugin']]/version" \ "-Dxpath=/project/build/plugins/plugin[artifactId[.='maven-bundle-plugin']]" \ "-DnewElement=version" "-DnewValue=$VERSION" \ org.apache.maven.plugins:maven-pom-plugin:1.0-SNAPSHOT:add-by-xpath done