Package io.protostuff.mojo
Class ProtoCompilerMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- io.protostuff.mojo.ProtoCompilerMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="compile", configurator="include-project-dependencies", requiresDependencyResolution=COMPILE_PLUS_RUNTIME) public class ProtoCompilerMojo extends org.apache.maven.plugin.AbstractMojoCompiles proto files to java/gwt/etc.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FilebaseDirMaven module base directoryprivate booleancacheProtosWhentrue, the protos are cached for re-use.private org.apache.maven.plugin.MojoExecutionexecutionprivate booleanforceMojoExecutionUsually most of protostuff mojos will not get executed on parent poms (i.e.static java.lang.StringGENERATE_TEST_SOURCES_PHASEprotected java.io.FilemodulesFileThe properties file that contains the modulesprotected java.io.FileoutputBaseDirIf not specified, the directory where the file is located will be used as its base dir.protected org.apache.maven.project.MavenProjectprojectThe current Maven project.protected java.util.PropertiespropertiesPlugin properties that are passed to the compilerprotected ProtoModule[]protoModulesThe modules to generate code fromprivate booleanskipWhentrue, skip the execution.protected java.io.FilesourceBaseDirIf not specified, the directory where the file is located will be used as its base dir.private java.util.PropertiessystemPropertiesBackup
-
Constructor Summary
Constructors Constructor Description ProtoCompilerMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()private voidresetSystemProperties()private voidsetSystemProperties()protected booleanskipMojo()Determine if the mojo execution should get skipped.private voidupdateRelativeOutputLocation(ProtoModule m)
-
-
-
Field Detail
-
GENERATE_TEST_SOURCES_PHASE
public static final java.lang.String GENERATE_TEST_SOURCES_PHASE
- See Also:
- Constant Field Values
-
project
@Parameter(property="project", required=true, readonly=true) protected org.apache.maven.project.MavenProject projectThe current Maven project.
-
skip
@Parameter(property="protostuff.compiler.skip", defaultValue="false") private boolean skipWhentrue, skip the execution.- Since:
- 1.0.1
-
cacheProtos
@Parameter(property="protostuff.compiler.cache_protos", defaultValue="false") private boolean cacheProtosWhentrue, the protos are cached for re-use. This matters when a certain proto is also used/imported by other modules.- Since:
- 1.0.5
-
forceMojoExecution
@Parameter(property="protostuff.compiler.force", defaultValue="false", required=true) private boolean forceMojoExecutionUsually most of protostuff mojos will not get executed on parent poms (i.e. projects with packaging type 'pom'). Setting this parameter totruewill force the execution of this mojo, even if it would usually get skipped in this case.- Since:
- 1.0.1
-
modulesFile
@Parameter protected java.io.File modulesFile
The properties file that contains the modules
-
sourceBaseDir
@Parameter protected java.io.File sourceBaseDir
If not specified, the directory where the file is located will be used as its base dir.This is only relevent when
is provided.- Since:
- 1.0.8
-
outputBaseDir
@Parameter protected java.io.File outputBaseDir
If not specified, the directory where the file is located will be used as its base dir.This is only relevent when
is provided.- Since:
- 1.0.8
-
protoModules
@Parameter protected ProtoModule[] protoModules
The modules to generate code from
-
baseDir
@Parameter(property="project.basedir", required=true) protected java.io.File baseDirMaven module base directory
-
properties
@Parameter protected java.util.Properties properties
Plugin properties that are passed to the compiler- Since:
- 1.3.1
-
execution
@Component private org.apache.maven.plugin.MojoExecution execution
-
systemPropertiesBackup
private java.util.Properties systemPropertiesBackup
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
updateRelativeOutputLocation
private void updateRelativeOutputLocation(ProtoModule m)
-
setSystemProperties
private void setSystemProperties()
-
resetSystemProperties
private void resetSystemProperties()
-
skipMojo
protected boolean skipMojo()
Determine if the mojo execution should get skipped.
This is the case if:skipistrue- if the mojo gets executed on a project with packaging type 'pom' and
forceMojoExecutionisfalse
- Returns:
trueif the mojo execution should be skipped.- Since:
- 1.0.1
-
-