Discussion:
exclude entries in MANIFEST.MF
Surendran D
2013-11-06 08:54:59 UTC
Permalink
Hi,
I am currently building and EAR file using maven-ear-plugin

I have a requirement to exclude some of the Class-Path: entries from
MANIFEST.MF file.

For example I have 3 dependencies hibernate-core.jar, quartz-1.6.5.jar and
poi-3.7.jar in my class path (in my dependency of pom.xml)

When I build my EAR file all these entries will be automatically added to
Class-Path entry of my MANIFEST.MF file.

My maven build looks as follows

<build>
<finalName>MyEAR</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>true</addClasspath>
<addExtensions />
<classpathPrefix />
</manifest>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF
</manifestFile>
</archive>
.....
.....
</configuration>
</plugin>
</plugins>
</build>
In the above build file

<addClasspath>true</addClasspath>
is responsible for adding the MANIFEST.MF entries.

My requirement is to add only 2 jars in dependency quartz-1.6.5.jar and
poi-3.7.jar and exlcude the remaning.

If I give false all the entries are excluded from the MANIFEST.MF
classpath. If the remove the depependecy entries from pom I get compilation
errors.

how can I achieve the above scenario.

thanks,
Anders Hammar
2013-11-06 09:01:36 UTC
Permalink
Why do you need the Class-Path entry for an ear? JEE containers have other
means to create the classpath.

/Anders
Post by Surendran D
Hi,
I am currently building and EAR file using maven-ear-plugin
I have a requirement to exclude some of the Class-Path: entries from
MANIFEST.MF file.
For example I have 3 dependencies hibernate-core.jar, quartz-1.6.5.jar and
poi-3.7.jar in my class path (in my dependency of pom.xml)
When I build my EAR file all these entries will be automatically added to
Class-Path entry of my MANIFEST.MF file.
My maven build looks as follows
<build>
<finalName>MyEAR</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>true</addClasspath>
<addExtensions />
<classpathPrefix />
</manifest>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF
</manifestFile>
</archive>
.....
.....
</configuration>
</plugin>
</plugins>
</build>
In the above build file
<addClasspath>true</addClasspath>
is responsible for adding the MANIFEST.MF entries.
My requirement is to add only 2 jars in dependency quartz-1.6.5.jar and
poi-3.7.jar and exlcude the remaning.
If I give false all the entries are excluded from the MANIFEST.MF
classpath. If the remove the depependecy entries from pom I get compilation
errors.
how can I achieve the above scenario.
thanks,
b***@commcity.ch
2013-11-06 14:15:39 UTC
Permalink
Try to define a filter, similar to the following snippet:

<defaultLibBundleDir>lib</defaultLibBundleDir>
<archive>
<manifest>
<addDefaultImplementationEntries>
true
</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>
true
</addDefaultSpecificationEntries>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<earSourceDirectory>src/main/resources/</earSourceDirectory>
<earSourceExcludes>
**/*application.xml,**/*MANIFEST.MF
</earSourceExcludes>




From: Surendran D <***@gmail.com>
To: Maven Users List <***@maven.apache.org>
Date: 06.11.2013 10:04
Subject: exclude entries in MANIFEST.MF



Hi,
I am currently building and EAR file using maven-ear-plugin

I have a requirement to exclude some of the Class-Path: entries from
MANIFEST.MF file.

For example I have 3 dependencies hibernate-core.jar, quartz-1.6.5.jar and
poi-3.7.jar in my class path (in my dependency of pom.xml)

When I build my EAR file all these entries will be automatically added to
Class-Path entry of my MANIFEST.MF file.

My maven build looks as follows

<build>
<finalName>MyEAR</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>true</addClasspath>
<addExtensions />
<classpathPrefix />
</manifest>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF
</manifestFile>
</archive>
.....
.....
</configuration>
</plugin>
</plugins>
</build>
In the above build file

<addClasspath>true</addClasspath>
is responsible for adding the MANIFEST.MF entries.

My requirement is to add only 2 jars in dependency quartz-1.6.5.jar and
poi-3.7.jar and exlcude the remaning.

If I give false all the entries are excluded from the MANIFEST.MF
classpath. If the remove the depependecy entries from pom I get
compilation
errors.

how can I achieve the above scenario.

thanks,
Ron Wheeler
2013-11-06 14:37:18 UTC
Permalink
Why are you doing all of this?
What are you building that is so far outside the normal way to build
EARs that it requires that you do this?
Why do you need hibernate to compile but not to run?
If hibernate is being provided at run-time then scope "provided" should
handle this properly.

I may be off base but it looks like you are trying to do something that
should be very easy but have tried to make it too complex

Fiddling with the Manifest is a not a normal activity as far as I know
but I am not building EARs - only WARs and JARs.

As a side note, Eclipse and its plug-ins do not use Maven to get
everything done.
They keep an eye on your pom.xml and try to set up their parameters to
match what they think you are trying to do with the POM.

You still have to look at the properties of your project to see how your
Eclipse configuration has been adjusted to match your pom.
That is the first thing to do if you are having trouble deploying and
running through some Eclipse feature.
You may have to manually adjust the properties if Eclipse misinterprets
your pom.
Once that works, you can go back and see if you can fix your pom or some
plug-in to make it easier for Eclipse to figure it out, if possible.

Free advice and worth every penny!

Ron
Post by b***@commcity.ch
<defaultLibBundleDir>lib</defaultLibBundleDir>
<archive>
<manifest>
<addDefaultImplementationEntries>
true
</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>
true
</addDefaultSpecificationEntries>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<earSourceDirectory>src/main/resources/</earSourceDirectory>
<earSourceExcludes>
**/*application.xml,**/*MANIFEST.MF
</earSourceExcludes>
Date: 06.11.2013 10:04
Subject: exclude entries in MANIFEST.MF
Hi,
I am currently building and EAR file using maven-ear-plugin
I have a requirement to exclude some of the Class-Path: entries from
MANIFEST.MF file.
For example I have 3 dependencies hibernate-core.jar, quartz-1.6.5.jar and
poi-3.7.jar in my class path (in my dependency of pom.xml)
When I build my EAR file all these entries will be automatically added to
Class-Path entry of my MANIFEST.MF file.
My maven build looks as follows
<build>
<finalName>MyEAR</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>true</addClasspath>
<addExtensions />
<classpathPrefix />
</manifest>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF
</manifestFile>
</archive>
.....
.....
</configuration>
</plugin>
</plugins>
</build>
In the above build file
<addClasspath>true</addClasspath>
is responsible for adding the MANIFEST.MF entries.
My requirement is to add only 2 jars in dependency quartz-1.6.5.jar and
poi-3.7.jar and exlcude the remaning.
If I give false all the entries are excluded from the MANIFEST.MF
classpath. If the remove the depependecy entries from pom I get compilation
errors.
how can I achieve the above scenario.
thanks,
--
Ron Wheeler
President
Artifact Software Inc
email: ***@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102
Loading...