How do I use a custom webresource in a nested pom?

My setup looks like this... "[]" means it's a folder

  - [MyApp]
     - pom.xml
     - [domain]
        - pom.xml
     - [webgui]
        - pom.xml
        - [src]
           - [main]
              - [webapp]
              - [webresources_development]
                 - fileA
              - [webresources_production]
                 - fileB

I want to choose the webresource at build-time using a profile so I
modified my webapp pom.xml like this...

<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";>
 <parent>
   <groupId>MyApp</groupId>
   <artifactId>MyWebapp</artifactId>
   <version>0.1.0-SNAPSHOT</version>
 </parent>
 <modelVersion>4.0.0</modelVersion>
 <artifactId>webgui</artifactId>
 <version>0.1.0-SNAPSHOT</version>
 <name>MyWebapp</name>
 <packaging>war</packaging>
 <dependencies>
   <dependency>
     <groupId>MyApp</groupId>
     <artifactId>domain</artifactId>
     <version>0.1.0-SNAPSHOT</version>
   </dependency>
 </dependencies>
 <build>
   <finalName>MyWebapp</finalName>
   <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-war-plugin</artifactId>
       <version>2.0.1</version>
       <configuration>
         <webResources>
           <resource>
             <!-- this is relative to the pom.xml directory -->
             <directory>src/main/webresources_production</directory>
           </resource>
         </webResources>
       </configuration>
     </plugin>
   </plugins>
 </build>
 <profiles>
   <profile>
     <id>dev</id>
     <activation>
       <property>
         <name>dev</name>
       </property>
     </activation>
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-war-plugin</artifactId>
           <version>2.0.1</version>
           <configuration>
             <webResources>
               <resource>
                 <!-- this is relative to the pom.xml directory -->
                 <directory>src/main/webresources_development</directory>
               </resource>
             </webResources>
           </configuration>
         </plugin>
       </plugins>
     </build>
   </profile>
 </profiles>
</project>

This works if I build from the webgui directory, but if I build from
the parent directory I have to change add webgui to the path (eg,
<directory>webgui/src/main/webresources_development</directory>).

How can I make the path work from both locations without having to
modify my pom each time?

???
,chris

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

Reply via email to