Class BytecodeInjectionMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.jboss.maven.plugins.injection.BytecodeInjectionMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
public class BytecodeInjectionMojo extends org.apache.maven.plugin.AbstractMojo
Used to inject resolved expression values into compiled bytecode. TODO : add checks as to whether the injection is needed to avoid file timestamp changes. Basically we should skip the injection if the class file field is already the injection value...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
BytecodeInjectionMojo.BaseInjectionTarget
private class
BytecodeInjectionMojo.ConstantInjectionTarget
static interface
BytecodeInjectionMojo.InjectionTarget
Defines a strategy for applying injections.private class
BytecodeInjectionMojo.MethodBodyReturnReplacementTarget
-
Field Summary
Fields Modifier and Type Field Description protected BytecodeInjection[]
bytecodeInjections
The injections to be performed.private javassist.ClassPool
classPool
private javassist.LoaderClassPath
loaderClassPath
protected org.apache.maven.project.MavenProject
project
The Maven Project Object
-
Constructor Summary
Constructors Constructor Description BytecodeInjectionMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ClassLoader
buildProjectCompileClassLoader()
Builds aClassLoader
based on the maven project's compile classpath elements.void
execute()
private java.util.List<java.lang.String>
projectCompileClasspathElements()
Essentially a call toMavenProject.getCompileClasspathElements()
except that here we cast it to the generic type and internally handleDependencyResolutionRequiredException
.
-
-
-
Field Detail
-
project
protected org.apache.maven.project.MavenProject project
The Maven Project Object
-
bytecodeInjections
protected BytecodeInjection[] bytecodeInjections
The injections to be performed.
-
loaderClassPath
private javassist.LoaderClassPath loaderClassPath
-
classPool
private javassist.ClassPool classPool
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
buildProjectCompileClassLoader
private java.lang.ClassLoader buildProjectCompileClassLoader() throws org.apache.maven.plugin.MojoExecutionException
Builds aClassLoader
based on the maven project's compile classpath elements.- Returns:
- The
ClassLoader
made up of the maven project's compile classpath elements. - Throws:
org.apache.maven.plugin.MojoExecutionException
- Indicates an issue processing one of the classpath elements
-
projectCompileClasspathElements
private java.util.List<java.lang.String> projectCompileClasspathElements() throws org.apache.maven.plugin.MojoExecutionException
Essentially a call toMavenProject.getCompileClasspathElements()
except that here we cast it to the generic type and internally handleDependencyResolutionRequiredException
.- Returns:
- The compile classpath elements
- Throws:
org.apache.maven.plugin.MojoExecutionException
- Indicates aDependencyResolutionRequiredException
was encountered
-
-