You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Stefan Seelmann <se...@apache.org> on 2009/02/06 12:13:33 UTC

[Studio] Creating MANIFEST.MF using mvn studio:eclipse

Hi,

When checking out studio from SVN and running "mvn studio:eclipse" the
MANIFEST.MF isn't created properly. No "Export-Package" is created in
the MANIFEST.MF.

In the following I use the "jars" plugin only.

I found out that "bundle:manifest" brings some warnings:
--------------------------------------------
[WARNING] Warning in manifest for
org.apache.directory.studio:jars:jar:1.4.0-SNAPSHOT : No sub JAR or
directory lib/studio-dsml-parser-0.4.4-SNAPSHOT.jar
...
--------------------------------------------

That is because target/classes/lib with all the jars doesn't exist.

If I run a "mvn compile" first then all jars from the lib folder are
copied to target/classes/lib. Then "bundle:mainifest" works properly and
creates the "Export-Package" header.

As a workaround I modified the StudioEclipseMojo and added a
  forkMvnGoal( "compile" );
before running "bundle:manifest".

It works but I wonder if that is a proper solution, Felix?

Kind Regards,
Stefan

Re: [Studio] Creating MANIFEST.MF using mvn studio:eclipse

Posted by Pierre-Arnaud Marcelot <pa...@marcelot.net>.
Hi Stefan,

This is strange we did not notice that ealier...

That's a good quick fix.

Anyways, I think we'll need to find a better one because generating eclipse
descriptors should be very quick and I'm affraid adding the 'compile' goal
will dramatically increase the generation time.

Regards,
Pierre-Arnaud

On Fri, Feb 6, 2009 at 12:13 PM, Stefan Seelmann <se...@apache.org>wrote:

> Hi,
>
> When checking out studio from SVN and running "mvn studio:eclipse" the
> MANIFEST.MF isn't created properly. No "Export-Package" is created in
> the MANIFEST.MF.
>
> In the following I use the "jars" plugin only.
>
> I found out that "bundle:manifest" brings some warnings:
> --------------------------------------------
> [WARNING] Warning in manifest for
> org.apache.directory.studio:jars:jar:1.4.0-SNAPSHOT : No sub JAR or
> directory lib/studio-dsml-parser-0.4.4-SNAPSHOT.jar
> ...
> --------------------------------------------
>
> That is because target/classes/lib with all the jars doesn't exist.
>
> If I run a "mvn compile" first then all jars from the lib folder are
> copied to target/classes/lib. Then "bundle:mainifest" works properly and
> creates the "Export-Package" header.
>
> As a workaround I modified the StudioEclipseMojo and added a
>  forkMvnGoal( "compile" );
> before running "bundle:manifest".
>
> It works but I wonder if that is a proper solution, Felix?
>
> Kind Regards,
> Stefan
>

Re: [Studio] Creating MANIFEST.MF using mvn studio:eclipse

Posted by Felix Knecht <fe...@apache.org>.
Stefan Seelmann schrieb:
> Maybe it is easier to copy the all jars from the "artifactList" to
> "classesOutDir".
> 
> Stefan Seelmann wrote:
>> Hi,
>>
>> When checking out studio from SVN and running "mvn studio:eclipse" the
>> MANIFEST.MF isn't created properly. No "Export-Package" is created in
>> the MANIFEST.MF.
>>
>> In the following I use the "jars" plugin only.
>>
>> I found out that "bundle:manifest" brings some warnings:
>> --------------------------------------------
>> [WARNING] Warning in manifest for
>> org.apache.directory.studio:jars:jar:1.4.0-SNAPSHOT : No sub JAR or
>> directory lib/studio-dsml-parser-0.4.4-SNAPSHOT.jar
>> ...
>> --------------------------------------------
>>
>> That is because target/classes/lib with all the jars doesn't exist.
>>
>> If I run a "mvn compile" first then all jars from the lib folder are
>> copied to target/classes/lib. Then "bundle:mainifest" works properly and
>> creates the "Export-Package" header.
>>
>> As a workaround I modified the StudioEclipseMojo and added a
>>   forkMvnGoal( "compile" );
>> before running "bundle:manifest".
>>
>> It works but I wonder if that is a proper solution, Felix?

I don't have that much more knowledge. If it works and has no unwanted side effects ... ;-)
I'm absolutely fine with that.

Felix


Re: [Studio] Creating MANIFEST.MF using mvn studio:eclipse

Posted by Stefan Seelmann <se...@apache.org>.
Maybe it is easier to copy the all jars from the "artifactList" to
"classesOutDir".

Stefan Seelmann wrote:
> Hi,
> 
> When checking out studio from SVN and running "mvn studio:eclipse" the
> MANIFEST.MF isn't created properly. No "Export-Package" is created in
> the MANIFEST.MF.
> 
> In the following I use the "jars" plugin only.
> 
> I found out that "bundle:manifest" brings some warnings:
> --------------------------------------------
> [WARNING] Warning in manifest for
> org.apache.directory.studio:jars:jar:1.4.0-SNAPSHOT : No sub JAR or
> directory lib/studio-dsml-parser-0.4.4-SNAPSHOT.jar
> ...
> --------------------------------------------
> 
> That is because target/classes/lib with all the jars doesn't exist.
> 
> If I run a "mvn compile" first then all jars from the lib folder are
> copied to target/classes/lib. Then "bundle:mainifest" works properly and
> creates the "Export-Package" header.
> 
> As a workaround I modified the StudioEclipseMojo and added a
>   forkMvnGoal( "compile" );
> before running "bundle:manifest".
> 
> It works but I wonder if that is a proper solution, Felix?
> 
> Kind Regards,
> Stefan


Re: [Studio] Creating MANIFEST.MF using mvn studio:eclipse

Posted by Felix Knecht <fe...@apache.org>.
Felix Knecht schrieb:
>> Hi,
>>
>> When checking out studio from SVN and running "mvn studio:eclipse" the
>> MANIFEST.MF isn't created properly. No "Export-Package" is created in
>> the MANIFEST.MF.
>>
>> In the following I use the "jars" plugin only.
>>
>> I found out that "bundle:manifest" brings some warnings:
>> --------------------------------------------
>> [WARNING] Warning in manifest for
>> org.apache.directory.studio:jars:jar:1.4.0-SNAPSHOT : No sub JAR or
>> directory lib/studio-dsml-parser-0.4.4-SNAPSHOT.jar
>> ...
>> --------------------------------------------
>>
>> That is because target/classes/lib with all the jars doesn't exist.
> 
> If it's everywhere only a problem of copying the missing jar files to target/classes/lib it's probably faster to add
> just something to copy the libraries. Please note that this will only work if the snapshot repository is available
> (especially for the jars module ut maybe for others as well). If the user runs "mvn studio:eclipse -o" (-o for offline)
> it'll still not work because of missing dependencies.
> Maybe another solution is to have the export packages explicitly listed instead of using the wildcard '*'. So it'll be
> something like
> 
> <Export-Package>org.apache.commons.collections.keyvalue;uses:="org.apache.commons.collections";version="1.4.0.SNAPSHOT",
> org.apache.log4j;uses:="org.slf4j.impl,org.apache.log4j.config,org.apache.log4j.helpers,
> <snip>...<snip>
> org.apache.directory.shared.asn1.ber.tlv;uses:="org.apache.directory.shared.asn1.util,
> org.apache.directory.shared.asn1.primitives,
> org.apache.directory.shared.asn1.codec";version="1.4.0.SNAPSHOT",
> org.xmlpull.v1.builder.impl;uses:="org.xmlpull.v1,
> org.xmlpull.v1.builder";version="1.4.0.SNAPSHOT"</Export-Package>
> 
> instead of
> 
> <Export-Package>!org.apache.commons.lang.enum,*</Export-Package>
> 
> As it's nicer and easier to maintain I'd look for a solution to copy the missing dependencies into target/classes/lib before.

:( This will not work. The problem is the the bundle:manifest goal is designed to be run just before creating the
library (jar) file and build the MF file according to what was built. Using the bundle:manifest goal as we do isn't
according the the lifecycle design of this goal.

We can add something like
Index: src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
===================================================================
--- src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java      (Revision 746847)
+++ src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java      (Arbeitskopie)
@@ -144,6 +144,7 @@
         {
             try
             {
+                forkMvnGoal( "studio:prepare-jar-package" );
                 forkMvnGoal( "bundle:manifest" );
             }
             catch ( Exception e )

This will make the jars available in the target/calsses/lib directory and put the packages into the MF Export-Package:
section. But this will not still not work for a configuration like <Export-Package>*</Export-Package>. "These packages
are copied into the resulting bundle JAR file from the available classes (i.e., project classes, dependencies, and class
path);" [1] -> classes from the module itself are found without beeing compiled before only in the src/java folder but
not in the classpath! Thus they will still not appear in the MF Export-Package: section :(

-> Use patch above and make sure to have explicit listed package names from the current module and NOT include all using
wildcard '*'
-> Or at least compile the whole project before using mvn studio:eclipse


[1] http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html <Export-Package>

> 
> Regards
> Felix
> 
>> If I run a "mvn compile" first then all jars from the lib folder are
>> copied to target/classes/lib. Then "bundle:mainifest" works properly and
>> creates the "Export-Package" header.
>>
>> As a workaround I modified the StudioEclipseMojo and added a
>>   forkMvnGoal( "compile" );
>> before running "bundle:manifest".
>>
>> It works but I wonder if that is a proper solution, Felix?
>>
>> Kind Regards,
>> Stefan
>>
> 


Re: [Studio] Creating MANIFEST.MF using mvn studio:eclipse

Posted by Felix Knecht <fe...@apache.org>.
> Hi,
> 
> When checking out studio from SVN and running "mvn studio:eclipse" the
> MANIFEST.MF isn't created properly. No "Export-Package" is created in
> the MANIFEST.MF.
> 
> In the following I use the "jars" plugin only.
> 
> I found out that "bundle:manifest" brings some warnings:
> --------------------------------------------
> [WARNING] Warning in manifest for
> org.apache.directory.studio:jars:jar:1.4.0-SNAPSHOT : No sub JAR or
> directory lib/studio-dsml-parser-0.4.4-SNAPSHOT.jar
> ...
> --------------------------------------------
> 
> That is because target/classes/lib with all the jars doesn't exist.

If it's everywhere only a problem of copying the missing jar files to target/classes/lib it's probably faster to add
just something to copy the libraries. Please note that this will only work if the snapshot repository is available
(especially for the jars module ut maybe for others as well). If the user runs "mvn studio:eclipse -o" (-o for offline)
it'll still not work because of missing dependencies.
Maybe another solution is to have the export packages explicitly listed instead of using the wildcard '*'. So it'll be
something like

<Export-Package>org.apache.commons.collections.keyvalue;uses:="org.apache.commons.collections";version="1.4.0.SNAPSHOT",
org.apache.log4j;uses:="org.slf4j.impl,org.apache.log4j.config,org.apache.log4j.helpers,
<snip>...<snip>
org.apache.directory.shared.asn1.ber.tlv;uses:="org.apache.directory.shared.asn1.util,
org.apache.directory.shared.asn1.primitives,
org.apache.directory.shared.asn1.codec";version="1.4.0.SNAPSHOT",
org.xmlpull.v1.builder.impl;uses:="org.xmlpull.v1,
org.xmlpull.v1.builder";version="1.4.0.SNAPSHOT"</Export-Package>

instead of

<Export-Package>!org.apache.commons.lang.enum,*</Export-Package>

As it's nicer and easier to maintain I'd look for a solution to copy the missing dependencies into target/classes/li before.

Regards
Felix

> 
> If I run a "mvn compile" first then all jars from the lib folder are
> copied to target/classes/lib. Then "bundle:mainifest" works properly and
> creates the "Export-Package" header.
> 
> As a workaround I modified the StudioEclipseMojo and added a
>   forkMvnGoal( "compile" );
> before running "bundle:manifest".
> 
> It works but I wonder if that is a proper solution, Felix?
> 
> Kind Regards,
> Stefan
>