You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/12 06:25:55 UTC
svn commit: r314777 -
/maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
Author: brett
Date: Tue Oct 11 21:25:51 2005
New Revision: 314777
URL: http://svn.apache.org/viewcvs?rev=314777&view=rev
Log:
PR: MNG-958
Submitted by: Johnny R. Ruiz III
Reviewed by: Brett Porter
optionally include site in assembly
Modified:
maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
Modified: maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java?rev=314777&r1=314776&r2=314777&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java Tue Oct 11 21:25:51 2005
@@ -91,7 +91,7 @@
* @required
* @readonly
*/
- private String basedir;
+ private File basedir;
/**
* The Maven Project.
@@ -119,6 +119,21 @@
private File tempRoot;
/**
+ * Directory for site generated.
+ *
+ * @parameter expression="${project.build.directory}/site"
+ * @readonly
+ */
+ private File siteDirectory;
+
+ /**
+ * Set to true to include the site generated by site:site goal.
+ *
+ * @parameter expression="${includeSite}" default-value="false"
+ */
+ private boolean includeSite;
+
+ /**
* Create the binary distribution.
*
* @throws MojoExecutionException
@@ -226,6 +241,12 @@
{
IOUtil.close( r );
}
+
+ if ( includeSite )
+ {
+ includeSiteInAssembly( assembly );
+ }
+
return assembly;
}
@@ -353,7 +374,7 @@
if ( directory == null )
{
- directory = basedir;
+ directory = basedir.getAbsolutePath();
if ( output == null )
{
output = "";
@@ -611,5 +632,23 @@
return lineEnding;
}
+ private void includeSiteInAssembly( Assembly assembly )
+ throws MojoExecutionException
+ {
+ if ( !siteDirectory.exists() )
+ {
+ throw new MojoExecutionException(
+ "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 );
+ }
}