You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Omar Yasseen <Om...@avenuea-razorfish.com> on 2007/10/29 19:47:05 UTC

incorrect WEB-INF generated location

Hi All,
 
I think Maven is a cool tool to use but why are things so damn hard :|
 
Thanks for any help!
 
Summary: 
Invoking mvn ant:ant Maven plugin is generating incorrect path for
WEB-INF location in maven-build.xml.
 
Question:
How can I configure the pom.xml so that mvn generates
 
<webinf dir="${basedir}/src/web/WEB-INF" 
              excludes="web.xml"/>
 
instead of 
 
<webinf dir="${basedir}/src/main/webapp/WEB-INF" 
              excludes="web.xml"/>

 
(1) The POM.xml file
(2)  The generated maven-build.xml file content
 
Detail:
(1) The POM.xml file
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>aarf</groupId> 
  <artifactId>o2_cfu</artifactId> 
  <version>1.0</version>
  <name>cfu</name> 
  <packaging>war</packaging>
  <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope> 
     </dependency> 
     <dependency> 
  <groupId>springframework</groupId> 
  <artifactId>spring-core</artifactId>
  <version>1.2.6</version>
  <scope>deploy</scope> 
     </dependency>
  </dependencies>
  <repositories>
       <repository>
        <id>aarf-internal-site</id>
        <url>http://10.97.160.130/maven-snap</url>
       </repository>
  </repositories>
  <build>
      <directory>${basedir}/build</directory>
      <outputDirectory>${basedir}/build/classes/</outputDirectory>
      <finalName>${artifactId}-${version}</finalName>
 
<testOutputDirectory>${basedir}/build/test-classes/</testOutputDirectory
>
      <sourceDirectory>${basedir}/src/java/</sourceDirectory>
      <testSourceDirectory>${basedir}/test/java</testSourceDirectory>
      <resources>
        <resource>
          <directory>resources</directory>
        </resource>
      </resources>
      <testResources>
        <testResource>
          <directory>test/resources</directory>
        </testResource>
      </testResources>
      <plugins>
       <plugin><!-- war -->
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
   <webappDirectory>${basedir}/src/web</webappDirectory>
   <webXml>${basedir}/src/web/WEB-INF</webXml>
     </configuration>
        </plugin>
      </plugins>
  </build>
  <reporting>
      <outputDirectory>build/site</outputDirectory>
  </reporting>
</project>
 
(2) The generated file maven-build.xml
 
<project name="o2_cfu-from-maven" default="package" basedir=".">
....
<!--
======================================================================
-->
  <!-- Package target
-->
  <!--
======================================================================
-->
 
  <target name="package" depends="compile,test" description="Package the
application">
    <mkdir
dir="${maven.build.dir}/${maven.build.finalName}/WEB-INF/lib"/>
    <copy
file="c:\dev\maven.repo.local\org\springframework\spring-core\1.2.6\spri
ng-core-1.2.6.jar" 
 
todir="${maven.build.dir}/${maven.build.finalName}/WEB-INF/lib"/>
    <copy file="c:\dev\maven.repo.local\aarf\aarf\1.0\aarf-1.0.jar" 
 
todir="${maven.build.dir}/${maven.build.finalName}/WEB-INF/lib"/>
    <war destfile="${maven.build.dir}/${maven.build.finalName}.war" 
         basedir="${maven.build.outputDir}" 
         compress="true" 
         webxml="C:\dev\Projects\O2_CFUProject/src/web/WEB-INF">
      <lib
dir="${maven.build.dir}/${maven.build.finalName}/WEB-INF/lib"/>
      <classes dir="${maven.build.outputDir}"/>
      <webinf dir="${basedir}/src/main/webapp/WEB-INF" 
              excludes="web.xml"/>
      <fileset dir="${basedir}/src/main/webapp"/>
    </war>
  </target>
....
<project>
 
Kind Regards
Omar