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/19 01:23:33 UTC
svn commit: r1632861 [2/2] - in
/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly:
./ archive/ archive/archiver/ archive/phase/ archive/phase/wrappers/
archive/task/ artifact/ filter/ format/ interpolation/ io/ m...
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/MetaInfSpringHandler.java Sat Oct 18 23:23:32 2014
@@ -22,7 +22,7 @@ package org.apache.maven.plugin.assembly
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.components.io.fileselectors.FileInfo;
-@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-spring", instantiationStrategy = "per-lookup")
+@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-spring", instantiationStrategy = "per-lookup" )
public class MetaInfSpringHandler
extends AbstractLineAggregatingHandler
{
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/SimpleAggregatingDescriptorHandler.java Sat Oct 18 23:23:32 2014
@@ -46,7 +46,6 @@ import org.codehaus.plexus.util.IOUtil;
* @version $Id$
*/
@Component( role = ContainerDescriptorHandler.class, hint = "file-aggregator", instantiationStrategy = "per-lookup" )
-
public class SimpleAggregatingDescriptorHandler
implements ContainerDescriptorHandler, LogEnabled
{
@@ -71,7 +70,8 @@ public class SimpleAggregatingDescriptor
private Logger logger;
- public void finalizeArchiveCreation( final Archiver archiver ) throws ArchiverException
+ public void finalizeArchiveCreation( final Archiver archiver )
+ throws ArchiverException
{
checkConfig();
@@ -79,7 +79,7 @@ public class SimpleAggregatingDescriptor
{
throw new ArchiverException(
"Cannot write aggregated properties to a directory. You must specify a file name in the outputPath configuration for this handler. (handler: "
- + getClass().getName() );
+ + getClass().getName() );
}
if ( outputPath.startsWith( "/" ) )
@@ -96,7 +96,8 @@ public class SimpleAggregatingDescriptor
overrideFilterAction = false;
}
- private File writePropertiesFile() throws ArchiverException
+ private File writePropertiesFile()
+ throws ArchiverException
{
File f;
@@ -111,8 +112,9 @@ public class SimpleAggregatingDescriptor
writer.write( commentChars + " Aggregated on " + new Date() + " from: " );
- for (final String filename : filenames) {
- writer.write("\n" + commentChars + " " + filename);
+ for ( final String filename : filenames )
+ {
+ writer.write( "\n" + commentChars + " " + filename );
}
writer.write( "\n\n" );
@@ -122,7 +124,7 @@ public class SimpleAggregatingDescriptor
catch ( final IOException e )
{
throw new ArchiverException( "Error adding aggregated properties to finalize archive creation. Reason: "
- + e.getMessage(), e );
+ + e.getMessage(), e );
}
finally
{
@@ -132,7 +134,8 @@ public class SimpleAggregatingDescriptor
return f;
}
- public void finalizeArchiveExtraction( final UnArchiver unarchiver ) throws ArchiverException
+ public void finalizeArchiveExtraction( final UnArchiver unarchiver )
+ throws ArchiverException
{
}
@@ -143,7 +146,8 @@ public class SimpleAggregatingDescriptor
return Collections.singletonList( outputPath );
}
- public boolean isSelected( final FileInfo fileInfo ) throws IOException
+ public boolean isSelected( final FileInfo fileInfo )
+ throws IOException
{
checkConfig();
@@ -153,7 +157,7 @@ public class SimpleAggregatingDescriptor
return true;
}
- String name = AssemblyFileUtils.normalizeFileInfo(fileInfo);
+ String name = AssemblyFileUtils.normalizeFileInfo( fileInfo );
if ( fileInfo.isFile() && name.matches( filePattern ) )
{
@@ -175,7 +179,8 @@ public class SimpleAggregatingDescriptor
}
}
- private void readProperties( final FileInfo fileInfo ) throws IOException
+ private void readProperties( final FileInfo fileInfo )
+ throws IOException
{
final StringWriter writer = new StringWriter();
Reader reader = null;
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java Sat Oct 18 23:23:32 2014
@@ -130,7 +130,7 @@ public class FileFormatter
}
else
{
- filterRequest.setDelimiters( filterRequest.getDelimiters());
+ filterRequest.setDelimiters( filterRequest.getDelimiters() );
}
filterRequest.setInjectProjectBuildFilters( configSource.isIncludeProjectBuildFilters() );
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileSetFormatter.java Sat Oct 18 23:23:32 2014
@@ -48,7 +48,8 @@ public class FileSetFormatter
this.logger = logger;
}
- public File formatFileSetForAssembly( @Nonnull File fileSetDir, @Nonnull org.apache.maven.plugin.assembly.model.FileSet set )
+ public File formatFileSetForAssembly( @Nonnull File fileSetDir,
+ @Nonnull org.apache.maven.plugin.assembly.model.FileSet set )
throws AssemblyFormattingException, IOException
{
String lineEndingHint = set.getLineEnding();
@@ -60,9 +61,9 @@ public class FileSetFormatter
FileSet fileSet = new FileSet();
fileSet.setLineEnding( lineEnding );
-
+
fileSet.setDirectory( fileSetDir.getAbsolutePath() );
-
+
fileSet.setIncludes( set.getIncludes() );
fileSet.setExcludes( set.getExcludes() );
@@ -74,37 +75,44 @@ public class FileSetFormatter
// if we don't have anything to process, let's just skip all of this mess.
if ( ( files == null ) || ( files.length == 0 ) )
{
- logger.info( "No files selected for line-ending conversion or filtering. Skipping: " + fileSet.getDirectory() );
+ logger.info( "No files selected for line-ending conversion or filtering. Skipping: "
+ + fileSet.getDirectory() );
}
else
{
File formattedDir =
FileUtils.createTempFile( "fileSetFormatter.", ".tmp", configSource.getTemporaryRootDirectory() );
-
+
logger.debug( "Filtering files from: " + fileSetDir + " into temp dir: " + formattedDir );
formattedDir.delete();
formattedDir.mkdirs();
FileFormatter fileFormatter = new FileFormatter( configSource, logger );
- for (String file : files) {
- logger.debug("Filtering: " + file);
+ for ( String file : files )
+ {
+ logger.debug( "Filtering: " + file );
- File targetFile = new File(formattedDir, file);
+ File targetFile = new File( formattedDir, file );
targetFile.getParentFile().mkdirs();
- File sourceFile = new File(fileSetDir, file);
- try {
+ File sourceFile = new File( fileSetDir, file );
+ try
+ {
sourceFile =
- fileFormatter.format(sourceFile, set.isFiltered(), lineEndingHint, formattedDir,
- configSource.getEncoding());
- AssemblyFileUtils.copyFile(sourceFile, targetFile);
- } catch (AssemblyFormattingException e) {
- deleteDirectory(formattedDir);
+ fileFormatter.format( sourceFile, set.isFiltered(), lineEndingHint, formattedDir,
+ configSource.getEncoding() );
+ AssemblyFileUtils.copyFile( sourceFile, targetFile );
+ }
+ catch ( AssemblyFormattingException e )
+ {
+ deleteDirectory( formattedDir );
throw e;
- } catch (IOException e) {
- deleteDirectory(formattedDir);
+ }
+ catch ( IOException e )
+ {
+ deleteDirectory( formattedDir );
throw e;
}
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/interpolation/AssemblyInterpolator.java Sat Oct 18 23:23:32 2014
@@ -116,7 +116,7 @@ public class AssemblyInterpolator
catch ( final InterpolationException e )
{
throw new AssemblyInterpolationException( "Failed to interpolate assembly with ID: " + assembly.getId()
- + ". Reason: " + e.getMessage(), e );
+ + ". Reason: " + e.getMessage(), e );
}
finally
{
@@ -127,12 +127,13 @@ public class AssemblyInterpolator
{
final StringBuilder sb = new StringBuilder();
- sb.append("One or more minor errors occurred while interpolating the assembly with ID: ").append(assembly.getId()).append(":\n");
+ sb.append( "One or more minor errors occurred while interpolating the assembly with ID: " ).append( assembly.getId() ).append( ":\n" );
@SuppressWarnings( "unchecked" )
final List<ObjectInterpolationWarning> warnings = objectInterpolator.getWarnings();
- for (final ObjectInterpolationWarning warning : warnings) {
- sb.append('\n').append(warning);
+ for ( final ObjectInterpolationWarning warning : warnings )
+ {
+ sb.append( '\n' ).append( warning );
}
sb.append( "\n\nThese values were SKIPPED, but the assembly process will continue.\n" );
@@ -190,8 +191,7 @@ public class AssemblyInterpolator
interpolator.addValueSource( new PropertiesBasedValueSource( settingsProperties ) );
-
- Properties commandLineProperties = DefaultAssemblyReader.mergeExecutionPropertiesWithSystemPropertiew(session);
+ Properties commandLineProperties = DefaultAssemblyReader.mergeExecutionPropertiesWithSystemPropertiew( session );
// 7
interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java Sat Oct 18 23:23:32 2014
@@ -111,17 +111,19 @@ public class DefaultAssemblyReader
if ( ( descriptors != null ) && ( descriptors.length > 0 ) )
{
locator.setStrategies( strategies );
- for (String descriptor1 : descriptors) {
- getLogger().info("Reading assembly descriptor: " + descriptor1);
- addAssemblyFromDescriptor(descriptor1, locator, configSource, assemblies);
+ for ( String descriptor1 : descriptors )
+ {
+ getLogger().info( "Reading assembly descriptor: " + descriptor1 );
+ addAssemblyFromDescriptor( descriptor1, locator, configSource, assemblies );
}
}
if ( ( descriptorRefs != null ) && ( descriptorRefs.length > 0 ) )
{
locator.setStrategies( refStrategies );
- for (String descriptorRef : descriptorRefs) {
- addAssemblyForDescriptorReference(descriptorRef, configSource, assemblies);
+ for ( String descriptorRef : descriptorRefs )
+ {
+ addAssemblyForDescriptorReference( descriptorRef, configSource, assemblies );
}
}
@@ -163,8 +165,9 @@ public class DefaultAssemblyReader
if ( paths != null )
{
- for (String path : paths) {
- addAssemblyFromDescriptor(path, locator, configSource, assemblies);
+ for ( String path : paths )
+ {
+ addAssemblyFromDescriptor( path, locator, configSource, assemblies );
}
}
}
@@ -183,9 +186,11 @@ public class DefaultAssemblyReader
// check unique IDs
final Set<String> ids = new HashSet<String>();
- for (final Assembly assembly : assemblies) {
- if (!ids.add(assembly.getId())) {
- getLogger().warn("The assembly id " + assembly.getId() + " is used more than once.");
+ for ( final Assembly assembly : assemblies )
+ {
+ if ( !ids.add( assembly.getId() ) )
+ {
+ getLogger().warn( "The assembly id " + assembly.getId() + " is used more than once." );
}
}
@@ -347,7 +352,7 @@ public class DefaultAssemblyReader
final Map<String, String> context = new HashMap<String, String>();
final MavenSession session = configSource.getMavenSession();
- Properties commandLineProperties = mergeExecutionPropertiesWithSystemPropertiew(session);
+ Properties commandLineProperties = mergeExecutionPropertiesWithSystemPropertiew( session );
for ( final Enumeration<Object> e = commandLineProperties.keys(); e.hasMoreElements(); )
{
@@ -404,21 +409,22 @@ public class DefaultAssemblyReader
return assembly;
}
- public static Properties mergeExecutionPropertiesWithSystemPropertiew(MavenSession session) {
+ public static Properties mergeExecutionPropertiesWithSystemPropertiew( MavenSession session )
+ {
Properties commandLineProperties = System.getProperties();
if ( session != null )
- {
- commandLineProperties = new Properties();
- if ( session.getExecutionProperties() != null )
- {
- commandLineProperties.putAll( session.getExecutionProperties() );
- }
-
- if ( session.getUserProperties() != null )
- {
- commandLineProperties.putAll( session.getUserProperties() );
- }
- }
+ {
+ commandLineProperties = new Properties();
+ if ( session.getExecutionProperties() != null )
+ {
+ commandLineProperties.putAll( session.getExecutionProperties() );
+ }
+
+ if ( session.getUserProperties() != null )
+ {
+ commandLineProperties.putAll( session.getUserProperties() );
+ }
+ }
return commandLineProperties;
}
@@ -465,36 +471,48 @@ public class DefaultAssemblyReader
final List<String> componentLocations = assembly.getComponentDescriptors();
- for (String location : componentLocations) {
+ for ( String location : componentLocations )
+ {
// allow expressions in path to component descriptor... MASSEMBLY-486
- try {
- location = aee.evaluate(location).toString();
- } catch (final Exception eee) {
- getLogger().error("Error interpolating componentDescriptor: " + location, eee);
+ try
+ {
+ location = aee.evaluate( location ).toString();
+ }
+ catch ( final Exception eee )
+ {
+ getLogger().error( "Error interpolating componentDescriptor: " + location, eee );
}
- final Location resolvedLocation = locator.resolve(location);
+ final Location resolvedLocation = locator.resolve( location );
- if (resolvedLocation == null) {
- throw new AssemblyReadException("Failed to locate component descriptor: " + location);
+ if ( resolvedLocation == null )
+ {
+ throw new AssemblyReadException( "Failed to locate component descriptor: " + location );
}
Component component = null;
Reader reader = null;
- try {
- reader = new InputStreamReader(resolvedLocation.getInputStream());
- component = new ComponentXpp3Reader().read(reader);
- } catch (final IOException e) {
- throw new AssemblyReadException("Error reading component descriptor: " + location + " (resolved to: "
- + resolvedLocation.getSpecification() + ")", e);
- } catch (final XmlPullParserException e) {
- throw new AssemblyReadException("Error reading component descriptor: " + location + " (resolved to: "
- + resolvedLocation.getSpecification() + ")", e);
- } finally {
- IOUtil.close(reader);
+ try
+ {
+ reader = new InputStreamReader( resolvedLocation.getInputStream() );
+ component = new ComponentXpp3Reader().read( reader );
+ }
+ catch ( final IOException e )
+ {
+ throw new AssemblyReadException( "Error reading component descriptor: " + location + " (resolved to: "
+ + resolvedLocation.getSpecification() + ")", e );
+ }
+ catch ( final XmlPullParserException e )
+ {
+ throw new AssemblyReadException( "Error reading component descriptor: " + location + " (resolved to: "
+ + resolvedLocation.getSpecification() + ")", e );
+ }
+ finally
+ {
+ IOUtil.close( reader );
}
- mergeComponentWithAssembly(component, assembly);
+ mergeComponentWithAssembly( component, assembly );
}
}
@@ -509,32 +527,37 @@ public class DefaultAssemblyReader
final List<ContainerDescriptorHandlerConfig> containerHandlerDescriptors =
component.getContainerDescriptorHandlers();
- for (final ContainerDescriptorHandlerConfig cfg : containerHandlerDescriptors) {
- assembly.addContainerDescriptorHandler(cfg);
+ for ( final ContainerDescriptorHandlerConfig cfg : containerHandlerDescriptors )
+ {
+ assembly.addContainerDescriptorHandler( cfg );
}
final List<DependencySet> dependencySetList = component.getDependencySets();
- for (final DependencySet dependencySet : dependencySetList) {
- assembly.addDependencySet(dependencySet);
+ for ( final DependencySet dependencySet : dependencySetList )
+ {
+ assembly.addDependencySet( dependencySet );
}
final List<FileSet> fileSetList = component.getFileSets();
- for (final FileSet fileSet : fileSetList) {
- assembly.addFileSet(fileSet);
+ for ( final FileSet fileSet : fileSetList )
+ {
+ assembly.addFileSet( fileSet );
}
final List<FileItem> fileList = component.getFiles();
- for (final FileItem fileItem : fileList) {
- assembly.addFile(fileItem);
+ for ( final FileItem fileItem : fileList )
+ {
+ assembly.addFile( fileItem );
}
final List<Repository> repositoriesList = component.getRepositories();
- for (final Repository repository : repositoriesList) {
- assembly.addRepository(repository);
+ for ( final Repository repository : repositoriesList )
+ {
+ assembly.addRepository( repository );
}
final List<ModuleSet> moduleSets = component.getModuleSets();
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/UnpackMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/UnpackMojo.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/UnpackMojo.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/UnpackMojo.java Sat Oct 18 23:23:32 2014
@@ -87,26 +87,36 @@ public class UnpackMojo
dependencies.addAll( projectArtifacts );
}
- for (final Artifact artifact : dependencies) {
+ for ( final Artifact artifact : dependencies )
+ {
final String name = artifact.getFile().getName();
- final File tempLocation = new File(workDirectory, name.substring(0, name.lastIndexOf('.')));
+ final File tempLocation = new File( workDirectory, name.substring( 0, name.lastIndexOf( '.' ) ) );
boolean process = false;
- if (!tempLocation.exists()) {
+ if ( !tempLocation.exists() )
+ {
tempLocation.mkdirs();
process = true;
- } else if (artifact.getFile().lastModified() > tempLocation.lastModified()) {
+ }
+ else if ( artifact.getFile().lastModified() > tempLocation.lastModified() )
+ {
process = true;
}
- if (process) {
+ if ( process )
+ {
final File file = artifact.getFile();
- try {
- AssemblyFileUtils.unpack(file, tempLocation, archiverManager);
- } catch (final NoSuchArchiverException e) {
- getLog().info("Skip unpacking dependency file with unknown extension: " + file.getPath());
- } catch (final ArchiveExpansionException e) {
- throw new MojoExecutionException("Error unpacking dependency file: " + file, e);
+ try
+ {
+ AssemblyFileUtils.unpack( file, tempLocation, archiverManager );
+ }
+ catch ( final NoSuchArchiverException e )
+ {
+ getLog().info( "Skip unpacking dependency file with unknown extension: " + file.getPath() );
+ }
+ catch ( final ArchiveExpansionException e )
+ {
+ throw new MojoExecutionException( "Error unpacking dependency file: " + file, e );
}
}
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedAssembly.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedAssembly.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedAssembly.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedAssembly.java Sat Oct 18 23:23:32 2014
@@ -34,75 +34,81 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-public class ResolvedAssembly {
+public class ResolvedAssembly
+{
+ private final Assembly assembly;
- private final Assembly assembly;
- private final List<ResolvedModuleSet> resolvedModuleSets;
- private final Set<Artifact> dependencySetArtifacts;
-
- public ResolvedAssembly( Assembly assembly, List<ResolvedModuleSet> resolvedModuleSets,
- Set<Artifact> dependencySetArtifacts ) {
- this.assembly = assembly;
- this.resolvedModuleSets = resolvedModuleSets;
- this.dependencySetArtifacts = dependencySetArtifacts;
- }
-
- public static ResolvedAssembly create(Assembly assembly){
- return new ResolvedAssembly(assembly, null, null );
- }
-
- public ResolvedAssembly withResolvedModuleSets(Iterable<ResolvedModuleSet> resolvedModuleSets){
- List<ResolvedModuleSet> resolvedModuleSets1 = new ArrayList<ResolvedModuleSet>( );
- for ( ResolvedModuleSet resolvedModuleSet : resolvedModuleSets )
- {
- resolvedModuleSets1.add(resolvedModuleSet);
- }
- return new ResolvedAssembly( assembly, resolvedModuleSets1, dependencySetArtifacts );
- }
-
-
-
- public void forEachResolvedModule(ResolvedModuleSetConsumer resolvedModuleSetConsumer) throws
- ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
- {
- if (resolvedModuleSets == null) return;
- for ( ResolvedModuleSet resolvedModuleSet : resolvedModuleSets )
- {
- resolvedModuleSetConsumer.accept( resolvedModuleSet);
- }
- }
-
- public Set<Artifact> getResolvedDependencySetArtifacts(){
- return dependencySetArtifacts;
- }
-
- public Assembly getAssembly() {
- return assembly;
- }
-
- public List<DependencySet> getDependencySets()
- {
- return assembly.getDependencySets();
- }
-
- public List<FileItem> getFiles()
- {
- return assembly.getFiles();
- }
-
- public List<FileSet> getFileSets()
- {
- return assembly.getFileSets();
- }
-
- public List<Repository> getRepositories()
- {
- return assembly.getRepositories();
- }
-
- public ResolvedAssembly withDependencySetArtifacts( final Set<Artifact> dependencySetArtifacts )
- {
- return new ResolvedAssembly( assembly, resolvedModuleSets, dependencySetArtifacts );
- }
+ private final List<ResolvedModuleSet> resolvedModuleSets;
+
+ private final Set<Artifact> dependencySetArtifacts;
+
+ public ResolvedAssembly( Assembly assembly, List<ResolvedModuleSet> resolvedModuleSets,
+ Set<Artifact> dependencySetArtifacts )
+ {
+ this.assembly = assembly;
+ this.resolvedModuleSets = resolvedModuleSets;
+ this.dependencySetArtifacts = dependencySetArtifacts;
+ }
+
+ public static ResolvedAssembly create( Assembly assembly )
+ {
+ return new ResolvedAssembly( assembly, null, null );
+ }
+
+ public ResolvedAssembly withResolvedModuleSets( Iterable<ResolvedModuleSet> resolvedModuleSets )
+ {
+ List<ResolvedModuleSet> resolvedModuleSets1 = new ArrayList<ResolvedModuleSet>();
+ for ( ResolvedModuleSet resolvedModuleSet : resolvedModuleSets )
+ {
+ resolvedModuleSets1.add( resolvedModuleSet );
+ }
+ return new ResolvedAssembly( assembly, resolvedModuleSets1, dependencySetArtifacts );
+ }
+
+ public void forEachResolvedModule( ResolvedModuleSetConsumer resolvedModuleSetConsumer )
+ throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
+ {
+ if ( resolvedModuleSets == null )
+ return;
+ for ( ResolvedModuleSet resolvedModuleSet : resolvedModuleSets )
+ {
+ resolvedModuleSetConsumer.accept( resolvedModuleSet );
+ }
+ }
+
+ public Set<Artifact> getResolvedDependencySetArtifacts()
+ {
+ return dependencySetArtifacts;
+ }
+
+ public Assembly getAssembly()
+ {
+ return assembly;
+ }
+
+ public List<DependencySet> getDependencySets()
+ {
+ return assembly.getDependencySets();
+ }
+
+ public List<FileItem> getFiles()
+ {
+ return assembly.getFiles();
+ }
+
+ public List<FileSet> getFileSets()
+ {
+ return assembly.getFileSets();
+ }
+
+ public List<Repository> getRepositories()
+ {
+ return assembly.getRepositories();
+ }
+
+ public ResolvedAssembly withDependencySetArtifacts( final Set<Artifact> dependencySetArtifacts )
+ {
+ return new ResolvedAssembly( assembly, resolvedModuleSets, dependencySetArtifacts );
+ }
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedModuleSet.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedModuleSet.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedModuleSet.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/ResolvedModuleSet.java Sat Oct 18 23:23:32 2014
@@ -24,33 +24,40 @@ import org.apache.maven.plugin.assembly.
import java.util.Set;
-public class ResolvedModuleSet {
- private final ModuleSet moduleSet;
- private final Set<Artifact> artifacts;
-
- private ResolvedModuleSet( ModuleSet moduleSet, Set<Artifact> artifacts ) {
- this.moduleSet = moduleSet;
- this.artifacts = artifacts;
- }
-
- public static ResolvedModuleSet createResolvedModuleSet(ModuleSet moduleSet) {
- return new ResolvedModuleSet(moduleSet, null );
- }
-
- public static ResolvedModuleSet empty() {
- return new ResolvedModuleSet(null, null );
- }
-
- public ModuleSet getModuleSet() {
- return moduleSet;
- }
-
- public ResolvedModuleSet withArtifacts(Set<Artifact> artifacts ){
- return new ResolvedModuleSet( moduleSet, artifacts );
- }
-
- public Set<Artifact> getArtifacts()
- {
- return artifacts;
- }
+public class ResolvedModuleSet
+{
+ private final ModuleSet moduleSet;
+
+ private final Set<Artifact> artifacts;
+
+ private ResolvedModuleSet( ModuleSet moduleSet, Set<Artifact> artifacts )
+ {
+ this.moduleSet = moduleSet;
+ this.artifacts = artifacts;
+ }
+
+ public static ResolvedModuleSet createResolvedModuleSet( ModuleSet moduleSet )
+ {
+ return new ResolvedModuleSet( moduleSet, null );
+ }
+
+ public static ResolvedModuleSet empty()
+ {
+ return new ResolvedModuleSet( null, null );
+ }
+
+ public ModuleSet getModuleSet()
+ {
+ return moduleSet;
+ }
+
+ public ResolvedModuleSet withArtifacts( Set<Artifact> artifacts )
+ {
+ return new ResolvedModuleSet( moduleSet, artifacts );
+ }
+
+ public Set<Artifact> getArtifacts()
+ {
+ return artifacts;
+ }
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/functions/ResolvedModuleSetConsumer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/functions/ResolvedModuleSetConsumer.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/functions/ResolvedModuleSetConsumer.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/resolved/functions/ResolvedModuleSetConsumer.java Sat Oct 18 23:23:32 2014
@@ -18,12 +18,14 @@ package org.apache.maven.plugin.assembly
* specific language governing permissions and limitations
* under the License.
*/
+
import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException;
import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
import org.apache.maven.plugin.assembly.resolved.ResolvedModuleSet;
-public interface ResolvedModuleSetConsumer {
- void accept(ResolvedModuleSet resolvedModule)
- throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException;
+public interface ResolvedModuleSetConsumer
+{
+ void accept( ResolvedModuleSet resolvedModule )
+ throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException;
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFileUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFileUtils.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFileUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFileUtils.java Sat Oct 18 23:23:32 2014
@@ -84,11 +84,12 @@ public final class AssemblyFileUtils
return path;
}
- public static void verifyTempDirectoryAvailability( @Nonnull final File tempDir )
+ public static void verifyTempDirectoryAvailability( @Nonnull
+ final File tempDir )
{
if ( !tempDir.exists() )
{
- //noinspection ResultOfMethodCallIgnored
+ // noinspection ResultOfMethodCallIgnored
tempDir.mkdirs();
}
}
@@ -96,7 +97,7 @@ public final class AssemblyFileUtils
/**
* Unpacks the archive file.
*
- * @param source File to be unpacked.
+ * @param source File to be unpacked.
* @param destDir Location where to put the unpacked files.
*/
public static void unpack( File source, File destDir, ArchiverManager archiverManager )
@@ -125,7 +126,7 @@ public final class AssemblyFileUtils
FileChannel c2 = new RandomAccessFile( dst, "rw" ).getChannel();
long tCount = 0, size = c1.size();
- //noinspection StatementWithEmptyBody
+ // noinspection StatementWithEmptyBody
while ( ( tCount += c2.transferFrom( c1, 0, size - tCount ) ) < size )
{
}
@@ -145,7 +146,7 @@ public final class AssemblyFileUtils
public static String normalizeFileInfo( @Nonnull FileInfo fileInfo )
{
String name = fileInfo.getName();
- name = normalizePath(name);
+ name = normalizePath( name );
return name.replace( File.separatorChar, '/' ); // How can this be anything but a no-op
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/AssemblyFormatUtils.java Sat Oct 18 23:23:32 2014
@@ -240,7 +240,7 @@ public final class AssemblyFormatUtils
catch ( final IOException e )
{
throw new AssemblyFormattingException( "Failed to retrieve OS environment variables. Reason: "
- + e.getMessage(), e );
+ + e.getMessage(), e );
}
try
@@ -467,7 +467,7 @@ public final class AssemblyFormatUtils
catch ( final IOException e )
{
throw new AssemblyFormattingException( "Failed to retrieve OS environment variables. Reason: "
- + e.getMessage(), e );
+ + e.getMessage(), e );
}
try
@@ -477,7 +477,7 @@ public final class AssemblyFormatUtils
catch ( final InterpolationException e )
{
throw new AssemblyFormattingException( "Failed to interpolate output filename mapping. Reason: "
- + e.getMessage(), e );
+ + e.getMessage(), e );
}
value = StringUtils.replace( value, "//", "/" );
@@ -490,11 +490,9 @@ public final class AssemblyFormatUtils
public static String fixRelativeRefs( String src )
{
String value = src;
-
- String[] separators = {
- "/", "\\"
- };
-
+
+ String[] separators = { "/", "\\" };
+
String finalSep = null;
for ( String sep : separators )
{
@@ -502,12 +500,12 @@ public final class AssemblyFormatUtils
{
finalSep = sep;
}
-
- if (value.contains("." + sep))
+
+ if ( value.contains( "." + sep ) )
{
List<String> parts = new ArrayList<String>();
parts.addAll( Arrays.asList( value.split( sep.replace( "\\", "\\\\" ) ) ) );
-
+
for ( ListIterator<String> it = parts.listIterator(); it.hasNext(); )
{
String part = it.next();
@@ -525,16 +523,16 @@ public final class AssemblyFormatUtils
}
}
}
-
+
value = StringUtils.join( parts.iterator(), sep );
}
}
-
+
if ( finalSep != null && value.length() > 0 && !value.endsWith( finalSep ) )
{
value += finalSep;
}
-
+
return value;
}
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/FilterUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/FilterUtils.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/FilterUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/FilterUtils.java Sat Oct 18 23:23:32 2014
@@ -80,9 +80,11 @@ public final class FilterUtils
}
}
- for (final PatternIncludesArtifactFilter f : allFilters) {
- if (f != null) {
- f.reportMissedCriteria(logger);
+ for ( final PatternIncludesArtifactFilter f : allFilters )
+ {
+ if ( f != null )
+ {
+ f.reportMissedCriteria( logger );
}
}
}
@@ -149,13 +151,16 @@ public final class FilterUtils
reportFilteringStatistics( allFilters, logger );
- for (final ArtifactFilter f : allFilters) {
- if (f instanceof StatisticsReportingArtifactFilter) {
+ for ( final ArtifactFilter f : allFilters )
+ {
+ if ( f instanceof StatisticsReportingArtifactFilter )
+ {
final StatisticsReportingArtifactFilter sFilter = (StatisticsReportingArtifactFilter) f;
- if (strictFiltering && sFilter.hasMissedCriteria()) {
+ if ( strictFiltering && sFilter.hasMissedCriteria() )
+ {
throw new InvalidAssemblerConfigurationException(
- "One or more filters had unmatched criteria. Check debug log for more information.");
+ "One or more filters had unmatched criteria. Check debug log for more information." );
}
}
}
@@ -163,16 +168,19 @@ public final class FilterUtils
public static void reportFilteringStatistics( final Collection<ArtifactFilter> filters, final Logger logger )
{
- for (final ArtifactFilter f : filters) {
- if (f instanceof StatisticsReportingArtifactFilter) {
+ for ( final ArtifactFilter f : filters )
+ {
+ if ( f instanceof StatisticsReportingArtifactFilter )
+ {
final StatisticsReportingArtifactFilter sFilter = (StatisticsReportingArtifactFilter) f;
- if (logger.isDebugEnabled()) {
- logger.debug("Statistics for " + sFilter + "\n");
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Statistics for " + sFilter + "\n" );
}
- sFilter.reportMissedCriteria(logger);
- sFilter.reportFilteredArtifacts(logger);
+ sFilter.reportMissedCriteria( logger );
+ sFilter.reportFilteredArtifacts( logger );
}
}
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/LineEndings.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/LineEndings.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/LineEndings.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/LineEndings.java Sat Oct 18 23:23:32 2014
@@ -20,20 +20,13 @@ package org.apache.maven.plugin.assembly
*/
/**
- * Enumeration to keep the different line
- * ending types we support.
+ * Enumeration to keep the different line ending types we support.
*
* @author Karl-Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
- *
*/
public enum LineEndings
{
- keep( null ),
- dos( "\r\n" ),
- windows( "\r\n" ),
- unix( "\n" ),
- crlf( "\r\n" ),
- lf( "\n" );
+ keep( null ), dos( "\r\n" ), windows( "\r\n" ), unix( "\n" ), crlf( "\r\n" ), lf( "\n" );
private String lineEndingCharacters;
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/TypeConversionUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/TypeConversionUtils.java?rev=1632861&r1=1632860&r2=1632861&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/TypeConversionUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/TypeConversionUtils.java Sat Oct 18 23:23:32 2014
@@ -58,16 +58,16 @@ public final class TypeConversionUtils
if ( ( list != null ) && !list.isEmpty() )
{
- result = list.toArray(new String[list.size()]);
+ result = list.toArray( new String[list.size()] );
}
return result;
}
- public static int modeToInt( final String mode, final Logger logger ) throws AssemblyFormattingException
+ public static int modeToInt( final String mode, final Logger logger )
+ throws AssemblyFormattingException
{
- if ( mode == null || mode.trim()
- .length() < 1 )
+ if ( mode == null || mode.trim().length() < 1 )
{
return -1;
}
@@ -93,7 +93,7 @@ public final class TypeConversionUtils
{
final StringBuilder messages = new StringBuilder();
- messages.append("The mode: ").append(Integer.toString(mode, 8)).append(" contains nonsensical permissions:");
+ messages.append( "The mode: " ).append( Integer.toString( mode, 8 ) ).append( " contains nonsensical permissions:" );
boolean warn = false;