org.codehaus.mojo.javascript
Class CompileMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.javascript.CompileMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
TitaniumCompileMojo, WarPackageMojo

public class CompileMojo
extends org.apache.maven.plugin.AbstractMojo

Goal which assemble javascript sources into the packaging directory. An optional assembler descriptor can be set to configure scripts to be merged. Other scripts are simply copied to the output directory.

Author:
Nicolas De Loof
Is defined by the goal name:
compile
Is bound to the specified phase of the standard build lifecycle:
compile
Requires the dependencies in this specified scope:
compile

Field Summary
protected  AssemblerReaderManager assemblerReaderManager
           
protected static java.lang.String[] DEFAULT_INCLUDES
          default includes pattern
protected  int depsCount
           
protected  java.io.File depsDirectory
          The folder where javascript dependencies are extracted and taken during assembling
protected  java.io.File descriptor
          Descriptor for the strategy to assemble individual scripts sources into destination.
protected  java.lang.String descriptorFormat
          Descriptor file format (default or jsbuilder)
protected  java.lang.String[] excludes
          Exclusion pattern.
protected  java.lang.String[] includes
          Inclusion pattern.
protected  JavascriptArtifactManager javascriptArtifactManager
           
protected  java.io.File outputDirectory
          The output directory of the assembled js file.
protected  org.apache.maven.project.MavenProject project
          The maven project.
protected  java.io.File sourceDirectory
          Location of the source files.
protected  boolean useArtifactId
          For dependencies, if true, create a folder named by the artifactId while unpacking
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
CompileMojo()
           
 
Method Summary
protected  int appendScriptFile(java.io.File dir, org.codehaus.plexus.util.DirectoryScanner scanner, java.io.PrintWriter writer, java.lang.String scriptInclude, java.util.Set merged)
           
protected  java.util.Set assemble()
          Honor the assembly rules to build merged scripts from individual ones.
protected  java.util.Set assemble(Assembler assembler)
           
protected  void copyUnmerged(java.util.Set merged)
           
 void execute()
           
protected  JavascriptArtifactManager getJavascriptArtifactManager()
           
protected  org.apache.maven.project.MavenProject getProject()
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INCLUDES

protected static final java.lang.String[] DEFAULT_INCLUDES
default includes pattern


project

protected org.apache.maven.project.MavenProject project
The maven project.

Is defined by:
expression:
${project}
Is readonly.
Is required.

sourceDirectory

protected java.io.File sourceDirectory
Location of the source files.

Is defined by:
default-value:
${basedir}/src/main/javascript

outputDirectory

protected java.io.File outputDirectory
The output directory of the assembled js file.

Is defined by:
default-value:
${project.build.outputDirectory}

depsDirectory

protected java.io.File depsDirectory
The folder where javascript dependencies are extracted and taken during assembling

Is defined by:
default-value:
${project.build.directory}/javascript-dependency

useArtifactId

protected boolean useArtifactId
For dependencies, if true, create a folder named by the artifactId while unpacking

Is defined by:

excludes

protected java.lang.String[] excludes
Exclusion pattern.

Is defined by:

includes

protected java.lang.String[] includes
Inclusion pattern.

Is defined by:

assemblerReaderManager

protected AssemblerReaderManager assemblerReaderManager
Is a Plexus component defined by:

descriptor

protected java.io.File descriptor
Descriptor for the strategy to assemble individual scripts sources into destination.

Is defined by:
default-value:
${basedir}/src/assembler/${project.artifactId}.xml

descriptorFormat

protected java.lang.String descriptorFormat
Descriptor file format (default or jsbuilder)

Is defined by:

javascriptArtifactManager

protected JavascriptArtifactManager javascriptArtifactManager
Is a Plexus component defined by:

depsCount

protected int depsCount
Constructor Detail

CompileMojo

public CompileMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

copyUnmerged

protected void copyUnmerged(java.util.Set merged)
                     throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

assemble

protected java.util.Set assemble()
                          throws org.apache.maven.plugin.MojoExecutionException
Honor the assembly rules to build merged scripts from individual ones.

Returns:
a set of all script merged, to be skiped from the target directory.
Throws:
org.apache.maven.plugin.MojoExecutionException

assemble

protected java.util.Set assemble(Assembler assembler)
                          throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

appendScriptFile

protected int appendScriptFile(java.io.File dir,
                               org.codehaus.plexus.util.DirectoryScanner scanner,
                               java.io.PrintWriter writer,
                               java.lang.String scriptInclude,
                               java.util.Set merged)
                        throws java.io.IOException
Throws:
java.io.IOException

getProject

protected org.apache.maven.project.MavenProject getProject()
Returns:
the project

getJavascriptArtifactManager

protected JavascriptArtifactManager getJavascriptArtifactManager()
Returns:
the javascript artifact manager


Copyright © 2011 SOFTEC sa. All Rights Reserved.