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.AbstractMojoUsed 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 classBytecodeInjectionMojo.BaseInjectionTargetprivate classBytecodeInjectionMojo.ConstantInjectionTargetstatic interfaceBytecodeInjectionMojo.InjectionTargetDefines a strategy for applying injections.private classBytecodeInjectionMojo.MethodBodyReturnReplacementTarget
-
Field Summary
Fields Modifier and Type Field Description protected BytecodeInjection[]bytecodeInjectionsThe injections to be performed.private javassist.ClassPoolclassPoolprivate javassist.LoaderClassPathloaderClassPathprotected org.apache.maven.project.MavenProjectprojectThe 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.ClassLoaderbuildProjectCompileClassLoader()Builds aClassLoaderbased on the maven project's compile classpath elements.voidexecute()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.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
buildProjectCompileClassLoader
private java.lang.ClassLoader buildProjectCompileClassLoader() throws org.apache.maven.plugin.MojoExecutionExceptionBuilds aClassLoaderbased on the maven project's compile classpath elements.- Returns:
- The
ClassLoadermade 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.MojoExecutionExceptionEssentially 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 aDependencyResolutionRequiredExceptionwas encountered
-
-