Discussion:
maven-jar-plugin and maven-ejb-plugin / generate manifest if not present
Julien CARSIQUE
2008-01-24 17:40:15 UTC
Permalink
Hello,

I would like the plugin to use the given manifest, if present, and add
some properties; and to generate the manifest if it doesn't exist.
Is it possible ?

Here is my common configuration in the parent pom :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>

<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-Version>${pom.version}</Bundle-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>

For now, if there's no manifest in the specified place, I got this error :
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error assembling JAR

Embedded error: Manifest file:
.../src/main/resources/META-INF/MANIFEST.MF does not exist.

Of course, the aim is to have a generic configuration, in order not
having to specify for each artifact if there's a manifest, or none.


Thanks,
Julien
--
Julien CARSIQUE, Nuxeo (Paris, France)
Open Source Enterprise Content Management - http://www.nuxeo.org/
Nuxeo EP 5: extensible, Java EE and standards based ECM Platform
http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87
Wayne Fay
2008-01-24 18:29:20 UTC
Permalink
Try removing the <manifestFile> entry and see what happens when
there's a file present in that location, and what happens when there's
not (check target to see what ends up in the JAR). By default, Maven
looks for the file in that location, and uses it if its there, or
generates one if there's not.

I'm honestly not sure that adding a manifestEntry will work when the
file is present, but sounds like another thing to try while you're
doing the tests I suggested above.

Wayne
Post by Julien CARSIQUE
Hello,
I would like the plugin to use the given manifest, if present, and add
some properties; and to generate the manifest if it doesn't exist.
Is it possible ?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-Version>${pom.version}</Bundle-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error assembling JAR
.../src/main/resources/META-INF/MANIFEST.MF does not exist.
Of course, the aim is to have a generic configuration, in order not
having to specify for each artifact if there's a manifest, or none.
Thanks,
Julien
--
Julien CARSIQUE, Nuxeo (Paris, France)
Open Source Enterprise Content Management - http://www.nuxeo.org/
Nuxeo EP 5: extensible, Java EE and standards based ECM Platform
http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87
---------------------------------------------------------------------
Julien CARSIQUE
2008-01-24 20:39:29 UTC
Permalink
Sorry, I didn't list all the tests I've done.
I tried what you suggest, the result is a jar containing a new manifest
with the wanted manifest entries from pom.xml but without all the
content of the manifest present in src/main/...

While doing this, I'm trying to manage with the buildnumber plugin in
order to have manifest containing unique Bundle-Version; which is
required by Eclipse when some of our artifacts are used as plugins.

Being able to add entries from pom to an existing (or not) manifest
would be very useful for this.
Post by Wayne Fay
Try removing the <manifestFile> entry and see what happens when
there's a file present in that location, and what happens when there's
not (check target to see what ends up in the JAR). By default, Maven
looks for the file in that location, and uses it if its there, or
generates one if there's not.
I'm honestly not sure that adding a manifestEntry will work when the
file is present, but sounds like another thing to try while you're
doing the tests I suggested above.
Wayne
Post by Julien CARSIQUE
Hello,
I would like the plugin to use the given manifest, if present, and add
some properties; and to generate the manifest if it doesn't exist.
Is it possible ?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-Version>${pom.version}</Bundle-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error assembling JAR
.../src/main/resources/META-INF/MANIFEST.MF does not exist.
Of course, the aim is to have a generic configuration, in order not
having to specify for each artifact if there's a manifest, or none.
Thanks,
Julien
--
Julien CARSIQUE, Nuxeo (Paris, France)
Open Source Enterprise Content Management - http://www.nuxeo.org/
Nuxeo EP 5: extensible, Java EE and standards based ECM Platform
http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87
---------------------------------------------------------------------
---------------------------------------------------------------------
Simon Kitching
2008-01-25 08:47:08 UTC
Permalink
Maybe you could set the <manifestEntry> settings to target/resources/META-INF/MANIFEST.MF (or whatever the right path is), and then use maven filtering to transform the "template" in src/main/resources into the form you want.

Regards,
Simon
Post by Julien CARSIQUE
Sorry, I didn't list all the tests I've done.
I tried what you suggest, the result is a jar containing a new manifest
with the wanted manifest entries from pom.xml but without all the
content of the manifest present in src/main/...
While doing this, I'm trying to manage with the buildnumber plugin in
order to have manifest containing unique Bundle-Version; which is
required by Eclipse when some of our artifacts are used as plugins.
Being able to add entries from pom to an existing (or not) manifest
would be very useful for this.
Post by Wayne Fay
Try removing the <manifestFile> entry and see what happens when
there's a file present in that location, and what happens when there's
not (check target to see what ends up in the JAR). By default, Maven
looks for the file in that location, and uses it if its there, or
generates one if there's not.
I'm honestly not sure that adding a manifestEntry will work when the
file is present, but sounds like another thing to try while you're
doing the tests I suggested above.
Wayne
Post by Julien CARSIQUE
Hello,
I would like the plugin to use the given manifest, if present, and add
some properties; and to generate the manifest if it doesn't exist.
Is it possible ?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-Version>${pom.version}</Bundle-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error assembling JAR
.../src/main/resources/META-INF/MANIFEST.MF does not exist.
Of course, the aim is to have a generic configuration, in order not
having to specify for each artifact if there's a manifest, or none.
Thanks,
Julien
--
Julien CARSIQUE, Nuxeo (Paris, France)
Open Source Enterprise Content Management - http://www.nuxeo.org/
Nuxeo EP 5: extensible, Java EE and standards based ECM Platform
http://www.nuxeo.com/ - Tel: +33 1 40 33 79 87
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
Loading...