felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuri de Wit <yde...@gmail.com>
Subject Re: maven-bundle-plugin and .impl and .internal packages
Date Sun, 01 May 2011 23:19:39 GMT
Thanks. I didn't know about "mvn help:effective-pom".

This is what I added to my local branch (it's a small bit but it could
have helped me):

thanks,
- yuri

diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 084d55c..664093f 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -323,6 +323,7 @@ public class BundlePlugin extends AbstractMojo

                 try
                 {
+                    getLog().info( "Writting MANIFEST.MF to " +
outputFile + " ..." );
                     Manifest manifest = builder.getJar().getManifest();
                     ManifestPlugin.writeManifest( manifest, outputFile );
                 }
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
index 6e5677e..65ec799 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
@@ -90,6 +90,7 @@ public class ManifestPlugin extends BundlePlugin

         try
         {
+            getLog().info( "Writting MANIFEST.MF to " + outputFile + " ..." );
             writeManifest( manifest, outputFile );
         }
         catch ( IOException e )


On Sun, May 1, 2011 at 6:54 PM, Stuart McCulloch <mcculls@gmail.com> wrote:
> On 1 May 2011 17:37, Yuri de Wit <ydewit@gmail.com> wrote:
>
>> Thanks for the answer, Stuart.
>>
>> I did read the documentation and followed the instructions there, but
>> although I had an Export-Package setting it was not being picked up.
>>
>> It turns out that the issue had nothing to do with
>> maven-bundle-plugin, but self-inflicted with a little "help" from
>> maven. I had the plugin configured twice in my parent pom's
>> pluginManagement (it's a few pages long) and maven was silently
>> ignoring the first one, which had all the settings. In my bundle
>> configuration I had:
>>
>>
>> <Export-Package>!${project.groupId}.${project.artifactId}.internal.*,${project.groupId}.${project.artifactId}.*</Export-Package>
>>
>> <Private-Package>${project.groupId}.${project.artifactId}.internal.*</Private-Package>
>>
>> Removing the dup one fixed the problem.
>>
>
> FYI, I find "mvn help:effective-pom" helps to solve these sorts of problems,
> since it shows you the final merged pom
>
>
>> I also added a bit of logging to BundlePlugin and ManifestPlugin to
>> help track what it is actually doing and double check it was doing
>> what I wanted:
>>
>
> Cool - we already do some logging of what gets sent to bnd and what comes
> back, but you need to add "-X" to see it
>
> (unfortunately this also produces a lot of other maven related debug output)
>
>
>> [INFO] Writting MANIFEST.MF to
>> /Users/joe/Workspaces/hello/hello.bundles/hello.core/META-INF/MANIFEST.MF
>> ...
>>
>> thanks,
>> -- yuri
>>
>> On Sun, May 1, 2011 at 7:52 AM, Stuart McCulloch <mcculls@gmail.com>
>> wrote:
>> > On 30 April 2011 23:47, Yuri de Wit <ydewit@gmail.com> wrote:
>> >
>> >> I have been going in circles trying to figure out why certain packages
>> >> weren't being exported until I noticed, after taking a look at the
>> >> sources, that the maven-bundle-plugin seems to be skipping .impl and
>> >> .internal packages.
>> >
>> >
>> > That's correct - if you don't define any Export-Package then it defaults
>> to
>> > the local non-internal / non-impl packages, as described in the "Default
>> > Behavior" section:
>> >
>> >   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
>> >
>> > After I renamed my package to something else it
>> >> worked as expected.
>> >>
>> >> Is this restriction imposed by the OSGi specs? Although in theory
>> >> .impl means an internal package it is not always the case. Renaming
>> >> the package is an option, but seems a bit invasive (specially without
>> >> knowing a good reason for it to be the way it is). Last, is there a
>> >> simple work around for this beyond renaming the package?
>> >>
>> >
>> > There is nothing in the specs that restrict implementation packages from
>> > being exported, the bundleplugin defaults are based on user feedback
>> > and current best-practice. But they are only defaults - if you want to
>> > export internal packages then you can do so by explicitly setting
>> > Export-Package (or _exportcontents if you're exporting packages from
>> > embedded JARs, see the above link and FAQ for more details).
>> >
>> > Though ideally you wouldn't want to export implementation packages, since
>> > one benefit of modularity is that you can hide away internal /
>> > implementation details and instead communicate via interfaces and
>> services.
>> > That way you get loose coupling, and substitutable bundles.
>> >
>> >
>> >> -- yuri
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> >> For additional commands, e-mail: users-help@felix.apache.org
>> >>
>> >
>> > --
>> > Cheers, Stuart
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message