You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2014/10/02 00:03:27 UTC
svn commit: r1628849 [1/3] - in /maven/plugins/trunk/maven-war-plugin/src:
main/java/org/apache/maven/plugin/war/
main/java/org/apache/maven/plugin/war/overlay/
main/java/org/apache/maven/plugin/war/packaging/
main/java/org/apache/maven/plugin/war/util...
Author: khmarbaise
Date: Wed Oct 1 22:03:26 2014
New Revision: 1628849
URL: http://svn.apache.org/r1628849
Log:
[MWAR-325]
- Cleaned up several Checkstyle (errors, warnings)
- CPD issues.
Modified:
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/Overlay.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarManifestMojo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/DefaultOverlay.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/InvalidOverlayConfigurationException.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ClassesPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/DependenciesAnalysisPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/OverlayPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/SaveWebappStructurePostPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingContext.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarPostPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/ClassesPackager.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/DependencyInfo.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/PathSet.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WarUtils.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WebappStructure.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WebappStructureSerializer.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarExplodedMojoTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/AbstractWarMojoTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarDependenciesAnalysisTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoFilteringTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarExplodedMojoTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarInPlaceMojoTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarManifestMojoTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarMojoTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarOverlaysTest.java
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarZipTest.java
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java Wed Oct 1 22:03:26 2014
@@ -84,9 +84,9 @@ public abstract class AbstractWarMojo
private File classesDirectory;
/**
- * Whether a JAR file will be created for the classes in the webapp. Using this optional configuration
- * parameter will make the compiled classes to be archived into a JAR file
- * and the classes directory will then be excluded from the webapp.
+ * Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter
+ * will make the compiled classes to be archived into a JAR file and the classes directory will then be excluded
+ * from the webapp.
*
* @since 2.0.1
*/
@@ -114,8 +114,7 @@ public abstract class AbstractWarMojo
private File webappDirectory;
/**
- * Single directory for extra files to include in the WAR. This is where
- * you place your JSP files.
+ * Single directory for extra files to include in the WAR. This is where you place your JSP files.
*/
@Parameter( defaultValue = "${basedir}/src/main/webapp", required = true )
private File warSourceDirectory;
@@ -139,10 +138,9 @@ public abstract class AbstractWarMojo
private File webXml;
/**
- * The path to a configuration file for the servlet container. Note that
- * the file name may be different for different servlet containers.
- * Apache Tomcat uses a configuration file named context.xml. The file will
- * be copied to the META-INF directory.
+ * The path to a configuration file for the servlet container. Note that the file name may be different for
+ * different servlet containers. Apache Tomcat uses a configuration file named context.xml. The file will be copied
+ * to the META-INF directory.
*/
@Parameter( property = "maven.war.containerConfigXML" )
private File containerConfigXML;
@@ -154,8 +152,8 @@ public abstract class AbstractWarMojo
private File workDirectory;
/**
- * The file name mapping to use when copying libraries and TLDs. If no file mapping is
- * set (default) the files are copied with their standard names.
+ * The file name mapping to use when copying libraries and TLDs. If no file mapping is set (default) the files are
+ * copied with their standard names.
*
* @since 2.1-alpha-1
*/
@@ -171,8 +169,8 @@ public abstract class AbstractWarMojo
private File cacheFile;
/**
- * Whether the cache should be used to save the status of the webapp
- * across multiple runs. Experimental feature so disabled by default.
+ * Whether the cache should be used to save the status of the webapp across multiple runs. Experimental feature so
+ * disabled by default.
*
* @since 2.1-alpha-1
*/
@@ -201,23 +199,19 @@ public abstract class AbstractWarMojo
private MavenResourcesFiltering mavenResourcesFiltering;
/**
- * The comma separated list of tokens to include when copying the content
- * of the warSourceDirectory.
+ * The comma separated list of tokens to include when copying the content of the warSourceDirectory.
*/
@Parameter( alias = "includes", defaultValue = "**" )
private String warSourceIncludes;
/**
- * The comma separated list of tokens to exclude when copying the content
- * of the warSourceDirectory.
+ * The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.
*/
@Parameter( alias = "excludes" )
private String warSourceExcludes;
/**
- * The comma separated list of tokens to include when doing
- * a WAR overlay.
- * Default is '**'
+ * The comma separated list of tokens to include when doing a WAR overlay. Default is '**'
*
* @deprecated Use <overlay>/<includes> instead
*/
@@ -225,8 +219,7 @@ public abstract class AbstractWarMojo
private String dependentWarIncludes = "**/**";
/**
- * The comma separated list of tokens to exclude when doing
- * a WAR overlay.
+ * The comma separated list of tokens to exclude when doing a WAR overlay.
*
* @deprecated Use <overlay>/<excludes> instead
*/
@@ -234,33 +227,28 @@ public abstract class AbstractWarMojo
private String dependentWarExcludes = "META-INF/**";
/**
- * The overlays to apply.
- *
- * Each <overlay> element may contain:
+ * The overlays to apply. Each <overlay> element may contain:
* <ul>
- * <li>id (defaults to <tt>currentBuild</tt>)</li>
- * <li>groupId (if this and artifactId are null, then the current project is treated as its own overlay)</li>
- * <li>artifactId (see above)</li>
- * <li>classifier</li>
- * <li>type</li>
- * <li>includes (a list of string patterns)</li>
- * <li>excludes (a list of string patterns)</li>
- * <li>filtered (defaults to false)</li>
- * <li>skip (defaults to false)</li>
- * <li>targetPath (defaults to root of webapp structure)</li>
- *
+ * <li>id (defaults to <tt>currentBuild</tt>)</li>
+ * <li>groupId (if this and artifactId are null, then the current project is treated as its own overlay)</li>
+ * <li>artifactId (see above)</li>
+ * <li>classifier</li>
+ * <li>type</li>
+ * <li>includes (a list of string patterns)</li>
+ * <li>excludes (a list of string patterns)</li>
+ * <li>filtered (defaults to false)</li>
+ * <li>skip (defaults to false)</li>
+ * <li>targetPath (defaults to root of webapp structure)</li>
* </ul>
*
- *
- *
* @since 2.1-alpha-1
*/
@Parameter
private List<Overlay> overlays = new ArrayList<Overlay>();
/**
- * A list of file extensions that should not be filtered.
- * <b>Will be used when filtering webResources and overlays.</b>
+ * A list of file extensions that should not be filtered. <b>Will be used when filtering webResources and
+ * overlays.</b>
*
* @since 2.1-alpha-2
*/
@@ -282,8 +270,8 @@ public abstract class AbstractWarMojo
private boolean filteringDeploymentDescriptors = false;
/**
- * To escape interpolated values with Windows path
- * <code>c:\foo\bar</code> will be replaced with <code>c:\\foo\\bar</code>.
+ * To escape interpolated values with Windows path <code>c:\foo\bar</code> will be replaced with
+ * <code>c:\\foo\\bar</code>.
*
* @since 2.1-alpha-2
*/
@@ -291,8 +279,8 @@ public abstract class AbstractWarMojo
private boolean escapedBackslashesInFilePath = false;
/**
- * Expression preceded with this String won't be interpolated.
- * <code>\${foo}</code> will be replaced with <code>${foo}</code>.
+ * Expression preceded with this String won't be interpolated. <code>\${foo}</code> will be replaced with
+ * <code>${foo}</code>.
*
* @since 2.1-beta-1
*/
@@ -300,15 +288,14 @@ public abstract class AbstractWarMojo
protected String escapeString;
/**
- * Indicates if zip archives (jar,zip etc) being added to the war should be
- * compressed again. Compressing again can result in smaller archive size, but
- * gives noticeably longer execution time.
+ * Indicates if zip archives (jar,zip etc) being added to the war should be compressed again. Compressing again can
+ * result in smaller archive size, but gives noticeably longer execution time.
*
* @since 2.3
*/
@Parameter( defaultValue = "true" )
private boolean recompressZippedFiles;
-
+
/**
* @since 2.4
*/
@@ -317,22 +304,23 @@ public abstract class AbstractWarMojo
/**
* Stop searching endToken at the end of line
+ *
* @since 2.4
*/
- @Parameter(property = "maven.war.supportMultiLineFiltering", defaultValue = "false" )
+ @Parameter( property = "maven.war.supportMultiLineFiltering", defaultValue = "false" )
private boolean supportMultiLineFiltering = false;
/**
* use jvmChmod rather that cli chmod and forking process
+ *
* @since 2.4
*/
- @Parameter(property = "maven.war.useJvmChmod", defaultValue = "true" )
+ @Parameter( property = "maven.war.useJvmChmod", defaultValue = "true" )
private boolean useJvmChmod;
-
/**
- * The archive configuration to use.
- * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>.
+ * The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven
+ * Archiver Reference</a>.
*/
@Parameter
private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
@@ -341,15 +329,13 @@ public abstract class AbstractWarMojo
private final Overlay currentProjectOverlay = Overlay.createInstance();
-
public Overlay getCurrentProjectOverlay()
{
return currentProjectOverlay;
}
/**
- * Returns a string array of the excludes to be used
- * when copying the content of the WAR source directory.
+ * Returns a string array of the excludes to be used when copying the content of the WAR source directory.
*
* @return an array of tokens to exclude
*/
@@ -373,12 +359,11 @@ public abstract class AbstractWarMojo
excludeList.add( "**/" + META_INF + "/" + containerConfigXML.getName() );
}
- return excludeList.toArray(new String[excludeList.size()]);
+ return excludeList.toArray( new String[excludeList.size()] );
}
/**
- * Returns a string array of the includes to be used
- * when assembling/copying the WAR.
+ * Returns a string array of the includes to be used when assembling/copying the WAR.
*
* @return an array of tokens to include
*/
@@ -388,8 +373,7 @@ public abstract class AbstractWarMojo
}
/**
- * Returns a string array of the excludes to be used
- * when adding dependent WAR as an overlay onto this WAR.
+ * Returns a string array of the excludes to be used when adding dependent WAR as an overlay onto this WAR.
*
* @return an array of tokens to exclude
*/
@@ -408,8 +392,7 @@ public abstract class AbstractWarMojo
}
/**
- * Returns a string array of the includes to be used
- * when adding dependent WARs as an overlay onto this WAR.
+ * Returns a string array of the includes to be used when adding dependent WARs as an overlay onto this WAR.
*
* @return an array of tokens to include
*/
@@ -418,14 +401,14 @@ public abstract class AbstractWarMojo
return StringUtils.split( StringUtils.defaultString( dependentWarIncludes ), "," );
}
- public void buildExplodedWebapp( File webappDirectory )
+ public void buildExplodedWebapp( File webapplicationDirectory )
throws MojoExecutionException, MojoFailureException
{
- webappDirectory.mkdirs();
+ webapplicationDirectory.mkdirs();
try
{
- buildWebapp( project, webappDirectory );
+ buildWebapp( project, webapplicationDirectory );
}
catch ( IOException e )
{
@@ -433,40 +416,37 @@ public abstract class AbstractWarMojo
}
}
-
/**
- * Builds the webapp for the specified project with the new packaging task
- * thingy
+ * Builds the webapp for the specified project with the new packaging task thingy
* <p/>
- * Classes, libraries and tld files are copied to
- * the <tt>webappDirectory</tt> during this phase.
+ * Classes, libraries and tld files are copied to the <tt>webappDirectory</tt> during this phase.
*
- * @param project the maven project
- * @param webappDirectory the target directory
+ * @param mavenProject the maven project
+ * @param webapplicationDirectory the target directory
* @throws MojoExecutionException if an error occurred while packaging the webapp
- * @throws MojoFailureException if an unexpected error occurred while packaging the webapp
- * @throws IOException if an error occurred while copying the files
+ * @throws MojoFailureException if an unexpected error occurred while packaging the webapp
+ * @throws IOException if an error occurred while copying the files
*/
@SuppressWarnings( "unchecked" )
- public void buildWebapp( MavenProject project, File webappDirectory )
+ public void buildWebapp( MavenProject mavenProject, File webapplicationDirectory )
throws MojoExecutionException, MojoFailureException, IOException
{
WebappStructure cache;
if ( useCache && cacheFile.exists() )
{
- cache = new WebappStructure( project.getDependencies(), webappStructureSerialier.fromXml( cacheFile ) );
+ cache = new WebappStructure( mavenProject.getDependencies(), webappStructureSerialier.fromXml( cacheFile ) );
}
else
{
- cache = new WebappStructure( project.getDependencies(), null );
+ cache = new WebappStructure( mavenProject.getDependencies(), null );
}
final long startTime = System.currentTimeMillis();
- getLog().info( "Assembling webapp [" + project.getArtifactId() + "] in [" + webappDirectory + "]" );
+ getLog().info( "Assembling webapp [" + mavenProject.getArtifactId() + "] in [" + webapplicationDirectory + "]" );
final OverlayManager overlayManager =
- new OverlayManager( overlays, project, dependentWarIncludes, dependentWarExcludes, currentProjectOverlay );
+ new OverlayManager( overlays, mavenProject, dependentWarIncludes, dependentWarExcludes, currentProjectOverlay );
final List<WarPackagingTask> packagingTasks = getPackagingTasks( overlayManager );
List<FileUtils.FilterWrapper> defaultFilterWrappers;
try
@@ -474,8 +454,9 @@ public abstract class AbstractWarMojo
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
mavenResourcesExecution.setEscapeString( escapeString );
mavenResourcesExecution.setSupportMultiLineFiltering( supportMultiLineFiltering );
- mavenResourcesExecution.setMavenProject( project );
- if (filters == null) {
+ mavenResourcesExecution.setMavenProject( mavenProject );
+ if ( filters == null )
+ {
filters = getProject().getBuild().getFilters();
}
mavenResourcesExecution.setFilters( filters );
@@ -493,12 +474,10 @@ public abstract class AbstractWarMojo
throw new MojoExecutionException( e.getMessage(), e );
}
- final WarPackagingContext context = new DefaultWarPackagingContext( webappDirectory, cache, overlayManager,
- defaultFilterWrappers,
- getNonFilteredFileExtensions(),
- filteringDeploymentDescriptors,
- this.artifactFactory, resourceEncoding,
- useJvmChmod);
+ final WarPackagingContext context =
+ new DefaultWarPackagingContext( webapplicationDirectory, cache, overlayManager, defaultFilterWrappers,
+ getNonFilteredFileExtensions(), filteringDeploymentDescriptors,
+ this.artifactFactory, resourceEncoding, useJvmChmod );
for ( WarPackagingTask warPackagingTask : packagingTasks )
{
warPackagingTask.performPackaging( context );
@@ -515,8 +494,8 @@ public abstract class AbstractWarMojo
}
/**
- * Returns a <tt>List</tt> of the {@link org.apache.maven.plugin.war.packaging.WarPackagingTask}
- * instances to invoke to perform the packaging.
+ * Returns a <tt>List</tt> of the {@link org.apache.maven.plugin.war.packaging.WarPackagingTask} instances to invoke
+ * to perform the packaging.
*
* @param overlayManager the overlay manager
* @return the list of packaging tasks
@@ -547,10 +526,9 @@ public abstract class AbstractWarMojo
return packagingTasks;
}
-
/**
- * Returns a <tt>List</tt> of the {@link org.apache.maven.plugin.war.packaging.WarPostPackagingTask}
- * instances to invoke to perform the post-packaging.
+ * Returns a <tt>List</tt> of the {@link org.apache.maven.plugin.war.packaging.WarPostPackagingTask} instances to
+ * invoke to perform the post-packaging.
*
* @return the list of post packaging tasks
*/
@@ -591,9 +569,11 @@ public abstract class AbstractWarMojo
private boolean useJvmChmod = true;
public DefaultWarPackagingContext( File webappDirectory, final WebappStructure webappStructure,
- final OverlayManager overlayManager, List<FileUtils.FilterWrapper> filterWrappers,
- List<String> nonFilteredFileExtensions, boolean filteringDeploymentDescriptors,
- ArtifactFactory artifactFactory, String resourceEncoding, boolean useJvmChmod )
+ final OverlayManager overlayManager,
+ List<FileUtils.FilterWrapper> filterWrappers,
+ List<String> nonFilteredFileExtensions,
+ boolean filteringDeploymentDescriptors, ArtifactFactory artifactFactory,
+ String resourceEncoding, boolean useJvmChmod )
{
this.webappDirectory = webappDirectory;
this.webappStructure = webappStructure;
@@ -601,8 +581,8 @@ public abstract class AbstractWarMojo
this.filterWrappers = filterWrappers;
this.artifactFactory = artifactFactory;
this.filteringDeploymentDescriptors = filteringDeploymentDescriptors;
- this.nonFilteredFileExtensions = nonFilteredFileExtensions == null ? Collections.<String>emptyList()
- : nonFilteredFileExtensions;
+ this.nonFilteredFileExtensions =
+ nonFilteredFileExtensions == null ? Collections.<String> emptyList() : nonFilteredFileExtensions;
this.resourceEncoding = resourceEncoding;
// This is kinda stupid but if we loop over the current overlays and we request the path structure
// it will register it. This will avoid wrong warning messages in a later phase
@@ -652,7 +632,7 @@ public abstract class AbstractWarMojo
{
return getExcludes();
}
-
+
public boolean isWebappSourceIncludeEmptyDirectories()
{
return includeEmptyDirectories;
@@ -904,7 +884,6 @@ public abstract class AbstractWarMojo
this.warSourceExcludes = warSourceExcludes;
}
-
public boolean isUseCache()
{
return useCache;
@@ -939,7 +918,7 @@ public abstract class AbstractWarMojo
{
this.artifactFactory = artifactFactory;
}
-
+
protected MavenSession getSession()
{
return this.session;
@@ -949,7 +928,7 @@ public abstract class AbstractWarMojo
{
return recompressZippedFiles;
}
-
+
protected boolean isIncludeEmptyDirectories()
{
return includeEmptyDirectories;
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/Overlay.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/Overlay.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/Overlay.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/Overlay.java Wed Oct 1 22:03:26 2014
@@ -26,16 +26,14 @@ import java.util.Arrays;
import java.util.List;
/**
- * An overlay is a skeleton WAR added to another WAR project in order to inject a
- * functionality, resources or any other shared component.
+ * An overlay is a skeleton WAR added to another WAR project in order to inject a functionality, resources or any other
+ * shared component.
* <p/>
- * Note that a particular WAR dependency can be added multiple times as an overlay
- * with different includes/excludes filter; this allows building a fine grained
- * overwriting policy.
+ * Note that a particular WAR dependency can be added multiple times as an overlay with different includes/excludes
+ * filter; this allows building a fine grained overwriting policy.
* <p/>
- * The current project can also be described as an overlay and can not be specified
- * twice. An overlay with no groupId and no artifactId represents the
- * current project.
+ * The current project can also be described as an overlay and can not be specified twice. An overlay with no groupId
+ * and no artifactId represents the current project.
*
* @author Stephane Nicoll
* @version $Id$
@@ -43,9 +41,9 @@ import java.util.List;
public class Overlay
{
- public static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
+ public static final String[] DEFAULT_INCLUDES = new String[] { "**/**" };
- public static final String[] DEFAULT_EXCLUDES = new String[]{"META-INF/MANIFEST.MF"};
+ public static final String[] DEFAULT_EXCLUDES = new String[] { "META-INF/MANIFEST.MF" };
private String id;
@@ -64,10 +62,10 @@ public class Overlay
private boolean skip = false;
private Artifact artifact;
-
+
private String targetPath;
-
- /** default overlay type is war */
+
+ /** default overlay type is war */
private String type = "war";
public Overlay()
@@ -75,7 +73,6 @@ public class Overlay
super();
}
-
public Overlay( String groupId, String artifactId )
{
this();
@@ -217,7 +214,6 @@ public class Overlay
return targetPath;
}
-
public void setTargetPath( String targetPath )
{
this.targetPath = targetPath;
@@ -228,18 +224,16 @@ public class Overlay
return type;
}
-
public void setType( String type )
{
this.type = type;
}
-
+
public String toString()
{
return " id " + getId();
}
-
public boolean equals( Object o )
{
if ( this == o )
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarExplodedMojo.java Wed Oct 1 22:03:26 2014
@@ -30,8 +30,7 @@ import org.apache.maven.plugins.annotati
*
* @version $Id$
*/
-@Mojo( name = "exploded", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true,
- requiresDependencyResolution = ResolutionScope.RUNTIME )
+@Mojo( name = "exploded", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.RUNTIME )
public class WarExplodedMojo
extends AbstractWarMojo
{
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarInPlaceMojo.java Wed Oct 1 22:03:26 2014
@@ -29,7 +29,7 @@ import org.apache.maven.plugins.annotati
*
* @version $Id$
*/
-@Mojo( name = "inplace", requiresDependencyResolution = ResolutionScope.RUNTIME , threadSafe = true )
+@Mojo( name = "inplace", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true )
public class WarInPlaceMojo
extends AbstractWarMojo
{
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarManifestMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarManifestMojo.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarManifestMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarManifestMojo.java Wed Oct 1 22:03:26 2014
@@ -38,14 +38,12 @@ import java.io.IOException;
import java.io.PrintWriter;
/**
- * Generate a manifest for this webapp. The manifest file is created in the
- * <code>warSourceDirectory</code>.
+ * Generate a manifest for this webapp. The manifest file is created in the <code>warSourceDirectory</code>.
*
* @author Mike Perham
* @version $Id$
*/
-@Mojo( name = "manifest", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, threadSafe = true,
- requiresDependencyResolution = ResolutionScope.RUNTIME )
+@Mojo( name = "manifest", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.RUNTIME )
public class WarManifestMojo
extends AbstractWarMojo
{
@@ -55,7 +53,6 @@ public class WarManifestMojo
@Component( role = Archiver.class, hint = "war" )
private WarArchiver warArchiver;
-
/**
* Executes this mojo on the current project.
*
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java Wed Oct 1 22:03:26 2014
@@ -48,8 +48,11 @@ import java.util.Arrays;
* @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
*/
-@Mojo( name = "war", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true,
- requiresDependencyResolution = ResolutionScope.RUNTIME )
+@Mojo(
+ name = "war",
+ defaultPhase = LifecyclePhase.PACKAGE,
+ threadSafe = true,
+ requiresDependencyResolution = ResolutionScope.RUNTIME )
public class WarMojo
extends AbstractWarMojo
{
@@ -66,18 +69,16 @@ public class WarMojo
private String warName;
/**
- * Classifier to add to the generated WAR. If given, the artifact will be an attachment instead.
- * The classifier will not be applied to the JAR file of the project - only to the WAR file.
+ * Classifier to add to the generated WAR. If given, the artifact will be an attachment instead. The classifier will
+ * not be applied to the JAR file of the project - only to the WAR file.
*/
@Parameter
private String classifier;
/**
- * The comma separated list of tokens to exclude from the WAR before
- * packaging. This option may be used to implement the skinny WAR use
- * case. Note that you can use the Java Regular Expressions engine to
- * include and exclude specific pattern using the expression %regex[].
- * Hint: read the about (?!Pattern).
+ * The comma separated list of tokens to exclude from the WAR before packaging. This option may be used to implement
+ * the skinny WAR use case. Note that you can use the Java Regular Expressions engine to include and exclude
+ * specific pattern using the expression %regex[]. Hint: read the about (?!Pattern).
*
* @since 2.1-alpha-2
*/
@@ -85,11 +86,9 @@ public class WarMojo
private String packagingExcludes;
/**
- * The comma separated list of tokens to include in the WAR before
- * packaging. By default everything is included. This option may be used
- * to implement the skinny WAR use case. Note that you can use the
- * Java Regular Expressions engine to include and exclude specific pattern
- * using the expression %regex[].
+ * The comma separated list of tokens to include in the WAR before packaging. By default everything is included.
+ * This option may be used to implement the skinny WAR use case. Note that you can use the Java Regular Expressions
+ * engine to include and exclude specific pattern using the expression %regex[].
*
* @since 2.1-beta-1
*/
@@ -108,16 +107,16 @@ public class WarMojo
private MavenProjectHelper projectHelper;
/**
- * Whether this is the main artifact being built. Set to <code>false</code> if you don't want to install or
- * deploy it to the local repository instead of the default one in an execution.
+ * Whether this is the main artifact being built. Set to <code>false</code> if you don't want to install or deploy
+ * it to the local repository instead of the default one in an execution.
*/
@Parameter( property = "primaryArtifact", defaultValue = "true" )
private boolean primaryArtifact = true;
/**
- * Whether or not to fail the build if the <code>web.xml</code> file is missing. Set to <code>false</code>
- * if you want you WAR built without a <code>web.xml</code> file.
- * This may be useful if you are building an overlay that has no web.xml file.
+ * Whether or not to fail the build if the <code>web.xml</code> file is missing. Set to <code>false</code> if you
+ * want you WAR built without a <code>web.xml</code> file. This may be useful if you are building an overlay that
+ * has no web.xml file.
*
* @since 2.1-alpha-2
*/
@@ -125,22 +124,25 @@ public class WarMojo
private boolean failOnMissingWebXml = true;
/**
- * Whether classes (that is the content of the WEB-INF/classes directory) should be attached to the
- * project as an additional artifact.
- * <p>By default the
- * classifier for the additional artifact is 'classes'.
- * You can change it with the
- * <code><![CDATA[<classesClassifier>someclassifier</classesClassifier>]]></code>
- * parameter.
- * </p><p>
- * If this parameter true, another project can depend on the classes
- * by writing something like:
- * <pre><![CDATA[<dependency>
+ * Whether classes (that is the content of the WEB-INF/classes directory) should be attached to the project as an
+ * additional artifact.
+ * <p>
+ * By default the classifier for the additional artifact is 'classes'. You can change it with the
+ * <code><![CDATA[<classesClassifier>someclassifier</classesClassifier>]]></code> parameter.
+ * </p>
+ * <p>
+ * If this parameter true, another project can depend on the classes by writing something like:
+ *
+ * <pre>
+ * <![CDATA[<dependency>
* <groupId>myGroup</groupId>
* <artifactId>myArtifact</artifactId>
* <version>myVersion</myVersion>
* <classifier>classes</classifier>
- * </dependency>]]></pre></p>
+ * </dependency>]]>
+ * </pre>
+ *
+ * </p>
*
* @since 2.1-alpha-2
*/
@@ -159,7 +161,6 @@ public class WarMojo
// Implementation
// ----------------------------------------------------------------------
-
/**
* Executes the WarMojo on the current project.
*
@@ -196,16 +197,15 @@ public class WarMojo
* Generates the webapp according to the <tt>mode</tt> attribute.
*
* @param warFile the target WAR file
- * @throws IOException if an error occurred while copying files
- * @throws ArchiverException if the archive could not be created
- * @throws ManifestException if the manifest could not be created
- * @throws DependencyResolutionRequiredException
- * if an error occurred while resolving the dependencies
+ * @throws IOException if an error occurred while copying files
+ * @throws ArchiverException if the archive could not be created
+ * @throws ManifestException if the manifest could not be created
+ * @throws DependencyResolutionRequiredException if an error occurred while resolving the dependencies
* @throws MojoExecutionException if the execution failed
- * @throws MojoFailureException if a fatal exception occurred
+ * @throws MojoFailureException if a fatal exception occurred
*/
private void performPackaging( File warFile )
- throws IOException, ArchiverException, ManifestException, DependencyResolutionRequiredException,
+ throws IOException, ManifestException, DependencyResolutionRequiredException,
MojoExecutionException, MojoFailureException
{
getLog().info( "Packaging webapp" );
@@ -218,10 +218,8 @@ public class WarMojo
archiver.setOutputFile( warFile );
- getLog().debug(
- "Excluding " + Arrays.asList( getPackagingExcludes() ) + " from the generated webapp archive." );
- getLog().debug(
- "Including " + Arrays.asList( getPackagingIncludes() ) + " in the generated webapp archive." );
+ getLog().debug( "Excluding " + Arrays.asList( getPackagingExcludes() ) + " from the generated webapp archive." );
+ getLog().debug( "Including " + Arrays.asList( getPackagingIncludes() ) + " in the generated webapp archive." );
warArchiver.addDirectory( getWebappDirectory(), getPackagingIncludes(), getPackagingExcludes() );
@@ -231,8 +229,8 @@ public class WarMojo
warArchiver.setWebxml( webXmlFile );
}
- warArchiver.setRecompressAddedZips( isRecompressZippedFiles() );
-
+ warArchiver.setRecompressAddedZips( isRecompressZippedFiles() );
+
warArchiver.setIncludeEmptyDirs( isIncludeEmptyDirectories() );
if ( !failOnMissingWebXml )
@@ -252,7 +250,7 @@ public class WarMojo
{
// special handling in case of archived classes: MWAR-240
File targetClassesFile = getTargetClassesFile();
- FileUtils.copyFile(getJarArchiver().getDestFile(), targetClassesFile);
+ FileUtils.copyFile( getJarArchiver().getDestFile(), targetClassesFile );
projectHelper.attachArtifact( getProject(), "jar", getClassesClassifier(), targetClassesFile );
}
else
@@ -269,10 +267,9 @@ public class WarMojo
}
}
- String classifier = this.classifier;
- if ( classifier != null )
+ if ( this.classifier != null )
{
- projectHelper.attachArtifact( getProject(), "war", classifier, warFile );
+ projectHelper.attachArtifact( getProject(), "war", this.classifier, warFile );
}
else
{
@@ -288,7 +285,6 @@ public class WarMojo
}
}
-
protected static File getTargetFile( File basedir, String finalName, String classifier, String type )
{
if ( classifier == null )
@@ -303,7 +299,6 @@ public class WarMojo
return new File( basedir, finalName + classifier + "." + type );
}
-
protected File getTargetWarFile()
{
return getTargetFile( new File( getOutputDirectory() ), getWarName(), getClassifier(), "war" );
@@ -348,7 +343,7 @@ public class WarMojo
{
if ( StringUtils.isEmpty( packagingIncludes ) )
{
- return new String[]{"**"};
+ return new String[] { "**" };
}
else
{
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/DefaultOverlay.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/DefaultOverlay.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/DefaultOverlay.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/DefaultOverlay.java Wed Oct 1 22:03:26 2014
@@ -26,7 +26,6 @@ import org.apache.maven.plugin.war.Overl
* A default overlay implementation based on an {@link Artifact}.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class DefaultOverlay
@@ -51,7 +50,7 @@ public class DefaultOverlay
/**
* Creates an overlay for the specified artifact.
*
- * @param a the artifact
+ * @param a the artifact
* @param includes the includes to use
* @param excludes the excludes to use
*/
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/InvalidOverlayConfigurationException.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/InvalidOverlayConfigurationException.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/InvalidOverlayConfigurationException.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/InvalidOverlayConfigurationException.java Wed Oct 1 22:03:26 2014
@@ -21,13 +21,10 @@ package org.apache.maven.plugin.war.over
import org.apache.maven.plugin.MojoExecutionException;
-
-
/**
* Thrown if the overlay configuration is invalid.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class InvalidOverlayConfigurationException
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java Wed Oct 1 22:03:26 2014
@@ -35,7 +35,6 @@ import org.codehaus.plexus.util.StringUt
* Manages the overlays.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class OverlayManager
@@ -49,19 +48,17 @@ public class OverlayManager
/**
* Creates a manager with the specified overlays.
* <p/>
- * Note that the list is potentially updated by the
- * manager so a new list is created based on the overlays.
+ * Note that the list is potentially updated by the manager so a new list is created based on the overlays.
*
- * @param overlays the overlays
- * @param project the maven project
+ * @param overlays the overlays
+ * @param project the maven project
* @param defaultIncludes the default includes to use
* @param defaultExcludes the default excludes to use
* @param currentProjectOverlay the overlay for the current project
- * @throws InvalidOverlayConfigurationException
- * if the config is invalid
+ * @throws InvalidOverlayConfigurationException if the config is invalid
*/
- public OverlayManager( List<Overlay> overlays, MavenProject project, String defaultIncludes, String defaultExcludes,
- Overlay currentProjectOverlay )
+ public OverlayManager( List<Overlay> overlays, MavenProject project, String defaultIncludes,
+ String defaultExcludes, Overlay currentProjectOverlay )
throws InvalidOverlayConfigurationException
{
this.overlays = new ArrayList<Overlay>();
@@ -78,7 +75,6 @@ public class OverlayManager
}
-
/**
* Returns the resolved overlays.
*
@@ -110,9 +106,8 @@ public class OverlayManager
*
* @param defaultIncludes the default includes to use
* @param defaultExcludes the default excludes to use
- * @param currentProjectOverlay the overlay for the current project
- * @throws InvalidOverlayConfigurationException
- * if the configuration is invalid
+ * @param currentProjectOverlay the overlay for the current project
+ * @throws InvalidOverlayConfigurationException if the configuration is invalid
*/
void initialize( String defaultIncludes, String defaultExcludes, Overlay currentProjectOverlay )
throws InvalidOverlayConfigurationException
@@ -176,14 +171,13 @@ public class OverlayManager
/**
* Returns the Artifact associated to the specified overlay.
* <p/>
- * If the overlay defines the current project, <tt>null</tt> is
- * returned. If no artifact could not be found for the overlay
- * a InvalidOverlayConfigurationException is thrown.
+ * If the overlay defines the current project, <tt>null</tt> is returned. If no artifact could not be found for the
+ * overlay a InvalidOverlayConfigurationException is thrown.
*
* @param overlay an overlay
* @return the artifact associated to the overlay
- * @throws org.apache.maven.plugin.war.overlay.InvalidOverlayConfigurationException
- * if the overlay does not have an associated artifact
+ * @throws org.apache.maven.plugin.war.overlay.InvalidOverlayConfigurationException if the overlay does not have an
+ * associated artifact
*/
Artifact getAssociatedArtifact( final Overlay overlay )
throws InvalidOverlayConfigurationException
@@ -215,8 +209,7 @@ public class OverlayManager
}
}
}
- throw new InvalidOverlayConfigurationException(
- "overlay [" + overlay + "] is not a dependency of the project." );
+ throw new InvalidOverlayConfigurationException( "overlay [" + overlay + "] is not a dependency of the project." );
}
@@ -232,13 +225,13 @@ public class OverlayManager
return ( StringUtils.equals( overlay.getGroupId(), artifact.getGroupId() )
&& StringUtils.equals( overlay.getArtifactId(), artifact.getArtifactId() )
&& StringUtils.equals( overlay.getType(), artifact.getType() )
- // MWAR-241 Make sure to treat null and "" as equal when comparing the classifier
- && StringUtils.equals( StringUtils.defaultString( overlay.getClassifier() ), StringUtils.defaultString( artifact.getClassifier() ) ) );
+ // MWAR-241 Make sure to treat null and "" as equal when comparing the classifier
+ && StringUtils.equals( StringUtils.defaultString( overlay.getClassifier() ),
+ StringUtils.defaultString( artifact.getClassifier() ) ) );
}
/**
- * Returns a list of WAR {@link org.apache.maven.artifact.Artifact} describing
- * the overlays of the current project.
+ * Returns a list of WAR {@link org.apache.maven.artifact.Artifact} describing the overlays of the current project.
*
* @return the overlays as artifacts objects
*/
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java Wed Oct 1 22:03:26 2014
@@ -45,7 +45,7 @@ import org.codehaus.plexus.util.IOUtil;
public abstract class AbstractWarPackagingTask
implements WarPackagingTask
{
- public static final String[] DEFAULT_INCLUDES = {"**/**"};
+ public static final String[] DEFAULT_INCLUDES = { "**/**" };
public static final String WEB_INF_PATH = "WEB-INF";
@@ -58,20 +58,18 @@ public abstract class AbstractWarPackagi
/**
* Copies the files if possible with an optional target prefix.
* <p/>
- * Copy uses a first-win strategy: files that have already been copied by previous
- * tasks are ignored. This method makes sure to update the list of protected files
- * which gives the list of files that have already been copied.
+ * Copy uses a first-win strategy: files that have already been copied by previous tasks are ignored. This method
+ * makes sure to update the list of protected files which gives the list of files that have already been copied.
* <p/>
- * If the structure of the source directory is not the same as the root of the
- * webapp, use the <tt>targetPrefix</tt> parameter to specify in which particular
- * directory the files should be copied. Use <tt>null</tt> to copy the files with
- * the same structure
- *
- * @param sourceId the source id
- * @param context the context to use
- * @param sourceBaseDir the base directory from which the <tt>sourceFilesSet</tt> will be copied
+ * If the structure of the source directory is not the same as the root of the webapp, use the <tt>targetPrefix</tt>
+ * parameter to specify in which particular directory the files should be copied. Use <tt>null</tt> to copy the
+ * files with the same structure
+ *
+ * @param sourceId the source id
+ * @param context the context to use
+ * @param sourceBaseDir the base directory from which the <tt>sourceFilesSet</tt> will be copied
* @param sourceFilesSet the files to be copied
- * @param targetPrefix the prefix to add to the target file name
+ * @param targetPrefix the prefix to add to the target file name
* @throws IOException if an error occurred while copying the files
*/
protected void copyFiles( String sourceId, WarPackagingContext context, File sourceBaseDir, PathSet sourceFilesSet,
@@ -92,9 +90,7 @@ public abstract class AbstractWarPackagi
destinationFileName = targetPrefix + fileToCopyName;
}
-
- if ( filtered
- && !context.isNonFilteredExtension( sourceFile.getName() ) )
+ if ( filtered && !context.isNonFilteredExtension( sourceFile.getName() ) )
{
copyFilteredFile( sourceId, context, sourceFile, destinationFileName );
}
@@ -108,13 +104,12 @@ public abstract class AbstractWarPackagi
/**
* Copies the files if possible as is.
* <p/>
- * Copy uses a first-win strategy: files that have already been copied by previous
- * tasks are ignored. This method makes sure to update the list of protected files
- * which gives the list of files that have already been copied.
- *
- * @param sourceId the source id
- * @param context the context to use
- * @param sourceBaseDir the base directory from which the <tt>sourceFilesSet</tt> will be copied
+ * Copy uses a first-win strategy: files that have already been copied by previous tasks are ignored. This method
+ * makes sure to update the list of protected files which gives the list of files that have already been copied.
+ *
+ * @param sourceId the source id
+ * @param context the context to use
+ * @param sourceBaseDir the base directory from which the <tt>sourceFilesSet</tt> will be copied
* @param sourceFilesSet the files to be copied
* @throws IOException if an error occurred while copying the files
*/
@@ -128,62 +123,79 @@ public abstract class AbstractWarPackagi
/**
* Copy the specified file if the target location has not yet already been used.
* <p/>
- * The <tt>targetFileName</tt> is the relative path according to the root of
- * the generated web application.
+ * The <tt>targetFileName</tt> is the relative path according to the root of the generated web application.
*
- * @param sourceId the source id
- * @param context the context to use
- * @param file the file to copy
+ * @param sourceId the source id
+ * @param context the context to use
+ * @param file the file to copy
* @param targetFilename the relative path according to the root of the webapp
* @throws IOException if an error occurred while copying
*/
- protected void copyFile( String sourceId, final WarPackagingContext context, final File file,
- String targetFilename )
+ protected void copyFile( String sourceId, final WarPackagingContext context, final File file, String targetFilename )
throws IOException
{
final File targetFile = new File( context.getWebappDirectory(), targetFilename );
-
- if( file.isFile() )
- {
- context.getWebappStructure().registerFile( sourceId, targetFilename, new WebappStructure.RegistrationCallback()
- {
- public void registered( String ownerId, String targetFilename )
- throws IOException
- {
- copyFile( context, file, targetFile, targetFilename, false );
- }
-
- public void alreadyRegistered( String ownerId, String targetFilename )
- throws IOException
- {
- copyFile( context, file, targetFile, targetFilename, true );
- }
-
- public void refused( String ownerId, String targetFilename, String actualOwnerId )
- throws IOException
- {
- context.getLog().debug( " - " + targetFilename + " wasn't copied because it has "
- + "already been packaged for overlay [" + actualOwnerId + "]." );
- }
-
- public void superseded( String ownerId, String targetFilename, String deprecatedOwnerId )
- throws IOException
- {
- context.getLog().info( "File [" + targetFilename + "] belonged to overlay [" + deprecatedOwnerId
- + "] so it will be overwritten." );
- copyFile( context, file, targetFile, targetFilename, false );
- }
- public void supersededUnknownOwner( String ownerId, String targetFilename, String unknownOwnerId )
- throws IOException
- {
- context.getLog()
- .warn( "File [" + targetFilename + "] belonged to overlay [" + unknownOwnerId
- + "] which does not exist anymore in the current project. It is recommended to invoke "
- + "clean if the dependencies of the project changed." );
- copyFile( context, file, targetFile, targetFilename, false );
- }
- } );
+ if ( file.isFile() )
+ {
+ context.getWebappStructure().registerFile( sourceId, targetFilename,
+ new WebappStructure.RegistrationCallback()
+ {
+ public void registered( String ownerId, String targetFilename )
+ throws IOException
+ {
+ copyFile( context, file, targetFile, targetFilename,
+ false );
+ }
+
+ public void alreadyRegistered( String ownerId,
+ String targetFilename )
+ throws IOException
+ {
+ copyFile( context, file, targetFile, targetFilename,
+ true );
+ }
+
+ public void refused( String ownerId, String targetFilename,
+ String actualOwnerId )
+ throws IOException
+ {
+ context.getLog().debug( " - "
+ + targetFilename
+ + " wasn't copied because it has "
+ + "already been packaged for overlay ["
+ + actualOwnerId + "]." );
+ }
+
+ public void superseded( String ownerId,
+ String targetFilename,
+ String deprecatedOwnerId )
+ throws IOException
+ {
+ context.getLog().info( "File ["
+ + targetFilename
+ + "] belonged to overlay ["
+ + deprecatedOwnerId
+ + "] so it will be overwritten." );
+ copyFile( context, file, targetFile, targetFilename,
+ false );
+ }
+
+ public void supersededUnknownOwner( String ownerId,
+ String targetFilename,
+ String unknownOwnerId )
+ throws IOException
+ {
+ context.getLog().warn( "File ["
+ + targetFilename
+ + "] belonged to overlay ["
+ + unknownOwnerId
+ + "] which does not exist anymore in the current project. It is recommended to invoke "
+ + "clean if the dependencies of the project changed." );
+ copyFile( context, file, targetFile, targetFilename,
+ false );
+ }
+ } );
}
else if ( !targetFile.exists() && !targetFile.mkdirs() )
{
@@ -192,18 +204,17 @@ public abstract class AbstractWarPackagi
}
/**
- * Copy the specified file if the target location has not yet already been
- * used and filter its content with the configured filter properties.
+ * Copy the specified file if the target location has not yet already been used and filter its content with the
+ * configured filter properties.
* <p/>
- * The <tt>targetFileName</tt> is the relative path according to the root of
- * the generated web application.
+ * The <tt>targetFileName</tt> is the relative path according to the root of the generated web application.
*
- * @param sourceId the source id
- * @param context the context to use
- * @param file the file to copy
+ * @param sourceId the source id
+ * @param context the context to use
+ * @param file the file to copy
* @param targetFilename the relative path according to the root of the webapp
* @return true if the file has been copied, false otherwise
- * @throws IOException if an error occurred while copying
+ * @throws IOException if an error occurred while copying
* @throws MojoExecutionException if an error occurred while retrieving the filter properties
*/
protected boolean copyFilteredFile( String sourceId, final WarPackagingContext context, File file,
@@ -229,8 +240,8 @@ public abstract class AbstractWarPackagi
}
// fix for MWAR-36, ensures that the parent dir are created first
targetFile.getParentFile().mkdirs();
-
- context.getMavenFileFilter().copyFile( file, targetFile, true, context.getFilterWrappers(), encoding);
+
+ context.getMavenFileFilter().copyFile( file, targetFile, true, context.getFilterWrappers(), encoding );
}
catch ( MavenFilteringException e )
{
@@ -242,8 +253,8 @@ public abstract class AbstractWarPackagi
}
else
{
- context.getLog().debug(
- " - " + targetFilename + " wasn't copied because it has already been packaged (filtered)." );
+ context.getLog().debug( " - " + targetFilename
+ + " wasn't copied because it has already been packaged (filtered)." );
return false;
}
}
@@ -251,8 +262,8 @@ public abstract class AbstractWarPackagi
/**
* Unpacks the specified file to the specified directory.
*
- * @param context the packaging context
- * @param file the file to unpack
+ * @param context the packaging context
+ * @param file the file to unpack
* @param unpackDirectory the directory to use for th unpacked file
* @throws MojoExecutionException if an error occurred while unpacking the file
*/
@@ -278,25 +289,25 @@ public abstract class AbstractWarPackagi
catch ( NoSuchArchiverException e )
{
context.getLog().warn( "Skip unpacking dependency file [" + file.getAbsolutePath()
- + " with unknown extension [" + archiveExt + "]" );
+ + " with unknown extension [" + archiveExt + "]" );
}
}
/**
- * Copy file from source to destination. The directories up to <code>destination</code>
- * will be created if they don't already exist. if the <code>onlyIfModified</code> flag
- * is <tt>false</tt>, <code>destination</code> will be overwritten if it already exists. If the
- * flag is <tt>true</tt> destination will be overwritten if it's not up to date.
+ * Copy file from source to destination. The directories up to <code>destination</code> will be created if they
+ * don't already exist. if the <code>onlyIfModified</code> flag is <tt>false</tt>, <code>destination</code> will be
+ * overwritten if it already exists. If the flag is <tt>true</tt> destination will be overwritten if it's not up to
+ * date.
* <p/>
*
- * @param context the packaging context
- * @param source an existing non-directory <code>File</code> to copy bytes from
- * @param destination a non-directory <code>File</code> to write bytes to (possibly overwriting).
+ * @param context the packaging context
+ * @param source an existing non-directory <code>File</code> to copy bytes from
+ * @param destination a non-directory <code>File</code> to write bytes to (possibly overwriting).
* @param targetFilename the relative path of the file from the webapp root directory
* @param onlyIfModified if true, copy the file only if the source has changed, always copy otherwise
* @return true if the file has been copied/updated, false otherwise
- * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot
- * be written to, or an IO error occurs during copying
+ * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be written to, or an
+ * IO error occurs during copying
*/
protected boolean copyFile( WarPackagingContext context, File source, File destination, String targetFilename,
boolean onlyIfModified )
@@ -360,12 +371,11 @@ public abstract class AbstractWarPackagi
IOUtil.close( xmlReader );
}
}
-
+
/**
- * Returns the file to copy. If the includes are <tt>null</tt> or empty, the
- * default includes are used.
+ * Returns the file to copy. If the includes are <tt>null</tt> or empty, the default includes are used.
*
- * @param baseDir the base directory to start from
+ * @param baseDir the base directory to start from
* @param includes the includes
* @param excludes the excludes
* @return the files to copy
@@ -376,10 +386,9 @@ public abstract class AbstractWarPackagi
}
/**
- * Returns the file to copy. If the includes are <tt>null</tt> or empty, the
- * default includes are used.
+ * Returns the file to copy. If the includes are <tt>null</tt> or empty, the default includes are used.
*
- * @param baseDir the base directory to start from
+ * @param baseDir the base directory to start from
* @param includes the includes
* @param excludes the excludes
* @return the files to copy
@@ -407,22 +416,21 @@ public abstract class AbstractWarPackagi
scanner.scan();
PathSet pathSet = new PathSet( scanner.getIncludedFiles() );
-
+
if ( includeDirectories )
{
pathSet.addAll( scanner.getIncludedDirectories() );
}
-
+
return pathSet;
}
/**
* Returns the final name of the specified artifact.
* <p/>
- * If the <tt>outputFileNameMapping</tt> is set, it is used, otherwise
- * the standard naming scheme is used.
+ * If the <tt>outputFileNameMapping</tt> is set, it is used, otherwise the standard naming scheme is used.
*
- * @param context the packaging context
+ * @param context the packaging context
* @param artifact the artifact
* @return the converted filename of the artifact
*/
@@ -437,8 +445,7 @@ public abstract class AbstractWarPackagi
String classifier = artifact.getClassifier();
if ( ( classifier != null ) && !( "".equals( classifier.trim() ) ) )
{
- return MappingUtils.evaluateFileNameMapping( MappingUtils.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER,
- artifact );
+ return MappingUtils.evaluateFileNameMapping( MappingUtils.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER, artifact );
}
else
{
@@ -448,9 +455,8 @@ public abstract class AbstractWarPackagi
}
/**
- * Returns <code>true</code> if the <code>File</code>-object is a file (not
- * a directory) that is not <code>null</code> and has a file name that ends
- * in ".xml".
+ * Returns <code>true</code> if the <code>File</code>-object is a file (not a directory) that is not
+ * <code>null</code> and has a file name that ends in ".xml".
*
* @param file The file to check
* @return <code>true</code> if the file is an xml-file, otherwise <code>false</code>
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ArtifactsPackagingTask.java Wed Oct 1 22:03:26 2014
@@ -34,7 +34,6 @@ import org.codehaus.plexus.interpolation
* Handles the artifacts that needs to be packaged in the web application.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class ArtifactsPackagingTask
@@ -53,90 +52,90 @@ public class ArtifactsPackagingTask
private final String id;
-
public ArtifactsPackagingTask( Set<Artifact> artifacts, Overlay currentProjectOverlay )
{
this.artifacts = artifacts;
this.id = currentProjectOverlay.getId();
}
-
public void performPackaging( WarPackagingContext context )
throws MojoExecutionException
{
try
{
- final ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
- final List<String> duplicates = findDuplicates( context, artifacts );
+ final ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
+ final List<String> duplicates = findDuplicates( context, artifacts );
- for ( Artifact artifact : artifacts )
- {
- String targetFileName = getArtifactFinalName( context, artifact );
+ for ( Artifact artifact : artifacts )
+ {
+ String targetFileName = getArtifactFinalName( context, artifact );
- context.getLog().debug( "Processing: " + targetFileName );
+ context.getLog().debug( "Processing: " + targetFileName );
- if ( duplicates.contains( targetFileName ) )
- {
- context.getLog().debug( "Duplicate found: " + targetFileName );
- targetFileName = artifact.getGroupId() + "-" + targetFileName;
- context.getLog().debug( "Renamed to: " + targetFileName );
- }
- context.getWebappStructure().registerTargetFileName( artifact, targetFileName );
+ if ( duplicates.contains( targetFileName ) )
+ {
+ context.getLog().debug( "Duplicate found: " + targetFileName );
+ targetFileName = artifact.getGroupId() + "-" + targetFileName;
+ context.getLog().debug( "Renamed to: " + targetFileName );
+ }
+ context.getWebappStructure().registerTargetFileName( artifact, targetFileName );
- if ( !artifact.isOptional() && filter.include( artifact ) )
- {
- try
+ if ( !artifact.isOptional() && filter.include( artifact ) )
{
- String type = artifact.getType();
- if ( "tld".equals( type ) )
- {
- copyFile( id, context, artifact.getFile(), TLD_PATH + targetFileName );
- }
- else if ( "aar".equals( type ) )
- {
- copyFile( id, context, artifact.getFile(), SERVICES_PATH + targetFileName );
- }
- else if ( "mar".equals( type ) )
+ try
{
- copyFile( id, context, artifact.getFile(), MODULES_PATH + targetFileName );
+ String type = artifact.getType();
+ if ( "tld".equals( type ) )
+ {
+ copyFile( id, context, artifact.getFile(), TLD_PATH + targetFileName );
+ }
+ else if ( "aar".equals( type ) )
+ {
+ copyFile( id, context, artifact.getFile(), SERVICES_PATH + targetFileName );
+ }
+ else if ( "mar".equals( type ) )
+ {
+ copyFile( id, context, artifact.getFile(), MODULES_PATH + targetFileName );
+ }
+ else if ( "xar".equals( type ) )
+ {
+ copyFile( id, context, artifact.getFile(), EXTENSIONS_PATH + targetFileName );
+ }
+ else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type )
+ || "test-jar".equals( type ) || "bundle".equals( type ) )
+ {
+ copyFile( id, context, artifact.getFile(), LIB_PATH + targetFileName );
+ }
+ else if ( "par".equals( type ) )
+ {
+ targetFileName = targetFileName.substring( 0, targetFileName.lastIndexOf( '.' ) ) + ".jar";
+ copyFile( id, context, artifact.getFile(), LIB_PATH + targetFileName );
+ }
+ else if ( "war".equals( type ) )
+ {
+ // Nothing to do here, it is an overlay and it's already handled
+ context.getLog().debug( "war artifacts are handled as overlays, ignoring [" + artifact
+ + "]" );
+ }
+ else if ( "zip".equals( type ) )
+ {
+ // Nothing to do here, it is an overlay and it's already handled
+ context.getLog().debug( "zip artifacts are handled as overlays, ignoring [" + artifact
+ + "]" );
+ }
+ else
+ {
+ context.getLog().debug( "Artifact of type [" + type + "] is not supported, ignoring ["
+ + artifact + "]" );
+ }
}
- else if ( "xar".equals( type ) )
+ catch ( IOException e )
{
- copyFile( id, context, artifact.getFile(), EXTENSIONS_PATH + targetFileName );
- }
- else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type )
- || "test-jar".equals( type ) || "bundle".equals( type ) )
- {
- copyFile( id, context, artifact.getFile(), LIB_PATH + targetFileName );
- }
- else if ( "par".equals( type ) )
- {
- targetFileName = targetFileName.substring( 0, targetFileName.lastIndexOf( '.' ) ) + ".jar";
- copyFile( id, context, artifact.getFile(), LIB_PATH + targetFileName );
- }
- else if ( "war".equals( type ) )
- {
- // Nothing to do here, it is an overlay and it's already handled
- context.getLog().debug( "war artifacts are handled as overlays, ignoring [" + artifact + "]" );
- }
- else if ( "zip".equals( type ) )
- {
- // Nothing to do here, it is an overlay and it's already handled
- context.getLog().debug( "zip artifacts are handled as overlays, ignoring [" + artifact + "]" );
- }
- else
- {
- context.getLog().debug(
- "Artifact of type [" + type + "] is not supported, ignoring [" + artifact + "]" );
+ throw new MojoExecutionException( "Failed to copy file for artifact [" + artifact + "]", e );
}
}
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Failed to copy file for artifact [" + artifact + "]", e );
- }
}
}
- }
catch ( InterpolationException e )
{
throw new MojoExecutionException( e.getMessage(), e );
@@ -144,10 +143,9 @@ public class ArtifactsPackagingTask
}
/**
- * Searches a set of artifacts for duplicate filenames and returns a list
- * of duplicates.
+ * Searches a set of artifacts for duplicate filenames and returns a list of duplicates.
*
- * @param context the packaging context
+ * @param context the packaging context
* @param artifacts set of artifacts
* @return List of duplicated artifacts as bundling file names
*/
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ClassesPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ClassesPackagingTask.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ClassesPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/ClassesPackagingTask.java Wed Oct 1 22:03:26 2014
@@ -34,12 +34,10 @@ import java.io.IOException;
/**
* Handles the classes directory that needs to be packaged in the web application.
* <p/>
- * Based on the {@link WarPackagingContext#archiveClasses()} flag the resources
- * either copied into to <tt>WEB-INF/classes</tt> directory or archived in a jar
- * within the <tt>WEB-INF/lib</tt> directory.
+ * Based on the {@link WarPackagingContext#archiveClasses()} flag the resources either copied into to
+ * <tt>WEB-INF/classes</tt> directory or archived in a jar within the <tt>WEB-INF/lib</tt> directory.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class ClassesPackagingTask
@@ -72,13 +70,13 @@ public class ClassesPackagingTask
final PathSet sources = getFilesToIncludes( context.getClassesDirectory(), null, null );
try
{
- copyFiles( currentProjectOverlay.getId(), context, context.getClassesDirectory(),
- sources, CLASSES_PATH, false );
+ copyFiles( currentProjectOverlay.getId(), context, context.getClassesDirectory(), sources,
+ CLASSES_PATH, false );
}
catch ( IOException e )
{
- throw new MojoExecutionException(
- "Could not copy webapp classes [" + context.getClassesDirectory().getAbsolutePath() + "]", e );
+ throw new MojoExecutionException( "Could not copy webapp classes ["
+ + context.getClassesDirectory().getAbsolutePath() + "]", e );
}
}
}
@@ -89,8 +87,8 @@ public class ClassesPackagingTask
{
MavenProject project = context.getProject();
ArtifactFactory factory = context.getArtifactFactory();
- Artifact artifact = factory.createBuildArtifact( project.getGroupId(), project.getArtifactId(),
- project.getVersion(), "jar" );
+ Artifact artifact =
+ factory.createBuildArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), "jar" );
String archiveName;
try
{
@@ -98,9 +96,8 @@ public class ClassesPackagingTask
}
catch ( InterpolationException e )
{
- throw new MojoExecutionException(
- "Could not get the final name of the artifact [" + artifact.getGroupId() + ":" + artifact.getArtifactId()
- + ":" + artifact.getVersion() + "]", e );
+ throw new MojoExecutionException( "Could not get the final name of the artifact [" + artifact.getGroupId()
+ + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() + "]", e );
}
final String targetFilename = LIB_PATH + archiveName;
@@ -114,8 +111,8 @@ public class ClassesPackagingTask
}
else
{
- context.getLog().warn(
- "Could not generate archive classes file [" + targetFilename + "] has already been copied." );
+ context.getLog().warn( "Could not generate archive classes file [" + targetFilename
+ + "] has already been copied." );
}
}
}
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/DependenciesAnalysisPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/DependenciesAnalysisPackagingTask.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/DependenciesAnalysisPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/DependenciesAnalysisPackagingTask.java Wed Oct 1 22:03:26 2014
@@ -28,11 +28,9 @@ import org.apache.maven.plugin.war.util.
import java.io.File;
/**
- * Analyzes the dependencies of the project with its previous state and update
- * the target directory accordingly.
+ * Analyzes the dependencies of the project with its previous state and update the target directory accordingly.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class DependenciesAnalysisPackagingTask
@@ -55,7 +53,8 @@ public class DependenciesAnalysisPackagi
{
context.getLog().debug( notBundledMessage );
}
- else {
+ else
+ {
handleDependencyScope( context, dependency, warOrZipMessage, standardMessage, removeFile );
}
}
@@ -139,7 +138,6 @@ public class DependenciesAnalysisPackagi
}
}
-
class DependenciesAnalysisCallbackImpl
implements WebappStructure.DependenciesAnalysisCallback
{
@@ -172,23 +170,20 @@ public class DependenciesAnalysisPackagi
public void updatedVersion( Dependency dependency, String previousVersion )
{
handleDependency( context, dependency, "Version of dependency [" + dependency + "] has changed ("
- + previousVersion + " -> " + dependency.getVersion() + ") but it was not bundled anyway.",
- "Version of dependency [" + dependency + "] has changed ("
- + previousVersion + " -> " + dependency.getVersion()
- + "). If it was included in the build as an overlay, "
- + "consider "
- + "cleaning the target directory of the project (mvn clean)",
- "Version of dependency [" + dependency + "] has changed ("
- + previousVersion + " -> " + dependency.getVersion() + ").",
- true );
+ + previousVersion + " -> " + dependency.getVersion()
+ + ") but it was not bundled anyway.",
+ "Version of dependency [" + dependency + "] has changed (" + previousVersion + " -> "
+ + dependency.getVersion() + "). If it was included in the build as an overlay, "
+ + "consider " + "cleaning the target directory of the project (mvn clean)",
+ "Version of dependency [" + dependency + "] has changed (" + previousVersion + " -> "
+ + dependency.getVersion() + ").", true );
}
public void updatedScope( Dependency dependency, String previousScope )
{
- if ( Artifact.SCOPE_PROVIDED.equals( dependency.getScope() ) || Artifact.SCOPE_TEST.equals(
- dependency.getScope() )
- && ( !Artifact.SCOPE_PROVIDED.equals( previousScope )
- && !Artifact.SCOPE_TEST.equals( previousScope ) ) )
+ if ( Artifact.SCOPE_PROVIDED.equals( dependency.getScope() )
+ || Artifact.SCOPE_TEST.equals( dependency.getScope() )
+ && ( !Artifact.SCOPE_PROVIDED.equals( previousScope ) && !Artifact.SCOPE_TEST.equals( previousScope ) ) )
{
// It's now provided or test so it should be removed
handleDependencyScope( context, dependency, "Scope of dependency [" + dependency + "] has changed ("
@@ -200,19 +195,16 @@ public class DependenciesAnalysisPackagi
}
-
public void updatedOptionalFlag( Dependency dependency, boolean previousOptional )
{
if ( !previousOptional && dependency.isOptional() )
{
// It wasn't optional but now it is anymore
- handleDependency( context, dependency,
- "Dependency [" + dependency + "] is now optional but it was not bundled anyway.",
- "Dependency [" + dependency
- + "] is now optional. If it was included in the build as an overlay, "
- + "consider cleaning the target directory of the project (mvn clean)",
- "Dependency [" + dependency + "] is now optional", true );
-
+ handleDependency( context, dependency, "Dependency [" + dependency
+ + "] is now optional but it was not bundled anyway.", "Dependency [" + dependency
+ + "] is now optional. If it was included in the build as an overlay, "
+ + "consider cleaning the target directory of the project (mvn clean)", "Dependency [" + dependency
+ + "] is now optional", true );
}
}
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/OverlayPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/OverlayPackagingTask.java?rev=1628849&r1=1628848&r2=1628849&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/OverlayPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/OverlayPackagingTask.java Wed Oct 1 22:03:26 2014
@@ -31,7 +31,6 @@ import java.io.IOException;
* Handles an overlay.
*
* @author Stephane Nicoll
- *
* @version $Id$
*/
public class OverlayPackagingTask
@@ -39,7 +38,6 @@ public class OverlayPackagingTask
{
private final Overlay overlay;
-
public OverlayPackagingTask( Overlay overlay, Overlay currentProjectOverlay )
{
if ( overlay == null )
@@ -53,12 +51,11 @@ public class OverlayPackagingTask
this.overlay = overlay;
}
-
public void performPackaging( WarPackagingContext context )
throws MojoExecutionException
{
- context.getLog().debug(
- "OverlayPackagingTask performPackaging overlay.getTargetPath() " + overlay.getTargetPath() );
+ context.getLog().debug( "OverlayPackagingTask performPackaging overlay.getTargetPath() "
+ + overlay.getTargetPath() );
if ( overlay.shouldSkip() )
{
context.getLog().info( "Skipping overlay [" + overlay + "]" );
@@ -102,8 +99,7 @@ public class OverlayPackagingTask
/**
* Unpacks the specified overlay.
* <p/>
- * Makes sure to skip the unpack process if the overlay has
- * already been unpacked.
+ * Makes sure to skip the unpack process if the overlay has already been unpacked.
*
* @param context the packaging context
* @param overlay the overlay