Need help wrapping third party to a bundle [message #1446322] |
Thu, 16 October 2014 17:35 |
nemewsys hellius Messages: 1 Registered: October 2014 |
Junior Member |
|
|
Hello!
I need to use these two packages in my code:
import org.apache.commons.validator.routines.DomainValidator;
import org.apache.commons.validator.routines.InetAddressValidator;
So I need to grab apache commons-validator 1.4.0 and make it a bundle.
For that I've created a new maven project, consisting only in one POM file, where the POM contains the following:
<modelVersion>4.0.0</modelVersion>
<groupId>apache-commons-validator-osgi</groupId>
<artifactId>apache-commons-validator-osgi</artifactId>
<version>1.4.0</version>
<packaging>bundle</packaging>
<name>${project.groupId} - ${project.artifactId}</name>
<description>
Demonstrates how to easily deploy the classes contained in a pre-packaged vanilla jar file into an OSGi
container, when the jar does not contain the necessary OSGi manifest headers.
</description>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Embed-Transitive>true</Embed-Transitive>
<_exportcontents>
org.apache.commons.validator.*;version=${commons-validator.version}
</_exportcontents>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<commons-validator.version>1.4.0</commons-validator.version>
</properties>
<dependencies>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
</dependency>
</dependencies>
However, when I compile this project, the resulting bundle manifest will start importing new stuff... Check the Import-Package tag of the generated MANIFEST.MF here:
Manifest-Version: 1
Bnd-LastModified: 1413479060520
Build-Jdk: 1.6.0_65
Built-By: Pedro
Bundle-ClassPath: .,OSGI-INF/lib/commons-beanutils-1.8.3.jar,OSGI-INF/li
b/commons-digester-1.8.jar,OSGI-INF/lib/commons-validator-1.4.0.jar,OSG
I-INF/lib/commons-logging-1.1.1.jar
Bundle-Description: Demonstrates how to easily deploy the classes contai
ned in a pre-packaged vanilla jar file into an OSGi container, when the
jar does not contain the necessary OSGi manifest headers.
Bundle-ManifestVersion: 2
Bundle-Name: apache-commons-validator-osgi - apache-commons-validator-os
gi
Bundle-SymbolicName: apache-commons-validator-osgi
Bundle-Version: 1.4.0
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile|runtime
Embed-Directory: OSGI-INF/lib
Embed-Transitive: true
Export-Package: org.apache.commons.validator.javascript;version="1.4.0",
org.apache.commons.validator.util;uses:="org.apache.commons.validator";
version="1.4.0",org.apache.commons.validator.routines.checkdigit;versio
n="1.4.0",org.apache.commons.validator.resources;version="1.4.0",org.ap
ache.commons.validator.routines;uses:="org.apache.commons.validator.rou
tines.checkdigit";version="1.4.0",org.apache.commons.validator;uses:="o
rg.apache.commons.validator.util,org.apache.commons.validator.routines,
org.xml.sax";version="1.4.0"
Import-Package: javax.servlet,javax.xml.parsers,org.apache.avalon.framew
ork.logger,org.apache.commons.collections.comparators,org.apache.common
s.collections.keyvalue,org.apache.commons.collections.list,org.apache.c
ommons.collections.set,org.apache.log,org.apache.log4j,org.w3c.dom,org.
xml.sax,org.xml.sax.helpers
Tool: Bnd-1.43.0
I would expect it to import nothing and be self-contained... I hate this stuff when working with OSGi, including 3rd party dependencies is very hard
How can I make this bundle self-contained?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03091 seconds