Class ProtocTestCompileCustomMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.xolstice.maven.plugin.protobuf.AbstractProtocMojo
-
- org.xolstice.maven.plugin.protobuf.AbstractProtocTestCompileMojo
-
- org.xolstice.maven.plugin.protobuf.ProtocTestCompileCustomMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="test-compile-custom", defaultPhase=GENERATE_TEST_SOURCES, requiresDependencyResolution=TEST, threadSafe=true) public final class ProtocTestCompileCustomMojo extends AbstractProtocTestCompileMojo
This mojo executes theprotoc
compiler with the specified plugin executable to generate test sources from protocol buffer definitions. It also searches dependency artifacts for.proto
files and includes them in theproto_path
so that they can be referenced. Finally, it adds the.proto
files to the project as resources so that they can be included in the test-jar artifact.- Since:
- 0.4.1
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File
outputBaseDirectory
This is the base directory for the generated code.private java.io.File
outputDirectory
This is the directory where the generated code will be placed.private java.lang.String
pluginArtifact
Plugin artifact specification, ingroupId:artifactId:version[:type[:classifier]]
format.private java.lang.String
pluginExecutable
An optional path to plugin executable.private java.lang.String
pluginId
A unique id that identifies the plugin to protoc.private java.lang.String
pluginParameter
An optional parameter to be passed to the plugin.private java.lang.String
pluginTool
IfpluginToolchain
is specified, this parameter specifies the tool in the toolchain, which is to be resolved as plugin executable.private java.lang.String
pluginToolchain
A name of an optional custom toolchain that can be used to locate the plugin executable.-
Fields inherited from class org.xolstice.maven.plugin.protobuf.AbstractProtocTestCompileMojo
descriptorSetClassifier
-
Fields inherited from class org.xolstice.maven.plugin.protobuf.AbstractProtocMojo
attachDescriptorSet, attachProtoSources, buildContext, descriptorSetFileName, includeDependenciesInDescriptorSet, includeSourceInfoInDescriptorSet, project, projectHelper, session, toolchainManager, useArgumentFile, writeDescriptorSet
-
-
Constructor Summary
Constructors Constructor Description ProtocTestCompileCustomMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addProtocBuilderParameters(Protoc.Builder protocBuilder)
Adds mojo-specific parameters to the protoc builder.protected java.io.File
getOutputDirectory()
Returns the output directory for generated sources.-
Methods inherited from class org.xolstice.maven.plugin.protobuf.AbstractProtocTestCompileMojo
doAttachGeneratedFiles, doAttachProtoSources, getDependencyArtifacts, getDescriptorSetOutputDirectory, getProtoSourceRoot
-
Methods inherited from class org.xolstice.maven.plugin.protobuf.AbstractProtocMojo
checkFilesUpToDate, checkParameters, createDependencyArtifact, createDependencyArtifact, createProtocPlugins, detectJavaHome, doAttachFiles, execute, findGeneratedFilesInDirectory, findProtoFilesInDirectories, findProtoFilesInDirectory, getDependencyArtifactFiles, getExcludes, getIncludes, hasDelta, lastModified, makeProtoPathFromJars, resolveBinaryArtifact, skipMojo, toHexString, truncatePath
-
-
-
-
Field Detail
-
pluginId
@Parameter(required=true, property="protocPluginId") private java.lang.String pluginId
A unique id that identifies the plugin to protoc. Cannot be one of the built-in protoc plugins:- java
- javanano
- js
- csharp
- cpp
- python
- descriptor-set
-
outputBaseDirectory
@Parameter(required=true, readonly=true, defaultValue="${project.build.directory}/generated-test-sources/protobuf") private java.io.File outputBaseDirectory
This is the base directory for the generated code. If an explicitoutputDirectory
parameter is not specified, an output directory named afterpluginId
will be created inside this base directory.
-
outputDirectory
@Parameter(required=false, property="protocPluginOutputDirectory") private java.io.File outputDirectory
This is the directory where the generated code will be placed. If this parameter is unspecified, then the default location is constructed as follows:
${project.build.directory}/generated-test-sources/protobuf/<pluginId>
-
pluginExecutable
@Parameter(required=false, property="protocPluginExecutable") private java.lang.String pluginExecutable
An optional path to plugin executable. If unspecified, alternative options must be used (e.g. toolchains).
-
pluginParameter
@Parameter(required=false, property="protocPluginParameter") private java.lang.String pluginParameter
An optional parameter to be passed to the plugin. Cannot contain colon (:) symbols.
-
pluginToolchain
@Parameter(required=false, property="protocPluginToolchain") private java.lang.String pluginToolchain
A name of an optional custom toolchain that can be used to locate the plugin executable. The toolchain must be registered as a build extension and initialised properly.
-
pluginTool
@Parameter(required=false, property="protocPluginTool") private java.lang.String pluginTool
IfpluginToolchain
is specified, this parameter specifies the tool in the toolchain, which is to be resolved as plugin executable.
-
pluginArtifact
@Parameter(required=false, property="protocPluginArtifact") private java.lang.String pluginArtifact
Plugin artifact specification, ingroupId:artifactId:version[:type[:classifier]]
format. When this parameter is set, the specified artifact will be resolved as a plugin executable.- Since:
- 0.4.1
-
-
Method Detail
-
addProtocBuilderParameters
protected void addProtocBuilderParameters(Protoc.Builder protocBuilder)
Description copied from class:AbstractProtocMojo
Adds mojo-specific parameters to the protoc builder.- Overrides:
addProtocBuilderParameters
in classAbstractProtocMojo
- Parameters:
protocBuilder
- the builder to be modified.
-
getOutputDirectory
protected java.io.File getOutputDirectory()
Description copied from class:AbstractProtocMojo
Returns the output directory for generated sources. Depends on build phase so must be defined in concrete implementation.- Specified by:
getOutputDirectory
in classAbstractProtocMojo
- Returns:
- output directory for generated sources.
-
-