Package adams.flow.maven
Class ClassListerMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- adams.flow.maven.AbstractAdamsMojo
-
- adams.flow.maven.ClassListerMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="classlister", threadSafe=false, defaultPhase=COMPILE, requiresDependencyResolution=COMPILE) public class ClassListerMojo extends AbstractAdamsMojo
Outputs the classes or packages as props files.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
-
Fields inherited from class adams.flow.maven.AbstractAdamsMojo
NEWLINE
-
-
Constructor Summary
Constructors Constructor Description ClassListerMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addResource(org.apache.maven.model.Resource resource)
Adds the supplied Resource to the project using the appropriate scope (i.e.protected void
execute(List<String> cmd)
Executes the command.protected File
getOutputDirectory()
Retrieves the directory where the generated files should be written to.protected boolean
isReGenerationRequired()
Java generation is required if any of the file products is outdated/stale.protected boolean
performExecution()
Implement this method to perform this Mojo's execution.protected boolean
shouldExecutionBeSkipped()
Implement this method to check if this AbstractAdamsMojo should skip executing altogether.-
Methods inherited from class adams.flow.maven.AbstractAdamsMojo
execute, getBuildContext, getClasspath, getExecution, getProject, logSystemPropertiesAndBasedir, warnAboutIncorrectPluginConfiguration
-
-
-
-
Method Detail
-
shouldExecutionBeSkipped
protected boolean shouldExecutionBeSkipped()
Implement this method to check if this AbstractAdamsMojo should skip executing altogether.- Specified by:
shouldExecutionBeSkipped
in classAbstractAdamsMojo
- Returns:
true
to indicate that this AbstractAdamsMojo should bail out of its execute method.
-
addResource
protected void addResource(org.apache.maven.model.Resource resource)
Adds the supplied Resource to the project using the appropriate scope (i.e. resource or testResource) depending on the exact implementation of this AbstractAdamsMojo.- Specified by:
addResource
in classAbstractAdamsMojo
- Parameters:
resource
- The resource to add.
-
isReGenerationRequired
protected boolean isReGenerationRequired()
Java generation is required if any of the file products is outdated/stale.
- Specified by:
isReGenerationRequired
in classAbstractAdamsMojo
- Returns:
true
to indicate that this AbstractAdamsMojo should be run since its generated files were either stale or not present, andfalse
otherwise.
-
execute
protected void execute(List<String> cmd) throws org.apache.maven.plugin.MojoExecutionException
Executes the command.- Parameters:
cmd
- the command to execute- Throws:
org.apache.maven.plugin.MojoExecutionException
- if command exits with code != 0 or an exception occurred
-
performExecution
protected boolean performExecution() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
Implement this method to perform this Mojo's execution. This method will only be called if
!shouldExecutionBeSkipped() && isReGenerationRequired()
.- Specified by:
performExecution
in classAbstractAdamsMojo
- Returns:
true
if the timestamp of the stale file should be updated.- Throws:
org.apache.maven.plugin.MojoExecutionException
- if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.org.apache.maven.plugin.MojoFailureException
- if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" message to be displayed.
-
getOutputDirectory
protected File getOutputDirectory()
Retrieves the directory where the generated files should be written to.- Specified by:
getOutputDirectory
in classAbstractAdamsMojo
- Returns:
- the directory where the generated files should be written to.
-
-