Hello Carlos,

I had some time to play with the ManifestPlugin and that's what I did and found 
out so far.
In the ManifestPlugin class I
    - added the instructions Map to the properties
And now get the Bundle-Activator and Private-Package entries in the resulting 
MANIFEST.
Export-Packages still are not written to the MANIFEST.
The Export-Package property in the analyzer is set and I can follow until the 
Analyzer.analyze() method.
There the exportInstructions map contains the exported packages but are then 
lost when the
Analyzer.merge() method is called within the analyze() method.
The resulting exports Map from the merge() method is empty.
The merge() method is called with a Map actual (2nd param) which is empty and 
therefore nothing is added to the
Resulting map as no matching "packageName" is found for the export Instructions.

I hope this is helping you in any way,

Michael
     


 
 

-----Ursprüngliche Nachricht-----
Von: Hampel, Michael 
Gesendet: Dienstag, 13. Februar 2007 11:05
An: felix-dev@incubator.apache.org
Betreff: AW: maven-bundle plugin

 
Hello,

Thank's for your answers.
Carlos, I have tried out the maven-bundle plugin from the repository.
Unfortunately, when running the bundle goal I get an exception when using the 
following configuration:
    <plugin>    
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>0.9.0-incubator-SNAPSHOT</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>            
            <Export-Package>com.mh.mc.recorder.bundle.*</Export-Package>        
              
            
<Bundle-Activator>com.mh.mc.recorder.bundle.Activator</Bundle-Activator>
          </instructions>          
        </configuration>        
      </plugin> 

The same configuration works when using the felix maven-bundle plugin.
Please find the StackTrace below. 

I also have tried out the manifest goal. It creates the MANIFEST.MF file but
Appears to ignore the instructions - but probably its only me doing something 
wrong.
I have tried:

        <plugin>    
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>0.9.0-incubator-SNAPSHOT</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>            
            <Export-Package>com.siemens.mc.recorder.bundle.*</Export-Package>   
   
            
<Bundle-Activator>com.siemens.mc.recorder.bundle.Activator</Bundle-Activator>
          </instructions>          
        </configuration>
        <executions>
        <execution>
          <id>manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
            <configuration>
                <skip>false</skip>              
                <manifestLocation>../META-INF</manifestLocation>
            </configuration>
        </execution>
        <execution>
          <id>bundle</id>
            <phase>package</phase>
            <goals>
              <goal>bundle</goal>
            </goals>
        </execution>
        </executions-->        
      </plugin>    <!-- (2) END -->

The resulting MANIFEST file looks like:

Manifest-Version: 1
Bundle-Name: buildOSGiMaven
Created-By: Bnd-0.0.110
Import-Package: *
Bundle-ManifestVersion: 2
Bundle-SymbolicName: com.mh.mc.buildOSGiMaven
Include-Resource: src/main/resources/
Bundle-Version: 1.0.0.SNAPSHOT

Unfortunately I just know to less about Maven and bnd internals to help a lot 
with the code but I'll probably
Try to write a test case for the maven goal to see what happens.

Anyway thank's a lot for the link and the plugin, because in the end I think it 
will exactly provide
What is needed.

Regards,

Michael

Stacktrace for bundle goal:

[INFO] [bundle:bundle]
[ERROR] The JAR is empty
org.apache.maven.plugin.MojoFailureException: Found errors, see log
        at 
org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:156)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenC[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Found errors, see log
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unknown error occurred
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unknown error 
occurred
        at 
org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:171)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
        ... 16 more
Caused by: org.apache.maven.plugin.MojoFailureException: Found errors, see log
        at 
org.apache.felix.tools.maven2.bundleplugin.BundlePlugin.execute(BundlePlugin.java:156)
        ... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Tue Feb 13 10:43:20 CET 2007
li.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


 

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Carlos Sanchez
Gesendet: Montag, 12. Februar 2007 19:58
An: felix-dev@incubator.apache.org
Betreff: Re: maven-bundle plugin

Actually I have almost get it to work, the manifest just seems not to
be right yet.

Latest code of my branch of the bundle plugin is at
http://svn.apache.org/repos/asf/maven/sandbox/plugins/maven-bundle-plugin/
if you want to give it a try.

On 2/12/07, Richard S. Hall <[EMAIL PROTECTED]> wrote:
>  From what Peter says, it doesn't sound like this is easily possible:
>
>     This is not possible ... The bnd file == the manifest. You can't have the 
> definition in two places. So or you use the PDE where the manifest describes 
> your classpath (together with Eclipse magic), and then no bnd. Or you use the 
> JDE with bnd  ...
>
> -> richard
>
> Hampel, Michael wrote:
> > Hello,
> >
> > I have  a question regarding the maven-bundle plugin and MANIFEST
> > generation.
> > Is it possible to generate the manifest also additionally outside of the
> > resulting jar or is it
> > possible to work with an existing MANIFEST file like in the maven-osgi
> > plugin?
> > When developing in eclipse I need a MANIFEST file to run my bundle
> > within the eclipse
> > OSGi runtime and I don't want to have two different MANIFEST files. Also
> > I want
> > to have the possibility to change the MANIFEST file.
> >
> > Thank's in advance for any help,
> >
> > Michael
> >
> >
> >
> >
> >
> >
>


-- 
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

Reply via email to