MavenWarSource

HomePage | RecentChanges | Preferences

How do I include the source code in a WAR file?

When producing 'example' webapps, you may want to include the source code under WEB-INF to allow the user to make changes without having to check the project out of source control and learn to build it.

References

Solution

Define a new goal in the top-level 'maven.xml' file:

  <goal name="copy-src">
    <ant:copy todir="${maven.war.webapp.dir}/WEB-INF/src/" overwrite="false">
      <ant:fileset dir="${basedir}/src/java"
           excludes="**/.svn/**">
       </ant:fileset>
    </ant:copy>
  </goal>

Then call it from the 'maven.xml' file for the particular webapp you're building:

<?xml version="1.0"?>
<project>
    <postGoal name="war:webapp">
        <!-- Include the source code in the mailreader webapp -->
        <attainGoal name="copy-src"/>
    </postGoal>
</project>


HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited August 1, 2005 5:53 am by WendySmoak (diff)
Search: