From 099089e8373688e8c770984ed4f2a59cd00682ee Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Sun, 5 Nov 2006 23:27:46 +0000 Subject: [PATCH] o adding the incomplete repository assembly that I started decoupling from the assembly plugin so that we do it in one place and not make 5 copies of the same tool again. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@471568 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-repository-assembler/pom.xml | 63 ++ .../src/it/repository-assembly/pom.xml | 29 + .../repository-assembly/src/assemble/bin.xml | 14 + .../maven/plugin/assembly/test/App.java | 13 + .../maven/plugin/assembly/test/AppTest.java | 38 + .../assembly/DefaultRepositoryAssembler.java | 363 ++++++++ .../assembly/RepositoryAssembler.java | 74 ++ .../assembly/RepositoryAssemblyException.java | 39 + .../src/main/mdo/descriptor.mdo | 793 ++++++++++++++++++ 9 files changed, 1426 insertions(+) create mode 100644 archiva-sandbox/archiva-repository-assembler/pom.xml create mode 100644 archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/pom.xml create mode 100644 archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/assemble/bin.xml create mode 100644 archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/main/java/org/apache/maven/plugin/assembly/test/App.java create mode 100644 archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java create mode 100644 archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/DefaultRepositoryAssembler.java create mode 100644 archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssembler.java create mode 100644 archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssemblyException.java create mode 100644 archiva-sandbox/archiva-repository-assembler/src/main/mdo/descriptor.mdo diff --git a/archiva-sandbox/archiva-repository-assembler/pom.xml b/archiva-sandbox/archiva-repository-assembler/pom.xml new file mode 100644 index 000000000..be8c763ce --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/pom.xml @@ -0,0 +1,63 @@ + + + + + + + org.apache.maven.archiva + archiva + 1.0-SNAPSHOT + + 4.0.0 + archiva-repository-assembler + Archiva Repository Assembler + 1.0-SNAPSHOT + + + + org.codehaus.plexus + plexus-maven-plugin + + + create-component-descriptor + + descriptor + + + + + + + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-artifact-manager + + + org.apache.maven.archiva + archiva-utils + + + org.codehaus.plexus + plexus-container-default + + + diff --git a/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/pom.xml b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/pom.xml new file mode 100644 index 000000000..2057c7ebb --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + org.apache.maven.archiva.repository.test + repository-assembly + jar + 1.0-SNAPSHOT + Maven Quick Start Archetype + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + + + + maven-assembly-plugin + + src/assemble/bin.xml + assembly + + + + + diff --git a/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/assemble/bin.xml b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/assemble/bin.xml new file mode 100644 index 000000000..74a8ffd8a --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/assemble/bin.xml @@ -0,0 +1,14 @@ + + bin + + zip + + + + repo + + junit:junit + + + + diff --git a/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/main/java/org/apache/maven/plugin/assembly/test/App.java b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/main/java/org/apache/maven/plugin/assembly/test/App.java new file mode 100644 index 000000000..4fa5eb20c --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/main/java/org/apache/maven/plugin/assembly/test/App.java @@ -0,0 +1,13 @@ +package org.apache.maven.plugin.assembly.test; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java new file mode 100644 index 000000000..4483db746 --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/it/repository-assembly/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java @@ -0,0 +1,38 @@ +package org.apache.maven.plugin.assembly.test; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/DefaultRepositoryAssembler.java b/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/DefaultRepositoryAssembler.java new file mode 100644 index 000000000..38d3ac7b0 --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/DefaultRepositoryAssembler.java @@ -0,0 +1,363 @@ +package org.apache.maven.archiva.repository.assembly; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.IOUtil; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.lang.reflect.Field; +import java.security.NoSuchAlgorithmException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; + +/** + * @author Jason van Zyl + * @plexus.component role="org.apache.maven.archiva.RepositoryAssembler" role-hint="default" + */ + +// todo will need to pop the processed project cache using reflection +public class DefaultRepositoryAssembler + extends AbstractLogEnabled + implements RepositoryAssembler +{ + protected static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" ); + + protected static final String UTC_TIMESTAMP_PATTERN = "yyyyMMddHHmmss"; + + /** + * @plexus.requirement + */ + protected ArtifactFactory artifactFactory; + + /** + * @plexus.requirement + */ + protected ArtifactResolver artifactResolver; + + /** + * @plexus.requirement + */ + protected ArtifactRepositoryLayout repositoryLayout; + + /** + * @plexus.requirement + */ + protected ArtifactRepositoryFactory artifactRepositoryFactory; + + /** + * @plexus.requirement + */ + protected ArtifactMetadataSource metadataSource; + + public void assemble( Set artifacts, + File localRepository, + Set remoteRepositories, + ArtifactRepositoryLayout layout, + File repositoryDirectory ) + throws RepositoryAssemblyException + { + + } + + public void assemble( Set artifacts, + File localRepository, + Set remoteRepositories, + ArtifactFilter artifactFilter, + ArtifactRepositoryLayout layout, + File repositoryDirectory ) + throws RepositoryAssemblyException + { + ArtifactRepository targetRepository = createLocalRepository( repositoryDirectory ); + + ArtifactResolutionResult result = null; + + Artifact originatingArtifact = null; + + ArtifactRepository localRepo = createLocalRepository( localRepository ); + try + { + // i have to get everything first as a filter or transformation here + // doesn't seem to work + // to align everything. If I use a filter to change the version on + // the fly then I get the + // I get JARs but no POMs, and in some directories POMs with no + // JARs. + + // FIXME I'm not getting runtime dependencies here + result = artifactResolver.resolveTransitively( artifacts, originatingArtifact, + new ArrayList( remoteRepositories ), + localRepo, metadataSource ); + } + catch ( ArtifactResolutionException e ) + { + throw new RepositoryAssemblyException( "Error resolving artifacts: " + e.getMessage(), e ); + } + catch ( ArtifactNotFoundException e ) + { + throw new RepositoryAssemblyException( "Error resolving artifacts: " + e.getMessage(), e ); + } + + assembleRepositoryArtifacts( result, artifactFilter, localRepo, targetRepository, repositoryDirectory ); + + ArtifactRepository centralRepository = findCentralRepository( project ); + + assembleRepositoryMetadata( result, artifactFilter, centralRepository, targetRepository ); + } + + private void assembleRepositoryArtifacts( ArtifactResolutionResult result, + ArtifactFilter filter, + List remoteRepositories, + ArtifactRepository localRepository, + ArtifactRepository targetRepository, + File repositoryDirectory ) + throws RepositoryAssemblyException + { + try + { + // Now that we have the graph, let's try to align it to versions + // that we want and remove + // the assembly we previously populated. + FileUtils.deleteDirectory( repositoryDirectory ); + + FileUtils.mkdir( repositoryDirectory.getAbsolutePath() ); + + for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) + { + Artifact a = (Artifact) i.next(); + + if ( filter.include( a ) ) + { + // We need to flip it back to not being resolved so we can + // look for it again! + a.setResolved( false ); + + artifactResolver.resolve( a, remoteRepositories, localRepository ); + + File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( a ) ); + FileUtils.copyFile( a.getFile(), targetFile ); + + writeChecksums( targetFile ); + + if ( !"pom".equals( a.getType() ) ) + { + a = artifactFactory.createProjectArtifact( a.getGroupId(), a.getArtifactId(), a.getVersion() ); + + MavenProject p = projectBuilder.buildFromRepository( a, project.getRemoteArtifactRepositories(), + localRepository ); + + do + { + a = artifactFactory.createProjectArtifact( p.getGroupId(), p.getArtifactId(), p + .getVersion() ); + + setAlignment( a, groupVersionAlignments ); + + File sourceFile = new File( localRepository.getBasedir(), localRepository.pathOf( a ) ); + + if ( !sourceFile.exists() ) + { + break; + } + + targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( a ) ); + + FileUtils.copyFile( sourceFile, targetFile ); + + writeChecksums( targetFile ); + + p = p.getParent(); + } + while ( p != null ); + } + } + } + } + catch ( ArtifactResolutionException e ) + { + throw new RepositoryAssemblyException( "Error resolving artifacts: " + e.getMessage(), e ); + } + catch ( ArtifactNotFoundException e ) + { + throw new RepositoryAssemblyException( "Error resolving artifacts: " + e.getMessage(), e ); + } + catch ( IOException e ) + { + throw new RepositoryAssemblyException( "Error writing artifact metdata.", e ); + } + } + + private void assembleRepositoryMetadata( ArtifactResolutionResult result, + ArtifactFilter filter, + ArtifactRepository centralRepository, + ArtifactRepository targetRepository ) + throws RepositoryAssemblyException + { + for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) + { + Artifact a = (Artifact) i.next(); + + if ( filter.include( a ) ) + { + Versioning v = new Versioning(); + + v.setRelease( a.getVersion() ); + + v.setLatest( a.getVersion() ); + + v.addVersion( a.getVersion() ); + + v.setLastUpdated( getUtcDateFormatter().format( new Date() ) ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( a, v ); + String path = targetRepository.pathOfLocalRepositoryMetadata( metadata, centralRepository ); + File metadataFile = new File( targetRepository.getBasedir(), path ); + + MetadataXpp3Writer metadataWriter = new MetadataXpp3Writer(); + + Writer writer = null; + try + { + writer = new FileWriter( metadataFile ); + + metadataWriter.write( writer, metadata.getMetadata() ); + } + catch ( IOException e ) + { + throw new RepositoryAssemblyException( "Error writing artifact metdata.", e ); + } + finally + { + IOUtil.close( writer ); + } + + try + { + writeChecksums( metadataFile ); + + File metadataFileRemote = new File( targetRepository.getBasedir(), targetRepository + .pathOfRemoteRepositoryMetadata( metadata ) ); + + FileUtils.copyFile( metadataFile, metadataFileRemote ); + + FileUtils.copyFile( new File( metadataFile.getParentFile(), metadataFile.getName() + ".sha1" ), + new File( metadataFileRemote.getParentFile(), + metadataFileRemote.getName() + ".sha1" ) ); + + FileUtils.copyFile( new File( metadataFile.getParentFile(), metadataFile.getName() + ".md5" ), + new File( metadataFileRemote.getParentFile(), + metadataFileRemote.getName() + ".md5" ) ); + } + catch ( IOException e ) + { + throw new RepositoryAssemblyException( "Error writing artifact metdata.", e ); + } + } + } + } + + private void writeChecksums( File file ) + throws IOException, RepositoryAssemblyException + { + try + { + String md5 = DigestUtils.createChecksum( file, "MD5" ); + String sha1 = DigestUtils.createChecksum( file, "SHA-1" ); + + FileUtils.fileWrite( new File( file.getParentFile(), file.getName() + ".md5" ).getAbsolutePath(), md5 + .toLowerCase() ); + FileUtils.fileWrite( new File( file.getParentFile(), file.getName() + ".sha1" ).getAbsolutePath(), sha1 + .toLowerCase() ); + } + catch ( NoSuchAlgorithmException e ) + { + throw new RepositoryAssemblyException( "Unable to get write checksums: " + e.getMessage(), e ); + } + } + + protected static DateFormat getUtcDateFormatter() + { + DateFormat utcDateFormatter = new SimpleDateFormat( UTC_TIMESTAMP_PATTERN ); + utcDateFormatter.setTimeZone( UTC_TIME_ZONE ); + return utcDateFormatter; + } + + protected ArtifactRepository createLocalRepository( File directory ) + { + String localRepositoryUrl = directory.getAbsolutePath(); + + if ( !localRepositoryUrl.startsWith( "file:" ) ) + { + localRepositoryUrl = "file://" + localRepositoryUrl; + } + + return createRepository( "local", localRepositoryUrl, false, true, + ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN ); + } + + public ArtifactRepository createRepository( String repositoryId, + String repositoryUrl, + boolean offline, + boolean updateSnapshots, + String globalChecksumPolicy ) + { + ArtifactRepository localRepository = + new DefaultArtifactRepository( repositoryId, repositoryUrl, repositoryLayout ); + + boolean snapshotPolicySet = false; + + if ( offline ) + { + snapshotPolicySet = true; + } + + if ( !snapshotPolicySet && updateSnapshots ) + { + artifactRepositoryFactory.setGlobalUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS ); + } + + artifactRepositoryFactory.setGlobalChecksumPolicy( globalChecksumPolicy ); + + return localRepository; + } +} diff --git a/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssembler.java b/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssembler.java new file mode 100644 index 000000000..2dcfdb1ba --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssembler.java @@ -0,0 +1,74 @@ +package org.apache.maven.archiva.repository.assembly; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; + +import java.io.File; +import java.util.Set; + +/** + * Component responsible for writing out {@link Set}s of artifacts to a local directory. The resultant repository + * structure should be suitable for use as a remote repository. + * + * @author Jason van Zyl + */ +public interface RepositoryAssembler +{ + String ROLE = RepositoryAssembler.class.getName(); + + /** + * Write out a set of {@link org.apache.maven.artifact.Artifact}s, which are found in a + * specified local repository and remote repositories, with a given {@link ArtifactRepositoryLayout} + * to a specified directory. + * + * @param artifacts Artifacts to be written out to disk. + * @param localRepository Local repository to check for artifacts in the provided set. + * @param remoteRepositories Remote repositories to check for artifacts in the provided set. + * @param repositoryLayout The repository layout to use for the target repository. + * @param repositoryDirectory The directory to write out the repository in. + * @throws RepositoryAssemblyException + */ + public void assemble( Set artifacts, + File localRepository, + Set remoteRepositories, + ArtifactRepositoryLayout repositoryLayout, + File repositoryDirectory ) + throws RepositoryAssemblyException; + + /** + * Write out a set of {@link org.apache.maven.artifact.Artifact}s, which are found in a + * specified local repository and remote repositories, with a given {@link ArtifactRepositoryLayout} + * to a specified directory. + * + * @param artifacts Artifacts to be written out to disk. + * @param localRepository Local repository to check for artifacts in the provided set. + * @param remoteRepositories Remote repositories to check for artifacts in the provided set. + * @param artifactFilter Filter to use while processing artifacts. Can change or restrict given artifacts. + * @param repositoryLayout The repository layout to use for the target repository. + * @param repositoryDirectory The directory to write out the repository in. + * @throws RepositoryAssemblyException + */ + public void assemble( Set artifacts, + File localRepository, + Set remoteRepositories, + ArtifactFilter artifactFilter, + ArtifactRepositoryLayout repositoryLayout, + File repositoryDirectory ) + throws RepositoryAssemblyException; +} diff --git a/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssemblyException.java b/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssemblyException.java new file mode 100644 index 000000000..c0d39ccc3 --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/main/java/org/apache/maven/archiva/repository/assembly/RepositoryAssemblyException.java @@ -0,0 +1,39 @@ +package org.apache.maven.archiva.repository.assembly; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @author Jason van Zyl + */ +public class RepositoryAssemblyException + extends Exception +{ + public RepositoryAssemblyException( String string ) + { + super( string ); + } + + public RepositoryAssemblyException( String string, Throwable throwable ) + { + super( string, throwable ); + } + + public RepositoryAssemblyException( Throwable throwable ) + { + super( throwable ); + } +} diff --git a/archiva-sandbox/archiva-repository-assembler/src/main/mdo/descriptor.mdo b/archiva-sandbox/archiva-repository-assembler/src/main/mdo/descriptor.mdo new file mode 100644 index 000000000..913454022 --- /dev/null +++ b/archiva-sandbox/archiva-repository-assembler/src/main/mdo/descriptor.mdo @@ -0,0 +1,793 @@ + + + + + + + + assembly + Assembly + + + Maven Assembly Plugin relies on the provided assembly descriptors to dictate + its execution. Although there are already prefabricated descriptors available + for use, they can only suffice some of the common assembly requirements. +

+

+ So in order for you to customize the way the Assembly Plugin creates your + assemblies, you need to know how to use the Assembly Descriptor. +

+

+ This descriptor specifies the type of assembly archive to create, the contents + of the assembly, and the ways in which dependencies or its modules are bundled + with an assembly. +

+ ]]> +
+ + + package + org.apache.maven.plugins.assembly.model + + + + + Assembly + + + + 1.0.0+ + + + id + 1.0.0+ + true + String + + Sets the id of this assembly. This is a symbolic name for a + particular assembly of files from this project. Also, aside from + being used to distinctly name the assembled package by attaching + its value to the generated archive, the id is used as your + artifact's classifier when deploying. + + + + formats + 1.0.0+ + true + + String + * + + + +
  • "zip" - Creates a ZIP file format
  • +
  • "gz" - Creates a GZIP format
  • +
  • "tar" - Creates a TAR format
  • +
  • "tar.gz" - Creates a gzip'd TAR format
  • +
  • "tar.bz2 - Creates a bzip'd TAR format
  • + + ]]> +
    +
    + + includeBaseDirectory + boolean + true + + Includes a base directory in the final archive. For example, + if you are creating an assembly named "your-app", setting + includeBaseDirectory to true will create an archive that + includes this base directory. If this option is set to false + the archive created will unzip its content to the current + directory. Default value is true. + + + + baseDirectory + 1.1.0 + String + + Sets the base directory of the resulting assembly archive. If this is not + set and includeBaseDirectory == true, ${project.build.finalName} will be used instead. + + + + includeSiteDirectory + boolean + false + + Includes a site directory in the final archive. The site directory + location of a project is determined by the siteDirectory parameter + of the Assembly Plugin. Default value is false. + + + + moduleSets + 1.0.0+ + + ModuleSet + * + + + + + + + fileSets + 1.0.0+ + + FileSet + * + + + + + + + files + 1.0.0+ + + FileItem + * + + + + + + + dependencySets + 1.0.0+ + + DependencySet + * + + + + + + + repositories + 1.0.0+ + + Repository + * + + + + + + + componentDescriptors + 1.0.0+ + + String + * + + + + descriptor components for more information. A + componentDescriptor is specified by providing one or more of + <componentDescriptor> subelements. + ]]> + + +
    +
    + + + + SetBase + 1.0.0+ + + + useDefaultExcludes + 1.1.0 + boolean + true + + Whether standard exclusion patterns, such as those matching CVS and Subversion + metadata files, should be used when calculating the files affected by this set. + For backward compatibility, the default value is true. + + + + outputDirectory + 1.0.0+ + String + + Sets the output directory relative to the root + of the root directory of the assembly. For example, + "log" will put the specified files in the log directory. + + + + includes + 1.0.0+ + + String + * + + + + + + + excludes + 1.0.0+ + + String + * + + + + + + + fileMode + 1.0.0+ + String + 0644 + + (more on unix-style permissions) + ]]> + + + + directoryMode + 1.0.0+ + String + 0755 + + (more on unix-style permissions) + ]]> + + + + + + FileSet + 1.0.0+ + SetBase + + A fileSet allows the inclusion of groups of files into the assembly. + + + + directory + 1.0.0+ + String + + Sets the absolute or relative location from the module's + directory. For example, "src/main/bin" would select this + subdirectory of the project in which this dependency is defined. + + true + + + lineEnding + 1.0.0+ + String + + +
  • "keep" - Preserve all line endings
  • +
  • "unix" - Use Unix-style line endings
  • +
  • "lf" - Use a single line-feed line endings
  • +
  • "dos" - Use DOS-style line endings
  • +
  • "crlf" - Use Carraige-return, line-feed line endings
  • + + ]]> +
    +
    +
    +
    + + FileItem + 1.0.0+ + + A file allows individual file inclusion with the option to change + the destination filename not supported by fileSets. + + + + source + 1.0.0+ + String + true + + Sets the absolute or relative path from the module's directory + of the file to be included in the assembly. + + + + outputDirectory + 1.0.0+ + String + false + + Sets the output directory relative to the root + of the root directory of the assembly. For example, + "log" will put the specified files in the log directory. + + + + destName + 1.0.0+ + String + + Sets the destination filename in the outputDirectory. + Default is the same name as the source's file. + + + + fileMode + 1.0.0+ + String + 0644 + + (more on unix-style permissions) + ]]> + + + + lineEnding + 1.0.0+ + String + + +
  • "keep" - Preserve all line endings
  • +
  • "unix" - Use Unix-style line endings
  • +
  • "lf" - Use a single line-feed line endings
  • +
  • "dos" - Use DOS-style line endings
  • +
  • "crlf" - Use Carraige-return, line-feed line endings
  • + + ]]> +
    +
    + + filtered + 1.0.0+ + boolean + + Sets whether to determine if the file is filtered. + + +
    +
    + + + DependencySet + 1.0.0+ + SetBase + + A dependencySet allows inclusion and exclusion of project dependencies + in the assembly. + + + + outputFileNameMapping + 1.0.0+ + String + ${artifactId}-${version}.${extension} + + Sets the mapping pattern for all dependencies included in this + assembly. Default is ${artifactId}-${version}.${extension}. + + + + unpack + boolean + false + + If set to true, this property will unpack all dependencies + into the specified output directory. When set to false + dependencies will be includes as archives (jars). Can only unpack + jar, zip, tar.gz, and tar.bz archives. Default value is false. + + + + scope + 1.0.0+ + String + runtime + true + + Sets the dependency scope for this dependencySet. + Default scope value is "runtime". + + + + + + + ModuleSet + + NOTE: When using <moduleSets> from the command-line, it + is required to pass first the package phase by doing: "mvn package + assembly:assembly". This bug/issue is scheduled to be addressed by Maven 2.1. + ]]> + + 1.0.0+ + + + includeSubModules + 1.1.0 + boolean + true + + If set to false, the plugin will exclude sub-modules from processing in this ModuleSet. + Otherwise, it will process all sub-modules, each subject to include/exclude rules. + Default value is true. + + + + includes + 1.0.0+ + + + + + String + * + + + + excludes + 1.0.0+ + + + + + String + * + + + + sources + 1.0.0+ + + When this is present, the plugin will include the source files of + the included modules from this set in the resulting assembly. + + + ModuleSources + + + + binaries + 1.0.0+ + + When this is present, the plugin will include the binaries of the + included modules from this set in the resulting assembly. + + + ModuleBinaries + + + + + + + ModuleSources + 1.0.0+ + SetBase + + Contains configuration options for including the source files of a + project module in an assembly. + + + + fileSets + 1.1.0 + + FileSet + * + + + + + + + includeModuleDirectory + 1.1.0 + boolean + true + + + + + + excludeSubModuleDirectories + 1.1.0 + boolean + true + + + + + + outputDirectoryMapping + 1.1.0 + String + ${artifactId} + + Sets the mapping pattern for all module base-directories included in this assembly. + NOTE: This field is only used if includeModuleDirectory == true. + Default is the module's ${artifactId}. + + + + + + + ModuleBinaries + 1.0.0+ + SetBase + + Contains configuration options for including the binary files of a + project module in an assembly. + + + + includeDependencies + 1.0.0+ + boolean + false + + If set to true, the plugin will include the direct and transitive dependencies of + of the project modules included here. Otherwise, it will only include the module + packages only. Default value is false. + + + + dependencySets + 1.1.0 + + DependencySet + * + + + + + + + unpack + boolean + true + + If set to true, this property will unpack all module packages + into the specified output directory. When set to false + module packages will be included as archives (jars). + Default value is true. + + + + outputFileNameMapping + 1.0.0+ + String + ${artifactId}-${version}.${extension} + + Sets the mapping pattern for all dependencies included + in this assembly. + Default is ${artifactId}-${version}.${extension}. + + + + + + + Repository + 1.0.0+ + SetBase + + NOTE: Currently, only artifacts from the central repository + are allowed. + ]]> + + + + includeMetadata + 1.0.0+ + boolean + false + + If set to true, this property will trigger the creation of repository + metadata which will allow the repository to be used as a functional remote + repository. Default value is false. + + + + groupVersionAlignments + 1.0.0+ + + + + + GroupVersionAlignment + * + + + + scope + 1.1.0 + String + runtime + true + + Specifies the scope for artifacts included in this repository. + Default scope value is "runtime". + + + + + + GroupVersionAlignment + 1.0.0+ + + Allows a group of artifacts to be aligned to a specified version. + + + + id + 1.0.0+ + String + + The groupId of the artifacts for which you want to align the + versions. + + + + version + 1.0.0+ + String + + The version you want to align this group to. + + + + excludes + 1.0.0+ + + + + + String + * + + + + +
    +