You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/09 06:51:06 UTC

svn commit: r307363 - in /maven/components/trunk/maven-plugins/maven-war-plugin: ./ src/main/java/org/apache/maven/plugin/war/

Author: brett
Date: Sat Oct  8 21:50:58 2005
New Revision: 307363

URL: http://svn.apache.org/viewcvs?rev=307363&view=rev
Log:
PR: MNG-1037
Submitted by: Allan Ramirez
Reviewed by:  Brett Porter
add exploded and inplace goals
(applied with modifications to better  utilise base class and use shared default excludes)

Added:
    maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java   (with props)
    maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java   (with props)
    maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java   (with props)
Modified:
    maven/components/trunk/maven-plugins/maven-war-plugin/pom.xml
    maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java

Modified: maven/components/trunk/maven-plugins/maven-war-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-war-plugin/pom.xml?rev=307363&r1=307362&r2=307363&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-war-plugin/pom.xml (original)
+++ maven/components/trunk/maven-plugins/maven-war-plugin/pom.xml Sat Oct  8 21:50:58 2005
@@ -2,7 +2,7 @@
   <parent>
     <artifactId>maven-plugin-parent</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>2.0-beta-1</version>
+    <version>2.0-beta-4-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>maven-war-plugin</artifactId>
@@ -14,6 +14,10 @@
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-archiver</artifactId>
       <version>2.0-beta-3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>

Added: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java?rev=307363&view=auto
==============================================================================
--- maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java (added)
+++ maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java Sat Oct  8 21:50:58 2005
@@ -0,0 +1,318 @@
+package org.apache.maven.plugin.war;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+public abstract class AbstractWarMojo
+    extends AbstractMojo
+{
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * The directory containing generated classes.
+     *
+     * @parameter expression="${project.build.outputDirectory}"
+     * @required
+     * @readonly
+     */
+    private File classesDirectory;
+
+    /**
+     * The directory where the webapp is built.
+     *
+     * @parameter expression="${project.build.directory}/${project.build.finalName}"
+     * @required
+     */
+    private File webappDirectory;
+
+    /**
+     * Single directory for extra files to include in the WAR.
+     *
+     * @parameter expression="${basedir}/src/main/webapp"
+     * @required
+     */
+    private File warSourceDirectory;
+
+    /**
+     * The path to the web.xml file to use.
+     *
+     * @parameter expression="${maven.war.webxml}"
+     */
+    private String webXml;
+
+    public static final String WEB_INF = "WEB-INF";
+
+    /**
+     * The comma separated list of tokens to include in the WAR.
+     * Default is '**'.
+     *
+     * @parameter alias="includes"
+     */
+    private String warSourceIncludes = "**";
+
+    /**
+     * The comma separated list of tokens to exclude from the WAR.
+     *
+     * @parameter alias="excludes"
+     */
+    private String warSourceExcludes;
+
+    private static final String[] EMPTY_STRING_ARRAY = {};
+
+    public abstract void execute()
+        throws MojoExecutionException;
+
+    public MavenProject getProject()
+    {
+        return project;
+    }
+
+    public void setProject( MavenProject project )
+    {
+        this.project = project;
+    }
+
+    public File getClassesDirectory()
+    {
+        return classesDirectory;
+    }
+
+    public void setClassesDirectory( File classesDirectory )
+    {
+        this.classesDirectory = classesDirectory;
+    }
+
+    public File getWebappDirectory()
+    {
+        return webappDirectory;
+    }
+
+    public void setWebappDirectory( File webappDirectory )
+    {
+        this.webappDirectory = webappDirectory;
+    }
+
+    public File getWarSourceDirectory()
+    {
+        return warSourceDirectory;
+    }
+
+    public void setWarSourceDirectory( File warSourceDirectory )
+    {
+        this.warSourceDirectory = warSourceDirectory;
+    }
+
+    public String getWebXml()
+    {
+        return webXml;
+    }
+
+    public void setWebXml( String webXml )
+    {
+        this.webXml = webXml;
+    }
+
+    /**
+     * Returns a string array of the excludes to be used
+     * when assembling/copying the war.
+     *
+     * @return an array of tokens to exclude
+     */
+    protected String[] getExcludes()
+    {
+        List excludeList = FileUtils.getDefaultExcludesAsList();
+        if ( warSourceExcludes != null && !"".equals( warSourceExcludes ) )
+        {
+            excludeList.add( warSourceExcludes );
+        }
+
+        // if webXML is specified, omit the one in the source directory
+        if ( getWebXml() != null && !"".equals( getWebXml() ) )
+        {
+            excludeList.add( "**/" + WEB_INF + "/web.xml" );
+        }
+
+        return (String[]) excludeList.toArray( EMPTY_STRING_ARRAY );
+    }
+
+    /**
+     * Returns a string array of the includes to be used
+     * when assembling/copying the war.
+     *
+     * @return an array of tokens to include
+     */
+    protected String[] getIncludes()
+    {
+        return new String[]{warSourceIncludes};
+    }
+
+    public void buildExplodedWebapp( File webappDirectory )
+        throws MojoExecutionException
+    {
+        getLog().info( "Exploding webapp..." );
+
+        webappDirectory.mkdirs();
+
+        File webinfDir = new File( webappDirectory, WEB_INF );
+
+        webinfDir.mkdirs();
+
+        try
+        {
+            copyResources( getWarSourceDirectory(), webappDirectory, getWebXml() );
+
+            buildWebapp( getProject(), webappDirectory );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Could not explode webapp...", e );
+        }
+    }
+
+    /**
+     * Copies webapp resources from the specified directory.
+     * <p/>
+     * Note that the <tt>webXml</tt> parameter could be null and may
+     * specify a file which is not named <tt>web.xml<tt>. If the file
+     * exists, it will be copied to the <tt>META-INF</tt> directory and
+     * renamed accordingly.
+     *
+     * @param sourceDirectory the source directory
+     * @param webappDirectory the target directory
+     * @param webXml the path to a custom web.xml
+     * @throws java.io.IOException if an error occured while copying resources
+     */
+    public void copyResources( File sourceDirectory, File webappDirectory, String webXml )
+        throws IOException
+    {
+        if ( !sourceDirectory.equals( webappDirectory ) )
+        {
+            getLog().info( "Copy webapp resources to " + webappDirectory.getAbsolutePath() );
+            if ( getWarSourceDirectory().exists() )
+            {
+                String[] fileNames = getWarFiles( sourceDirectory );
+                for ( int i = 0; i < fileNames.length; i++ )
+                {
+                    FileUtils.copyFile( new File( sourceDirectory, fileNames[i] ),
+                                        new File( webappDirectory, fileNames[i] ) );
+                }
+            }
+
+            if ( webXml != null && !"".equals( webXml ) )
+            {
+                //rename to web.xml
+                File webinfDir = new File( webappDirectory, WEB_INF );
+                FileUtils.copyFile( new File( webXml ), new File( webinfDir, "/web.xml" ) );
+            }
+        }
+    }
+
+    /**
+     * Builds the webapp for the specified project.
+     * <p/>
+     * Classes, libraries and tld files are copied to
+     * the <tt>webappDirectory</tt> during this phase.
+     *
+     * @param project the maven project
+     * @param webappDirectory
+     * @throws java.io.IOException if an error occured while building the webapp
+     */
+    public void buildWebapp( MavenProject project, File webappDirectory )
+        throws IOException
+    {
+        getLog().info( "Assembling webapp " + project.getArtifactId() + " in " + webappDirectory );
+
+        File libDirectory = new File( webappDirectory, WEB_INF + "/lib" );
+
+        File tldDirectory = new File( webappDirectory, WEB_INF + "/tld" );
+
+        File webappClassesDirectory = new File( webappDirectory, WEB_INF + "/classes" );
+
+        if ( getClassesDirectory().exists() )
+        {
+            FileUtils.copyDirectoryStructure( getClassesDirectory(), webappClassesDirectory );
+        }
+
+        Set artifacts = project.getArtifacts();
+
+        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+        {
+            Artifact artifact = (Artifact) iter.next();
+
+            // TODO: utilise appropriate methods from project builder
+            // TODO: scope handler
+            // Include runtime and compile time libraries
+            if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) &&
+                !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
+            {
+                String type = artifact.getType();
+                if ( "tld".equals( type ) )
+                {
+                    FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
+                }
+                else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
+                {
+                    FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
+                }
+                else
+                {
+                    getLog().debug( "Skipping artifact of type " + type + " for WEB-INF/lib" );
+                }
+            }
+        }
+    }
+
+    /**
+     * Returns a list of filenames that should be copied
+     * over to the destination directory.
+     *
+     * @param sourceDir the directory to be scanned
+     * @return the array of filenames, relative to the sourceDir
+     */
+    private String[] getWarFiles( File sourceDir )
+    {
+        DirectoryScanner scanner = new DirectoryScanner();
+        scanner.setBasedir( sourceDir );
+        scanner.setExcludes( getExcludes() );
+        scanner.addDefaultExcludes();
+
+        scanner.setIncludes( getIncludes() );
+
+        scanner.scan();
+
+        return scanner.getIncludedFiles();
+    }
+}

Propchange: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java?rev=307363&view=auto
==============================================================================
--- maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java (added)
+++ maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java Sat Oct  8 21:50:58 2005
@@ -0,0 +1,36 @@
+package org.apache.maven.plugin.war;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Generate the exploded webapp
+ *
+ * @goal exploded
+ * @phase package
+ * @requiresDependencyResolution runtime
+ */
+public class WarExplodedMojo
+    extends AbstractWarMojo
+{
+    public void execute() throws MojoExecutionException
+    {
+        buildExplodedWebapp( getWebappDirectory(), getWebappDirectory() );
+    }
+
+}
\ No newline at end of file

Propchange: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java?rev=307363&view=auto
==============================================================================
--- maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java (added)
+++ maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java Sat Oct  8 21:50:58 2005
@@ -0,0 +1,36 @@
+package org.apache.maven.plugin.war;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Generates webapp in the source directory
+ *
+ * @goal inplace
+ * @requiresDependencyResolution runtime
+ */
+public class WarInPlaceMojo
+    extends AbstractWarMojo
+{
+    public void execute() throws MojoExecutionException
+    {
+        getLog().info( "Generating webapp in source directory... " + getWarSourceDirectory() );
+
+        buildExplodedWebapp( getWarSourceDirectory() );
+    }
+}
\ No newline at end of file

Propchange: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java?rev=307363&r1=307362&r2=307363&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java Sat Oct  8 21:50:58 2005
@@ -18,23 +18,15 @@
 
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.archiver.MavenArchiver;
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.jar.ManifestException;
 import org.codehaus.plexus.archiver.war.WarArchiver;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codehaus.plexus.util.FileUtils;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+
 
 /**
  * Build a war/webapp.
@@ -46,36 +38,8 @@
  * @requiresDependencyResolution runtime
  */
 public class WarMojo
-    extends AbstractMojo
+    extends AbstractWarMojo
 {
-    public static final String WEB_INF = "WEB-INF";
-
-    /**
-     * The mode to use. Possible values are: war (default), inplace
-     * and exploded.
-     *
-     * @parameter expression="${mode}"
-     */
-    private String mode = "war";
-
-    /**
-     * The maven project.
-     *
-     * @parameter expression="${project}"
-     * @required
-     * @readonly
-     */
-    private MavenProject project;
-
-    /**
-     * The directory containing generated classes.
-     *
-     * @parameter expression="${project.build.outputDirectory}"
-     * @required
-     * @readonly
-     */
-    private File classesDirectory;
-
     /**
      * The directory for the generated WAR.
      *
@@ -85,44 +49,6 @@
     private String outputDirectory;
 
     /**
-     * The directory where the webapp is built.
-     *
-     * @parameter expression="${project.build.directory}/${project.build.finalName}"
-     * @required
-     */
-    private File webappDirectory;
-
-    /**
-     * Single directory for extra files to include in the WAR.
-     *
-     * @parameter expression="${basedir}/src/main/webapp"
-     * @required
-     */
-    private File warSourceDirectory;
-
-    /**
-     * The comma separated list of tokens to include in the WAR.
-     * Default is '**'.
-     *
-     * @parameter alias="includes"
-     */
-    private String warSourceIncludes = "**";
-
-    /**
-     * The comma separated list of tokens to exclude from the WAR.
-     *
-     * @parameter alias="excludes"
-     */
-    private String warSourceExcludes;
-
-    /**
-     * The path to the web.xml file to use.
-     *
-     * @parameter expression="${maven.war.webxml}"
-     */
-    private String webXml;
-
-    /**
      * The name of the generated war.
      *
      * @parameter expression="${project.build.finalName}"
@@ -145,141 +71,6 @@
      */
     private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
 
-    private static final String[] EMPTY_STRING_ARRAY = {};
-
-
-    /**
-     * Copies webapp resources from the specified directory.
-     * <p/>
-     * Note that the <tt>webXml</tt> parameter could be null and may
-     * specify a file which is not named <tt>web.xml<tt>. If the file
-     * exists, it will be copied to the <tt>META-INF</tt> directory and
-     * renamed accordingly.
-     *
-     * @param sourceDirectory the source directory
-     * @param webappDirectory the target directory
-     * @param webXml          the path to a custom web.xml
-     * @throws IOException if an error occured while copying resources
-     */
-    public void copyResources( File sourceDirectory, File webappDirectory, String webXml )
-        throws IOException
-    {
-        if ( !sourceDirectory.equals( webappDirectory ) )
-        {
-            getLog().info( "Copy webapp resources to " + webappDirectory.getAbsolutePath() );
-
-            if ( warSourceDirectory.exists() )
-            {
-                String[] fileNames = getWarFiles( sourceDirectory );
-                for ( int i = 0; i < fileNames.length; i++ )
-                {
-                    FileUtils.copyFile( new File( sourceDirectory, fileNames[i] ),
-                                        new File( webappDirectory, fileNames[i] ) );
-                }
-            }
-
-            if ( webXml != null && !"".equals( webXml ) )
-            {
-                //rename to web.xml
-                File webinfDir = new File( webappDirectory, WEB_INF );
-                FileUtils.copyFile( new File( webXml ), new File( webinfDir, "/web.xml" ) );
-            }
-        }
-    }
-
-    /**
-     * Builds the webapp for the specified project.
-     * <p/>
-     * Classes, libraries and tld files are copied to
-     * the <tt>webappDirectory</tt> during this phase.
-     *
-     * @param project the maven project
-     * @throws IOException if an error occured while building the webapp
-     */
-    public void buildWebapp( MavenProject project )
-        throws IOException
-    {
-        getLog().info( "Assembling webapp " + project.getArtifactId() + " in " + webappDirectory );
-
-        File libDirectory = new File( webappDirectory, WEB_INF + "/lib" );
-
-        File tldDirectory = new File( webappDirectory, WEB_INF + "/tld" );
-
-        File webappClassesDirectory = new File( webappDirectory, WEB_INF + "/classes" );
-
-        if ( classesDirectory.exists() )
-        {
-            FileUtils.copyDirectoryStructure( classesDirectory, webappClassesDirectory );
-        }
-
-        Set artifacts = project.getArtifacts();
-
-        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
-        {
-            Artifact artifact = (Artifact) iter.next();
-
-            // TODO: utilise appropriate methods from project builder
-            // TODO: scope handler
-            // Include runtime and compile time libraries
-            if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) &&
-                !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
-            {
-                String type = artifact.getType();
-                if ( "tld".equals( type ) )
-                {
-                    FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
-                }
-                else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
-                {
-                    FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
-                }
-                else
-                {
-                    getLog().debug( "Skipping artifact of type " + type + " for WEB-INF/lib" );
-                }
-            }
-
-        }
-    }
-
-    /**
-     * Generates and exploded webapp.
-     * <p/>
-     * This mode is invoked when the <tt>mode</tt> parameter has a value
-     * of <tt>exploded</tt>.
-     *
-     * @throws IOException if an error occured while building the webapp
-     */
-    public void generateExplodedWebapp()
-        throws IOException
-    {
-        webappDirectory.mkdirs();
-
-        File webinfDir = new File( webappDirectory, WEB_INF );
-
-        webinfDir.mkdirs();
-
-        copyResources( warSourceDirectory, webappDirectory, webXml );
-
-        buildWebapp( project );
-    }
-
-    /**
-     * Generates the webapp in the source directory.
-     * <p/>
-     * This mode is invoked when the <tt>mode</tt> parameter has a value
-     * of <tt>inplace</tt>.
-     *
-     * @throws IOException if an error occured while building the webapp
-     */
-    public void generateInPlaceWebapp()
-        throws IOException
-    {
-        webappDirectory = warSourceDirectory;
-
-        generateExplodedWebapp();
-    }
-
     /**
      * Executes the WarMojo on the current project.
      *
@@ -311,138 +102,27 @@
      * @throws DependencyResolutionRequiredException
      */
     private void performPackaging( File warFile )
-        throws IOException, ArchiverException, ManifestException, DependencyResolutionRequiredException
-    {
-        if ( "inplace".equals( mode ) )
-        {
-            generateInPlaceWebapp();
-        }
-        else
-        {
-            generateExplodedWebapp();
-
-            // TODO: make a separate 'exploded' Mojo. For now,
-            // disable not making an artifact so the install phase
-            // doesn't fail.
-            if ( !"exploded".equals( mode ) )
-            {
-                //generate war file
-                getLog().info( "Generating war " + warFile.getAbsolutePath() );
-
-                MavenArchiver archiver = new MavenArchiver();
-
-                archiver.setArchiver( warArchiver );
-
-                archiver.setOutputFile( warFile );
-
-                warArchiver.addDirectory( webappDirectory, getIncludes(), getExcludes() );
-
-                warArchiver.setWebxml( new File( webappDirectory, "WEB-INF/web.xml" ) );
-
-                // create archive
-                archiver.createArchive( project, archive );
-
-                project.getArtifact().setFile( warFile );
-            }
-            else
-            {
-                getLog().warn( "Exploded mode will be deprecated in the next release. It is not compatible with install/deploy goals" );
-            }
-        }
-    }
-
-    /**
-     * Returns the default exclude tokens.
-     *
-     * @return a list of <code>String</code> tokens
-     * @todo copied again. Next person to touch it puts it in the right place! :)
-     */
-    public List getDefaultExcludes()
+        throws IOException, ArchiverException, ManifestException, DependencyResolutionRequiredException,
+            MojoExecutionException
     {
-        List defaultExcludes = new ArrayList();
-        defaultExcludes.add( "**/*~" );
-        defaultExcludes.add( "**/#*#" );
-        defaultExcludes.add( "**/.#*" );
-        defaultExcludes.add( "**/%*%" );
-        defaultExcludes.add( "**/._*" );
-
-        // CVS
-        defaultExcludes.add( "**/CVS" );
-        defaultExcludes.add( "**/CVS/**" );
-        defaultExcludes.add( "**/.cvsignore" );
-
-        // SCCS
-        defaultExcludes.add( "**/SCCS" );
-        defaultExcludes.add( "**/SCCS/**" );
-
-        // Visual SourceSafe
-        defaultExcludes.add( "**/vssver.scc" );
-
-        // Subversion
-        defaultExcludes.add( "**/.svn" );
-        defaultExcludes.add( "**/.svn/**" );
+        buildExplodedWebapp( getWebappDirectory() );
 
-        // Mac
-        defaultExcludes.add( "**/.DS_Store" );
+        //generate war file
+        getLog().info( "Generating war " + warFile.getAbsolutePath() );
 
-        // Windows Thumbs
-        defaultExcludes.add( "**/Thumbs.db" );
+        MavenArchiver archiver = new MavenArchiver();
 
-        return defaultExcludes;
-    }
+        archiver.setArchiver( warArchiver );
 
-    /**
-     * Returns a list of filenames that should be copied
-     * over to the destination directory.
-     *
-     * @param sourceDir the directory to be scanned
-     * @return the array of filenames, relative to the sourceDir
-     */
-    private String[] getWarFiles( File sourceDir )
-    {
-        DirectoryScanner scanner = new DirectoryScanner();
-        scanner.setBasedir( sourceDir );
-        scanner.setExcludes( getExcludes() );
-        scanner.addDefaultExcludes();
+        archiver.setOutputFile( warFile );
 
-        scanner.setIncludes( getIncludes() );
+        warArchiver.addDirectory( getWebappDirectory(), getIncludes(), getExcludes() );
 
-        scanner.scan();
+        warArchiver.setWebxml( new File( getWebappDirectory(), "WEB-INF/web.xml" ) );
 
-        return scanner.getIncludedFiles();
-    }
+        // create archive
+        archiver.createArchive( getProject(), archive );
 
-    /**
-     * Returns a string array of the excludes to be used
-     * when assembling/copying the war.
-     *
-     * @return an array of tokens to exclude
-     */
-    private String[] getExcludes()
-    {
-        List excludeList = getDefaultExcludes();
-        if ( warSourceExcludes != null && !"".equals( warSourceExcludes ) )
-        {
-            excludeList.add( warSourceExcludes );
-        }
-
-        // if webXML is specified, omit the one in the source directory
-        if ( webXml != null && !"".equals( webXml ) )
-        {
-            excludeList.add( "**/" + WEB_INF + "/web.xml" );
-        }
-
-        return (String[]) excludeList.toArray( EMPTY_STRING_ARRAY );
-    }
-
-    /**
-     * Returns a string array of the includes to be used
-     * when assembling/copying the war.
-     *
-     * @return an array of tokens to include
-     */
-    private String[] getIncludes()
-    {
-        return new String[]{warSourceIncludes};
+        getProject().getArtifact().setFile( warFile );
     }
 }