Hi all,
Preemptively apologize for this long message. I've been pulling my hair
for the better part of the past two days, and barely managed to get
everything working, but still don't quite understand what I've been
missing.
Basically, I have a project with this layout:
proj
--src
--webapp
where 'src' is the root of both the java source and resource files -
e.g., both Foo.hbm.xml and Foo.java are located under 'src/com/foo'.
And 'webapp' has most of the webapp related files located where they are
supposed to be in the final webapp, except for the classes and resource
files that need to be compiled/copied from 'src' to under
'WEB-INF/classes'.
For various reasons, I want to use war:inplace instead of war:war to
build the webapp in place under 'webapp'. In order for war:inplace to
copy whatever resource files under 'src' to 'WEB-INF/classes', I thought
I'd use:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>build-war-inplace</id>
<goals>
<goal>inplace</goal>
</goals>
<configuration>
<webappDirectory>${basedir}</webappDirectory>
<warSourceDirectory>${basedir}/webapp</warSourceDirectory>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>false</filtering>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.html</exclude>
<exclude>**/.svn</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
But that doesn't work, war:inplace goes ahead and created a skeleton
webapp under 'src/main/webapp', without copying over any of the resource
files.
After some hacking around, it looks like I have to move the
'configuration' block out of 'executions', i.e., to change the above
fragment to:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>${basedir}</webappDirectory>
<warSourceDirectory>${basedir}/webapp</warSourceDirectory>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>false</filtering>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.html</exclude>
<exclude>**/.svn</exclude>
</excludes>
</resource>
</webResources>
</configuration>
<executions>
<execution>
<id>build-war-inplace</id>
<goals>
<goal>inplace</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
That works fine, but the problem is obvious - that configuration doesn't
work for war:war. It's intended for war:inplace only.
I searched around and found this JIRA:
http://jira.codehaus.org/browse/MNG-781
Another strange thing is, in the above configuration, note that the
values for 'webappDirectory' and 'warSourceDirectory' that actually
_work_ for me are actually the opposite of what the plugin document says
they are supposed to be.
Thanks for any hint or pointers.
--
Jing Xue
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]