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.
|
| Modifier and Type | Field and Description |
|---|---|
protected String |
artifactId
The built project's artifact id.
|
protected boolean |
failOnLiveInitializer
When transforming classes during build time, it is not possible to apply any transformations which require a class
in its loaded state.
|
protected String |
groupId
The built project's group id.
|
protected Initialization |
initialization
The initializer used for creating a
ByteBuddy instance and for applying a transformation. |
protected List<org.eclipse.aether.repository.RemoteRepository> |
remoteRepositories
A list of all remote repositories.
|
protected org.eclipse.aether.RepositorySystem |
repositorySystem
The currently used repository system.
|
protected org.eclipse.aether.RepositorySystemSession |
repositorySystemSession
The currently used system session for the repository system.
|
protected String |
suffix
Specifies the method name suffix that is used when type's method need to be rebased.
|
protected List<Transformation> |
transformations
The list of transformations.
|
protected String |
version
The built project's version.
|
| 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.
|
@Parameter(defaultValue="${project.groupId}",
required=true,
readonly=true)
protected String groupId
@Parameter(defaultValue="${project.artifactId}",
required=true,
readonly=true)
protected String artifactId
@Parameter(defaultValue="${project.version}",
required=true,
readonly=true)
protected String version
@Parameter protected 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 protected 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 protected String suffix
@Parameter(defaultValue="true",
required=true)
protected boolean failOnLiveInitializer
false, this plugin does not throw an exception if such a live
initializer is defined during a transformation process.@Component protected org.eclipse.aether.RepositorySystem repositorySystem
@Parameter(defaultValue="${repositorySystemSession}",
required=true,
readonly=true)
protected org.eclipse.aether.RepositorySystemSession repositorySystemSession
@Parameter(defaultValue="${project.remoteProjectRepositories}",
required=true,
readonly=true)
protected List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories
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()
Copyright © 2014–2017. All rights reserved.