Yes. I have included <type>war</type> in dependency declaration. Below is a pom 
snapshot.
***** POM - START *****
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
 <modelVersion>4.0.0</modelVersion>
 <groupId>test</groupId>
 <artifactId>child2</artifactId>
 <version>1.0-SNAPSHOT</version>
 <description>child2</description>
 <packaging>war</packaging>
 <name>child2</name>
 <parent>
  <groupId>test</groupId>
  <artifactId>parent</artifactId>
  <version>1.0-SNAPSHOT</version>
  <relativePath>../parent/pom.xml</relativePath>
 </parent>
 <build>
  <resources>
   <resource>
    <directory>src/main/resources</directory>
   </resource>
   <resource>
    <directory>src/main/java</directory>
                  <filtering>true</filtering>
    <includes>
     <include>**/*.properties</include>
    </includes>
   </resource>
  </resources>
  <testResources>
   <testResource>
         <directory>
             src/test/resources
          </directory>
         <includes>
            <include>**/*.properties</include>
            <include>**/*.xml</include>                                         
      
          </includes> 
            </testResource>
  </testResources>  
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.1</version>    
    <executions>
     <execution>
      <configuration>
       <classesDirectory>target/classes</classesDirectory>
       <finalName>child2-1.0-SNAPSHOT</finalName>
       <outputDirectory>target</outputDirectory>
      </configuration>
      <phase>package</phase>
      <id>Create JAR in project</id>
      <goals>
       <goal>jar</goal>
      </goals>
     </execution>
    </executions>    
   </plugin>    
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2-SNAPSHOT</version>
    <configuration>
     <archiveClasses>false</archiveClasses>
     <webResources>
      <resource>
       <directory>
         ${basedir}/src/main/config/torque
       </directory>
       <excludes>
        <exclude>**/*model</exclude>
       </excludes>
       <targetPath>WEB-INF/data</targetPath>
      </resource>
      <resource>
       <directory>
         ${basedir}/src/main/resources
       </directory>
       <includes>
        <include>**/hibernate.properties</include>
       </includes>
       <targetPath>WEB-INF/classes</targetPath>
      </resource>
     </webResources>
     
<dependentWarExcludes>WEB-INF/classes/hibernate.properties</dependentWarExcludes>
    </configuration>
    <executions>
     <execution>
      <phase>validate</phase>
      <id>copy jars</id>
      <goals>
       <goal>exploded</goal>
      </goals>
     </execution>
    </executions>
   </plugin>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.2</version>    
    <executions>
     <execution>
      <configuration>
       <file>target/child2-1.0-SNAPSHOT.war</file>
       <repositoryLayout>default</repositoryLayout>
       <groupId>test</groupId>
       <artifactId>child2</artifactId>
       <version>1.0-SNAPSHOT</version>
       <packaging>war</packaging>
       <generatePom>true</generatePom>
      </configuration>
      <phase>install</phase>
      <id>install WAR in M2 repos</id>
      <goals>
       <goal>install-file</goal>
      </goals>
     </execution>
     <execution>
      <configuration>
       <file>target/child2-1.0-SNAPSHOT.jar</file>
       <repositoryLayout>default</repositoryLayout>
       <groupId>test</groupId>
       <artifactId>child2</artifactId>
       <version>1.0-SNAPSHOT</version>
       <packaging>jar</packaging>
       <generatePom>true</generatePom>
      </configuration>
      <phase>install</phase>
      <id>install JAR in M2 repos</id>
      <goals>
       <goal>install-file</goal>
      </goals>
     </execution>
    </executions>    
   </plugin>   
   
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.3-SNAPSHOT</version>
    <configuration>
     <excludes>
     </excludes>
     <testFailureIgnore>true</testFailureIgnore>
    </configuration>
   </plugin>
              <plugin>
                  <artifactId>maven-clean-plugin</artifactId>
                  <configuration>
                       <filesets>
                        <fileset>
       <directory>${basedir}/src/main/etc</directory>
       <includes>
        <include>setup.properties</include>
        <include>*.tmp</include>
        <include>utils/**</include>
       </includes>
       <followSymlinks>false</followSymlinks>
      </fileset>                    
      <fileset>
          <directory>${basedir}/src/main/webapp/WEB-INF/classes</directory>
          <followSymlinks>false</followSymlinks>
      </fileset>
      <fileset>
       <directory>${basedir}/src/main/java</directory>
       <includes>
        <include>report.om.generation</include>
       </includes>
      </fileset>                        
                       </filesets>
                  </configuration>
              </plugin>
  </plugins>
 </build>
 <dependencies>
  <!-- Few Dependencies are present here -->
  <dependency>
   <groupId>test</groupId>
   <artifactId>child1</artifactId>
   <version>1.0-SNAPSHOT</version>
   <type>war</type>
  </dependency> 
 </dependencies>
 <reporting>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-report-plugin</artifactId>
   </plugin>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
     <minmemory>128m</minmemory>
     <maxmemory>512m</maxmemory>
    </configuration>
   </plugin>
  </plugins>
 </reporting>
</project>

***** POM - END *****

thanks,
Anand

----- Original Message ----
From: Wayne Fay <[EMAIL PROTECTED]>
To: Maven Users List <[email protected]>
Sent: Tuesday, 27 November, 2007 12:32:13 PM
Subject: Re: Dependency issue (war and jar) in multimodule project

In your dependency declaration, did you include <type>war</type> for
the child1 dep in the child2 pom? Or how are you declaring the
dependency?

Perhaps show us your pom(s).

Wayne

On 11/26/07, Anand Rathi <[EMAIL PROTECTED]> wrote:
> Hi Juven,
> I removed child1 jar dependency and only kept child1 war dependency but while 
> building child2 project, it is still expanding child1 jar file instead of 
> child1 war file. Also it is picking up 'child1-1.0-SNAPSHOT.jar' from 
> 'child1\target' folder instead of repository. This is happening only in 
> multi-module build environment. If I build child2 seperately, it is building 
> successfully.
>
> Following message is shown in log:
> [DEBUG] Processing: child1-1.0-SNAPSHOT.war
> [INFO] Expanding: D:\temp\child1\target\child1-1.0-SNAPSHOT.jar into 
> D:\temp\child2\target\war\work\child1-1.0-SNAPSHOT
>
> thanks,
> Anand
>
>
> ----- Original Message ----
> From: Juven Xu <[EMAIL PROTECTED]>
> To: Maven Users List <[email protected]>
> Sent: Tuesday, 27 November, 2007 7:01:59 AM
> Subject: Re: Dependency issue (war and jar) in multimodule project
>
> Hi, Anand:
>
>  If child2 has a dependency on child1 war, I think you don't need to make
> dependency on child1 jar. Cause all the xml file and class file will be
> inherited.
>
>  Thanks,
>  Juven
>
> On Nov 26, 2007 3:34 PM, Anand Rathi <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I have a multimodule project as shown below:
> > - parent (pom)
> >        - child1 (war)
> >        - child2 (war)
> >
> > child2 project has a dependency on child1 jar as well as war. This is
> > required because child1 war contains some xml files which I need at the
> > child2 war creation time.
> >
> > I am building this project from parent folder using 'mvn clean install'
> > command. It builds child1 module successfully and installs jar as well as
> > war in repository.
> >
> > But while building child2 module, it fails because while expanding war
> > files, it is expanding child1 jar file instead of child1 war file.
> >
> > Following message shown in log file
> > [DEBUG] Processing: child1-1.0-SNAPSHOT.war
> > [INFO] Expanding: D:\temp\child1\target\child1-1.0-SNAPSHOT.jar into
> > D:\temp\child2\target\war\work\child1-1.0-SNAPSHOT
> >
> > thanks,
> > Anand
> >
> >
> >      Chat on a cool, new interface. No download required. Go to
> > http://in.messenger.yahoo.com/webmessengerpromo.php
>
>
>      Download prohibited? No problem. CHAT from any browser, without 
> download. Go to http://in.messenger.yahoo.com/webmessengerpromo.php/

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


      Chat on a cool, new interface. No download required. Go to 
http://in.messenger.yahoo.com/webmessengerpromo.php

Reply via email to