public abstract class ByteBuddyMojo
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Class and Description |
|---|---|
static class |
ByteBuddyMojo.ForProductionTypes
A Byte Buddy plugin that transforms a project's production class files.
|
static class |
ByteBuddyMojo.ForTestTypes
A Byte Buddy plugin that transforms a project's test class files.
|
protected static class |
ByteBuddyMojo.MavenBuildLogger
A
BuildLogger implementation for a Maven Log. |
protected static class |
ByteBuddyMojo.TransformationLogger
A
Plugin.Engine.Listener that logs several relevant events during the build. |
protected static class |
ByteBuddyMojo.Transformer
A transformer that is applied during the plugin's execution.
|
| Modifier and Type | Field and Description |
|---|---|
org.sonatype.plexus.build.incremental.BuildContext |
context
The build context to support incremental builds.
|
Discovery |
discovery
Determines if the build should discover Byte Buddy build plugins on this Maven plugin's class loader.
|
boolean |
extendedParsing
When set to
true, the debug information of class files should be parsed to extract parameter names. |
boolean |
failFast
When set to
true, this mojo fails immediately if a plugin cannot be applied. |
boolean |
failOnLiveInitializer
When transforming classes during build time, it is not possible to apply any transformations which require a class
in its loaded state.
|
boolean |
incremental
Determines if plugins are attempted to be built incrementally.
|
Initialization |
initialization
The initializer used for creating a
ByteBuddy instance and for applying a transformation. |
org.apache.maven.project.MavenProject |
project
The Maven project.
|
org.eclipse.aether.RepositorySystem |
repositorySystem
The currently used repository system.
|
org.eclipse.aether.RepositorySystemSession |
repositorySystemSession
The currently used system session for the repository system.
|
boolean |
skip
When set to
true, this mojo is not applied to the current module. |
String |
suffix
Specifies the method name suffix that is used when type's method need to be rebased.
|
int |
threads
Indicates the amount of threads used for parallel type processing or
0 for serial processing. |
List<Transformation> |
transformations
The list of transformations.
|
boolean |
warnOnEmptyTypeSet
When set to
true, this mojo warns of not having transformed any types. |
boolean |
warnOnMissingOutputDirectory
When set to
true, this mojo warns of an non-existent output directory. |
| Constructor and Description |
|---|
ByteBuddyMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute() |
protected abstract List<String> |
getClassPathElements()
Returns the class path elements of the relevant output directory.
|
protected abstract String |
getOutputDirectory()
Returns the output directory to search for class files.
|
protected abstract String |
getSourceDirectory()
Returns the source directory that determines the class files to process.
|
@Component public org.sonatype.plexus.build.incremental.BuildContext context
@Parameter(defaultValue="${project}",
readonly=true)
public org.apache.maven.project.MavenProject project
@Component public org.eclipse.aether.RepositorySystem repositorySystem
@Parameter(defaultValue="${repositorySystemSession}",
readonly=true)
public org.eclipse.aether.RepositorySystemSession repositorySystemSession
@Parameter public List<Transformation> transformations
The list of transformations. A transformation must specify the plugin property, containing the name of a class to apply.
Additionally, it is possible to optionally specify Maven coordinates for a project that contains this plugin class as groupId,
artifactId and version. If any of the latter properties is not set, this projects coordinate is used.
For example, the following configuration applies the foo.Bar class which must implement Plugin from artifact
transform-artifact with this project's group and version:
<transformations> <transformation> <plugin>foo.Bar< /plugin> <artifactId>transform-artifact< /artifactId> < /transformation> < /transformations>
If the list of transformations is empty or is not supplied at all, this plugin does not apply but prints a warning.
@Parameter public Initialization initialization
The initializer used for creating a ByteBuddy instance and for applying a transformation. By default,
a type is rebased. The initializer's entryPoint property can be set to any constant name of EntryPoint.Default
or to a class name. If the latter applies, it is possible to set Maven coordinates for a Maven plugin which defines this
class where any property defaults to this project's coordinates.
For example, the following configuration applies the foo.Qux class which must implement EntryPoint from
artifact initialization-artifact with this project's group and version:
<initialization> <entryPoint>foo.Qux< /entryPoint> <artifactId>initialization-artifact< /artifactId> < /initialization>
@Parameter public String suffix
@Parameter(defaultValue="true",
required=true)
public boolean failOnLiveInitializer
false, this plugin does not throw an exception if such a live
initializer is defined during a transformation process.@Parameter(defaultValue="false",
required=true)
public boolean skip
true, this mojo is not applied to the current module.@Parameter(defaultValue="true",
required=true)
public boolean warnOnMissingOutputDirectory
true, this mojo warns of an non-existent output directory.@Parameter(defaultValue="true",
required=true)
public boolean warnOnEmptyTypeSet
true, this mojo warns of not having transformed any types.@Parameter(defaultValue="true",
required=true)
public boolean failFast
true, this mojo fails immediately if a plugin cannot be applied.@Parameter(defaultValue="false",
required=true)
public boolean extendedParsing
true, the debug information of class files should be parsed to extract parameter names.@Parameter(defaultValue="EMPTY",
required=true)
public Discovery discovery
@Parameter(defaultValue="0",
required=true)
public int threads
0 for serial processing.@Parameter(defaultValue="false",
required=true)
public boolean incremental
public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected abstract String getOutputDirectory()
protected abstract String getSourceDirectory()
protected abstract List<String> getClassPathElements() throws org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoFailureException - If the class path cannot be resolved.Copyright © 2014–2021. All rights reserved.