You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2006/07/18 00:35:00 UTC
svn commit: r422907 [2/3] - in /maven/plugins/branches/MASSEMBLY-124: ./
src/functional-tests/
src/functional-tests/java/org/apache/maven/plugin/assembly/
src/main/java/org/apache/maven/plugin/assembly/
src/main/java/org/apache/maven/plugin/assembly/ar...
Added: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java?rev=422907&view=auto
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java (added)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java Mon Jul 17 15:34:58 2006
@@ -0,0 +1,323 @@
+package org.apache.maven.plugin.assembly.io;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolationException;
+import org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolator;
+import org.apache.maven.plugins.assembly.model.Assembly;
+import org.apache.maven.plugins.assembly.model.Component;
+import org.apache.maven.plugins.assembly.model.DependencySet;
+import org.apache.maven.plugins.assembly.model.FileItem;
+import org.apache.maven.plugins.assembly.model.FileSet;
+import org.apache.maven.plugins.assembly.model.io.xpp3.AssemblyXpp3Reader;
+import org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class DefaultAssemblyReader
+ extends AbstractLogEnabled
+ implements AssemblyReader
+{
+
+ public List readAssemblies( AssemblerConfigurationSource configSource )
+ throws AssemblyReadException
+ {
+ List assemblies = new ArrayList();
+
+ File descriptor = configSource.getDescriptor();
+ String descriptorId = configSource.getDescriptorId();
+ File[] descriptors = configSource.getDescriptors();
+ String[] descriptorRefs = configSource.getDescriptorReferences();
+ File descriptorSourceDirectory = configSource.getDescriptorSourceDirectory();
+
+ if ( descriptor != null )
+ {
+ assemblies.add( getAssemblyFromDescriptorFile( descriptor, configSource ) );
+ }
+
+ if ( descriptorId != null )
+ {
+ assemblies.add( getAssemblyForDescriptorReference( descriptorId, configSource ) );
+ }
+
+ if ( descriptors != null && descriptors.length > 0 )
+ {
+ for ( int i = 0; i < descriptors.length; i++ )
+ {
+ assemblies.add( getAssemblyFromDescriptorFile( descriptors[i], configSource ) );
+ }
+ }
+
+ if ( descriptorRefs != null && descriptorRefs.length > 0 )
+ {
+ for ( int i = 0; i < descriptorRefs.length; i++ )
+ {
+ assemblies.add( getAssemblyForDescriptorReference( descriptorRefs[i], configSource ) );
+ }
+ }
+
+ if ( descriptorSourceDirectory != null && descriptorSourceDirectory.isDirectory() )
+ {
+ try
+ {
+ List descriptorList = FileUtils.getFiles( descriptorSourceDirectory, "**/*.xml", null );
+
+ for ( Iterator iter = descriptorList.iterator(); iter.hasNext(); )
+ {
+ assemblies.add( getAssemblyFromDescriptorFile( (File) iter.next(), configSource ) );
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new AssemblyReadException( "error discovering descriptor files: " + e.getMessage() );
+ }
+ }
+
+ if ( assemblies.isEmpty() )
+ {
+ throw new AssemblyReadException( "No assembly descriptors found." );
+ }
+
+ // check unique IDs
+ Set ids = new HashSet();
+ for ( Iterator i = assemblies.iterator(); i.hasNext(); )
+ {
+ Assembly assembly = (Assembly) i.next();
+ if ( !ids.add( assembly.getId() ) )
+ {
+ getLogger().warn( "The assembly id " + assembly.getId() + " is used more than once." );
+ }
+
+ }
+ return assemblies;
+ }
+
+ public Assembly getAssemblyForDescriptorReference( String ref, AssemblerConfigurationSource configSource ) throws AssemblyReadException
+ {
+ InputStream resourceAsStream = getClass().getResourceAsStream( "/assemblies/" + ref + ".xml" );
+
+ if ( resourceAsStream == null )
+ {
+ throw new AssemblyReadException( "Descriptor with ID '" + ref + "' not found" );
+ }
+
+ return readAssembly( new InputStreamReader( resourceAsStream ), ref, configSource );
+ }
+
+ public Assembly getAssemblyFromDescriptorFile( File file, AssemblerConfigurationSource configSource )
+ throws AssemblyReadException
+ {
+ Reader r = null;
+ try
+ {
+ r = new FileReader( file );
+ return readAssembly( r, file.getAbsolutePath(), configSource );
+ }
+ catch ( FileNotFoundException e )
+ {
+ throw new AssemblyReadException( "Error locating assembly descriptor file: " + file, e );
+ }
+ finally
+ {
+ IOUtil.close( r );
+ }
+
+ }
+
+ public Assembly readAssembly( Reader reader, String locationDescription, AssemblerConfigurationSource configSource )
+ throws AssemblyReadException
+ {
+ Assembly assembly;
+
+ File basedir = configSource.getBasedir();
+ MavenProject project = configSource.getProject();
+
+ try
+ {
+ Map context = new HashMap( System.getProperties() );
+
+ context.put( "basedir", basedir.getAbsolutePath() );
+
+ AssemblyXpp3Reader r = new AssemblyXpp3Reader();
+ assembly = r.read( reader );
+
+ assembly = new AssemblyInterpolator().interpolate( assembly, project.getModel(), context );
+ }
+ catch ( IOException e )
+ {
+ throw new AssemblyReadException( "Error reading descriptor at: " + locationDescription + ": " + e.getMessage(), e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new AssemblyReadException( "Error reading descriptor at: " + locationDescription + ": " + e.getMessage(), e );
+ }
+ catch ( AssemblyInterpolationException e )
+ {
+ throw new AssemblyReadException( "Error reading descriptor at: " + locationDescription + ": " + e.getMessage(), e );
+ }
+ finally
+ {
+ IOUtil.close( reader );
+ }
+
+ if ( configSource.isSiteIncluded() || assembly.isIncludeSiteDirectory() )
+ {
+ }
+
+ mergeComponentsWithMainAssembly( assembly, configSource );
+
+ return assembly;
+ }
+
+ /**
+ * Add the contents of all included components to main assembly
+ *
+ * @param assembly
+ * @throws AssemblyReadException
+ * @throws MojoFailureException
+ * @throws MojoExecutionException
+ */
+ protected void mergeComponentsWithMainAssembly( Assembly assembly, AssemblerConfigurationSource configSource )
+ throws AssemblyReadException
+ {
+ List componentDescriptorFiles = assembly.getComponentDescriptors();
+
+ for ( int i = 0; i < componentDescriptorFiles.size(); ++i )
+ {
+ Component component = getComponentFromFile( componentDescriptorFiles.get( i ).toString(), configSource );
+
+ mergeComponentWithAssembly( component, assembly );
+ }
+ }
+
+ /**
+ * Add the content of a single Component to main assembly
+ * @param component
+ * @param assembly
+ */
+ protected void mergeComponentWithAssembly( Component component, Assembly assembly )
+ {
+ List dependencySetList = component.getDependencySets();
+
+ for ( int i = 0; i < dependencySetList.size(); ++i )
+ {
+ assembly.addDependencySet( (DependencySet) dependencySetList.get( i ) );
+ }
+
+ List fileSetList = component.getFileSets();
+
+ for ( int i = 0; i < fileSetList.size(); ++i )
+ {
+ assembly.addFileSet( (FileSet) fileSetList.get( i ) );
+ }
+
+ List fileList = component.getFiles();
+
+ for ( int i = 0; i < fileList.size(); ++i )
+ {
+ assembly.addFile( (FileItem) fileList.get( i ) );
+ }
+ }
+
+ /**
+ * Load the Component via a given file path relative to ${basedir}
+ *
+ * @param filePath
+ * @return
+ * @throws AssemblyReadException
+ * @throws MojoFailureException
+ * @throws MojoExecutionException
+ */
+ protected Component getComponentFromFile( String filePath, AssemblerConfigurationSource configSource ) throws AssemblyReadException
+ {
+ File basedir = configSource.getBasedir();
+
+ File componentDescriptor = new File( basedir + "/" + filePath );
+
+ Reader r;
+ try
+ {
+ r = new FileReader( componentDescriptor );
+ }
+ catch ( FileNotFoundException e )
+ {
+ throw new AssemblyReadException( "Unable to find descriptor: " + e.getMessage() );
+ }
+
+ return readComponent( r );
+
+ }
+
+ /**
+ * Load the Component via a Reader
+ *
+ * @param reader
+ * @throws AssemblyReadException
+ */
+ protected Component readComponent( Reader reader )
+ throws AssemblyReadException
+ {
+ Component component;
+ try
+ {
+ ComponentXpp3Reader r = new ComponentXpp3Reader();
+ component = r.read( reader );
+ }
+ catch ( IOException e )
+ {
+ throw new AssemblyReadException( "Error reading component descriptor", e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new AssemblyReadException( "Error reading component descriptor", e );
+ }
+ finally
+ {
+ IOUtil.close( reader );
+ }
+
+ return component;
+ }
+
+ protected void includeSiteInAssembly( Assembly assembly, AssemblerConfigurationSource configSource )
+ throws MojoFailureException
+ {
+ File siteDirectory = configSource.getSiteDirectory();
+
+ if ( !siteDirectory.exists() )
+ {
+ throw new MojoFailureException(
+ "site did not exist in the target directory - please run site:site before creating the assembly" );
+ }
+
+ getLogger().info( "Adding site directory to assembly : " + siteDirectory );
+
+ FileSet siteFileSet = new FileSet();
+
+ siteFileSet.setDirectory( siteDirectory.getPath() );
+
+ siteFileSet.setOutputDirectory( "/site" );
+
+ assembly.addFileSet( siteFileSet );
+ }
+
+}
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Copied: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractAssemblyMojo.java)
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java?p2=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java&p1=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractAssemblyMojo.java&r1=421932&r2=422907&rev=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractAssemblyMojo.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java Mon Jul 17 15:34:58 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.assembly;
+package org.apache.maven.plugin.assembly.mojos;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -17,79 +17,24 @@
*/
import org.apache.maven.archiver.MavenArchiveConfiguration;
-import org.apache.maven.archiver.MavenArchiver;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
-import org.apache.maven.model.Build;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.assembly.filter.AssemblyExcludesArtifactFilter;
-import org.apache.maven.plugin.assembly.filter.AssemblyIncludesArtifactFilter;
-import org.apache.maven.plugin.assembly.filter.AssemblyScopeArtifactFilter;
-import org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolationException;
-import org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolator;
-import org.apache.maven.plugin.assembly.interpolation.ReflectionProperties;
-import org.apache.maven.plugin.assembly.repository.RepositoryAssembler;
-import org.apache.maven.plugin.assembly.repository.RepositoryAssemblyException;
-import org.apache.maven.plugin.assembly.utils.FilterUtils;
-import org.apache.maven.plugin.assembly.utils.ProjectUtils;
-import org.apache.maven.plugin.assembly.utils.PropertyUtils;
+import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
+import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
+import org.apache.maven.plugin.assembly.archive.AssemblyArchiver;
+import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
+import org.apache.maven.plugin.assembly.io.AssemblyReadException;
+import org.apache.maven.plugin.assembly.io.AssemblyReader;
+import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
import org.apache.maven.plugins.assembly.model.Assembly;
-import org.apache.maven.plugins.assembly.model.Component;
-import org.apache.maven.plugins.assembly.model.DependencySet;
-import org.apache.maven.plugins.assembly.model.FileItem;
-import org.apache.maven.plugins.assembly.model.FileSet;
-import org.apache.maven.plugins.assembly.model.ModuleBinaries;
-import org.apache.maven.plugins.assembly.model.ModuleSet;
-import org.apache.maven.plugins.assembly.model.ModuleSources;
-import org.apache.maven.plugins.assembly.model.Repository;
-import org.apache.maven.plugins.assembly.model.io.xpp3.AssemblyXpp3Reader;
-import org.apache.maven.plugins.assembly.model.io.xpp3.ComponentXpp3Reader;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.shared.model.fileset.util.FileSetManager;
-import org.apache.maven.wagon.PathUtils;
-import org.codehaus.plexus.archiver.Archiver;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.jar.JarArchiver;
-import org.codehaus.plexus.archiver.jar.Manifest;
-import org.codehaus.plexus.archiver.jar.ManifestException;
-import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
-import org.codehaus.plexus.archiver.tar.TarArchiver;
-import org.codehaus.plexus.archiver.tar.TarLongFileMode;
-import org.codehaus.plexus.archiver.war.WarArchiver;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.InterpolationFilterReader;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
@@ -97,8 +42,57 @@
* @version $Id$
*/
public abstract class AbstractAssemblyMojo
- extends AbstractUnpackingMojo
+ extends AbstractMojo
+ implements AssemblerConfigurationSource
{
+
+ /**
+ * @parameter expression="${localRepository}"
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * Contains the full list of projects in the reactor.
+ *
+ * @parameter expression="${reactorProjects}"
+ * @required
+ * @readonly
+ */
+ private List reactorProjects;
+
+ /**
+ * The output directory of the assembled distribution file.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private File outputDirectory;
+
+ /**
+ * The filename of the assembled distribution file.
+ *
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName;
+
+ /**
+ * Directory to unpack JARs into if needed
+ *
+ * @parameter expression="${project.build.directory}/assembly/work"
+ * @required
+ */
+ private File workDirectory;
+
+ /**
+ * This is the artifact classifier to be used for the resultant assembly artifact. Normally, you would use the
+ * assembly-id instead of specifying this here.
+ *
+ * @parameter expression="${classifier}"
+ * @deprecated Please use the Assembly's id for classifier instead
+ */
+ private String classifier;
+
/**
* A list of descriptor files to generate from.
*
@@ -203,9 +197,10 @@
*/
protected boolean appendAssemblyId;
- private ComponentsXmlArchiverFileFilter componentsXmlFilter = new ComponentsXmlArchiverFileFilter();
-
/**
+ * This is a set of instructions to the archive builder, especially for building .jar files. It enables you to
+ * specify a Manifest file for the jar, in addition to other options.
+ *
* @parameter
*/
private MavenArchiveConfiguration archive;
@@ -215,14 +210,15 @@
*/
protected List filters;
- private Properties filterProperties;
-
/**
* @component
*/
- private RepositoryAssembler repositoryAssembler;
+ private AssemblyArchiver assemblyArchiver;
- private static final String LS = System.getProperty( "line.separator" );
+ /**
+ * @component
+ */
+ private AssemblyReader assemblyReader;
/**
* Create the binary distribution.
@@ -233,1435 +229,291 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
- List assemblies = readAssemblies();
-
- // TODO: include dependencies marked for distribution under certain formats
- // TODO: how, might we plug this into an installer, such as NSIS?
-
- for ( Iterator i = assemblies.iterator(); i.hasNext(); )
- {
- Assembly assembly = (Assembly) i.next();
- createAssembly( assembly );
- }
- }
-
- private void createAssembly( Assembly assembly )
- throws MojoExecutionException, MojoFailureException
- {
- String fullName = getDistributionName( assembly );
-
- for ( Iterator i = assembly.getFormats().iterator(); i.hasNext(); )
- {
- String format = (String) i.next();
-
- String filename = fullName + "." + format;
-
- File destFile;
- try
- {
- Archiver archiver = createArchiver( format );
-
- destFile = createArchive( archiver, assembly, filename );
- }
- catch ( NoSuchArchiverException e )
- {
- throw new MojoFailureException( "Unable to obtain archiver for extension '" + format + "'" );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error creating assembly: " + e.getMessage(), e );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error creating assembly: " + e.getMessage(), e );
- }
- catch ( RepositoryAssemblyException e )
- {
- throw new MojoExecutionException( "Error creating assembly: " + e.getMessage(), e );
- }
-
- if ( appendAssemblyId )
- {
- projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
- }
- else if ( classifier != null )
- {
- projectHelper.attachArtifact( project, format, classifier, destFile );
- }
- else
- {
- projectHelper.attachArtifact( project, format, null, destFile );
- }
- }
- }
-
- /**
- * Get the full name of the distribution artifact
- *
- * @param assembly
- * @return the distribution name
- */
- protected String getDistributionName( Assembly assembly )
- {
- String distributionName = finalName;
- if ( appendAssemblyId )
+ List assemblies;
+ try
{
- if ( !StringUtils.isEmpty( assembly.getId() ) )
- {
- distributionName = finalName + "-" + assembly.getId();
- }
+ assemblies = assemblyReader.readAssemblies( this );
}
- else if ( classifier != null )
+ catch ( AssemblyReadException e )
{
- distributionName = finalName + "-" + classifier;
+ throw new MojoExecutionException( "Error reading assemblies: " + e.getMessage(), e );
}
- return distributionName;
- }
- protected File createArchive( Archiver archiver, Assembly assembly, String filename )
- throws MojoExecutionException, MojoFailureException, IOException, ArchiverException, RepositoryAssemblyException
- {
- processRepositories( archiver, assembly.getRepositories(), assembly.isIncludeBaseDirectory() );
- processDependencySets( archiver, assembly.getDependencySets(), assembly.isIncludeBaseDirectory() );
- processModules( archiver, assembly.getModuleSets(), assembly.isIncludeBaseDirectory() );
- processFileSets( archiver, assembly.getFileSets(), assembly.isIncludeBaseDirectory() );
- processFileList( archiver, assembly.getFiles(), assembly.isIncludeBaseDirectory() );
-
- componentsXmlFilter.addToArchive( archiver );
-
- File destFile = new File( outputDirectory, filename );
+ // TODO: include dependencies marked for distribution under certain formats
+ // TODO: how, might we plug this into an installer, such as NSIS?
- if ( archiver instanceof JarArchiver )
+ for ( Iterator assemblyIterator = assemblies.iterator(); assemblyIterator.hasNext(); )
{
- // TODO: I'd really prefer to rewrite MavenArchiver as either a separate manifest creation utility (and to
- // create an include pom.properties etc into another archiver), or an implementation of an archiver
- // (the first is preferable).
- MavenArchiver mavenArchiver = new MavenArchiver();
-
- if ( archive != null )
+ Assembly assembly = (Assembly) assemblyIterator.next();
+ try
{
- try
+ String fullName = AssemblyFormatUtils.getDistributionName( assembly, this );
+
+ for ( Iterator formatIterator = assembly.getFormats().iterator(); formatIterator.hasNext(); )
{
- Manifest manifest;
- File manifestFile = archive.getManifestFile();
+ String format = (String) formatIterator.next();
+
+ File destFile = assemblyArchiver.createArchive( assembly, fullName, format, this );
- if ( manifestFile != null )
+ MavenProject project = getProject();
+ String classifier = getClassifier();
+
+ if ( isAssemblyIdAppended() )
{
- try
- {
- manifest = new Manifest( new FileReader( manifestFile ) );
- }
- catch ( FileNotFoundException e )
- {
- throw new MojoFailureException( "Manifest not found: " + e.getMessage() );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error processing manifest: " + e.getMessage(), e );
- }
+ projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
}
- else
+ else if ( classifier != null )
{
- manifest = mavenArchiver.getManifest( project, archive.getManifest() );
+ projectHelper.attachArtifact( project, format, classifier, destFile );
}
-
- if ( manifest != null )
+ else
{
- JarArchiver jarArchiver = (JarArchiver) archiver;
- jarArchiver.addConfiguredManifest( manifest );
+ projectHelper.attachArtifact( project, format, null, destFile );
}
}
- catch ( ManifestException e )
- {
- throw new MojoExecutionException( "Error creating manifest: " + e.getMessage(), e );
- }
- catch ( DependencyResolutionRequiredException e )
- {
- throw new MojoExecutionException( "Dependencies were not resolved: " + e.getMessage(), e );
- }
- }
- }
-
- archiver.setDestFile( destFile );
- archiver.createArchive();
-
- return destFile;
- }
-
- private void processRepositories( Archiver archiver, List modulesList, boolean includeBaseDirectory )
- throws RepositoryAssemblyException, MojoExecutionException
- {
- for ( Iterator i = modulesList.iterator(); i.hasNext(); )
- {
- Repository repository = (Repository) i.next();
-
- File repositoryDirectory = new File( tempRoot, repository.getOutputDirectory() );
-
- if ( !repositoryDirectory.exists() )
- {
- repositoryDirectory.mkdirs();
}
-
- repositoryAssembler.assemble( repositoryDirectory, repository, getExecutedProject(), localRepository );
-
- try
+ catch ( ArchiveCreationException e )
{
- if ( includeBaseDirectory )
- {
- archiver.addDirectory( repositoryDirectory, repository.getOutputDirectory() + "/" );
- }
- else
- {
- archiver.addDirectory( repositoryDirectory );
- }
+ throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
}
- catch ( ArchiverException e )
+ catch ( AssemblyFormattingException e )
{
- throw new MojoExecutionException( "Error adding directory to archive: " + e.getMessage(), e );
+ throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
}
}
}
-
- private void processModules( Archiver archiver, List moduleSets, boolean includeBaseDirectory )
- throws MojoFailureException, MojoExecutionException
+
+ protected AssemblyArchiver getAssemblyArchiver()
{
- for ( Iterator i = moduleSets.iterator(); i.hasNext(); )
- {
- ModuleSet moduleSet = (ModuleSet) i.next();
-
- AndArtifactFilter moduleFilter = new AndArtifactFilter();
-
- if ( !moduleSet.getIncludes().isEmpty() )
- {
- moduleFilter.add( new AssemblyIncludesArtifactFilter( moduleSet.getIncludes() ) );
- }
- if ( !moduleSet.getExcludes().isEmpty() )
- {
- moduleFilter.add( new AssemblyExcludesArtifactFilter( moduleSet.getExcludes() ) );
- }
-
- Set allModuleProjects = getModulesFromReactor( getExecutedProject() );
-
- Set moduleProjects = new HashSet( allModuleProjects );
-
- FilterUtils.filterProjects( moduleProjects, moduleSet.getIncludes(), moduleSet.getExcludes(), false );
-
- List moduleFileSets = new ArrayList();
-
- for ( Iterator j = moduleProjects.iterator(); j.hasNext(); )
- {
- MavenProject moduleProject = (MavenProject) j.next();
+ return assemblyArchiver;
+ }
+
+ protected AssemblyReader getAssemblyReader()
+ {
+ return assemblyReader;
+ }
+
+ public File getBasedir()
+ {
+ return basedir;
+ }
- String name = moduleProject.getBuild().getFinalName();
+ public File getDescriptor()
+ {
+ return descriptor;
+ }
- ModuleSources sources = moduleSet.getSources();
+ public String getDescriptorId()
+ {
+ return descriptorId;
+ }
- if ( sources != null )
- {
- String output = sources.getOutputDirectory();
- output = getOutputDirectory( output, moduleProject, includeBaseDirectory );
+ public String[] getDescriptorReferences()
+ {
+ return descriptorRefs;
+ }
- FileSet moduleFileSet = new FileSet();
+ public File getDescriptorSourceDirectory()
+ {
+ return descriptorSourceDirectory;
+ }
- moduleFileSet.setDirectory( moduleProject.getBasedir().getAbsolutePath() );
- moduleFileSet.setOutputDirectory( output );
+ public File[] getDescriptors()
+ {
+ return descriptors;
+ }
- List excludesList = new ArrayList();
- excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(),
- moduleProject.getBuild().getDirectory() ) + "/**" );
- excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(),
- moduleProject.getBuild().getOutputDirectory() ) + "/**" );
- excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(),
- moduleProject.getBuild().getTestOutputDirectory() ) +
- "/**" );
- excludesList.add( PathUtils.toRelative( moduleProject.getBasedir(),
- moduleProject.getReporting().getOutputDirectory() ) +
- "/**" );
- moduleFileSet.setExcludes( excludesList );
+ public abstract MavenProject getProject();
- moduleFileSets.add( moduleFileSet );
- }
+ public File getSiteDirectory()
+ {
+ return siteDirectory;
+ }
- ModuleBinaries binaries = moduleSet.getBinaries();
+ public boolean isSiteIncluded()
+ {
+ return includeSite;
+ }
- if ( binaries != null )
- {
- Artifact moduleArtifact = moduleProject.getArtifact();
+ public String getFinalName()
+ {
+ return finalName;
+ }
- if ( moduleArtifact.getFile() == null )
- {
- throw new MojoExecutionException( "Included module: " + moduleProject.getId() +
- " does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated." );
- }
+ public boolean isAssemblyIdAppended()
+ {
+ return appendAssemblyId;
+ }
- String output = binaries.getOutputDirectory();
- output = getOutputDirectory( output, moduleProject, includeBaseDirectory );
+ public String getTarLongFileMode()
+ {
+ return tarLongFileMode;
+ }
- archiver.setDefaultDirectoryMode( Integer.parseInt( binaries.getDirectoryMode(), 8 ) );
+ public File getOutputDirectory()
+ {
+ return outputDirectory;
+ }
- archiver.setDefaultFileMode( Integer.parseInt( binaries.getFileMode(), 8 ) );
+ public MavenArchiveConfiguration getJarArchiveConfiguration()
+ {
+ return archive;
+ }
- getLog().debug( "ModuleSet[" + output + "]" + " dir perms: " +
- Integer.toString( archiver.getDefaultDirectoryMode(), 8 ) + " file perms: " +
- Integer.toString( archiver.getDefaultFileMode(), 8 ) );
+ public File getWorkingDirectory()
+ {
+ return workDirectory;
+ }
- Set binaryDependencies = moduleProject.getArtifacts();
+ public ArtifactRepository getLocalRepository()
+ {
+ return localRepository;
+ }
- List includes = binaries.getIncludes();
- List excludes = binaries.getExcludes();
+ public File getTemporaryRootDirectory()
+ {
+ return tempRoot;
+ }
- FilterUtils.filterArtifacts( binaryDependencies, includes, excludes, true, Collections.EMPTY_LIST );
+ public File getArchiveBaseDirectory()
+ {
+ return archiveBaseDirectory;
+ }
- if ( binaries.isUnpack() )
- {
- // TODO: something like zipfileset in plexus-archiver
- // archiver.addJar( )
+ public List getFilters()
+ {
+ return filters;
+ }
- // TODO refactor into the AbstractUnpackMojo
- File tempLocation = new File( workDirectory, name );
- boolean process = false;
- if ( !tempLocation.exists() )
- {
- tempLocation.mkdirs();
- process = true;
- }
- else if ( moduleArtifact.getFile().lastModified() > tempLocation.lastModified() )
- {
- process = true;
- }
-
- if ( process )
- {
- try
- {
- unpack( moduleArtifact.getFile(), tempLocation );
-
- if ( binaries.isIncludeDependencies() )
- {
- for ( Iterator dependencyIterator = binaryDependencies.iterator();
- dependencyIterator.hasNext(); )
- {
- Artifact dependencyArtifact = (Artifact) dependencyIterator.next();
-
- unpack( dependencyArtifact.getFile(), tempLocation );
- }
- }
- }
- catch ( NoSuchArchiverException e )
- {
- throw new MojoExecutionException( "Unable to obtain unarchiver: " + e.getMessage(), e );
- }
-
- /*
- * If the assembly is 'jar-with-dependencies', remove the security files in all dependencies
- * that will prevent the uberjar to execute. Please see MASSEMBLY-64 for details.
- */
- if ( archiver instanceof JarArchiver )
- {
- String[] securityFiles = {"*.RSA", "*.DSA", "*.SF", "*.rsa", "*.dsa", "*.sf"};
- org.apache.maven.shared.model.fileset.FileSet securityFileSet =
- new org.apache.maven.shared.model.fileset.FileSet();
- securityFileSet.setDirectory( tempLocation.getAbsolutePath() + "/META-INF/" );
-
- for ( int sfsi = 0; sfsi < securityFiles.length; sfsi++ )
- {
- securityFileSet.addInclude( securityFiles[sfsi] );
- }
-
- FileSetManager fsm = new FileSetManager( getLog() );
- try
- {
- fsm.delete( securityFileSet );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException(
- "Failed to delete security files: " + e.getMessage(), e );
- }
- }
- }
+ public List getReactorProjects()
+ {
+ return reactorProjects;
+ }
- addDirectory( archiver, tempLocation, output, null, FileUtils.getDefaultExcludesAsList() );
- }
- else
- {
- try
- {
- String outputFileNameMapping = binaries.getOutputFileNameMapping();
-
- archiver.addFile( moduleArtifact.getFile(), output +
- evaluateFileNameMapping( moduleArtifact, outputFileNameMapping ) );
-
- if ( binaries.isIncludeDependencies() )
- {
- for ( Iterator artifacts = binaryDependencies.iterator(); artifacts.hasNext(); )
- {
- Artifact dependencyArtifact = (Artifact) artifacts.next();
-
- archiver.addFile( dependencyArtifact.getFile(), output +
- evaluateFileNameMapping( dependencyArtifact, outputFileNameMapping ) );
- }
- }
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error adding file to archive: " + e.getMessage(), e );
- }
- }
- }
+ public String getClassifier()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
- if ( !moduleFileSets.isEmpty() )
- {
- // TODO: includes and excludes
- processFileSets( archiver, moduleFileSets, includeBaseDirectory );
- }
- }
+ protected MavenProjectHelper getProjectHelper()
+ {
+ return projectHelper;
+ }
- allModuleProjects.removeAll( moduleProjects );
+ public void setAppendAssemblyId( boolean appendAssemblyId )
+ {
+ this.appendAssemblyId = appendAssemblyId;
+ }
- for ( Iterator it = allModuleProjects.iterator(); it.hasNext(); )
- {
- MavenProject excludedProject = (MavenProject) it.next();
+ public void setArchive( MavenArchiveConfiguration archive )
+ {
+ this.archive = archive;
+ }
- // would be better to have a way to find out when a specified include or exclude
- // is never triggered and warn() it.
- getLog().debug( "module: " + excludedProject.getId() + " not included" );
- }
- }
+ public void setArchiveBaseDirectory( File archiveBaseDirectory )
+ {
+ this.archiveBaseDirectory = archiveBaseDirectory;
}
- private static String evaluateFileNameMapping( Artifact artifact, String mapping )
- throws MojoExecutionException
+ public void setAssemblyArchiver( AssemblyArchiver assemblyArchiver )
{
- String fileNameMapping = mapping;
- //insert the classifier if exist
- if ( !StringUtils.isEmpty( artifact.getClassifier() ) )
- {
- int dotIdx = fileNameMapping.lastIndexOf( "." );
+ this.assemblyArchiver = assemblyArchiver;
+ }
- if ( dotIdx >= 0 )
- {
- String extension = fileNameMapping.substring( dotIdx + 1, fileNameMapping.length() );
- String artifactWithoutExt = fileNameMapping.substring( 0, dotIdx );
+ public void setAssemblyReader( AssemblyReader assemblyReader )
+ {
+ this.assemblyReader = assemblyReader;
+ }
- fileNameMapping = artifactWithoutExt + "-" + artifact.getClassifier() + "." + extension;
- }
- else
- {
- fileNameMapping = fileNameMapping + "-" + artifact.getClassifier();
- }
- }
+ public void setBasedir( File basedir )
+ {
+ this.basedir = basedir;
+ }
- return evaluateFileNameMapping( fileNameMapping, artifact );
+ public void setClassifier( String classifier )
+ {
+ this.classifier = classifier;
}
- private Set getModulesFromReactor( MavenProject parent )
+ public void setDescriptor( File descriptor )
{
- return getModulesFromReactor( parent, false );
+ this.descriptor = descriptor;
}
- private Set getModulesFromReactor( MavenProject parent, boolean recurse )
+ public void setDescriptorId( String descriptorId )
{
- Set modules = new HashSet();
+ this.descriptorId = descriptorId;
+ }
- String parentId = parent.getId();
+ public void setDescriptorRefs( String[] descriptorRefs )
+ {
+ this.descriptorRefs = descriptorRefs;
+ }
- for ( Iterator i = reactorProjects.iterator(); i.hasNext(); )
- {
- MavenProject reactorProject = (MavenProject) i.next();
+ public void setDescriptors( File[] descriptors )
+ {
+ this.descriptors = descriptors;
+ }
- if ( isProjectModule( parentId, reactorProject, recurse ) )
- {
- modules.add( reactorProject );
- }
- }
+ public void setDescriptorSourceDirectory( File descriptorSourceDirectory )
+ {
+ this.descriptorSourceDirectory = descriptorSourceDirectory;
+ }
- return modules;
+ public void setFilters( List filters )
+ {
+ this.filters = filters;
}
- private boolean isProjectModule( String parentId, MavenProject reactorProject, boolean recurse )
+ public void setFinalName( String finalName )
{
- MavenProject parent = reactorProject.getParent();
+ this.finalName = finalName;
+ }
- if ( parent != null )
- {
- if ( parent.getId().equals( parentId ) )
- {
- return true;
- }
- else if ( recurse )
- {
- isProjectModule( parentId, parent, true );
- }
- }
+ public void setIncludeSite( boolean includeSite )
+ {
+ this.includeSite = includeSite;
+ }
- return false;
+ public void setLocalRepository( ArtifactRepository localRepository )
+ {
+ this.localRepository = localRepository;
}
- protected List readAssemblies()
- throws MojoFailureException, MojoExecutionException
+ public void setOutputDirectory( File outputDirectory )
{
- List assemblies = new ArrayList();
+ this.outputDirectory = outputDirectory;
+ }
- if ( descriptor != null )
- {
- assemblies.add( getAssembly( descriptor ) );
- }
+ public void setProjectHelper( MavenProjectHelper projectHelper )
+ {
+ this.projectHelper = projectHelper;
+ }
- if ( descriptorId != null )
- {
- assemblies.add( getAssembly( descriptorId ) );
- }
+ public void setReactorProjects( List reactorProjects )
+ {
+ this.reactorProjects = reactorProjects;
+ }
- if ( descriptors != null && descriptors.length > 0 )
- {
- for ( int i = 0; i < descriptors.length; i++ )
- {
- assemblies.add( getAssembly( descriptors[i] ) );
- }
- }
+ public void setSiteDirectory( File siteDirectory )
+ {
+ this.siteDirectory = siteDirectory;
+ }
- if ( descriptorRefs != null && descriptorRefs.length > 0 )
- {
- for ( int i = 0; i < descriptorRefs.length; i++ )
- {
- assemblies.add( getAssembly( descriptorRefs[i] ) );
- }
- }
+ public void setTarLongFileMode( String tarLongFileMode )
+ {
+ this.tarLongFileMode = tarLongFileMode;
+ }
- if ( descriptorSourceDirectory != null && descriptorSourceDirectory.isDirectory() )
- {
- try
- {
- List descriptorList = FileUtils.getFiles( descriptorSourceDirectory, "**/*.xml", null );
+ public void setTempRoot( File tempRoot )
+ {
+ this.tempRoot = tempRoot;
+ }
- for ( Iterator iter = descriptorList.iterator(); iter.hasNext(); )
- {
- assemblies.add( getAssembly( (File) iter.next() ) );
- }
- }
- catch ( IOException e )
- {
- throw new MojoFailureException( "error discovering descriptor files: " + e.getMessage() );
- }
- }
-
- if ( assemblies.isEmpty() )
- {
- throw new MojoFailureException( "No assembly descriptors found." );
- }
-
- // check unique IDs
- Set ids = new HashSet();
- for ( Iterator i = assemblies.iterator(); i.hasNext(); )
- {
- Assembly assembly = (Assembly) i.next();
- if ( !ids.add( assembly.getId() ) )
- {
- throw new MojoFailureException( "The assembly id " + assembly.getId() + " is used more than once." );
- }
-
- }
- return assemblies;
- }
-
- private Assembly getAssembly( String ref )
- throws MojoFailureException, MojoExecutionException
- {
- InputStream resourceAsStream = getClass().getResourceAsStream( "/assemblies/" + ref + ".xml" );
- if ( resourceAsStream == null )
- {
- throw new MojoFailureException( "Descriptor with ID '" + ref + "' not found" );
- }
- return getAssembly( new InputStreamReader( resourceAsStream ) );
- }
-
- private Assembly getAssembly( File file )
- throws MojoFailureException, MojoExecutionException
- {
- Reader r;
- try
- {
- r = new FileReader( file );
- }
- catch ( FileNotFoundException e )
- {
- throw new MojoFailureException( "Unable to find descriptor: " + e.getMessage() );
- }
-
- return getAssembly( r );
- }
-
- private Assembly getAssembly( Reader reader )
- throws MojoFailureException, MojoExecutionException
- {
- Assembly assembly;
-
- try
- {
- Map context = new HashMap( System.getProperties() );
-
- context.put( "basedir", basedir.getAbsolutePath() );
-
- AssemblyXpp3Reader r = new AssemblyXpp3Reader();
- assembly = r.read( reader );
-
- assembly = new AssemblyInterpolator().interpolate( assembly, project.getModel(), context );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error reading descriptor", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new MojoExecutionException( "Error reading descriptor", e );
- }
- catch ( AssemblyInterpolationException e )
- {
- throw new MojoExecutionException( "Error reading descriptor: " + e.getMessage(), e );
- }
- finally
- {
- IOUtil.close( reader );
- }
-
- if ( includeSite || assembly.isIncludeSiteDirectory() )
- {
- includeSiteInAssembly( assembly );
- }
-
- appendComponentsToMainAssembly( assembly );
-
- return assembly;
- }
-
- /**
- * Add the contents of all included components to main assembly
- *
- * @param assembly
- * @throws MojoFailureException
- * @throws MojoExecutionException
- */
- private void appendComponentsToMainAssembly( Assembly assembly )
- throws MojoFailureException, MojoExecutionException
- {
- List componentDescriptorFiles = assembly.getComponentDescriptors();
-
- for ( int i = 0; i < componentDescriptorFiles.size(); ++i )
- {
- Component component = getComponent( componentDescriptorFiles.get( i ).toString() );
-
- appendComponent( assembly, component );
- }
- }
-
- /**
- * Add the content of a single Component to main assembly
- *
- * @param assembly
- * @param component
- */
- private void appendComponent( Assembly assembly, Component component )
- {
- List dependencySetList = component.getDependencySets();
-
- for ( int i = 0; i < dependencySetList.size(); ++i )
- {
- assembly.addDependencySet( (DependencySet) dependencySetList.get( i ) );
- }
-
- List fileSetList = component.getFileSets();
-
- for ( int i = 0; i < fileSetList.size(); ++i )
- {
- assembly.addFileSet( (FileSet) fileSetList.get( i ) );
- }
-
- List fileList = component.getFiles();
-
- for ( int i = 0; i < fileList.size(); ++i )
- {
- assembly.addFile( (FileItem) fileList.get( i ) );
- }
- }
-
- /**
- * Load the Component via a given file path relative to ${basedir}
- *
- * @param filePath
- * @return
- * @throws MojoFailureException
- * @throws MojoExecutionException
- */
- private Component getComponent( String filePath )
- throws MojoExecutionException, MojoFailureException
- {
- File componentDescriptor = new File( this.project.getBasedir() + "/" + filePath );
-
- Reader r;
- try
- {
- r = new FileReader( componentDescriptor );
- }
- catch ( FileNotFoundException e )
- {
- throw new MojoFailureException( "Unable to find descriptor: " + e.getMessage() );
- }
-
- return getComponent( r );
-
- }
-
- /**
- * Load the Component via a Reader
- *
- * @param reader
- */
- private Component getComponent( Reader reader )
- throws MojoExecutionException
- {
- Component component;
- try
- {
- ComponentXpp3Reader r = new ComponentXpp3Reader();
- component = r.read( reader );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error reading component descriptor", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new MojoExecutionException( "Error reading component descriptor", e );
- }
- finally
- {
- IOUtil.close( reader );
- }
-
- return component;
- }
-
- /**
- * Processes Dependency Sets
- *
- * @param archiver
- * @param dependencySets
- * @param includeBaseDirectory
- */
- protected void processDependencySets( Archiver archiver, List dependencySets, boolean includeBaseDirectory )
- throws MojoExecutionException
- {
- for ( Iterator i = dependencySets.iterator(); i.hasNext(); )
- {
- DependencySet dependencySet = (DependencySet) i.next();
- String output = dependencySet.getOutputDirectory();
- output = getOutputDirectory( output, project, includeBaseDirectory );
-
- archiver.setDefaultDirectoryMode( Integer.parseInt( dependencySet.getDirectoryMode(), 8 ) );
-
- archiver.setDefaultFileMode( Integer.parseInt( dependencySet.getFileMode(), 8 ) );
-
- getLog().debug( "DependencySet[" + output + "]" + " dir perms: " +
- Integer.toString( archiver.getDefaultDirectoryMode(), 8 ) + " file perms: " +
- Integer.toString( archiver.getDefaultFileMode(), 8 ) );
-
- Set allDependencyArtifacts = ProjectUtils.getDependencies( getExecutedProject() );
- Set dependencyArtifacts = new HashSet( allDependencyArtifacts );
-
- AssemblyScopeArtifactFilter scopeFilter = new AssemblyScopeArtifactFilter( dependencySet.getScope() );
-
- FilterUtils.filterArtifacts( dependencyArtifacts, dependencySet.getIncludes(), dependencySet.getExcludes(),
- true, Collections.singletonList( scopeFilter ) );
-
- for ( Iterator j = dependencyArtifacts.iterator(); j.hasNext(); )
- {
- Artifact artifact = (Artifact) j.next();
-
- String fileNameMapping = evaluateFileNameMapping( artifact, dependencySet.getOutputFileNameMapping() );
- if ( dependencySet.isUnpack() )
- {
- // TODO: something like zipfileset in plexus-archiver
- // archiver.addJar( )
-
- File tempLocation = new File( workDirectory, fileNameMapping );
- boolean process = false;
- if ( !tempLocation.exists() )
- {
- tempLocation.mkdirs();
- process = true;
- }
- else if ( artifact.getFile().lastModified() > tempLocation.lastModified() )
- {
- process = true;
- }
-
- if ( process )
- {
- try
- {
- unpack( artifact.getFile(), tempLocation );
- }
- catch ( NoSuchArchiverException e )
- {
- throw new MojoExecutionException(
- "Unable to obtain unarchiver for file '" + artifact.getFile() + "'" );
- }
-
- /*
- * If the assembly is 'jar-with-dependencies', remove the security files in all dependencies
- * that will prevent the uberjar to execute. Please see MASSEMBLY-64 for details.
- */
- if ( archiver instanceof JarArchiver )
- {
- String[] securityFiles = {"*.RSA", "*.DSA", "*.SF", "*.rsa", "*.dsa", "*.sf"};
- org.apache.maven.shared.model.fileset.FileSet securityFileSet =
- new org.apache.maven.shared.model.fileset.FileSet();
- securityFileSet.setDirectory( tempLocation.getAbsolutePath() + "/META-INF/" );
-
- for ( int sfsi = 0; sfsi < securityFiles.length; sfsi++ )
- {
- securityFileSet.addInclude( securityFiles[sfsi] );
- }
-
- FileSetManager fsm = new FileSetManager( getLog() );
- try
- {
- fsm.delete( securityFileSet );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Failed to delete security files: " + e.getMessage(),
- e );
- }
- }
- }
-
- addDirectory( archiver, tempLocation, output, null, FileUtils.getDefaultExcludesAsList() );
- }
- else
- {
- try
- {
- archiver.addFile( artifact.getFile(), output + fileNameMapping );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException(
- "Error adding file '" + artifact.getFile() + "' to archive: " + e.getMessage(), e );
- }
- }
- }
-
- allDependencyArtifacts.removeAll( dependencyArtifacts );
-
- for ( Iterator it = allDependencyArtifacts.iterator(); it.hasNext(); )
- {
- Artifact artifact = (Artifact) it.next();
-
- // would be better to have a way to find out when a specified include or exclude
- // is never triggered and warn() it.
- getLog().debug( "artifact: " + artifact + " not included" );
- }
- }
- }
-
- private void addDirectory( Archiver archiver, File directory, String output, String[] includes, List excludes )
- throws MojoExecutionException
- {
- if ( directory.exists() )
- {
- List adaptedExcludes = excludes;
-
- // TODO: more robust set of filters on added files in the archiver
- File componentsXml = new File( directory, ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH );
- if ( componentsXml.exists() )
- {
- try
- {
- componentsXmlFilter.addComponentsXml( componentsXml );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error reading components.xml to merge: " + e.getMessage(), e );
- }
- catch ( XmlPullParserException e )
- {
- throw new MojoExecutionException( "Error reading components.xml to merge: " + e.getMessage(), e );
- }
- adaptedExcludes = new ArrayList( excludes );
- adaptedExcludes.add( ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH );
- }
-
- try
- {
- archiver.addDirectory( directory, output, includes,
- (String[]) adaptedExcludes.toArray( EMPTY_STRING_ARRAY ) );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error adding directory to archive: " + e.getMessage(), e );
- }
- }
- }
-
- /**
- * Process Files that will be included in the distribution.
- *
- * @param archiver
- * @param fileSets
- * @param includeBaseDirecetory
- */
- protected void processFileSets( Archiver archiver, List fileSets, boolean includeBaseDirecetory )
- throws MojoExecutionException, MojoFailureException
+ public void setWorkDirectory( File workDirectory )
{
- for ( Iterator i = fileSets.iterator(); i.hasNext(); )
- {
- FileSet fileSet = (FileSet) i.next();
- String directory = fileSet.getDirectory();
- String output = fileSet.getOutputDirectory();
-
- String lineEnding = getLineEndingCharacters( fileSet.getLineEnding() );
-
- File tmpDir = null;
-
- if ( lineEnding != null )
- {
- tmpDir = FileUtils.createTempFile( "", "", tempRoot );
- tmpDir.mkdirs();
- }
-
- archiver.setDefaultDirectoryMode( Integer.parseInt( fileSet.getDirectoryMode(), 8 ) );
-
- archiver.setDefaultFileMode( Integer.parseInt( fileSet.getFileMode(), 8 ) );
-
- getLog().debug( "FileSet[" + output + "]" + " dir perms: " +
- Integer.toString( archiver.getDefaultDirectoryMode(), 8 ) + " file perms: " +
- Integer.toString( archiver.getDefaultFileMode(), 8 ) +
- ( fileSet.getLineEnding() == null ? "" : " lineEndings: " + fileSet.getLineEnding() ) );
-
- if ( directory == null )
- {
- directory = basedir.getAbsolutePath();
- if ( output == null )
- {
- output = "";
- }
- }
- else
- {
- if ( output == null )
- {
- output = directory;
- }
- }
- output = getOutputDirectory( output, project, includeBaseDirecetory );
-
- String[] includes = (String[]) fileSet.getIncludes().toArray( EMPTY_STRING_ARRAY );
- if ( includes.length == 0 )
- {
- includes = null;
- }
-
- // TODO: default excludes should be in the archiver?
- List excludesList = fileSet.getExcludes();
- excludesList.addAll( FileUtils.getDefaultExcludesAsList() );
-
- String[] excludes = (String[]) excludesList.toArray( EMPTY_STRING_ARRAY );
-
- File archiveBaseDir;
- if ( archiveBaseDirectory == null )
- {
- archiveBaseDir = new File( directory );
- }
- else
- {
- if ( ! archiveBaseDirectory.exists() )
- {
- throw new MojoFailureException(
- "The archive base directory '" + archiveBaseDirectory.getAbsolutePath() + "' does not exist" );
- }
- if ( ! archiveBaseDirectory.isDirectory() )
- {
- throw new MojoFailureException( "The archive base directory '" +
- archiveBaseDirectory.getAbsolutePath() + "' exists, but it is not a directory" );
- }
- archiveBaseDir = new File( archiveBaseDirectory, directory );
- }
- getLog().debug( "The archive base directory is '" + archiveBaseDir.getAbsolutePath() + "'" );
-
- if ( ! archiveBaseDir.isAbsolute() )
- {
- archiveBaseDir = new File( basedir, directory );
- }
-
- if ( archiveBaseDir.exists() )
- {
- if ( lineEnding != null )
- {
- copySetReplacingLineEndings( archiveBaseDir, tmpDir, includes, excludes, lineEnding );
-
- archiveBaseDir = tmpDir;
- }
- getLog().debug( "Archive base directory: '" + archiveBaseDir.getAbsolutePath() + "'" );
- addDirectory( archiver, archiveBaseDir, output, includes, excludesList );
- }
- }
- }
-
- /**
- * Copy files to the distribution with option to change destination name
- *
- * @param archiver
- * @param fileList
- */
- protected void processFileList( Archiver archiver, List fileList, boolean includeBaseDirecetory )
- throws MojoExecutionException, MojoFailureException
- {
- for ( Iterator i = fileList.iterator(); i.hasNext(); )
- {
- FileItem fileItem = (FileItem) i.next();
-
- //ensure source file is in absolute path for reactor build to work
- File source = new File( fileItem.getSource() );
- if ( ! source.isAbsolute() )
- {
- source = new File( this.basedir, fileItem.getSource() );
- }
-
- if ( fileItem.isFiltered() )
- {
- source = filterFile( source ).getAbsoluteFile();
- }
-
- String outputDirectory = fileItem.getOutputDirectory();
-
- if ( outputDirectory == null )
- {
- outputDirectory = "";
- }
-
- String destName = fileItem.getDestName();
-
- if ( destName == null )
- {
- destName = source.getName();
- }
-
- String lineEnding = getLineEndingCharacters( fileItem.getLineEnding() );
-
- if ( lineEnding != null )
- {
- try
- {
- if ( !tempRoot.exists() )
- {
- tempRoot.mkdirs();
- }
-
- File tempRootFile = File.createTempFile( source.getName() + ".", "", tempRoot );
-
- tempRootFile.deleteOnExit();
-
- copyReplacingLineEndings( source, tempRootFile, lineEnding );
-
- source = tempRootFile;
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error replacing line endings: " + e.getMessage(), e );
- }
- }
-
- outputDirectory = getOutputDirectory( outputDirectory, project, includeBaseDirecetory );
-
- // omit the last char if ends with / or \\
- if ( outputDirectory.endsWith( "/" ) || outputDirectory.endsWith( "\\" ) )
- {
- outputDirectory = outputDirectory.substring( 0, outputDirectory.length() - 1 );
- }
-
- try
- {
- archiver.addFile( source, outputDirectory + "/" + destName,
- Integer.parseInt( fileItem.getFileMode() ) );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error adding file to archive: " + e.getMessage(), e );
- }
- }
- }
-
- /**
- * Evaluates Filename Mapping
- *
- * @param expression
- * @param artifact
- * @return expression
- * @throws org.apache.maven.plugin.MojoExecutionException
- *
- */
- private static String evaluateFileNameMapping( String expression, Artifact artifact )
- throws MojoExecutionException
- {
- String value = expression;
-
- // this matches the last ${...} string
- Pattern pat = Pattern.compile( "^(.*)\\$\\{([^\\}]+)\\}(.*)$" );
- Matcher mat = pat.matcher( expression );
-
- if ( mat.matches() )
- {
- Object middle;
- String left = evaluateFileNameMapping( mat.group( 1 ), artifact );
- try
- {
- middle = ReflectionValueExtractor.evaluate( mat.group( 2 ), artifact, false );
- }
- catch ( Exception e )
- {
- throw new MojoExecutionException(
- "Cannot evaluate filenameMapping: '" + mat.group( 1 ) + "': " + e.getMessage(), e );
- }
- String right = mat.group( 3 );
-
- if ( middle == null )
- {
- // TODO: There should be a more generic way dealing with that. Having magic words is not good at all.
- // probe for magic word
- if ( "extension".equals( mat.group( 2 ).trim() ) )
- {
- ArtifactHandler artifactHandler = artifact.getArtifactHandler();
- middle = artifactHandler.getExtension();
- }
- else
- {
- middle = "${" + mat.group( 2 ) + "}";
- }
- }
-
- value = left + middle + right;
- }
-
- return value;
- }
-
- private String getOutputDirectory( String output, MavenProject project, boolean includeBaseDirectory )
- {
- String value = output;
- if ( value == null )
- {
- value = "";
- }
- if ( !value.endsWith( "/" ) && !value.endsWith( "\\" ) )
- {
- // TODO: shouldn't archiver do this?
- value += '/';
- }
-
- if ( includeBaseDirectory )
- {
- if ( value.startsWith( "/" ) )
- {
- value = finalName + value;
- }
- else
- {
- value = finalName + "/" + value;
- }
- }
- else
- {
- if ( value.startsWith( "/" ) )
- {
- value = value.substring( 1 );
- }
- }
-
- if ( project != null )
- {
- value = StringUtils.replace( value, "${groupId}", project.getGroupId() );
- value = StringUtils.replace( value, "${artifactId}", project.getArtifactId() );
- value = StringUtils.replace( value, "${version}", project.getVersion() );
-
- Build build = project.getBuild();
- value = StringUtils.replace( value, "${build.finalName}", build.getFinalName() );
- value = StringUtils.replace( value, "${finalName}", build.getFinalName() );
- }
-
- return value;
- }
-
- /**
- * Creates the necessary archiver to build the distribution file.
- *
- * @param format Archive format
- * @return archiver Archiver generated
- * @throws org.codehaus.plexus.archiver.ArchiverException
- *
- * @throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException
- *
- */
- private Archiver createArchiver( String format )
- throws ArchiverException, NoSuchArchiverException
- {
- Archiver archiver;
- if ( format.startsWith( "tar" ) )
- {
- TarArchiver tarArchiver = (TarArchiver) this.archiverManager.getArchiver( "tar" );
- archiver = tarArchiver;
- int index = format.indexOf( '.' );
- if ( index >= 0 )
- {
- // TODO: this needs a cleanup in plexus archiver - use a real typesafe enum
- TarArchiver.TarCompressionMethod tarCompressionMethod = new TarArchiver.TarCompressionMethod();
- // TODO: this should accept gz and bz2 as well so we can skip over the switch
- String compression = format.substring( index + 1 );
- if ( "gz".equals( compression ) )
- {
- tarCompressionMethod.setValue( "gzip" );
- }
- else if ( "bz2".equals( compression ) )
- {
- tarCompressionMethod.setValue( "bzip2" );
- }
- else
- {
- // TODO: better handling
- throw new IllegalArgumentException( "Unknown compression format: " + compression );
- }
- tarArchiver.setCompression( tarCompressionMethod );
-
- TarLongFileMode tarFileMode = new TarLongFileMode();
-
- tarFileMode.setValue( tarLongFileMode );
-
- tarArchiver.setLongfile( tarFileMode );
- }
- }
- else if ( "war".equals( format ) )
- {
- WarArchiver warArchiver = (WarArchiver) this.archiverManager.getArchiver( "war" );
- warArchiver.setIgnoreWebxml( false ); // See MNG-1274
- archiver = warArchiver;
- }
- else
- {
- archiver = this.archiverManager.getArchiver( format );
- }
- return archiver;
- }
-
- private void copyReplacingLineEndings( File source, File dest, String lineEndings )
- throws IOException
- {
- getLog().debug( "Copying while replacing line endings: " + source + " to " + dest );
-
- BufferedReader in = new BufferedReader( new FileReader( source ) );
- BufferedWriter out = null;
- try
- {
- out = new BufferedWriter( new FileWriter( dest ) );
-
- String line;
-
- do
- {
- line = in.readLine();
- if ( line != null )
- {
- out.write( line );
- out.write( lineEndings );
- }
- }
- while ( line != null );
-
- out.flush();
- }
- finally
- {
- IOUtil.close( out );
- IOUtil.close( in );
- }
- }
-
- private void copySetReplacingLineEndings( File archiveBaseDir, File tmpDir, String[] includes, String[] excludes,
- String lineEnding )
- throws MojoExecutionException
- {
- DirectoryScanner scanner = new DirectoryScanner();
- scanner.setBasedir( archiveBaseDir.getAbsolutePath() );
- scanner.setIncludes( includes );
- scanner.setExcludes( excludes );
- scanner.scan();
-
- String[] dirs = scanner.getIncludedDirectories();
-
- for ( int j = 0; j < dirs.length; j++ )
- {
- new File( tempRoot, dirs[j] ).mkdirs();
- }
-
- String[] files = scanner.getIncludedFiles();
-
- for ( int j = 0; j < files.length; j++ )
- {
- File targetFile = new File( tmpDir, files[j] );
-
- try
- {
- targetFile.getParentFile().mkdirs();
-
- copyReplacingLineEndings( new File( archiveBaseDir, files[j] ), targetFile, lineEnding );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error copying file '" + files[j] + "' to '" + targetFile + "'", e );
- }
- }
-
- }
-
- private static String getLineEndingCharacters( String lineEnding )
- throws MojoFailureException
- {
- String value = lineEnding;
- if ( lineEnding != null )
- {
- if ( "keep".equals( lineEnding ) )
- {
- value = null;
- }
- else if ( "dos".equals( lineEnding ) || "crlf".equals( lineEnding ) )
- {
- value = "\r\n";
- }
- else if ( "unix".equals( lineEnding ) || "lf".equals( lineEnding ) )
- {
- value = "\n";
- }
- else
- {
- throw new MojoFailureException( "Illlegal lineEnding specified: '" + lineEnding + "'" );
- }
- }
-
- return value;
- }
-
- private void includeSiteInAssembly( Assembly assembly )
- throws MojoFailureException
- {
- if ( !siteDirectory.exists() )
- {
- throw new MojoFailureException(
- "site did not exist in the target directory - please run site:site before creating the assembly" );
- }
-
- getLog().info( "Adding site directory to assembly : " + siteDirectory );
-
- FileSet siteFileSet = new FileSet();
-
- siteFileSet.setDirectory( siteDirectory.getPath() );
-
- siteFileSet.setOutputDirectory( "/site" );
-
- assembly.addFileSet( siteFileSet );
- }
-
- //@todo should only run once or know when it has already initialized
- private void initializeFiltering()
- throws MojoExecutionException
- {
- getLog().info( "Initializing assembly filters..." );
-
- // System properties
- filterProperties = new Properties( System.getProperties() );
-
- // Project properties
- filterProperties.putAll( project.getProperties() );
-
- if ( filters != null && !filters.isEmpty() )
- {
- for ( Iterator i = filters.iterator(); i.hasNext(); )
- {
- String filtersfile = (String) i.next();
-
- try
- {
- Properties properties = PropertyUtils.loadPropertyFile( new File( filtersfile ), true, true );
-
- filterProperties.putAll( properties );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error loading property file '" + filtersfile + "'", e );
- }
- }
- }
- }
-
- private File filterFile( File file )
- throws MojoExecutionException
- {
- initializeFiltering();
-
- File tempFilterFile = new File( tempRoot + "/" + file.getName() );
-
- Reader fileReader = null;
- try
- {
- fileReader = new BufferedReader( new FileReader( file ) );
-
- boolean isPropertiesFile = false;
-
- if ( file.isFile() && file.getName().endsWith( ".properties" ) )
- {
- isPropertiesFile = true;
- }
-
- tempFilterFile.getParentFile().mkdirs();
-
- // support ${token}
- Reader reader = new InterpolationFilterReader( fileReader, filterProperties, "${", "}" );
-
- BufferedReader in = new BufferedReader( new InterpolationFilterReader( reader, new ReflectionProperties(
- project, isPropertiesFile ), "${", "}" ) );
-
- Writer fileWriter = null;
- try
- {
- fileWriter = new FileWriter( tempFilterFile );
-
- String line;
-
- while ( ( line = in.readLine() ) != null )
- {
- fileWriter.write( line );
- fileWriter.write( LS );
- }
-
- fileWriter.flush();
- }
- finally
- {
- IOUtil.close( fileWriter );
- }
- }
- catch ( FileNotFoundException e )
- {
- throw new MojoExecutionException( "File to filter not found: " + e.getMessage(), e );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error filtering file '" + file + "': " + e.getMessage(), e );
- }
- finally
- {
- IOUtil.close( fileReader );
- }
-
- return tempFilterFile;
+ this.workDirectory = workDirectory;
}
+
}
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Copied: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractDirectoryMojo.java (from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java)
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractDirectoryMojo.java?p2=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractDirectoryMojo.java&p1=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java&r1=421932&r2=422907&rev=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractDirectoryMojo.java Mon Jul 17 15:34:58 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.assembly;
+package org.apache.maven.plugin.assembly.mojos;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -18,13 +18,13 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.assembly.repository.RepositoryAssemblyException;
+import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
+import org.apache.maven.plugin.assembly.archive.AssemblyArchiver;
+import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
+import org.apache.maven.plugin.assembly.io.AssemblyReadException;
+import org.apache.maven.plugin.assembly.io.AssemblyReader;
import org.apache.maven.plugins.assembly.model.Assembly;
-import org.codehaus.plexus.archiver.Archiver;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
-import java.io.IOException;
import java.util.Iterator;
import java.util.List;
@@ -34,7 +34,18 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
- List assemblies = readAssemblies();
+ AssemblyReader reader = getAssemblyReader();
+
+ List assemblies;
+ try
+ {
+ assemblies = reader.readAssemblies( this );
+ }
+ catch ( AssemblyReadException e )
+ {
+ throw new MojoExecutionException( "Error reading assembly descriptors: " + e.getMessage(), e );
+ }
+
for ( Iterator i = assemblies.iterator(); i.hasNext(); )
{
Assembly assembly = (Assembly) i.next();
@@ -45,7 +56,9 @@
private void createDirectory( Assembly assembly )
throws MojoExecutionException, MojoFailureException
{
- String fullName = finalName;
+ AssemblyArchiver archiver = getAssemblyArchiver();
+
+ String fullName = getFinalName();
if ( appendAssemblyId )
{
@@ -58,24 +71,13 @@
try
{
- Archiver archiver = this.archiverManager.getArchiver( "dir" );
-
- createArchive( archiver, assembly, fullName );
- }
-
- catch ( NoSuchArchiverException e )
- {
- throw new MojoExecutionException( "Error creating assembly", e );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error creating assembly", e );
+ archiver.createArchive( assembly, fullName, "dir", this );
}
- catch ( IOException e )
+ catch ( ArchiveCreationException e )
{
- throw new MojoExecutionException( "Error creating assembly", e );
+ throw new MojoExecutionException( "Error creating assembly: " + e.getMessage(), e );
}
- catch ( RepositoryAssemblyException e )
+ catch ( AssemblyFormattingException e )
{
throw new MojoExecutionException( "Error creating assembly: " + e.getMessage(), e );
}
Copied: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java (from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java)
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java?p2=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java&p1=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java&r1=421932&r2=422907&rev=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java Mon Jul 17 15:34:58 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.assembly;
+package org.apache.maven.plugin.assembly.mojos;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -39,7 +39,7 @@
*/
private MavenProject executedProject;
- protected MavenProject getExecutedProject()
+ public MavenProject getProject()
{
return executedProject;
}
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.5
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AssemblyMojo.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Copied: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java (from r421932, maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AttachedAssemblyMojo.java)
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java?p2=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java&p1=maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AttachedAssemblyMojo.java&r1=421932&r2=422907&rev=422907&view=diff
==============================================================================
--- maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/AttachedAssemblyMojo.java (original)
+++ maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java Mon Jul 17 15:34:58 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.assembly;
+package org.apache.maven.plugin.assembly.mojos;
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -31,7 +31,14 @@
public class AttachedAssemblyMojo
extends AbstractAssemblyMojo
{
- protected MavenProject getExecutedProject()
+ /**
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ public MavenProject getProject()
{
return project;
}
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/MASSEMBLY-124/src/main/java/org/apache/maven/plugin/assembly/mojos/AttachedAssemblyMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"