You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2013/08/27 20:25:11 UTC
svn commit: r1517906 [5/24] - in /maven/plugins/trunk:
maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/
maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/
maven-ant-plugin/src/test/java/org/apache/maven/plugin/ant/stubs/
maven-antru...
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java Tue Aug 27 18:25:03 2013
@@ -117,9 +117,8 @@ public class AddDependencySetsTask
logger.debug( "Project " + project.getId() + " has no dependencies. Skipping dependency set addition." );
}
- for ( final DependencySet dependencySet : dependencySets )
- {
- addDependencySet( dependencySet, archiver, configSource );
+ for (final DependencySet dependencySet : dependencySets) {
+ addDependencySet(dependencySet, archiver, configSource);
}
}
@@ -132,7 +131,7 @@ public class AddDependencySetsTask
if ( !dependencySet.isUseTransitiveDependencies() && dependencySet.isUseTransitiveFiltering() )
{
logger.warn( "DependencySet has nonsensical configuration: useTransitiveDependencies == false "
- + "AND useTransitiveFiltering == true. Transitive filtering flag will be ignored." );
+ + "AND useTransitiveFiltering == true. Transitive filtering flag will be ignored." );
}
final Set<Artifact> dependencyArtifacts = resolveDependencyArtifacts( dependencySet );
@@ -150,36 +149,26 @@ public class AddDependencySetsTask
logger.debug( "Adding " + dependencyArtifacts.size() + " dependency artifacts." );
- for ( final Artifact depArtifact : dependencyArtifacts )
- {
+ for (final Artifact depArtifact : dependencyArtifacts) {
MavenProject depProject;
- try
- {
- depProject = projectBuilder.buildFromRepository( depArtifact, configSource.getRemoteRepositories(),
- configSource.getLocalRepository() );
- }
- catch ( final ProjectBuildingException e )
- {
- logger.debug(
- "Error retrieving POM of module-dependency: " + depArtifact.getId() + "; Reason: " + e.getMessage()
- + "\n\nBuilding stub project instance." );
-
- depProject = buildProjectStub( depArtifact );
- }
-
- if ( NON_ARCHIVE_DEPENDENCY_TYPES.contains( depArtifact.getType() ) )
- {
- addNonArchiveDependency( depArtifact, depProject, dependencySet, archiver, configSource );
- }
- else
- {
- if ( filterContents )
- {
- addFilteredUnpackedArtifact( dependencySet, depArtifact, depProject, archiver, configSource );
- }
- else
- {
- addNormalArtifact( dependencySet, depArtifact, depProject, archiver, configSource );
+ try {
+ depProject =
+ projectBuilder.buildFromRepository(depArtifact, configSource.getRemoteRepositories(),
+ configSource.getLocalRepository());
+ } catch (final ProjectBuildingException e) {
+ logger.debug("Error retrieving POM of module-dependency: " + depArtifact.getId() + "; Reason: "
+ + e.getMessage() + "\n\nBuilding stub project instance.");
+
+ depProject = buildProjectStub(depArtifact);
+ }
+
+ if (NON_ARCHIVE_DEPENDENCY_TYPES.contains(depArtifact.getType())) {
+ addNonArchiveDependency(depArtifact, depProject, dependencySet, archiver, configSource);
+ } else {
+ if (filterContents) {
+ addFilteredUnpackedArtifact(dependencySet, depArtifact, depProject, archiver, configSource);
+ } else {
+ addNormalArtifact(dependencySet, depArtifact, depProject, archiver, configSource);
}
}
}
@@ -199,12 +188,12 @@ public class AddDependencySetsTask
mapping = defaultOutputFileNameMapping;
}
- if ( ( dir == null || !dir.contains( "${" ) ) && ( mapping == null || !mapping.contains( "${" ) ) )
+ if ( ( dir == null || !dir.contains("${")) && ( mapping == null || !mapping.contains("${")) )
{
- logger.warn(
- "NOTE: Your assembly specifies a dependencySet that matches multiple artifacts, but specifies a concrete output format. "
- + "THIS MAY RESULT IN ONE OR MORE ARTIFACTS BEING OBSCURED!\n\nOutput directory: '" + dir
- + "'\nOutput filename mapping: '" + mapping + "'" );
+ logger.warn( "NOTE: Your assembly specifies a dependencySet that matches multiple artifacts, but specifies a concrete output format. "
+ + "THIS MAY RESULT IN ONE OR MORE ARTIFACTS BEING OBSCURED!\n\nOutput directory: '"
+ + dir
+ + "'\nOutput filename mapping: '" + mapping + "'" );
}
}
@@ -215,8 +204,12 @@ public class AddDependencySetsTask
{
logger.debug( "Adding dependency artifact " + depArtifact.getId() + " after filtering the unpacked contents." );
- final StringBuilder sb = new StringBuilder().append( depArtifact.getGroupId() ).append( "_" ).append(
- depArtifact.getArtifactId() ).append( "_" ).append( depArtifact.getVersion() );
+ final StringBuilder sb =
+ new StringBuilder().append( depArtifact.getGroupId() )
+ .append( "_" )
+ .append( depArtifact.getArtifactId() )
+ .append( "_" )
+ .append( depArtifact.getVersion() );
final String classifier = depArtifact.getClassifier();
if ( classifier != null )
@@ -230,7 +223,7 @@ public class AddDependencySetsTask
if ( dir.exists() )
{
logger.debug( "NOT unpacking: " + depArtifact.getId() + ". Directory already exists in workdir:\n\t"
- + dir.getAbsolutePath() );
+ + dir.getAbsolutePath() );
}
else
{
@@ -244,7 +237,7 @@ public class AddDependencySetsTask
catch ( final NoSuchArchiverException e )
{
throw new ArchiveCreationException( "Failed to retrieve un-archiver for: " + depArtifact.getId()
- + ". Dependency filtering cannot proceed.", e );
+ + ". Dependency filtering cannot proceed.", e );
}
unarchiver.setDestDirectory( dir );
@@ -259,7 +252,7 @@ public class AddDependencySetsTask
catch ( final ArchiverException e )
{
throw new ArchiveCreationException( "Failed to unpack dependency archive: " + depArtifact.getId()
- + ". Dependency filtering cannot proceed.", e );
+ + ". Dependency filtering cannot proceed.", e );
}
}
@@ -378,7 +371,7 @@ public class AddDependencySetsTask
else
{
logger.warn( "Cannot include project artifact: " + projectArtifact
- + "; it doesn't have an associated file or directory." );
+ + "; it doesn't have an associated file or directory." );
}
}
@@ -388,17 +381,12 @@ public class AddDependencySetsTask
final List<Artifact> attachments = project.getAttachedArtifacts();
if ( attachments != null )
{
- for ( final Artifact attachment : attachments )
- {
- if ( attachment.getFile() != null )
- {
- dependencyArtifacts.add( attachment );
- }
- else
- {
- logger.warn(
- "Cannot include attached artifact: " + project.getId() + " for project: " + project.getId()
- + "; it doesn't have an associated file or directory." );
+ for (final Artifact attachment : attachments) {
+ if (attachment.getFile() != null) {
+ dependencyArtifacts.add(attachment);
+ } else {
+ logger.warn("Cannot include attached artifact: " + project.getId() + " for project: "
+ + project.getId() + "; it doesn't have an associated file or directory.");
}
}
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddFileSetsTask.java Tue Aug 27 18:25:03 2013
@@ -77,19 +77,18 @@ public class AddFileSetsTask
{
if ( !archiveBaseDir.exists() )
{
- throw new ArchiveCreationException(
- "The archive base directory '" + archiveBaseDir.getAbsolutePath() + "' does not exist" );
+ throw new ArchiveCreationException( "The archive base directory '" + archiveBaseDir.getAbsolutePath()
+ + "' does not exist" );
}
else if ( !archiveBaseDir.isDirectory() )
{
throw new ArchiveCreationException( "The archive base directory '" + archiveBaseDir.getAbsolutePath()
- + "' exists, but it is not a directory" );
+ + "' exists, but it is not a directory" );
}
}
- for ( final FileSet fileSet : fileSets )
- {
- addFileSet( fileSet, archiver, configSource, archiveBaseDir );
+ for (final FileSet fileSet : fileSets) {
+ addFileSet(fileSet, archiver, configSource, archiveBaseDir);
}
}
@@ -122,11 +121,10 @@ public class AddFileSetsTask
if ( logger.isDebugEnabled() )
{
- logger.debug( "FileSet[" + destDirectory + "]" + " dir perms: " + Integer.toString(
- archiver.getOverrideDirectoryMode(), 8 ) + " file perms: " + Integer.toString(
- archiver.getOverrideFileMode(), 8 ) + ( fileSet.getLineEnding() == null
- ? ""
- : " lineEndings: " + fileSet.getLineEnding() ) );
+ logger.debug( "FileSet[" + destDirectory + "]" + " dir perms: "
+ + Integer.toString( archiver.getOverrideDirectoryMode(), 8 ) + " file perms: "
+ + Integer.toString( archiver.getOverrideFileMode(), 8 )
+ + ( fileSet.getLineEnding() == null ? "" : " lineEndings: " + fileSet.getLineEnding() ) );
}
logger.debug( "The archive base directory is '" + archiveBaseDir + "'" );
@@ -141,18 +139,17 @@ public class AddFileSetsTask
}
catch ( final IOException e )
{
- throw new ArchiveCreationException(
- "Error fixing file-set line endings for assembly: " + e.getMessage(), e );
+ throw new ArchiveCreationException( "Error fixing file-set line endings for assembly: "
+ + e.getMessage(), e );
}
logger.debug( "Adding file-set from directory: '" + fileSetDir.getAbsolutePath()
- + "'\nassembly output directory is: \'" + destDirectory + "\'" );
+ + "'\nassembly output directory is: \'" + destDirectory + "\'" );
- if ( fileSetDir.getPath().equals( File.separator ) )
+ if (fileSetDir.getPath().equals( File.separator ))
{
- throw new AssemblyFormattingException(
- "Your assembly descriptor specifies a directory of " + File.separator +
- ", which is your *entire* file system.\nThese are not the files you are looking for" );
+ throw new AssemblyFormattingException( "Your assembly descriptor specifies a directory of " + File.separator +
+ ", which is your *entire* file system.\nThese are not the files you are looking for");
}
final AddDirectoryTask task = new AddDirectoryTask( fileSetDir );
@@ -187,7 +184,8 @@ public class AddFileSetsTask
{
String sourceDirectory = fileSet.getDirectory();
- if ( sourceDirectory == null || sourceDirectory.trim().length() < 1 )
+ if ( sourceDirectory == null || sourceDirectory.trim()
+ .length() < 1 )
{
sourceDirectory = basedir.getAbsolutePath();
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/artifact/DefaultDependencyResolver.java Tue Aug 27 18:25:03 2013
@@ -123,8 +123,7 @@ public class DefaultDependencyResolver
}
else
{
- getLogger().debug(
- "Resolving project dependencies ONLY. Transitive dependencies WILL NOT be included in the results." );
+ getLogger().debug( "Resolving project dependencies ONLY. Transitive dependencies WILL NOT be included in the results." );
artifacts = resolveNonTransitively( assembly, artifacts, configSource, repos );
}
@@ -139,30 +138,22 @@ public class DefaultDependencyResolver
final List<Artifact> missing = new ArrayList<Artifact>();
final Set<Artifact> resolved = new LinkedHashSet<Artifact>();
- for ( final Artifact depArtifact : dependencyArtifacts )
- {
- try
- {
- resolver.resolve( depArtifact, repos, configSource.getLocalRepository() );
- resolved.add( depArtifact );
- }
- catch ( final ArtifactResolutionException e )
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "Failed to resolve: " + depArtifact.getId() + " for assembly: " + assembly.getId() );
+ for (final Artifact depArtifact : dependencyArtifacts) {
+ try {
+ resolver.resolve(depArtifact, repos, configSource.getLocalRepository());
+ resolved.add(depArtifact);
+ } catch (final ArtifactResolutionException e) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Failed to resolve: " + depArtifact.getId() + " for assembly: "
+ + assembly.getId());
}
- missing.add( depArtifact );
- }
- catch ( final ArtifactNotFoundException e )
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "Failed to resolve: " + depArtifact.getId() + " for assembly: " + assembly.getId() );
+ missing.add(depArtifact);
+ } catch (final ArtifactNotFoundException e) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Failed to resolve: " + depArtifact.getId() + " for assembly: "
+ + assembly.getId());
}
- missing.add( depArtifact );
+ missing.add(depArtifact);
}
}
@@ -196,9 +187,10 @@ public class DefaultDependencyResolver
ArtifactResolutionResult result;
try
{
- result = resolver.resolveTransitively( dependencyArtifacts, project.getArtifact(),
- project.getManagedVersionMap(), localRepository, repos,
- metadataSource, filter );
+ result =
+ resolver.resolveTransitively( dependencyArtifacts, project.getArtifact(),
+ project.getManagedVersionMap(), localRepository, repos, metadataSource,
+ filter );
}
catch ( final ArtifactResolutionException e )
{
@@ -254,7 +246,8 @@ public class DefaultDependencyResolver
catch ( final ArchiveCreationException e )
{
throw new DependencyResolutionException(
- "Error determining project-set for moduleSet with binaries.", e );
+ "Error determining project-set for moduleSet with binaries.",
+ e );
}
if ( projects != null && !projects.isEmpty() )
@@ -279,8 +272,7 @@ public class DefaultDependencyResolver
{
getDependencySetResolutionRequirements( assembly,
ModuleSetAssemblyPhase.getDependencySets( binaries ),
- requirements,
- projects.toArray( new MavenProject[projects.size()] ) );
+ requirements, projects.toArray(new MavenProject[projects.size()]));
}
}
}
@@ -322,13 +314,14 @@ public class DefaultDependencyResolver
catch ( final InvalidDependencyVersionException e )
{
throw new DependencyResolutionException(
- "Failed to create dependency artifacts for resolution. Assembly: " + assembly.getId(), e );
+ "Failed to create dependency artifacts for resolution. Assembly: "
+ + assembly.getId(), e );
}
}
requirements.addArtifacts( dependencyArtifacts );
- getLogger().debug( "Dependencies for project: " + project.getId() + " are:\n" + StringUtils.join(
- dependencyArtifacts.iterator(), "\n" ) );
+ getLogger().debug( "Dependencies for project: " + project.getId() + " are:\n"
+ + StringUtils.join( dependencyArtifacts.iterator(), "\n" ) );
}
}
}
@@ -358,8 +351,8 @@ public class DefaultDependencyResolver
}
@SuppressWarnings( "unchecked" )
- protected List<ArtifactRepository> aggregateRemoteArtifactRepositories(
- final List<ArtifactRepository> remoteRepositories, final Set<MavenProject> projects )
+ protected List<ArtifactRepository> aggregateRemoteArtifactRepositories( final List<ArtifactRepository> remoteRepositories,
+ final Set<MavenProject> projects )
{
final List<List<ArtifactRepository>> repoLists = new ArrayList<List<ArtifactRepository>>();
@@ -372,16 +365,12 @@ public class DefaultDependencyResolver
final List<ArtifactRepository> remoteRepos = new ArrayList<ArtifactRepository>();
final Set<String> encounteredUrls = new HashSet<String>();
- for ( final List<ArtifactRepository> repositoryList : repoLists )
- {
- if ( ( repositoryList != null ) && !repositoryList.isEmpty() )
- {
- for ( final ArtifactRepository repo : repositoryList )
- {
- if ( !encounteredUrls.contains( repo.getUrl() ) )
- {
- remoteRepos.add( repo );
- encounteredUrls.add( repo.getUrl() );
+ for (final List<ArtifactRepository> repositoryList : repoLists) {
+ if ((repositoryList != null) && !repositoryList.isEmpty()) {
+ for (final ArtifactRepository repo : repositoryList) {
+ if (!encounteredUrls.contains(repo.getUrl())) {
+ remoteRepos.add(repo);
+ encounteredUrls.add(repo.getUrl());
}
}
}
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/AbstractLineAggregatingHandler.java Tue Aug 27 18:25:03 2013
@@ -95,9 +95,8 @@ public abstract class AbstractLineAggreg
}
catch ( final IOException e )
{
- throw new ArchiverException(
- "Error adding aggregated content for: " + fname + " to finalize archive creation. Reason: "
- + e.getMessage(), e );
+ throw new ArchiverException( "Error adding aggregated content for: " + fname
+ + " to finalize archive creation. Reason: " + e.getMessage(), e );
}
finally
{
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java Tue Aug 27 18:25:03 2013
@@ -47,7 +47,7 @@ import java.util.Map;
/**
* Components XML file filter.
- *
+ *
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
@@ -63,8 +63,7 @@ public class ComponentsXmlArchiverFileFi
public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";
- protected void addComponentsXml( final Reader componentsReader )
- throws XmlPullParserException, IOException
+ protected void addComponentsXml( final Reader componentsReader ) throws XmlPullParserException, IOException
{
Xpp3Dom newDom = Xpp3DomBuilder.build( componentsReader );
@@ -77,26 +76,22 @@ public class ComponentsXmlArchiverFileFi
{
final Xpp3Dom[] children = newDom.getChildren();
- for ( final Xpp3Dom component : children )
- {
- if ( components == null )
- {
+ for (final Xpp3Dom component : children) {
+ if (components == null) {
components = new LinkedHashMap<String, Xpp3Dom>();
}
- final String role = component.getChild( "role" ).getValue();
- final Xpp3Dom child = component.getChild( "role-hint" );
+ final String role = component.getChild("role")
+ .getValue();
+ final Xpp3Dom child = component.getChild("role-hint");
final String roleHint = child != null ? child.getValue() : "";
final String key = role + roleHint;
- if ( !components.containsKey( key ) )
- {
- System.out.println( "Adding " + key );
- components.put( key, component );
- }
- else
- {
- System.out.println( "Component: " + key + " is already defined. Skipping." );
+ if (!components.containsKey(key)) {
+ System.out.println("Adding " + key);
+ components.put(key, component);
+ } else {
+ System.out.println("Component: " + key + " is already defined. Skipping.");
}
}
}
@@ -118,8 +113,7 @@ public class ComponentsXmlArchiverFileFi
// }
// }
- private void addToArchive( final Archiver archiver )
- throws IOException, ArchiverException
+ private void addToArchive( final Archiver archiver ) throws IOException, ArchiverException
{
if ( components != null )
{
@@ -134,9 +128,8 @@ public class ComponentsXmlArchiverFileFi
final Xpp3Dom componentDom = new Xpp3Dom( "components" );
dom.addChild( componentDom );
- for ( final Xpp3Dom component : components.values() )
- {
- componentDom.addChild( component );
+ for (final Xpp3Dom component : components.values()) {
+ componentDom.addChild(component);
}
Xpp3DomWriter.write( fileWriter, dom );
@@ -154,8 +147,7 @@ public class ComponentsXmlArchiverFileFi
}
}
- public void finalizeArchiveCreation( final Archiver archiver )
- throws ArchiverException
+ public void finalizeArchiveCreation( final Archiver archiver ) throws ArchiverException
{
// this will prompt the isSelected() call, below, for all resources added to the archive.
// FIXME: This needs to be corrected in the AbstractArchiver, where
@@ -187,8 +179,7 @@ public class ComponentsXmlArchiverFileFi
return null;
}
- public boolean isSelected( final FileInfo fileInfo )
- throws IOException
+ public boolean isSelected( final FileInfo fileInfo ) throws IOException
{
if ( fileInfo.isFile() )
{
@@ -197,7 +188,8 @@ public class ComponentsXmlArchiverFileFi
return true;
}
- String entry = fileInfo.getName().replace( '\\', '/' );
+ String entry = fileInfo.getName()
+ .replace( '\\', '/' );
if ( entry.startsWith( "/" ) )
{
@@ -214,7 +206,7 @@ public class ComponentsXmlArchiverFileFi
stream = fileInfo.getContents();
// TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
reader = new InputStreamReader( stream, "UTF-8" );
- addComponentsXml( new BufferedReader( reader, 8192 ) );
+ addComponentsXml( new BufferedReader( reader, 8192 ));
}
catch ( final XmlPullParserException e )
{
@@ -243,8 +235,7 @@ public class ComponentsXmlArchiverFileFi
}
}
- public void finalizeArchiveExtraction( final UnArchiver unarchiver )
- throws ArchiverException
+ public void finalizeArchiveExtraction( final UnArchiver unarchiver ) throws ArchiverException
{
}
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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -69,16 +69,15 @@ public class SimpleAggregatingDescriptor
private Logger logger;
- public void finalizeArchiveCreation( final Archiver archiver )
- throws ArchiverException
+ public void finalizeArchiveCreation( final Archiver archiver ) throws ArchiverException
{
checkConfig();
if ( outputPath.endsWith( "/" ) )
{
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() );
+ "Cannot write aggregated properties to a directory. You must specify a file name in the outputPath configuration for this handler. (handler: "
+ + getClass().getName() );
}
if ( outputPath.startsWith( "/" ) )
@@ -95,8 +94,7 @@ public class SimpleAggregatingDescriptor
overrideFilterAction = false;
}
- private File writePropertiesFile()
- throws ArchiverException
+ private File writePropertiesFile() throws ArchiverException
{
File f;
@@ -111,9 +109,8 @@ 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,8 +119,8 @@ public class SimpleAggregatingDescriptor
}
catch ( final IOException e )
{
- throw new ArchiverException(
- "Error adding aggregated properties to finalize archive creation. Reason: " + e.getMessage(), e );
+ throw new ArchiverException( "Error adding aggregated properties to finalize archive creation. Reason: "
+ + e.getMessage(), e );
}
finally
{
@@ -133,8 +130,7 @@ public class SimpleAggregatingDescriptor
return f;
}
- public void finalizeArchiveExtraction( final UnArchiver unarchiver )
- throws ArchiverException
+ public void finalizeArchiveExtraction( final UnArchiver unarchiver ) throws ArchiverException
{
}
@@ -145,8 +141,7 @@ public class SimpleAggregatingDescriptor
return Collections.singletonList( outputPath );
}
- public boolean isSelected( final FileInfo fileInfo )
- throws IOException
+ public boolean isSelected( final FileInfo fileInfo ) throws IOException
{
checkConfig();
@@ -177,12 +172,11 @@ public class SimpleAggregatingDescriptor
if ( filePattern == null || outputPath == null )
{
throw new IllegalStateException(
- "You must configure filePattern and outputPath in your containerDescriptorHandler declaration." );
+ "You must configure filePattern and outputPath in your containerDescriptorHandler declaration." );
}
}
- 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/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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -46,8 +46,7 @@ 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();
@@ -59,9 +58,9 @@ public class FileSetFormatter
FileSet fileSet = new FileSet();
fileSet.setLineEnding( lineEnding );
-
+
fileSet.setDirectory( fileSetDir.getAbsolutePath() );
-
+
fileSet.setIncludes( set.getIncludes() );
fileSet.setExcludes( set.getExcludes() );
@@ -73,43 +72,37 @@ 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
- {
- sourceFile = fileFormatter.format( sourceFile, set.isFiltered(), lineEndingHint, formattedDir,
- configSource.getEncoding() );
- AssemblyFileUtils.copyFile( sourceFile, targetFile );
- }
- catch ( AssemblyFormattingException e )
- {
- deleteDirectory( formattedDir );
+ 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);
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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -115,8 +115,8 @@ public class AssemblyInterpolator
}
catch ( final InterpolationException e )
{
- throw new AssemblyInterpolationException(
- "Failed to interpolate assembly with ID: " + assembly.getId() + ". Reason: " + e.getMessage(), e );
+ throw new AssemblyInterpolationException( "Failed to interpolate assembly with ID: " + assembly.getId()
+ + ". Reason: " + e.getMessage(), e );
}
finally
{
@@ -127,14 +127,12 @@ 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" );
@@ -172,24 +170,22 @@ public class AssemblyInterpolator
}
}
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
- project.getProperties(), true ) );
- interpolator.addValueSource(
- new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES, project, true ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource(
+ InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
+ project.getProperties(), true ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES, project,
+ true ) );
final Properties settingsProperties = new Properties();
if ( configSource.getLocalRepository() != null )
{
settingsProperties.setProperty( "localRepository", configSource.getLocalRepository().getBasedir() );
- settingsProperties.setProperty( "settings.localRepository",
- configSource.getLocalRepository().getBasedir() );
+ settingsProperties.setProperty( "settings.localRepository", configSource.getLocalRepository().getBasedir() );
}
else if ( session != null && session.getSettings() != null )
{
settingsProperties.setProperty( "localRepository", session.getSettings().getLocalRepository() );
- settingsProperties.setProperty( "settings.localRepository",
- configSource.getLocalRepository().getBasedir() );
+ settingsProperties.setProperty( "settings.localRepository", configSource.getLocalRepository().getBasedir() );
}
interpolator.addValueSource( new PropertiesBasedValueSource( settingsProperties ) );
@@ -202,7 +198,7 @@ public class AssemblyInterpolator
{
commandLineProperties.putAll( session.getExecutionProperties() );
}
-
+
if ( session.getUserProperties() != null )
{
commandLineProperties.putAll( session.getUserProperties() );
@@ -211,8 +207,8 @@ public class AssemblyInterpolator
// 7
interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( Collections.singletonList( "env." ), ENVIRONMENT_VARIABLES, true ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
+ ENVIRONMENT_VARIABLES, true ) );
interpolator.addPostProcessor( new PathTranslatingPostProcessor( project.getBasedir() ) );
return interpolator;
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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -112,30 +112,28 @@ 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);
}
}
if ( ( descriptorSourceDirectory != null ) && descriptorSourceDirectory.isDirectory() )
{
- locator.setStrategies(
- Collections.singletonList( new RelativeFileLocatorStrategy( descriptorSourceDirectory ) ) );
+ locator.setStrategies( Collections.singletonList( new RelativeFileLocatorStrategy(
+ descriptorSourceDirectory ) ) );
final DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( descriptorSourceDirectory );
- scanner.setIncludes( new String[]{ "**/*.xml" } );
+ scanner.setIncludes( new String[] { "**/*.xml" } );
scanner.addDefaultExcludes();
try
@@ -147,8 +145,8 @@ public class DefaultAssemblyReader
{
final StackTraceElement frameZero = e.getStackTrace()[0];
- if ( "org.codehaus.plexus.util.DirectoryScanner".equals( frameZero.getClassName() ) && "scandir".equals(
- frameZero.getMethodName() ) )
+ if ( "org.codehaus.plexus.util.DirectoryScanner".equals( frameZero.getClassName() )
+ && "scandir".equals( frameZero.getMethodName() ) )
{
if ( getLogger().isDebugEnabled() )
{
@@ -166,9 +164,8 @@ public class DefaultAssemblyReader
if ( paths != null )
{
- for ( String path : paths )
- {
- addAssemblyFromDescriptor( path, locator, configSource, assemblies );
+ for (String path : paths) {
+ addAssemblyFromDescriptor(path, locator, configSource, assemblies);
}
}
}
@@ -177,8 +174,7 @@ public class DefaultAssemblyReader
{
if ( configSource.isIgnoreMissingDescriptor() )
{
- getLogger().debug(
- "Ignoring missing assembly descriptors per configuration. See messages above for specifics." );
+ getLogger().debug( "Ignoring missing assembly descriptors per configuration. See messages above for specifics." );
}
else
{
@@ -188,19 +184,16 @@ 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.");
}
}
return assemblies;
}
- public Assembly getAssemblyForDescriptorReference( final String ref,
- final AssemblerConfigurationSource configSource )
+ public Assembly getAssemblyForDescriptorReference( final String ref, final AssemblerConfigurationSource configSource )
throws AssemblyReadException, InvalidAssemblerConfigurationException
{
return addAssemblyForDescriptorReference( ref, configSource, new ArrayList<Assembly>( 1 ) );
@@ -307,8 +300,8 @@ public class DefaultAssemblyReader
}
else
{
- throw new AssemblyReadException(
- "Error locating assembly descriptor: " + spec + "\n\n" + locator.getMessageHolder().render() );
+ throw new AssemblyReadException( "Error locating assembly descriptor: " + spec + "\n\n"
+ + locator.getMessageHolder().render() );
}
}
@@ -396,17 +389,20 @@ public class DefaultAssemblyReader
}
catch ( final IOException e )
{
- throw new AssemblyReadException( "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
+ throw new AssemblyReadException(
+ "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
e );
}
catch ( final XmlPullParserException e )
{
- throw new AssemblyReadException( "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
+ throw new AssemblyReadException(
+ "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
e );
}
catch ( final AssemblyInterpolationException e )
{
- throw new AssemblyReadException( "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
+ throw new AssemblyReadException(
+ "Error reading descriptor: " + locationDescription + ": " + e.getMessage(),
e );
}
finally
@@ -431,8 +427,8 @@ public class DefaultAssemblyReader
}
catch ( final IOException e )
{
- getLogger().debug(
- "Failed to print debug message with assembly descriptor listing, and message: " + message, e );
+ getLogger().debug( "Failed to print debug message with assembly descriptor listing, and message: "
+ + message, e );
}
getLogger().debug( message + "\n\n" + sWriter.toString() + "\n\n" );
@@ -440,7 +436,7 @@ public class DefaultAssemblyReader
/**
* Add the contents of all included components to main assembly
- *
+ *
* @param assembly
* @param assemblyDir
* @throws AssemblyReadException
@@ -465,54 +461,42 @@ 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);
}
}
/**
* Add the content of a single Component to main assembly
- *
+ *
* @param component
* @param assembly
*/
@@ -521,37 +505,32 @@ 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();
@@ -569,7 +548,7 @@ public class DefaultAssemblyReader
if ( !siteDirectory.exists() )
{
throw new InvalidAssemblerConfigurationException(
- "site did not exist in the target directory - please run site:site before creating the assembly" );
+ "site did not exist in the target directory - please run site:site before creating the assembly" );
}
getLogger().info( "Adding site directory to assembly : " + siteDirectory );
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java Tue Aug 27 18:25:03 2013
@@ -375,9 +375,9 @@ public abstract class AbstractAssemblyMo
/**
* Create the binary distribution.
- *
+ *
* @throws org.apache.maven.plugin.MojoExecutionException
- *
+ *
*/
public void execute()
throws MojoExecutionException, MojoFailureException
@@ -406,108 +406,87 @@ public abstract class AbstractAssemblyMo
}
catch ( final InvalidAssemblerConfigurationException e )
{
- throw new MojoFailureException( assemblyReader, e.getMessage(),
- "Mojo configuration is invalid: " + e.getMessage() );
+ throw new MojoFailureException( assemblyReader, e.getMessage(), "Mojo configuration is invalid: "
+ + e.getMessage() );
}
// TODO: include dependencies marked for distribution under certain formats
// TODO: how, might we plug this into an installer, such as NSIS?
boolean warnedAboutMainProjectArtifact = false;
- for ( final Assembly assembly : assemblies )
- {
- try
- {
- final String fullName = AssemblyFormatUtils.getDistributionName( assembly, this );
+ for (final Assembly assembly : assemblies) {
+ try {
+ final String fullName = AssemblyFormatUtils.getDistributionName(assembly, this);
List<String> effectiveFormats = formats;
- if ( effectiveFormats == null || effectiveFormats.size() == 0 )
- {
+ if (effectiveFormats == null || effectiveFormats.size() == 0) {
effectiveFormats = assembly.getFormats();
}
- if ( effectiveFormats == null || effectiveFormats.size() == 0 )
- {
- throw new MojoFailureException(
- "No formats specified in the execution parameters or the assembly descriptor." );
+ if (effectiveFormats == null || effectiveFormats.size() == 0) {
+ throw new MojoFailureException("No formats specified in the execution parameters or the assembly descriptor.");
}
- for ( final String format : effectiveFormats )
- {
+ for (final String format : effectiveFormats) {
final File destFile =
- assemblyArchiver.createArchive( assembly, fullName, format, this, isRecompressZippedFiles() );
+ assemblyArchiver.createArchive(assembly, fullName, format, this, isRecompressZippedFiles());
final MavenProject project = getProject();
final String classifier = getClassifier();
- final String type = project.getArtifact().getType();
+ final String type = project.getArtifact()
+ .getType();
- if ( attach && destFile.isFile() )
- {
- if ( isAssemblyIdAppended() )
- {
- projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
- }
- else if ( classifier != null )
- {
- projectHelper.attachArtifact( project, format, classifier, destFile );
- }
- else if ( !"pom".equals( type ) && format.equals( type ) )
- {
- if ( !warnedAboutMainProjectArtifact )
- {
+ if (attach && destFile.isFile()) {
+ if (isAssemblyIdAppended()) {
+ projectHelper.attachArtifact(project, format, assembly.getId(), destFile);
+ } else if (classifier != null) {
+ projectHelper.attachArtifact(project, format, classifier, destFile);
+ } else if (!"pom".equals(type) && format.equals(type)) {
+ if (!warnedAboutMainProjectArtifact) {
final StringBuilder message = new StringBuilder();
- message.append(
- "Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing." );
- message.append( "\nInstead of attaching the assembly file: " ).append(
- destFile ).append( ", it will become the file for main project artifact." );
- message.append(
- "\nNOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!" );
+ message.append("Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing.");
+ message.append("\nInstead of attaching the assembly file: ")
+ .append(destFile)
+ .append(", it will become the file for main project artifact.");
+ message.append("\nNOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!");
- getLog().warn( message );
+ getLog().warn(message);
warnedAboutMainProjectArtifact = true;
}
- final File existingFile = project.getArtifact().getFile();
- if ( ( existingFile != null ) && existingFile.exists() )
- {
- getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile
- + "\nwith assembly file: " + destFile );
+ final File existingFile = project.getArtifact()
+ .getFile();
+ if ((existingFile != null) && existingFile.exists()) {
+ getLog().warn("Replacing pre-existing project main-artifact file: " + existingFile
+ + "\nwith assembly file: " + destFile);
}
- project.getArtifact().setFile( destFile );
+ project.getArtifact()
+ .setFile(destFile);
+ } else {
+ projectHelper.attachArtifact(project, format, null, destFile);
}
- else
- {
- projectHelper.attachArtifact( project, format, null, destFile );
- }
- }
- else if ( attach )
- {
- getLog().warn( "Assembly file: " + destFile
- + " is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment." );
+ } else if (attach) {
+ getLog().warn("Assembly file: "
+ + destFile
+ + " is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.");
}
}
- }
- catch ( final ArchiveCreationException e )
- {
- throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
- }
- catch ( final AssemblyFormattingException e )
- {
- throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
- }
- catch ( final InvalidAssemblerConfigurationException e )
- {
- throw new MojoFailureException( assembly, "Assembly is incorrectly configured: " + assembly.getId(),
- "Assembly: " + assembly.getId() + " is not configured correctly: "
- + e.getMessage() );
+ } catch (final ArchiveCreationException e) {
+ throw new MojoExecutionException("Failed to create assembly: " + e.getMessage(), e);
+ } catch (final AssemblyFormattingException e) {
+ throw new MojoExecutionException("Failed to create assembly: " + e.getMessage(), e);
+ } catch (final InvalidAssemblerConfigurationException e) {
+ throw new MojoFailureException(assembly, "Assembly is incorrectly configured: " + assembly.getId(),
+ "Assembly: " + assembly.getId() + " is not configured correctly: "
+ + e.getMessage());
}
}
}
/**
* Returns true if the current project is located at the Execution Root Directory (where mvn was launched)
- *
+ *
* @return
*/
protected boolean isThisTheExecutionRoot()
@@ -515,7 +494,8 @@ public abstract class AbstractAssemblyMo
final Log log = getLog();
log.debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() );
log.debug( "Current Folder:" + basedir );
- final boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() );
+ final boolean result = mavenSession.getExecutionRootDirectory()
+ .equalsIgnoreCase( basedir.toString() );
if ( result )
{
log.debug( "This is the execution root." );
@@ -545,7 +525,7 @@ public abstract class AbstractAssemblyMo
/**
* {@inheritDoc}
- *
+ *
* @deprecated This has been replaced by {@link #getDescriptors()}
*/
@Deprecated
@@ -556,7 +536,7 @@ public abstract class AbstractAssemblyMo
/**
* {@inheritDoc}
- *
+ *
* @deprecated This has been replaced by {@link #getDescriptorReferences()}
*/
@Deprecated
@@ -641,7 +621,8 @@ public abstract class AbstractAssemblyMo
{
if ( filters == null )
{
- filters = getProject().getBuild().getFilters();
+ filters = getProject().getBuild()
+ .getFilters();
if ( filters == null )
{
filters = Collections.emptyList();
@@ -703,7 +684,7 @@ public abstract class AbstractAssemblyMo
/**
* {@inheritDoc}
- *
+ *
* @deprecated This has been replaced by {@link #setDescriptors(String[])}
*/
@Deprecated
@@ -714,7 +695,7 @@ public abstract class AbstractAssemblyMo
/**
* {@inheritDoc}
- *
+ *
* @deprecated This has been replaced by {@link #setDescriptorRefs(String[])}
*/
@Deprecated
@@ -847,7 +828,7 @@ public abstract class AbstractAssemblyMo
{
return ignorePermissions;
}
-
+
public String getEncoding()
{
return encoding;
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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -88,36 +88,26 @@ 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/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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -192,7 +192,7 @@ public final class AssemblyFileUtils
}
}
}
- else if ( atEndOfFile == true )
+ else if (atEndOfFile == true )
{
eofChars = lineEndings;
}
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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -53,7 +53,7 @@ public final class AssemblyFormatUtils
/**
* Get the full name of the distribution artifact
- *
+ *
* @param assembly
* @return the distribution name
*/
@@ -154,8 +154,8 @@ public final class AssemblyFormatUtils
{
// 2
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject ) );
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( "module.properties.", moduleProject.getProperties() ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource( "module.properties.",
+ moduleProject.getProperties() ) );
if ( moduleProject.getArtifact() != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject.getArtifact() ) );
@@ -166,12 +166,11 @@ public final class AssemblyFormatUtils
{
// 3
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject ) );
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( "artifact.properties.", artifactProject.getProperties() ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource( "artifact.properties.",
+ artifactProject.getProperties() ) );
if ( artifactProject.getArtifact() != null )
{
- interpolator.addValueSource(
- new PrefixedObjectValueSource( "artifact.", artifactProject.getArtifact() ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject.getArtifact() ) );
}
}
@@ -204,13 +203,13 @@ public final class AssemblyFormatUtils
if ( mainProject != null )
{
// 5
- interpolator.addValueSource(
- new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES, mainProject, true ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES,
+ mainProject, true ) );
// 6
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
- mainProject.getProperties(), true ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource(
+ InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
+ mainProject.getProperties(), true ) );
}
Properties commandLineProperties = System.getProperties();
@@ -240,8 +239,8 @@ public final class AssemblyFormatUtils
}
catch ( final IOException e )
{
- throw new AssemblyFormattingException(
- "Failed to retrieve OS environment variables. Reason: " + e.getMessage(), e );
+ throw new AssemblyFormattingException( "Failed to retrieve OS environment variables. Reason: "
+ + e.getMessage(), e );
}
try
@@ -346,18 +345,17 @@ public final class AssemblyFormatUtils
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleArtifact ) );
// 1B
- interpolator.addValueSource(
- new PrefixedObjectValueSource( "module.", moduleArtifact.getArtifactHandler() ) );
- interpolator.addValueSource(
- new PrefixedObjectValueSource( "module.handler.", moduleArtifact.getArtifactHandler() ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleArtifact.getArtifactHandler() ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( "module.handler.",
+ moduleArtifact.getArtifactHandler() ) );
}
// 1C
if ( moduleProject != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject ) );
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( "module.properties.", moduleProject.getProperties() ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource( "module.properties.",
+ moduleProject.getProperties() ) );
if ( moduleProject.getArtifact() != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject.getArtifact() ) );
@@ -369,19 +367,17 @@ public final class AssemblyFormatUtils
// 2B
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifact.getArtifactHandler() ) );
- interpolator.addValueSource(
- new PrefixedObjectValueSource( "artifact.handler.", artifact.getArtifactHandler() ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.handler.", artifact.getArtifactHandler() ) );
// 2C
if ( artifactProject != null )
{
interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject ) );
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( "artifact.properties.", artifactProject.getProperties() ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource( "artifact.properties.",
+ artifactProject.getProperties() ) );
if ( artifactProject.getArtifact() != null )
{
- interpolator.addValueSource(
- new PrefixedObjectValueSource( "artifact.", artifactProject.getArtifact() ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject.getArtifact() ) );
}
}
@@ -389,8 +385,8 @@ public final class AssemblyFormatUtils
{
// 3
// 4
- interpolator.addValueSource(
- new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES, mainProject, true ) );
+ interpolator.addValueSource( new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES,
+ mainProject, true ) );
}
final Properties specialRules = new Properties();
@@ -438,9 +434,9 @@ public final class AssemblyFormatUtils
if ( mainProject != null )
{
// 7
- interpolator.addValueSource(
- new PrefixedPropertiesValueSource( InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
- mainProject.getProperties(), true ) );
+ interpolator.addValueSource( new PrefixedPropertiesValueSource(
+ InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
+ mainProject.getProperties(), true ) );
}
Properties commandLineProperties = System.getProperties();
@@ -470,8 +466,8 @@ public final class AssemblyFormatUtils
}
catch ( final IOException e )
{
- throw new AssemblyFormattingException(
- "Failed to retrieve OS environment variables. Reason: " + e.getMessage(), e );
+ throw new AssemblyFormattingException( "Failed to retrieve OS environment variables. Reason: "
+ + e.getMessage(), e );
}
try
@@ -480,8 +476,8 @@ public final class AssemblyFormatUtils
}
catch ( final InterpolationException e )
{
- throw new AssemblyFormattingException(
- "Failed to interpolate output filename mapping. Reason: " + e.getMessage(), e );
+ throw new AssemblyFormattingException( "Failed to interpolate output filename mapping. Reason: "
+ + e.getMessage(), e );
}
value = StringUtils.replace( value, "//", "/" );
@@ -494,9 +490,11 @@ public final class AssemblyFormatUtils
public static String fixRelativeRefs( String src )
{
String value = src;
-
- String[] separators = { "/", "\\" };
-
+
+ String[] separators = {
+ "/", "\\"
+ };
+
String finalSep = null;
for ( String sep : separators )
{
@@ -504,12 +502,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 ) ) );
-
+
for ( ListIterator<String> it = parts.listIterator(); it.hasNext(); )
{
String part = it.next();
@@ -527,16 +525,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=1517906&r1=1517905&r2=1517906&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 Tue Aug 27 18:25:03 2013
@@ -80,11 +80,9 @@ 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);
}
}
}
@@ -151,16 +149,13 @@ 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.");
}
}
}
@@ -168,19 +163,16 @@ 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/ProjectUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/utils/ProjectUtils.java Tue Aug 27 18:25:03 2013
@@ -54,8 +54,7 @@ public final class ProjectUtils
return classifier;
}
- @Nonnull
- public static Set<MavenProject> getProjectModules( @Nonnull final MavenProject project,
+ @Nonnull public static Set<MavenProject> getProjectModules( @Nonnull final MavenProject project,
@Nonnull final List<MavenProject> reactorProjects,
final boolean includeSubModules, @Nonnull final Logger logger )
throws IOException
@@ -80,16 +79,15 @@ public final class ProjectUtils
{
changed = 0;
- for ( final Iterator<MavenProject> candidateIterator = moduleCandidates.iterator();
- candidateIterator.hasNext(); )
+ for ( final Iterator<MavenProject> candidateIterator = moduleCandidates.iterator(); candidateIterator.hasNext(); )
{
final MavenProject moduleCandidate = candidateIterator.next();
if ( moduleCandidate.getFile() == null )
{
- logger.warn(
- "Cannot compute whether " + moduleCandidate.getId() + " is a module of: " + project.getId()
- + "; it does not have an associated POM file on the local filesystem." );
+ logger.warn( "Cannot compute whether " + moduleCandidate.getId() + " is a module of: "
+ + project.getId()
+ + "; it does not have an associated POM file on the local filesystem." );
continue;
}
@@ -152,7 +150,8 @@ public final class ProjectUtils
final List<String> modules = mainProject.getModules();
final File basedir = mainProject.getBasedir();
- final File moduleFile = moduleProject.getFile().getCanonicalFile();
+ final File moduleFile = moduleProject.getFile()
+ .getCanonicalFile();
File moduleBasedir = moduleProject.getBasedir();