You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Peter Kriens <Pe...@aQute.biz> on 2006/12/01 11:31:22 UTC

Re[2]: maven-osgi-plugin follow bundle dependencies?

AS> [ERROR] Importing packages that are never refered to by any class on the
AS> Bundle-Classpath[Jar:dot]: [*]
AS> [ERROR] The JAR is empty
The messages indicates there is no code included because you have not
specified any Export-Package or Private-Package instruction nor any
Include-Resource so no code is included, so the result is empty, so
there is no code, so there are no imports required ...

There is no specific log as far as I know, the messages are printed on
the console.

I understand you want to be able to generate just the manifest from
(Eclipse?) classpath. This will interferes with the Plugin Development
Environment (PDE). The classpath is defined by the PDE using the
manifest ... so generating the manifest from this information seems
circular?

The normal Maven approach is to let Maven define the .classpath file
(mvn eclipse:eclipse) and use the Java Development Environment (JDE),
not the PDE. The JDE does not require the manifest, it uses the
.classpath file in the project.

The only disadvantage I found with the PDE is that you need to run
maven or bnd before you debug or run. However, you can run bnd as an
Eclipse plugin which usually adds less than a second to build the JAR.
The advantage of a build phase is that you are not forced to do your
development work in the runtime environment (like META-INF/MANIFEST.MF
must always be perfect) but can optimize the development environment
for development purpose and construct the necessary (redundant)
artifacts when you run bnd.

I think you'll need to choose who is in charge of the classpath: PDE
or maven. If it is maven, I would choose the JDE and add the bnd
plugin for your development edit-debug cycle. If it is PDE, I do not
think the plugin in its current incarnation can be used. and I am not
sure I see a way how to extend the bnd plugin to make it useful in this
context, but I am open for ideas.

Kind regards,

     Peter Kriens








AS> Thanks for the help.

AS> I did do some simple testing and it does appear to do what I hoped it would.

AS> I'm now using maven-bundle-plugin.  It compiles the sources correctly but
AS> fails with:

AS> ...
AS> [INFO] [bundle:bundle]
AS> [ERROR] Importing packages that are never refered to by any class on the
AS> org.apache.maven.plugin.MojoFailureException: Found errors, see log
AS>         at
AS> org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.
AS> java:150)
AS> ...

AS> I'm not sure where the log is supposed to be.

AS> Maybe it'll help if I explain what I'm trying to do.  I'm working on equinox
AS> bundles that can be edited in the Eclipse IDE.  These aren't meant for an RCP
AS> app or anything.  They are just standard OSGi bundles with a few extra
AS> resources (like plugin.xml, etc.)  But, to edit sources in eclipse the
AS> manifest.mf file needs to be available (and in a META-INF directory) to the
AS> IDE so that the editor can resolve classes (eclipse will use the manifest.mf
AS> file for class resolution in the editor.)  It doesn't really help me if
AS> manifest.mf doesn't exist until packaging and only then in the target
AS> directory.  Is there any way to get a copy of the plugin-constructed manifest
AS> file put into ${basedir}/META-INF so that eclipse is happy?

AS> My current pom.xml looks like the following (note comments):

AS> <project xmlns="http://maven.apache.org/POM/4.0.0"
AS>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
AS>         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
AS>                       http://maven.apache.org/maven-v4_0_0.xsd">
AS>         <modelVersion>4.0.0</modelVersion>
AS>                 <groupId>ourgroup</groupId>
AS>         <artifactId>ourartifact</artifactId>
AS>         <packaging>bundle</packaging>
AS>         <version>1.0.0</version>
AS>         <name>some name</name>
AS>         <dependencies>
AS>                 <dependency>
AS>                         <!--This is a bundle that is needed only for
AS> compilation and should be added to Required-Bundles -->
AS>                         <groupId>equinox</groupId>
AS>                         <artifactId>apache_common_logging</artifactId>
AS>                         <version>1.0.4</version>
AS>                         <scope>provided</scope>
AS>                 </dependency>
AS>                 <dependency>
AS>                         <!-- This is a bundle that is needed only for
AS> compilation and should be added to Required-Bundles -->
AS>                         <groupId>equinox</groupId>
AS>                         <artifactId>servlet_api</artifactId>
AS>                         <version>1.0.0.v20060717</version>
AS>                         <scope>provided</scope>
AS>                 </dependency>
AS>                 <dependency>
AS>                         <!-- All other dependencies are standard library
AS> .jars and need to be packaged with the bundle and specified in the
AS> Bundle-Classpath in the manifest -->
AS>                         <groupId>jpivot</groupId>
AS>                         <artifactId>jpivot</artifactId>
AS>                         <version>0.0.1</version>
AS>                 </dependency>
AS>                 <dependency>
AS>                         <groupId>jpivot</groupId>
AS>                         <artifactId>wcf</artifactId>
AS>                         <version>0.0.1</version>
AS>                 </dependency>
AS>         </dependencies>
AS>         <build>
AS>                 <sourceDirectory>${basedir}/src</sourceDirectory>
AS>                 <plugins>
AS>                         <plugin>
AS>                                
AS> <artifactId>maven-bundle-plugin</artifactId>
AS>                                 <groupId>org.apache.felix</groupId>
AS>                                 <version>0.8.0-SNAPSHOT</version>
AS>                                 <extensions>true</extensions>
AS>                                 <configuration>
AS>                                 </configuration>
AS>                         </plugin>
AS>                 </plugins>
AS>         </build>
AS> </project>

AS> -----Original Message-----
AS> From: Richard S. Hall [mailto:heavy@ungoverned.org] 
AS> Sent: Thursday, November 30, 2006 3:23 PM
AS> To: felix-dev@incubator.apache.org
AS> Subject: Re: maven-osgi-plugin follow bundle dependencies?

AS> Aaron Siri wrote:
>> I'm wondering if it'll resolve classes that are in a dependency bundle.
>>   

AS> Well, I am still not clear as to what you are saying. Best way to figure it
AS> out is to create a simple example and see if it does what you expect.

>> Also, I specified my own manifest file via the <manifestFile> tag but 
>> it seems to be ignored (at least nothing in that file has been put 
>> into the manifest file in final .jar).
>>   

AS> Hmm. Not sure on this issue, since I never used the manifestFile option...I
AS> always just put everything in the pom file...and now I use the new bundle
AS> plugin...

->> richard
>> -Aaron
>>
>> -----Original Message-----
>> From: Richard S. Hall [mailto:heavy@ungoverned.org]
>> Sent: Thursday, November 30, 2006 3:02 PM
>> To: felix-dev@incubator.apache.org
>> Subject: Re: maven-osgi-plugin follow bundle dependencies?
>>
>> Aaron Siri wrote:
>>   
>>>  I'm wondering if the maven-osgi-plugin will properly add 
>>> Bundle-Classpath entries from dependencies to the classpath when 
>>> doing a
>>>     
>> compile?
>>   
>>> Specifically, can you specify a bundle as a maven dependency and have 
>>> the plugin do the right thing with the classpath entries in the 
>>> manifest from the dependencies when compiling.
>>>     
>>
>> If I understand your question correctly, yes you can have the plugin 
>> automatically embed your dependent JAR files inside of your bundle and 
>> put them on the bundle class path. See the "Advanced Features" section 
>> of this
>> document:
>>
>>     http://cwiki.apache.org/FELIX/osgi-plugin-for-maven-2.html
>>
>> The new maven bundle plugin uses a different approach where you simply 
>> specify which packages on the compile-time class path should be 
>> include in your bundle. Its documentation is here:
>>
>>     http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html
>>
>> -> richard
>>   


-- 
Peter Kriens                              Tel +33467542167
9C, Avenue St. Drézéry                    AOL,Yahoo: pkriens
34160 Beaulieu, France                    ICQ 255570717
Skype pkriens                             Fax +1 8153772599