You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Nunn, Gerald" <Ge...@CIBC.com> on 2007/01/04 15:05:41 UTC
How to create compile dependency to shared j2ee library?
Hi all,
I am working with WebLogic Portal 9.2 and Maven for the first time. I'm looking at using Maven instead of Ant for the build system as the dependency system is intriguing however I am having a problem getting my WLP dependencies setup. WLP has the notion of shared J2EE libraries where an EAR or a WAR contain various J2EE artifacts that can be referenced at compile and runtime. This system is described in more detail here http://e-docs.bea.com/workshop/docs92/ws_platform/ideuserguide/conJARLibraryDependencies.html
I have a small utility jar project I am trying to setup in Maven that uses a shared j2ee library called p13n-app-lib.ear which contains the jar I need to compile against. My hope was to simply create a dependency against the ear and have it work. I tried installing the ear using the mvn install:install-file command with package set to ear, however when I compile the application the dependency doesn't seem to be picked up at all from pom.xml and I get compile errors complaining about the missing WLP classes. Does Maven support shared j2ee libraries as a dependency for compilation?
I used this command to install the EAR:
mvn install:install-file -Dfile=%BEA_HOME%\weblogic92\common\deployable-libraries\p13n-app-lib.ear -DgroupId=weblogic-portal -DartifactId=p13n-app-lib -Dversion=9.2.0 -Dpackaging=ear -DgeneratePom=true
My dependency in pom.xml appears as follows:
<dependency>
<groupId>weblogic-portal</groupId>
<artifactId>p13n-app-lib</artifactId>
<version>9.2.0</version>
<type>ear</type>
<scope>compile</scope>
</dependency>
Thanks,
Gerald
Re: How to create compile dependency to shared j2ee library?
Posted by ChristianEdwardGruber <cg...@israfil.net>.
Hey,
We're having the same issue, and the answer given below is actually what
we've used. We've broken out the BEA "J2EE Weblogic Library" archives and
individually converted the contained jars into a maven repository structure.
I have some nice scripts that i will post eventually.
We do, however, have problems - especially when it comes to deployment
within Workshop and some advanced features of these so-called J2EE
libraries. Because these are not just ears of jars, wars of jars, and jars
of jars, but often contain .jsps and other artifacts that are laid under
your application, there is a whole "merging" facility that requires that
these .ears and .wars actually be deployed as such and treated as such by
workshop. So you still have to declare them as "Weblogic J2EE Libraries" in
your weblogic.xml and weblogic-application.xml files, so that when you
deploy TO a weblogic server, it can manfest the proper resources. Also,
this allows Workshop to do this merging/overlaying of various resources.
A key place where this occurs is within the Portal VisitorTools stuff,
and can be a real problem if you are trying to customize.
Weblogic as really created a new kind of hell with these, because they
are non-standard, there are no common patterns of classloader behaviour -
it's all BEA-specific classloaders that handle it, etc.
What would likely be the "right thing" wtihin a maven context in the
long term would be to write plexus components/maven plugins to handle these
new kinds of resources, with proper classloader behaviour that mimic's
BEA's, plus behaviour in the war and ear plugins to construct the J2EE
library text in weblogic-application.xml and weblogic.xml files. Honestly,
though, BEA portal or other BEA-specific stuff has gone way past the J2EE
standards and really done a number on interoperability and buildability.
It's almost worth chucking all the BEA-specific stuff into a sub-folder
wtih a single pom.xml file and execute the build using the antrun plugin.
That has its own hell, though. if you're doing anything with beehive,
remember you have to use an APT plugin becasue beehive creates a whole bunch
of struts stuff automagically using the APT. There's a decent mojo from
codehaus, but it's not released, so you'll have to compile it yourself to
use it.
Lastly, beware. the BEA Workshop stuff does NOT understand the Maven2
Classpath Container from the M2Eclipse plugin by the codehaus. This means
that if you are managing a lot of up-stream dependencies, you CANNOT deploy
to a server from within eclipse using the normal IDE tools unless you copy
all the dependencies into your src/main/webapp/WEB-INF/lib or
src/main/application/APP-INF/lib folders as appropriate. the Weblogic
server, even if it can get manually depended eclipse build-path jars, will
ignore any jars provided by the Maven2 classpath container in eclipse.
regards,
Christian Edward Gruber
cgruber@israfil.net
Nunn, Gerald wrote:
>
> Hi all,
>
> I am working with WebLogic Portal 9.2 and Maven for the first time. I'm
> looking at using Maven instead of Ant for the build system as the
> dependency system is intriguing however I am having a problem getting my
> WLP dependencies setup. WLP has the notion of shared J2EE libraries where
> an EAR or a WAR contain various J2EE artifacts that can be referenced at
> compile and runtime. This system is described in more detail here
> http://e-docs.bea.com/workshop/docs92/ws_platform/ideuserguide/conJARLibraryDependencies.html
>
> I have a small utility jar project I am trying to setup in Maven that uses
> a shared j2ee library called p13n-app-lib.ear which contains the jar I
> need to compile against. My hope was to simply create a dependency against
> the ear and have it work. I tried installing the ear using the mvn
> install:install-file command with package set to ear, however when I
> compile the application the dependency doesn't seem to be picked up at all
> from pom.xml and I get compile errors complaining about the missing WLP
> classes. Does Maven support shared j2ee libraries as a dependency for
> compilation?
>
> I used this command to install the EAR:
>
> mvn install:install-file
> -Dfile=%BEA_HOME%\weblogic92\common\deployable-libraries\p13n-app-lib.ear
> -DgroupId=weblogic-portal -DartifactId=p13n-app-lib -Dversion=9.2.0
> -Dpackaging=ear -DgeneratePom=true
>
> My dependency in pom.xml appears as follows:
>
> <dependency>
> <groupId>weblogic-portal</groupId>
> <artifactId>p13n-app-lib</artifactId>
> <version>9.2.0</version>
> <type>ear</type>
> <scope>compile</scope>
> </dependency>
>
> Thanks,
>
> Gerald
>
>
--
View this message in context: http://www.nabble.com/How-to-create-compile-dependency-to-shared-j2ee-library--tf2919659s177.html#a8398383
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: How to create compile dependency to shared j2ee library?
Posted by "Nunn, Gerald" <Ge...@CIBC.com>.
Thanks Wayne, that sounds like the best solution to me.
Gerald
-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com]
Sent: Thursday, January 04, 2007 11:25 AM
To: Maven Users List
Subject: Re: How to create compile dependency to shared j2ee library?
I think the problem is that Javac doesn't know how to deal with the
EAR that Maven puts on the compile classpath so the compile dependency
isn't doing anything. This isn't Maven's fault per se nor is it
something you can really expect Maven to help you with.
You'll probably need to break apart the EAR manually and install each
JAR it contains individually into the Maven repo -- I'd put them under
a groupId weblogic-portal.p13n-app-lib and use the name of the jar as
the name of the artifactId. Then make a p13n-app-lib-parent pom that
specifies all the individual jars as dependencies, and finally specify
the new p13n-app-lib-parent as a dependency in your own project(s).
Not positive, but that should probably work.
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to create compile dependency to shared j2ee library?
Posted by Wayne Fay <wa...@gmail.com>.
I think the problem is that Javac doesn't know how to deal with the
EAR that Maven puts on the compile classpath so the compile dependency
isn't doing anything. This isn't Maven's fault per se nor is it
something you can really expect Maven to help you with.
You'll probably need to break apart the EAR manually and install each
JAR it contains individually into the Maven repo -- I'd put them under
a groupId weblogic-portal.p13n-app-lib and use the name of the jar as
the name of the artifactId. Then make a p13n-app-lib-parent pom that
specifies all the individual jars as dependencies, and finally specify
the new p13n-app-lib-parent as a dependency in your own project(s).
Not positive, but that should probably work.
Wayne
On 1/4/07, Nunn, Gerald <Ge...@cibc.com> wrote:
> Hi all,
>
> I am working with WebLogic Portal 9.2 and Maven for the first time. I'm looking at using Maven instead of Ant for the build system as the dependency system is intriguing however I am having a problem getting my WLP dependencies setup. WLP has the notion of shared J2EE libraries where an EAR or a WAR contain various J2EE artifacts that can be referenced at compile and runtime. This system is described in more detail here http://e-docs.bea.com/workshop/docs92/ws_platform/ideuserguide/conJARLibraryDependencies.html
>
> I have a small utility jar project I am trying to setup in Maven that uses a shared j2ee library called p13n-app-lib.ear which contains the jar I need to compile against. My hope was to simply create a dependency against the ear and have it work. I tried installing the ear using the mvn install:install-file command with package set to ear, however when I compile the application the dependency doesn't seem to be picked up at all from pom.xml and I get compile errors complaining about the missing WLP classes. Does Maven support shared j2ee libraries as a dependency for compilation?
>
> I used this command to install the EAR:
>
> mvn install:install-file -Dfile=%BEA_HOME%\weblogic92\common\deployable-libraries\p13n-app-lib.ear -DgroupId=weblogic-portal -DartifactId=p13n-app-lib -Dversion=9.2.0 -Dpackaging=ear -DgeneratePom=true
>
> My dependency in pom.xml appears as follows:
>
> <dependency>
> <groupId>weblogic-portal</groupId>
> <artifactId>p13n-app-lib</artifactId>
> <version>9.2.0</version>
> <type>ear</type>
> <scope>compile</scope>
> </dependency>
>
> Thanks,
>
> Gerald
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org