@Test public void testLiveInitializerAllowed() throws Exception { Set<File> files = new HashSet<File>(addClass("foo.Bar")); try { execute("transform", "live.allowed"); ClassLoader classLoader = new URLClassLoader(new URL[]{project.toURI().toURL()}); try { assertMethod(classLoader.loadClass("foo.Bar"), FOO, QUX); fail(); } catch (InvocationTargetException exception) { assertThat(exception.getCause(), instanceOf(NullPointerException.class)); } } finally { for (File file : files) { assertThat(file.delete(), is(true)); } assertThat(new File(project, FOO).delete(), is(true)); } }
public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Not applying instrumentation as a result of plugin configuration."); return; } else if (transformations == null || transformations.isEmpty()) { getLog().warn("No transformations are specified. Skipping plugin application."); return; } try { apply(new File(getOutputDirectory()), getClassPathElements()); } catch (IOException exception) { throw new MojoFailureException("Error during writing process", exception); } }
ByteBuddyMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Not applying instrumentation as a result of plugin configuration."); return; } else if (transformations == null || transformations.isEmpty()) { getLog().warn("No transformations are specified. Skipping plugin application."); return; } try { apply(new File(getOutputDirectory()), getClassPathElements()); } catch (IOException exception) { throw new MojoFailureException("Error during writing process", exception); } } }
ByteBuddyMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Not applying instrumentation as a result of plugin configuration."); return; } else if (transformations == null || transformations.isEmpty()) { getLog().warn("No transformations are specified. Skipping plugin application."); return; } try { apply(new File(getOutputDirectory()), getClassPathElements()); } catch (IOException exception) { throw new MojoFailureException("Error during writing process", exception); } }  }
ByteBuddyMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Not applying instrumentation as a result of plugin configuration."); return; } else if (transformations == null || transformations.isEmpty()) { getLog().warn("No transformations are specified. Skipping plugin application."); return; } try { apply(new File(getOutputDirectory()), getClassPathElements()); } catch (IOException exception) { throw new MojoFailureException("Error during writing process", exception); } }  void execute(); }
ByteBuddyMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Not applying instrumentation as a result of plugin configuration."); return; } else if (transformations == null || transformations.isEmpty()) { getLog().warn("No transformations are specified. Skipping plugin application."); return; } try { apply(new File(getOutputDirectory()), getClassPathElements()); } catch (IOException exception) { throw new MojoFailureException("Error during writing process", exception); } }  void execute(); @Parameter(defaultValue = "${project.groupId}", required = true, readonly = true)
    public String groupId; @Parameter(defaultValue = "${project.artifactId}", required = true, readonly = true)
    public String artifactId; @Parameter(defaultValue = "${project.version}", required = true, readonly = true)
    public String version; @Parameter(defaultValue = "${project.packaging}", required = true, readonly = true)
    public String packaging; @Parameter(defaultValue = "${project}", readonly = true)
    public MavenProject project; @Parameter
    public List<Transformation> transformations; @Parameter
    public Initialization initialization; @Parameter
    public String suffix; @Parameter(defaultValue = "true", required = true)
    public boolean failOnLiveInitializer; @Parameter(defaultValue = "false", required = true)
    public boolean skip; @Parameter(defaultValue = "true", required = true)
    public boolean warnOnMissingOutputDirectory; @Parameter(defaultValue = "true", required = true)
    public boolean warnOnEmptyTypeSet; @Parameter(defaultValue = "true", required = true)
    public boolean failFast; @Parameter(defaultValue = "false", required = true)
    public boolean extendedParsing; @Parameter(defaultValue = "0", required = true)
    public int threads; @Component
    public RepositorySystem repositorySystem; @Parameter(defaultValue = "${repositorySystemSession}", required = true, readonly = true)
    public RepositorySystemSession repositorySystemSession; @Parameter(defaultValue = "${project.remoteProjectRepositories}", required = true, readonly = true)
    public List<RemoteRepository> remoteRepositories; }