Bah, now I am totally confused. I am not having a problem that I need fixed, but I hope that my musings here will help Mick find the answer to his problem (and then maybe post the solution so I can use the info to improve the situation on my project :-)).

The BBWM book seems to use the javaModule approach. However, it seems like javaModule may really be for deploying ejb-jars and not for deploying utility-jars. I am not sure which of the jars in the BBWM book are utility-jars vs. ejb-jars, so maybe I misread the example from the book.

My project is using javaModule, but I wasn't the one that set it up and I haven't really experimented with building ears in maven2. Our project setup might be flawed, and we might just be getting lucky due to JBoss's classloader architecture.

This topic of "Optional Packages" (= utility-jars) is addressed in the J2EE 1.4 spec in section J2EE.8.2. The spec will tell you precisely what your build should be producing, but it doesn't tell you how to make Maven do it (of course). In the past, I have setup Ant to create an ear with a war and ejb-jar sharing a utility-jar, and the key was to setup the Class-Path: entries in the war and ejb-jar manifests. This is in line with what the spec says. You can get the spec here:
http://java.sun.com/j2ee/j2ee-1_4-fr-spec.pdf

I just checked the manifest in the war file of my current project and it has no Class-Path: entries. We must just be getting lucky with the JBoss classloader. Or maybe specifying a utility-jar as a java module (in application.xml) AND using Class-Path: entries are both valid approaches. I'm just not sure. :-(

-Max

Wayne Fay wrote:
Hmmm... I checked my WAR and EAR poms... I am doing this:

WAR
   <dependency>
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.12</version>
     <scope>compile</scope>
     <exclusions>
       <exclusion>
         <artifactId>log4j</artifactId>
         <groupId>log4j</groupId>
       </exclusion>
     </excusions>
     <optional>true</optional>
   </dependency>

EAR
   <dependency>
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.12</version>
     <scope>compile</scope>
   </dependency>

(snip)
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-ear-plugin</artifactId>
       <configuration>
         <archive>
           <manifest>
             <addClasspath>true</addClasspath>
           </manifest>
         </archive>
       </configuration>
     </plugin>

So perhaps that's why its working for me, without using <javaModule> etc? ;-)

Wayne

On 10/19/06, Max Cooper <[EMAIL PROTECTED]> wrote:
You may need to declare more stuff, see:
http://maven.apache.org/plugins/maven-ear-plugin/howto.html

Specifically, I think you need to declare your common.jar as a
javaModule with includeInApplicationXml=true in your ear/pom.xml:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
           [...]
           <modules>
             <javaModule>
               <groupId>org.delta.npi.common</groupId>
               <artifactId>common-jar</artifactId>
               <includeInApplicationXml>true</includeInApplicationXml>
             </javaModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>

-Max

Mick Knutson wrote:
> Well, this does not seem to work the way I invision it.
>
> I have the following:
>
> pom.xml
> -->common/pom.xml
> -->ear/pom.xml
> -->war/pom.xml
>
>
> I declared my dependancies in my master pom, then added a provided scope in
> my ear:
>        <dependency>
>            <groupId>org.delta.npi.common</groupId>
>            <artifactId>common-jar</artifactId>
>            <scope>compile</scope>
>        </dependency>
>
>
> and in my war:
>
>        <dependency>
>            <groupId>org.delta.npi.common</groupId>
>            <artifactId>common-jar</artifactId>
>            <scope>provided</scope>
>        </dependency>
>
> The common-jar _is_ in my ear, but the deployment fails as it can't seem to
> access a class in common-jar
>
>
>
>
>
>
>
>
> On 10/11/06, Max Cooper <[EMAIL PROTECTED]> wrote:
>>
>> Scope is subject to inheritance as well.
>>
>> Deciding where to put it is a judgment call.
>>
>> In the context of your whole project, I wouldn't consider a jar that
>> goes in the ear to be "provided". I would only consider it to be
>> "provided" in the context of the war module. So, I would set the scope
>> in the child pom. And the version in the dependencyManagement section of
>> the parent pom.
>>
>> -Max
>>
>> Wayne Fay wrote:
>> > I'd imagine you could omit both, but I'm not currently doing that.
>> > Version I'm sure would flow through, and I'd expect scope would as
>> > well.
>> >
>> > Wayne
>> >
>> > On 10/11/06, Mick Knutson <[EMAIL PROTECTED]> wrote:
>> >> Can I omit the version and scope as they are already defined in the
>> >> master
>> >> pom.xml in DependancyManagement? Or did that not work?
>> >>
>> >>
>> >>
>> >>
>> >> On 10/11/06, Wayne Fay <[EMAIL PROTECTED]> wrote:
>> >> >
>> >> > Sure, here's my war and ear pom (not all of them, but some of the
>> >> > dependencies)...
>> >> >
>> >> > war/pom.xml
>> >> >     <dependency>
>> >> >       <groupId>geronimo-spec</groupId>
>> >> >       <artifactId>geronimo-spec-jms</artifactId>
>> >> >       <version>1.1-rc4</version>
>> >> >       <scope>provided</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>geronimo-spec</groupId>
>> >> >       <artifactId>geronimo-spec-ejb</artifactId>
>> >> >       <version>2.1-rc4</version>
>> >> >       <scope>provided</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>javax.servlet</groupId>
>> >> >       <artifactId>servlet-api</artifactId>
>> >> >       <version>2.3</version>
>> >> >       <scope>provided</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>taglibs</groupId>
>> >> >       <artifactId>standard</artifactId>
>> >> >       <version>1.1.2</version>
>> >> >       <scope>compile</scope>
>> >> >       <exclusions>
>> >> >         <exclusion>
>> >> >           <artifactId>taglibs</artifactId>
>> >> >           <groupId>standard</groupId>
>> >> >         </exclusion>
>> >> >       </exclusions>
>> >> >       <optional>true</optional>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>javax.servlet</groupId>
>> >> >       <artifactId>jstl</artifactId>
>> >> >       <version>1.1.2</version>
>> >> >       <scope>compile</scope>
>> >> >       <exclusions>
>> >> >         <exclusion>
>> >> >           <artifactId>javax.servlet</artifactId>
>> >> >           <groupId>jstl</groupId>
>> >> >         </exclusion>
>> >> >       </exclusions>
>> >> >       <optional>true</optional>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>log4j</groupId>
>> >> >       <artifactId>log4j</artifactId>
>> >> >       <version>1.2.12</version>
>> >> >       <scope>compile</scope>
>> >> >       <exclusions>
>> >> >         <exclusion>
>> >> >           <artifactId>log4j</artifactId>
>> >> >           <groupId>log4j</groupId>
>> >> >         </exclusion>
>> >> >       </exclusions>
>> >> >       <optional>true</optional>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>quartz</groupId>
>> >> >       <artifactId>quartz</artifactId>
>> >> >       <version>1.5.1</version>
>> >> >       <scope>compile</scope>
>> >> >       <exclusions>
>> >> >         <exclusion>
>> >> >           <artifactId>quartz</artifactId>
>> >> >           <groupId>quartz</groupId>
>> >> >         </exclusion>
>> >> >       </exclusions>
>> >> >       <optional>true</optional>
>> >> >     </dependency>
>> >> >
>> >> >
>> >> > ear/pom.xml
>> >> >     <dependency>
>> >> >       <groupId>geronimo-spec</groupId>
>> >> >       <artifactId>geronimo-spec-jms</artifactId>
>> >> >       <version>1.1-rc4</version>
>> >> >       <scope>provided</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>geronimo-spec</groupId>
>> >> >       <artifactId>geronimo-spec-ejb</artifactId>
>> >> >       <version>2.1-rc4</version>
>> >> >       <scope>provided</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>javax.servlet</groupId>
>> >> >       <artifactId>servlet-api</artifactId>
>> >> >       <version>2.3</version>
>> >> >       <scope>provided</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>taglibs</groupId>
>> >> >       <artifactId>standard</artifactId>
>> >> >       <version>1.1.2</version>
>> >> >       <scope>compile</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>javax.servlet</groupId>
>> >> >       <artifactId>jstl</artifactId>
>> >> >       <version>1.1.2</version>
>> >> >       <scope>compile</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>log4j</groupId>
>> >> >       <artifactId>log4j</artifactId>
>> >> >       <version>1.2.12</version>
>> >> >       <scope>compile</scope>
>> >> >     </dependency>
>> >> >     <dependency>
>> >> >       <groupId>quartz</groupId>
>> >> >       <artifactId>quartz</artifactId>
>> >> >       <version>1.5.1</version>
>> >> >       <scope>compile</scope>
>> >> >     </dependency>
>> >> >
>> >> >
>> >> > HTH.
>> >> > Wayne
>> >> >
>> >> > On 10/11/06, Mick Knutson <[EMAIL PROTECTED]> wrote:
>> >> > > Can I see your war pom.xml to see how you excluded everything?
>> >> > >
>> >> > >
>> >> > >
>> >> > > On 10/11/06, Wayne Fay <[EMAIL PROTECTED]> wrote:
>> >> > > >
>> >> > > > I generally only allow my JARs to be placed in my EAR lib to
>> reduce
>> >> > > > the overall size of my EAR and eliminate duplication of code
>> (I'm
>> >> > > > using Oracle OAS 10.1.2 right now). But you'll need to check
>> your
>> >> > > > container's documentation and perhaps the J2EE Specs to see what
>> >> works
>> >> > > > for you.
>> >> > > >
>> >> > > > Currently this requires me to declare and then simultaneously
>> >> exclude
>> >> > > > most every dependency in my WAR pom, and also declare them in
>> >> the EAR.
>> >> > > > So not a lot of fun from a "managing your poms" perspective.
>> >> > > >
>> >> > > > Wayne
>> >> > > >
>> >> > > > On 10/11/06, Mick Knutson <[EMAIL PROTECTED]> wrote:
>> >> > > > > I have many LIB's that are in both my war and my ear. Is this
>> >> > correct or
>> >> > > > > should they just be in the ear?
>> >> > > > >
>> >> > > > > --
>> >> > > > >
>> >> > > > > Thanks
>> >> > > > >
>> >> > > > > DJ MICK
>> >> > > > > http://www.djmick.com
>> >> > > > > http://www.myspace.com/mickknutson
>> >> > > > >
>> >> > > > >
>> >> > > >
>> >> > > >
>> >> ---------------------------------------------------------------------
>> >> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> > > > For additional commands, e-mail: [EMAIL PROTECTED]
>> >> > > >
>> >> > > >
>> >> > >
>> >> > >
>> >> > > --
>> >> > >
>> >> > > Thanks
>> >> > >
>> >> > > DJ MICK
>> >> > > http://www.djmick.com
>> >> > > http://www.myspace.com/mickknutson
>> >> > >
>> >> > >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >> >
>> >> >
>> >>
>> >>
>> >> --
>> >>
>> >> Thanks
>> >>
>> >> DJ MICK
>> >> http://www.djmick.com
>> >> http://www.myspace.com/mickknutson
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to