Initial version of war plugin.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163471 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-03-07 21:46:14 +00:00
parent 47da41f68e
commit 482684e3cc
4 changed files with 24 additions and 8 deletions

View File

@ -12,3 +12,4 @@ it0012
it0013 it0013
#it0014 #it0014
it0015 it0015
it0016

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app >
</web-app>

View File

@ -0,0 +1,5 @@
<html>
<body>
Hello World
</body>
</html>

View File

@ -82,7 +82,7 @@ import org.codehaus.plexus.util.FileUtils;
* required="true" * required="true"
* validator="" * validator=""
* expression="#maven.war.src" * expression="#maven.war.src"
* default="#basedir/src/webapp" * default="#basedir/src/main/webapp"
* description="" * description=""
* @parameter * @parameter
* name="warSourceIncludes" * name="warSourceIncludes"
@ -93,7 +93,7 @@ import org.codehaus.plexus.util.FileUtils;
* default="**" * default="**"
* description="" * description=""
* @parameter * @parameter
* name="warSourceIncludes" * name="warSourceExcludes"
* type="String" * type="String"
* required="false" * required="false"
* validator="" * validator=""
@ -112,7 +112,7 @@ import org.codehaus.plexus.util.FileUtils;
* required="true" * required="true"
* validator="" * validator=""
* expression="#maven.war.webapp.dir" * expression="#maven.war.webapp.dir"
* default="#project.build.output/#project.build.finalName" * default="#project.build.directory/#project.build.finalName"
* description="" * description=""
* @parameter * @parameter
* name="mode" * name="mode"
@ -128,7 +128,7 @@ import org.codehaus.plexus.util.FileUtils;
* required="true" * required="true"
* validator="" * validator=""
* expression="#maven.war.build.dir" * expression="#maven.war.build.dir"
* default="#project.build.output" * default="#project.build.directory"
* description="" * description=""
* @parameter * @parameter
* name="basedir" * name="basedir"
@ -157,7 +157,7 @@ import org.codehaus.plexus.util.FileUtils;
public class WarMojo public class WarMojo
extends AbstractPlugin extends AbstractPlugin
{ {
public static final String WEB_INF = "WEB_INF"; public static final String WEB_INF = "WEB-INF";
private PluginExecutionRequest request; private PluginExecutionRequest request;
@ -190,7 +190,8 @@ public class WarMojo
if ( warSourceDirectory.exists() ) if ( warSourceDirectory.exists() )
{ {
FileUtils.copyDirectory( sourceDirectory, webappDirectory, includes, excludes ); //TODO : Use includes and excludes
FileUtils.copyDirectoryStructure( sourceDirectory, webappDirectory );
} }
if ( webXml != null && ! "".equals( webXml ) ) if ( webXml != null && ! "".equals( webXml ) )
@ -281,11 +282,15 @@ public class WarMojo
MavenArchiver archiver = new MavenArchiver(); MavenArchiver archiver = new MavenArchiver();
//archiver.setArchiver( new WarArchiver() ); WarArchiver warArchiver = new WarArchiver();
archiver.setArchiver( warArchiver );
archiver.setOutputFile( warFile ); archiver.setOutputFile( warFile );
archiver.getArchiver().addDirectory( webappDirectory, new String[] { "**/**" }, null ); warArchiver.addDirectory( webappDirectory, new String[] { "**/**" }, new String[] { "**/WEB-INF/web.xml" } );
warArchiver.setWebxml( new File( webappDirectory, "WEB-INF/web.xml" ) );
// create archive // create archive
archiver.createArchive( request ); archiver.createArchive( request );