Discussion:
Maven EAR + EJB ... jars with prefixed "lib/" except for EJB
zm
2010-05-20 08:48:27 UTC
Permalink
Hi,

I'm having some trouble setting up a basic maven project structure. In this
case, I'm setting up an EAR project with an EJB and a WAR project inside.

I can successfully build the project, but the problem is as follows:

I define a defaultJavaBundleDir "lib/" on the ear pom. I want every jar
dependency to be inside that folder, except the ear modules ejb and war,
respectively.

It all works well, but looking at the manifest, I see a problem ... the
manifest of the war module has every entry with prefixed "lib/", so the ejb
it depends on is defined in the manifest as "lib/my-ejb.jar", when in
reality it is stored on the ear root.

I was expecting every jar to be prefixed with "lib/" except the webModule
and ejbModule entries defined in maven-ear-plugin.

Isn't it supposed to be like that? How can I make such setup?

Note: I'm not generating the ejb client (not using generateClient in ejb
pom), should this be a requirement? I'm new to maven+ejb setup like this, so
I need a bit of light ...


Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28618592.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 10:29:37 UTC
Permalink
More Info:

In my war pom, I have the following:

...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>


So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).

I'm still looking for examples, but without success so far.


Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Anders Hammar
2010-05-20 12:00:32 UTC
Permalink
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)

/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Celinio Fernandes
2010-05-20 13:46:42 UTC
Permalink
Hi,
I am using Eclipse Galileo.
Initially I created several projects (one webapp, one EJB project, one JPA project) in Eclipse, without Maven.
The output of these projects is a single EAR file (containing the JAR, WAR files ...).
There is no ANT build file. The compilation and creation of the EAR file is automatically generated with Eclipse.
I am using Java 6 and Maven 2.0.9.

The question is : how do you mavenize these projects ?


1) If I use the command line way to use Maven, under DOS, what do i need to do for each project ?

2) I have installed the m2Eclipse (Maven Integration) plugin for Eclipse. If I use that plugin,
how do i proceed ? I just noticed a feature called "Enable Dependency Management" if i right click on a project.
what does it do ?

Any suggestion or pointer would be much appreciated.
Thanks in advance for helping.
Thiébault Benoît
2010-05-20 13:52:00 UTC
Permalink
Hi Celinio,

You should download the book http://repo.exist.com/dist/maestro/1.7.0/BetterBuildsWithMaven.pdf
Chapter 8 gives an example of Maven migration

Hope this helps
Benoît
Post by Celinio Fernandes
Hi,
I am using Eclipse Galileo.
Initially I created several projects (one webapp, one EJB project, one JPA project) in Eclipse, without Maven.
The output of these projects is a single EAR file (containing the JAR, WAR files ...).
There is no ANT build file. The compilation and creation of the EAR file is automatically generated with Eclipse.
I am using Java 6 and Maven 2.0.9.
The question is : how do you mavenize these projects ?
1) If I use the command line way to use Maven, under DOS, what do i need to do for each project ?
2) I have installed the m2Eclipse (Maven Integration) plugin for Eclipse. If I use that plugin,
how do i proceed ? I just noticed a feature called "Enable Dependency Management" if i right click on a project.
what does it do ?
Any suggestion or pointer would be much appreciated.
Thanks in advance for helping.
zm
2010-05-20 15:41:20 UTC
Permalink
Post by Anders Hammar
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)
/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
If I skip manifest creation, it will probably work, because every
dependencies will be copied to WEB-INF/lib, and since EJB will need manifest
and many of the same libs on the EAR, I will end with a monster size EAR
package because of duplicated jar dependencies ... :(
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28623056.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Anders Hammar
2010-05-20 18:06:25 UTC
Permalink
I'm not sure we understand each other. I'm asking you to just skip this part
of the war-plugin configuration:
<archive>
<manifest>

<addClasspath>true</addClasspath>

<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>

You should still keep this:
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>

/Anders
Post by zm
Post by Anders Hammar
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)
/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to
have
Post by Anders Hammar
Post by zm
no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Post by Anders Hammar
Post by zm
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
If I skip manifest creation, it will probably work, because every
dependencies will be copied to WEB-INF/lib, and since EJB will need manifest
and many of the same libs on the EAR, I will end with a monster size EAR
package because of duplicated jar dependencies ... :(
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28623056.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
zm
2010-05-21 08:41:49 UTC
Permalink
Post by Anders Hammar
I'm not sure we understand each other. I'm asking you to just skip this part
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
/Anders
I'll will try that, and see the results.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28631100.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 11:30:49 UTC
Permalink
Post by zm
Post by Anders Hammar
I'm not sure we understand each other. I'm asking you to just skip this part
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
/Anders
I'll will try that, and see the results.
I've just tried it, and as far as I can tell, an EJB requires manifest
classpath to resolve dependencies, but a WAR module requires no WEB-INF\lib
and no manifest classpath to resolve them, as long as all dependencies are
available in the EAR package itself.

Now this just doesn't seem like a good practice ... but maintaining
dependencies on a big project really is a PITA ...

One strange thing I noticed when using an EJB client, was that although in
the WAR pom I only have a dependency to type "ejb-client", it correctly
inserts the client EJB on manifest classpath, but the WEB-INF\lib folder
ended with the full EJB package. Don't know if it is a bug on the war
plugin, but anyway I'll test this again.


Note: I have no clue why some of my posts are multi-submitted ... I'm
starting to suspect of my FF browser ... but it's strange, though. :-| I'll
post this one with keyboard only.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28632616.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Wayne Fay
2010-05-21 13:25:08 UTC
Permalink
Post by zm
Note: I have no clue why some of my posts are multi-submitted ... I'm
starting to suspect of my FF browser ... but it's strange, though. :-| I'll
post this one with keyboard only.
Perhaps try submitting your questions via Nabble.com instead of Hotmail.

Wayne
zm
2010-05-21 11:30:50 UTC
Permalink
Post by zm
Post by Anders Hammar
I'm not sure we understand each other. I'm asking you to just skip this part
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
/Anders
I'll will try that, and see the results.
I've just tried it, and as far as I can tell, an EJB requires manifest
classpath to resolve dependencies, but a WAR module requires no WEB-INF\lib
and no manifest classpath to resolve them, as long as all dependencies are
available in the EAR package itself.

Now this just doesn't seem like a good practice ... but maintaining
dependencies on a big project really is a PITA ...

One strange thing I noticed when using an EJB client, was that although in
the WAR pom I only have a dependency to type "ejb-client", it correctly
inserts the client EJB on manifest classpath, but the WEB-INF\lib folder
ended with the full EJB package. Don't know if it is a bug on the war
plugin, but anyway I'll test this again.


Note: I have no clue why some of my posts are multi-submitted ... I'm
starting to suspect of my FF browser ... but it's strange, though. :-| I'll
post this one with keyboard only.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28632618.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 11:30:51 UTC
Permalink
Post by zm
Post by Anders Hammar
I'm not sure we understand each other. I'm asking you to just skip this part
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
/Anders
I'll will try that, and see the results.
I've just tried it, and as far as I can tell, an EJB requires manifest
classpath to resolve dependencies, but a WAR module requires no WEB-INF\lib
and no manifest classpath to resolve them, as long as all dependencies are
available in the EAR package itself.

Now this just doesn't seem like a good practice ... but maintaining
dependencies on a big project really is a PITA ...

One strange thing I noticed when using an EJB client, was that although in
the WAR pom I only have a dependency to type "ejb-client", it correctly
inserts the client EJB on manifest classpath, but the WEB-INF\lib folder
ended with the full EJB package. Don't know if it is a bug on the war
plugin, but anyway I'll test this again.


Note: I have no clue why some of my posts are multi-submitted ... I'm
starting to suspect of my FF browser ... but it's strange, though. :-| I'll
post this one with keyboard only.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28632619.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 11:30:50 UTC
Permalink
Post by zm
Post by Anders Hammar
I'm not sure we understand each other. I'm asking you to just skip this part
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
/Anders
I'll will try that, and see the results.
I've just tried it, and as far as I can tell, an EJB requires manifest
classpath to resolve dependencies, but a WAR module requires no WEB-INF\lib
and no manifest classpath to resolve them, as long as all dependencies are
available in the EAR package itself.

Now this just doesn't seem like a good practice ... but maintaining
dependencies on a big project really is a PITA ...

One strange thing I noticed when using an EJB client, was that although in
the WAR pom I only have a dependency to type "ejb-client", it correctly
inserts the client EJB on manifest classpath, but the WEB-INF\lib folder
ended with the full EJB package. Don't know if it is a bug on the war
plugin, but anyway I'll test this again.


Note: I have no clue why some of my posts are multi-submitted ... I'm
starting to suspect of my FF browser ... but it's strange, though. :-| I'll
post this one with keyboard only.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28632617.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 11:30:52 UTC
Permalink
Post by zm
Post by Anders Hammar
I'm not sure we understand each other. I'm asking you to just skip this part
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
/Anders
I'll will try that, and see the results.
I've just tried it, and as far as I can tell, an EJB requires manifest
classpath to resolve dependencies, but a WAR module requires no WEB-INF\lib
and no manifest classpath to resolve them, as long as all dependencies are
available in the EAR package itself.

Now this just doesn't seem like a good practice ... but maintaining
dependencies on a big project really is a PITA ...

One strange thing I noticed when using an EJB client, was that although in
the WAR pom I only have a dependency to type "ejb-client", it correctly
inserts the client EJB on manifest classpath, but the WEB-INF\lib folder
ended with the full EJB package. Don't know if it is a bug on the war
plugin, but anyway I'll test this again.


Note: I have no clue why some of my posts are multi-submitted ... I'm
starting to suspect of my FF browser ... but it's strange, though. :-| I'll
post this one with keyboard only.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28632620.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 15:41:21 UTC
Permalink
Post by Anders Hammar
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)
/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
If I skip manifest creation, it will probably work, because every
dependencies will be copied to WEB-INF/lib, and since EJB will need manifest
and many of the same libs on the EAR, I will end with a monster size EAR
package because of duplicated jar dependencies ... :(
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28623057.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 15:41:22 UTC
Permalink
Post by Anders Hammar
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)
/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
If I skip manifest creation, it will probably work, because every
dependencies will be copied to WEB-INF/lib, and since EJB will need manifest
and many of the same libs on the EAR, I will end with a monster size EAR
package because of duplicated jar dependencies ... :(
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28623059.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 15:41:23 UTC
Permalink
Post by Anders Hammar
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)
/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
If I skip manifest creation, it will probably work, because every
dependencies will be copied to WEB-INF/lib, and since EJB will need manifest
and many of the same libs on the EAR, I will end with a monster size EAR
package because of duplicated jar dependencies ... :(
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28623061.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 15:41:23 UTC
Permalink
Post by Anders Hammar
Does it work (when deploying in the app server) if you just skip the
manifest config part of the war plugin? I was under the impression that the
manifest file doesn't really matter for war files, but I could be wrong.
(You'd be accessing the classes from the classpath and that's handled by the
container.)
/Anders
Post by zm
...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).
I'm still looking for examples, but without success so far.
Thanks
--
http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619436.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
If I skip manifest creation, it will probably work, because every
dependencies will be copied to WEB-INF/lib, and since EJB will need manifest
and many of the same libs on the EAR, I will end with a monster size EAR
package because of duplicated jar dependencies ... :(
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28623062.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Wayne Fay
2010-05-20 18:37:08 UTC
Permalink
On Thu, May 20, 2010 at 10:41 AM, zm <***@hotmail.com> wrote:
....

zm, can you PLEASE hit the send button ONLY ONE TIME in the future??
This is ridiculous. If you aren't sure if a message made it through to
the list, check the list archive at Nabble.com.

Wayne
zm
2010-05-21 08:47:42 UTC
Permalink
Post by Wayne Fay
....
zm, can you PLEASE hit the send button ONLY ONE TIME in the future??
This is ridiculous. If you aren't sure if a message made it through to
the list, check the list archive at Nabble.com.
Wayne
---------------------------------------------------------------------
I assure you I did hit the button ONLY ONE TIME in the past. And yes, I saw
that on both times it replicated the message posted 4 times.

The last post I send, a few minutes ago I hit the post message using the
keyboard, just to test the behavior. This post will also be submitted with
keyboard, just to make sure.

This was not a n00b navigation action.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28631153.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 08:47:46 UTC
Permalink
Post by Wayne Fay
....
zm, can you PLEASE hit the send button ONLY ONE TIME in the future??
This is ridiculous. If you aren't sure if a message made it through to
the list, check the list archive at Nabble.com.
Wayne
---------------------------------------------------------------------
I assure you I did hit the button ONLY ONE TIME in the past. And yes, I saw
that on both times it replicated the message posted 4 times.

The last post I send, a few minutes ago I hit the post message using the
keyboard, just to test the behavior. This post will also be submitted with
keyboard, just to make sure.

This was not a n00b navigation action.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28631155.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 08:47:48 UTC
Permalink
Post by Wayne Fay
....
zm, can you PLEASE hit the send button ONLY ONE TIME in the future??
This is ridiculous. If you aren't sure if a message made it through to
the list, check the list archive at Nabble.com.
Wayne
---------------------------------------------------------------------
I assure you I did hit the button ONLY ONE TIME in the past. And yes, I saw
that on both times it replicated the message posted 4 times.

The last post I send, a few minutes ago I hit the post message using the
keyboard, just to test the behavior. This post will also be submitted with
keyboard, just to make sure.

This was not a n00b navigation action.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28631157.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 08:47:48 UTC
Permalink
Post by Wayne Fay
....
zm, can you PLEASE hit the send button ONLY ONE TIME in the future??
This is ridiculous. If you aren't sure if a message made it through to
the list, check the list archive at Nabble.com.
Wayne
---------------------------------------------------------------------
I assure you I did hit the button ONLY ONE TIME in the past. And yes, I saw
that on both times it replicated the message posted 4 times.

The last post I send, a few minutes ago I hit the post message using the
keyboard, just to test the behavior. This post will also be submitted with
keyboard, just to make sure.

This was not a n00b navigation action.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28631158.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-21 08:47:47 UTC
Permalink
Post by Wayne Fay
....
zm, can you PLEASE hit the send button ONLY ONE TIME in the future??
This is ridiculous. If you aren't sure if a message made it through to
the list, check the list archive at Nabble.com.
Wayne
---------------------------------------------------------------------
I assure you I did hit the button ONLY ONE TIME in the past. And yes, I saw
that on both times it replicated the message posted 4 times.

The last post I send, a few minutes ago I hit the post message using the
keyboard, just to test the behavior. This post will also be submitted with
keyboard, just to make sure.

This was not a n00b navigation action.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28631156.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 10:29:37 UTC
Permalink
More Info:

In my war pom, I have the following:

...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>


So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).

I'm still looking for examples, but without success so far.


Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619437.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 10:29:38 UTC
Permalink
More Info:

In my war pom, I have the following:

...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>


So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).

I'm still looking for examples, but without success so far.


Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619438.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 10:29:40 UTC
Permalink
More Info:

In my war pom, I have the following:

...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>


So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).

I'm still looking for examples, but without success so far.


Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619440.html
Sent from the Maven - Users mailing list archive at Nabble.com.
zm
2010-05-20 10:29:39 UTC
Permalink
More Info:

In my war pom, I have the following:

...
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>my-ejb</artifactId>
<type>ejb-client</type>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>


So I have on ear root the war, the ejb and the ejb-client archives, but the
manifest of the war as all entries prefixed with "lib/" so it doesn't find
the client ... I would need a way of forcing the ejb-client entry to have no
prefix (or "/" prefix).

I'm still looking for examples, but without success so far.


Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28619439.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Celinio Fernandes
2010-05-20 14:32:12 UTC
Permalink
Thanks very much for these helpful pointers.

--- On Thu, 5/20/10, Jeff Jensen <***@upstairstechnology.com> wrote:

From: Jeff Jensen <***@upstairstechnology.com>
Subject: Re: How do you mavenize projects ? (EJB, Webapp, JPA under Eclipse)
To: "Maven Users List" <***@maven.apache.org>, ***@yahoo.com
Date: Thursday, May 20, 2010, 7:11 AM

Maven Users List rejects my reply as
spam (I sent it two times; oh well), so I am sending directly to you as well this time.


First item is to
install m2eclipse,
which you did.

Second is to create Maven POMs for each
module/Eclipse project (I infer you have not done this as
it was not mentioned).  You can use m2eclipse to help you create the
POMs.  Ensure each POM builds correctly
from the command line too.

Then you can "Enable Dep Management". 
It enables m2eclipse to do many wonderful
build things for you, using Maven.  Read the features list [0].

You
need to use some resources to help with
your quest :-).  Besides the Maven site, these [1] online free books
from Sonatype are very useful.  The
website and books will explain how to create a POM and run Maven for
builds and other activities.


[0]
http://m2eclipse.sonatype.org
[1]
http://www.sonatype.com/documentation/books


On Thu, 20 May 2010 06:46:42 -0700 (PDT)
Celinio Fernandes
Post by Celinio Fernandes
Hi,
I am using Eclipse Galileo.
Initially I created several
projects (one webapp, one
Post by Celinio Fernandes
EJB project, one JPA project) in Eclipse, without Maven.
The output of these
projects is a single EAR file
Post by Celinio Fernandes
(containing the JAR, WAR files ...).
There is no ANT build file. The
compilation and creation
Post by Celinio Fernandes
of the EAR file is automatically generated with Eclipse.
I am using Java 6 and
Maven 2.0.9.
Post by Celinio Fernandes
The question is : how do you mavenize these projects ?
1) If I
use the command line way to use Maven, under
Post by Celinio Fernandes
DOS, what do i need to do for each project ?
2) I
have installed the m2Eclipse (Maven Integration)
Post by Celinio Fernandes
plugin for Eclipse. If I use that plugin,
how do i
proceed ? I just noticed a feature called
Post by Celinio Fernandes
"Enable Dependency Management" if i right click on a
project.
what does it do ?
Any suggestion or pointer would be much appreciated.
Thanks in advance for helping.
Elliot Huntington
2010-05-20 15:31:42 UTC
Permalink
http://repo.exist.com/dist/maestro/1.7.0/BetterBuildsWithMaven.pdf
appears to be a broken link. Maybe the server is just down
temporarily.
Post by Celinio Fernandes
Thanks very much for these helpful pointers.
Subject: Re: How do you mavenize projects ? (EJB, Webapp, JPA under Eclipse)
Date: Thursday, May 20, 2010, 7:11 AM
Maven Users List rejects my reply as
spam (I sent it two times; oh well), so I am sending directly to you as well this time.
First item is to
install m2eclipse,
which you did.
Second is to create Maven POMs for each
module/Eclipse project (I infer you have not done this as
it was not mentioned).  You can use m2eclipse to help you create the
POMs.  Ensure each POM builds correctly
from the command line too.
Then you can "Enable Dep Management".
 It enables m2eclipse to do many wonderful
build things for you, using Maven.  Read the features list [0].
You
 need to use some resources to help with
your quest :-).  Besides the Maven site, these [1] online free books
from Sonatype are very useful.  The
website and books will explain how to create a POM and run Maven for
builds and other activities.
[0]
http://m2eclipse.sonatype.org
[1]
http://www.sonatype.com/documentation/books
On Thu, 20 May 2010 06:46:42 -0700 (PDT)
 Celinio Fernandes
Post by Celinio Fernandes
Hi,
I am using Eclipse Galileo.
Initially I created several
projects (one webapp, one
Post by Celinio Fernandes
EJB project, one JPA project) in Eclipse, without Maven.
The output of these
projects is a single EAR file
Post by Celinio Fernandes
(containing the JAR, WAR files ...).
There is no ANT build file. The
compilation and creation
Post by Celinio Fernandes
of the EAR file is automatically generated with Eclipse.
I am using Java 6 and
Maven 2.0.9.
Post by Celinio Fernandes
The question is : how do you mavenize these projects ?
1) If I
use the command line way to use Maven, under
Post by Celinio Fernandes
DOS, what do i need to do for each project ?
2) I
have installed the m2Eclipse (Maven Integration)
Post by Celinio Fernandes
plugin for Eclipse. If I use that plugin,
how do i
proceed ? I just noticed a feature called
Post by Celinio Fernandes
"Enable Dependency Management" if i right click on a
project.
what does it do ?
Any suggestion or pointer would be much appreciated.
Thanks in advance for helping.
--
Elliot
Stephen Coy
2010-05-21 11:49:45 UTC
Permalink
The answer to this question depends very much on what appserver (vendor and version) you are using.

If it is a JEE5 compliant server (JBoss 5.x, WebLogic 10.x, WebSphere 7.x)*, then you do not need manifest classpaths to be generated at all. All jars placed in the lib directory of the EAR will be visible to both EJB and WAR classes.

If it is an earlier version, the answer becomes vendor dependent as some support the JEE5 behaviour (as a vendor extension) and some don't.

Unfortunately, setting Maven up to put the correct jars in a WAR's WEB-INF/lib and an EAR's lib directory has to be done by hand with explicit dependency control in the case of the EAR and controlled use of <warSourceExcludes> in the war plugin configuration.

Cheers,

Steve C

* There's others, such as glassfish, but I'm not familiar with them.
Post by zm
Hi,
I'm having some trouble setting up a basic maven project structure. In this
case, I'm setting up an EAR project with an EJB and a WAR project inside.
I define a defaultJavaBundleDir "lib/" on the ear pom. I want every jar
dependency to be inside that folder, except the ear modules ejb and war,
respectively.
It all works well, but looking at the manifest, I see a problem ... the
manifest of the war module has every entry with prefixed "lib/", so the ejb
it depends on is defined in the manifest as "lib/my-ejb.jar", when in
reality it is stored on the ear root.
I was expecting every jar to be prefixed with "lib/" except the webModule
and ejbModule entries defined in maven-ear-plugin.
Isn't it supposed to be like that? How can I make such setup?
Note: I'm not generating the ejb client (not using generateClient in ejb
pom), should this be a requirement? I'm new to maven+ejb setup like this, so
I need a bit of light ...
Thanks
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28618592.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Nicola Musatti
2010-05-21 12:14:37 UTC
Permalink
Post by Stephen Coy
The answer to this question depends very much on what appserver (vendor and version) you are using.
If it is a JEE5 compliant server (JBoss 5.x, WebLogic 10.x, WebSphere 7.x)*, then you do not need manifest classpaths to be generated at all. All jars placed in the lib directory of the EAR will be visible to both EJB and WAR classes.
Are you sure about this? I'm asking because this is not the behaviour
I'm seeing for a WAR deployed to Websphere 7.0.0.7. In order for the
containing EAR's jar's to be visible from the WAR I have to specify them
explicitly in the WAR's manifest. This, on the other hand, is not
necessary for JBoss 5.1, as you say.

This wouldn't be so bad if it weren't for the fact that all transitive
dependencies have to be specified in the POM, so that they are
explicitly mentioned in the manifest classpath.

Cheers,
Nicola Musatti

[...]
Stephen Coy
2010-05-22 00:45:36 UTC
Permalink
Are you sure about this? I'm asking because this is not the behaviour I'm seeing for a WAR deployed to Websphere 7.0.0.7. In order for the containing EAR's jar's to be visible from the WAR I have to specify them explicitly in the WAR's manifest.
From "JavaTM Platform, Enterprise Edition (Java EE) Specification, v5"

EE.8.2.1 Bundled Libraries

1. ...

2. A .ear file may contain a directory that contains libraries packaged in JAR files. The library-directory element of the.earfile’s deployment descriptor contains the name of this directory. If a library-directory element isn’t specified, or if the .ear file does not contain a deployment descriptor, the directory named lib is used. An empty library-directory element may be used to specify that there is no library directory.
All files in this directory (but not subdirectories) with a .jar extension must be made available to all components packaged in the EAR file, including application clients. These libraries may reference other libraries, either bundled with the application or installed separately, using any of the techniques described herein.

3. A web application may include libraries in the WEB-INF/lib directory. See the Servlet specification for details. These libraries may reference other libraries, either bundled with the application or installed separately, using any of the techniques described herein.

The usual reason for this not working is using an old (J2EE 1.3 or 1.4) DTD/schema in the application.xml file.

Cheers,

Steve C
zm
2010-05-24 09:36:25 UTC
Permalink
Post by Stephen Coy
Are you sure about this? I'm asking because this is not the behaviour I'm
seeing for a WAR deployed to Websphere 7.0.0.7. In order for the
containing EAR's jar's to be visible from the WAR I have to specify them
explicitly in the WAR's manifest.
From "JavaTM Platform, Enterprise Edition (Java EE) Specification, v5"
EE.8.2.1 Bundled Libraries
1. ...
2. A .ear file may contain a directory that contains libraries packaged in
JAR files. The library-directory element of the.earfile’s deployment
descriptor contains the name of this directory. If a library-directory
element isn’t specified, or if the .ear file does not contain a deployment
descriptor, the directory named lib is used. An empty library-directory
element may be used to specify that there is no library directory.
All files in this directory (but not subdirectories) with a .jar extension
must be made available to all components packaged in the EAR file,
including application clients. These libraries may reference other
libraries, either bundled with the application or installed separately,
using any of the techniques described herein.
3. A web application may include libraries in the WEB-INF/lib directory.
See the Servlet specification for details. These libraries may reference
other libraries, either bundled with the application or installed
separately, using any of the techniques described herein.
The usual reason for this not working is using an old (J2EE 1.3 or 1.4)
DTD/schema in the application.xml file.
Cheers,
Steve C
---------------------------------------------------------------------
Perfect, that was exactly what I was thinking, that the specification should
define this.

This eases the work of making a cross-application-server EAR archive. Also
not needing the manifest entries makes it more easy to maintain the pom
files for maven.

We have so much stuff to worry about, that these small definitions help
alot.

I'll definitely try it on JBoss, WebSphere and Geronimo to check it out

Thanks.


Note about posting: I post in nabble.com, this time I'll post using Internet
Explorer.
--
View this message in context: http://old.nabble.com/Maven-EAR-%2B-EJB-...-jars-with-prefixed-%22lib-%22-except-for-EJB-tp28618592p28655173.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Loading...