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 AbstractProtocTestCompileMojoThis mojo executes theprotoccompiler with the specified plugin executable to generate test sources from protocol buffer definitions. It also searches dependency artifacts for.protofiles and includes them in theproto_pathso that they can be referenced. Finally, it adds the.protofiles 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.FileoutputBaseDirectoryThis is the base directory for the generated code.private java.io.FileoutputDirectoryThis is the directory where the generated code will be placed.private java.lang.StringpluginArtifactPlugin artifact specification, ingroupId:artifactId:version[:type[:classifier]]format.private java.lang.StringpluginExecutableAn optional path to plugin executable.private java.lang.StringpluginIdA unique id that identifies the plugin to protoc.private java.lang.StringpluginParameterAn optional parameter to be passed to the plugin.private java.lang.StringpluginToolIfpluginToolchainis specified, this parameter specifies the tool in the toolchain, which is to be resolved as plugin executable.private java.lang.StringpluginToolchainA 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 voidaddProtocBuilderParameters(Protoc.Builder protocBuilder)Adds mojo-specific parameters to the protoc builder.protected java.io.FilegetOutputDirectory()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 pluginIdA 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 outputBaseDirectoryThis is the base directory for the generated code. If an explicitoutputDirectoryparameter is not specified, an output directory named afterpluginIdwill be created inside this base directory.
-
outputDirectory
@Parameter(required=false, property="protocPluginOutputDirectory") private java.io.File outputDirectoryThis 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 pluginExecutableAn 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 pluginParameterAn optional parameter to be passed to the plugin. Cannot contain colon (:) symbols.
-
pluginToolchain
@Parameter(required=false, property="protocPluginToolchain") private java.lang.String pluginToolchainA 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 pluginToolIfpluginToolchainis 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 pluginArtifactPlugin 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:AbstractProtocMojoAdds mojo-specific parameters to the protoc builder.- Overrides:
addProtocBuilderParametersin classAbstractProtocMojo- Parameters:
protocBuilder- the builder to be modified.
-
getOutputDirectory
protected java.io.File getOutputDirectory()
Description copied from class:AbstractProtocMojoReturns the output directory for generated sources. Depends on build phase so must be defined in concrete implementation.- Specified by:
getOutputDirectoryin classAbstractProtocMojo- Returns:
- output directory for generated sources.
-
-