@Test(expected = MojoExecutionException.class) public void testInstallationAndOptimizationWithInvalidImage() throws MojoExecutionException, IOException { ImageOptimizationMojo mojo = new ImageOptimizationMojo(); mojo.basedir = basedir; mojo.buildDirectory = target; mojo.failOnBrokenAsset = true; FileUtils.copyFile(invalid, invalidOutput); mojo.execute(); }
@Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); } }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }  }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); }
ImageOptimizationMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (imageMinification == null) { imageMinification = new ImageMinification(); } if (skipImageOptimization || ! imageMinification.isEnabled()) { getLog().info("Image minification skipped"); removeFromWatching(); return; } npm = npm(this, NPM_NAME, imageMinification.getVersion()); optimizeAllImagesFromDirectory(new File(buildDirectory, "classes")); optimizeAllImagesFromDirectory(new File(getWisdomRootDirectory(), ASSETS_DIR)); }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); static final String NPM_NAME; static final String COMMAND; static final List<String> EXTENSIONS; @Parameter(defaultValue = "${skipImageOptimization}", required = false)
    public boolean skipImageOptimization; }