Author: aramirez
Date: Sun Mar 19 16:46:13 2006
New Revision: 387089
URL: http://svn.apache.org/viewcvs?rev=387089&view=rev
Log:
PR: MASSEMBLY-56
Submitted By: Gilles Scokart
-Added directory-inline mojo
Added:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java
Modified:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java
Added:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java?rev=387089&view=auto
==============================================================================
---
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
(added)
+++
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AbstractDirectoryMojo.java
Sun Mar 19 16:46:13 2006
@@ -0,0 +1,78 @@
+package org.apache.maven.plugin.assembly;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import
org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolationException;
+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 org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+public abstract class AbstractDirectoryMojo
+ extends AbstractAssemblyMojo {
+
+
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ List assemblies;
+ try
+ {
+ assemblies = readAssemblies();
+ }
+ catch( AssemblyInterpolationException e )
+ {
+ throw new MojoExecutionException( "Failed to interpolate assembly
descriptor", e );
+ }
+ for ( Iterator i = assemblies.iterator(); i.hasNext(); )
+ {
+ Assembly assembly = (Assembly) i.next();
+ createDirectory( assembly );
+ }
+ }
+
+ private void createDirectory( Assembly assembly )
+ throws MojoExecutionException, MojoFailureException
+ {
+ String fullName = finalName;
+
+ if ( appendAssemblyId )
+ {
+ fullName = fullName + "-" + assembly.getId();
+ }
+ else if ( getClassifier() != null )
+ {
+ fullName = fullName + "-" + getClassifier();
+ }
+
+ 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 );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error creating assembly", e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new MojoExecutionException( "Error creating assembly", e );
+ }
+ }
+
+}
Added:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java?rev=387089&view=auto
==============================================================================
---
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java
(added)
+++
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryInlineMojo.java
Sun Mar 19 16:46:13 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.plugin.assembly;
+
+import org.apache.maven.project.MavenProject;
+
+/*
+ * 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.
+ */
+
+
+
+/**
+ * Assemble an application bundle or distribution from an assembly descriptor
without
+ * launching a parallel lifecycle build.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Gilles Scokart</a>
+ *
+ * @goal directory-inline
+ * @requiresDependencyResolution test
+ * @aggregator
+ *
+ */
+public class DirectoryInlineMojo
+ extends AbstractDirectoryMojo
+{
+ protected MavenProject getExecutedProject()
+ {
+ return project;
+ }
+
+}
Modified:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java?rev=387089&r1=387088&r2=387089&view=diff
==============================================================================
---
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java
(original)
+++
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/DirectoryMojo.java
Sun Mar 19 16:46:13 2006
@@ -1,5 +1,7 @@
package org.apache.maven.plugin.assembly;
+import org.apache.maven.project.MavenProject;
+
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
@@ -16,29 +18,16 @@
* limitations under the License.
*/
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import
org.apache.maven.plugin.assembly.interpolation.AssemblyInterpolationException;
-import org.apache.maven.plugins.assembly.model.Assembly;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.archiver.Archiver;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
/**
* Assemble an application bundle or distribution.
*
* @goal directory
* @requiresDependencyResolution test
* @execute phase="package"
+ * @aggregator
*/
-public class DirectoryMojo
- extends AbstractAssemblyMojo
+public class DirectoryMojo
+ extends AbstractDirectoryMojo
{
/**
* Get the executed project from the forked lifecycle.
@@ -50,64 +39,6 @@
protected MavenProject getExecutedProject()
{
return executedProject;
- }
-
- public void execute()
- throws MojoExecutionException, MojoFailureException
- {
- List assemblies;
- try
- {
- assemblies = readAssemblies();
- }
- catch( AssemblyInterpolationException e )
- {
- throw new MojoExecutionException( "Failed to interpolate assembly
descriptor", e );
- }
- for ( Iterator i = assemblies.iterator(); i.hasNext(); )
- {
- Assembly assembly = (Assembly) i.next();
- createDirectory( assembly );
- }
- }
-
- private void createDirectory( Assembly assembly )
- throws MojoExecutionException, MojoFailureException
- {
- String fullName = finalName;
-
- if ( appendAssemblyId )
- {
- fullName = fullName + "-" + assembly.getId();
- }
- else if ( getClassifier() != null )
- {
- fullName = fullName + "-" + getClassifier();
- }
-
- 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 );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error creating assembly", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new MojoExecutionException( "Error creating assembly", e );
- }
}
}