Class MainGenerateMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.github.ascopes.protobufmavenplugin.mojo.AbstractGenerateMojo
io.github.ascopes.protobufmavenplugin.mojo.MainGenerateMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="generate",
defaultPhase=GENERATE_SOURCES,
requiresDependencyCollection=TEST,
requiresDependencyResolution=TEST,
requiresOnline=true,
threadSafe=true)
public final class MainGenerateMojo
extends AbstractGenerateMojo
Generate source code from protobuf files.
This treats generated code as being part of the main source set.
For test sources, use the generate-test
goal instead.
Any project dependencies using the compile
, provided
,
or system
scopes will be made available to import from protobuf sources.
By default, sources will be read from src/main/protobuf
,
and generated sources will be written to target/generated-sources/protobuf
.
- Author:
- Ashley Scopes
-
Field Summary
Fields inherited from class io.github.ascopes.protobufmavenplugin.mojo.AbstractGenerateMojo
binaryMavenPlugins, binaryPathPlugins, binaryUrlPlugins, cppEnabled, csharpEnabled, dependencyResolutionDepth, dependencyScopes, embedSourcesInClassOutputs, excludes, failOnInvalidDependencies, failOnMissingSources, failOnMissingTargets, fatalWarnings, ignoreProjectDependencies, importDependencies, importPaths, includes, incrementalCompilation, javaEnabled, jvmMavenPlugins, kotlinEnabled, liteOnly, mavenProject, mavenProjectHelper, objcEnabled, outputDescriptorAttached, outputDescriptorAttachmentClassifier, outputDescriptorAttachmentType, outputDescriptorFile, outputDescriptorIncludeImports, outputDescriptorIncludeSourceInfo, outputDescriptorRetainOptions, outputDirectory, phpEnabled, protocVersion, pythonEnabled, pythonStubsEnabled, registerAsCompilationRoot, rubyEnabled, rustEnabled, skip, sourceCodeGenerator, sourceDependencies, sourceDirectories
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe default dependency scopes used for resolution.(package private) Path
Provides the default output directory to write generated code to.(package private) Path
Provides the default source directory to read protobuf sources from.(package private) OutputDescriptorAttachmentRegistrar
Provides the registrar for output descriptor files to attach them to the Maven project as additional artifacts.(package private) SourceRootRegistrar
Provides the source root registrar for this Mojo.Methods inherited from class io.github.ascopes.protobufmavenplugin.mojo.AbstractGenerateMojo
execute
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
MainGenerateMojo
public MainGenerateMojo()
-
-
Method Details
-
sourceRootRegistrar
SourceRootRegistrar sourceRootRegistrar()Description copied from class:AbstractGenerateMojo
Provides the source root registrar for this Mojo.This specifies where to attach generated sources to in order for it to be included as part of the compilation for main or test sources.
- Specified by:
sourceRootRegistrar
in classAbstractGenerateMojo
- Returns:
- the registrar to use.
-
outputDescriptorAttachmentRegistrar
OutputDescriptorAttachmentRegistrar outputDescriptorAttachmentRegistrar()Description copied from class:AbstractGenerateMojo
Provides the registrar for output descriptor files to attach them to the Maven project as additional artifacts.- Specified by:
outputDescriptorAttachmentRegistrar
in classAbstractGenerateMojo
- Returns:
- the registrar to use.
-
defaultDependencyScopes
Description copied from class:AbstractGenerateMojo
The default dependency scopes used for resolution.- Specified by:
defaultDependencyScopes
in classAbstractGenerateMojo
- Returns:
- the set of dependency scopes used for resolution.
-
defaultSourceDirectory
Path defaultSourceDirectory()Description copied from class:AbstractGenerateMojo
Provides the default source directory to read protobuf sources from.This does not need to point to an existing directory, the plugin will handle this automatically.
- Specified by:
defaultSourceDirectory
in classAbstractGenerateMojo
- Returns:
- the path to the directory.
-
defaultOutputDirectory
Path defaultOutputDirectory()Description copied from class:AbstractGenerateMojo
Provides the default output directory to write generated code to.This does not need to point to an existing directory, the plugin will handle this automatically.
- Specified by:
defaultOutputDirectory
in classAbstractGenerateMojo
- Returns:
- the path to the directory.
-