Hello Wade,
I am assuming you are using the maven-bundle-plugin which is a wrapper around
the bnd tool. This is a very good and useful tool, but sometimes it sees a bit
much. It actually isn't bnd:s fault. It can't determine what is relevant and
what is not.
I had a very similar problem. Note that I didn't know about the !package to
exclude so I never tried that. That sounds like it should do the trick. I any
case what I did in this very specific case was to let maven-bundle-plugin
generate a MANIFEST.MF for me. Then I changed my project to
<packaging>jar</packaging> instead and put the MANIFEST.MF under
src/main/resources/META-INF and added the following to my pom:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
After that I edited the MANIFEST.MF "Import-Package:" part removing any import
I thought irrelevant. Basically I kept any package part of rt.jar (java.*
javax.*, org.w3c.*), and packages imported by my code. It then worked fine. I
think I removed about 70% of the generated imports so excluding them with
!package would have been messy.
The problem arises when you have dependencies on "large" frameworks/libraries
with many dependencies. In my case openjpa-all-2.2.0.jar pulled in tons of
packages that weren't needed and weren't available runtime.
In this case openjpa-all-2.2.0.jar did not automatically get included in the
bundle so I put it and another jar I needed into src/main/resources/lib, and
modified Bundle-Classpath accordingly:
Bundle-ClassPath: .,
lib/openjpa-all-2.2.0.jar,
lib/xob-4.0.jar
in MANIFEST.MF.
Maven might provide a better way to bundle dependencies without
maven-bundle-plugin.
I did spend a lot of time before I gave up and took this approach. Manually
managing the MAINFEST.MF file when needed is not that difficult. I do stick to
using maven-bundle-plugin for most of my bundles. I use this approach only when
it gives me to many imports.
/Tommy
26 okt 2013 kl. 16:19 skrev Wade Girard <[email protected]>:
> is there something that I am doing wrong???
>
> I tried adding optional=true to everything, that did not resolve it, and
> neither did the !oracle.xml thing. So I found the oracle jdeveloper tools,
> downloaded them, and added the oracle.xml jars to my maven repository, and to
> my dependencies. Which is odd to me because I ever needed it before.
>
> Since then it has just been a constant string of jars that I have had to go
> out and find, download, put in my repository, and add into the dependencies
> in my pom and the Private-Package definition.
>
> It just feels wrong. The reason I say that is that before, I didn't need to
> include all this stuff in my project, and my jar file worked perfectly fine.
>
> Am I missing something? Now it's asking for javax.resource… I'm kind of stuck
> on this one.
>
> Plus, in order to find all of these I am having to build the jar, uninstall
> the previous jar from felix, install the new jar, and try and start it. I
> then look at the error and try to resolve it, rinse and repeat. Is that
> really the correct way to go about this?
>
> Thanks for your help.
> Wade
>
> On Oct 25, 2013, at 7:30 AM, Snorre Lothar von Gohren Edwin
> <[email protected]> wrote:
>
>> Or you can try to figure out which bundle depends on oracle.xml and put it
>> with a flag optional=true.
>> This happened when I tried to create a bundle out of the OPC-UA SDK from
>> prosys.
>> I had the same problem with sun.security.x509 and sun.security.util on
>> some packages. But these are usually integrated into the JVM.
>>
>>
>> On Fri, Oct 25, 2013 at 2:24 PM, Richard S. Hall <[email protected]>wrote:
>>
>>> Try to exclude it in your Import-Package in your pom.xml (e.g.,
>>> "!oracle.xml.*").
>>>
>>> -> richard
>>>
>>>
>>> On 10/25/13, 00:15 , Wade Girard wrote:
>>>
>>>> I have been experimenting with felix and learning OSGi for the last week.
>>>> I really like what it has to offer and believe that I can use it for an
>>>> upcoming project that I am working on.
>>>>
>>>> I have been using maven to build bundles, and creating small test
>>>> bundles, that has been going well. I have run into a snag though while
>>>> trying to create a bundle from an existing jar file project. To figure out
>>>> the dependencies that I need to include in the jar, by adding to the
>>>> "Private-Package" in the pom.xml for the bundle plugin, I have been
>>>> building-installing-starting, and then just adding each missing package as
>>>> it's reported.
>>>>
>>>> I am currently stuck on this one though
>>>>
>>>> org.osgi.framework.**BundleException: Unresolved constraint in bundle
>>>> x.y.x [41]: Unable to resolve 41.0: missing requirement [41.0]
>>>> osgi.wiring.package; (osgi.wiring.package=oracle.**xml.parser)
>>>>
>>>> That package is not being used in my project directly, I do use an xml
>>>> reader to read rss feeds, that uses the com.sun.syndication.io.**XmlReader
>>>> class.
>>>>
>>>> If I add "oracle.xml.*" to the list of packages, then the build gives the
>>>> warning message
>>>> [WARNING] Warning building bundle x.y:z:bundle:2.0.0 : Instructions for
>>>> Private-Package that are never used: oracle\.xml\..*|oracle\.xml
>>>> and when I install-start the bundle I get the same error message
>>>>
>>>> Any help is appreciated
>>>>
>>>> Thanks
>>>> Wade
>>>>
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail:
>>> users-unsubscribe@felix.**apache.org<[email protected]>
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>> --
>> Mvh
>> Snorre Lothar von Gohren Edwin
>> MeetMe: http://doodle.com/vonGohren
>> +47 411 611 94
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]