@Test public void testDefaultConfiguration() throws MojoExecutionException { WebJarPackager packager = new WebJarPackager(); packager.project = mock(MavenProject.class); packager.projectHelper = mock(MavenProjectHelper.class); when(packager.project.getArtifactId()).thenReturn("test"); when(packager.project.getVersion()).thenReturn("1.0"); when(packager.project.getBasedir()).thenReturn(new File("")); packager.buildDirectory = new File("target"); packager.packageWebJar = true; packager.deployWebJarToWisdom = true; packager.execute(); assertThat(new File(packager.buildDirectory, "test-1.0-webjar.jar")).doesNotExist(); }
@Override public void execute() throws MojoExecutionException { if (!enabled()) { removeFromWatching(); return; } FileSet set = new FileSet(); set.setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); if (webjar == null) { webjar = new WebJar(project.getArtifactId(), project.getVersion(), "webjar", set); } else { if (webjar.getFileset() == null) { webjar.setFileset(set); } else if (webjar.getFileset().getDirectory() == null) { getLog().info("No directory define in the webjar fileset - use the AssetOutputDirectory"); webjar.getFileset().setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); } if (webjar.getName() == null) { webjar.setName(project.getArtifactId()); } if (webjar.getVersion() == null) { webjar.setVersion(project.getVersion()); } if (webjar.getClassifier() == null) { webjar.setClassifier("webjar"); } } try { File out = process(); if (out != null) { projectHelper.attachArtifact(project, out, webjar.getClassifier()); if (deployWebJarToWisdom) { copyToDestination(out); } } } catch (Exception e) { throw new MojoExecutionException("Failure while building the webjar", e); } }
WebJarPackager extends AbstractWisdomWatcherMojo { @Override public void execute() throws MojoExecutionException { if (!enabled()) { removeFromWatching(); return; } FileSet set = new FileSet(); set.setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); if (webjar == null) { webjar = new WebJar(project.getArtifactId(), project.getVersion(), "webjar", set); } else { if (webjar.getFileset() == null) { webjar.setFileset(set); } else if (webjar.getFileset().getDirectory() == null) { getLog().info("No directory define in the webjar fileset - use the AssetOutputDirectory"); webjar.getFileset().setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); } if (webjar.getName() == null) { webjar.setName(project.getArtifactId()); } if (webjar.getVersion() == null) { webjar.setVersion(project.getVersion()); } if (webjar.getClassifier() == null) { webjar.setClassifier("webjar"); } } try { File out = process(); if (out != null) { projectHelper.attachArtifact(project, out, webjar.getClassifier()); if (deployWebJarToWisdom) { copyToDestination(out); } } } catch (Exception e) { throw new MojoExecutionException("Failure while building the webjar", e); } } }
WebJarPackager extends AbstractWisdomWatcherMojo { @Override public void execute() throws MojoExecutionException { if (!enabled()) { removeFromWatching(); return; } FileSet set = new FileSet(); set.setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); if (webjar == null) { webjar = new WebJar(project.getArtifactId(), project.getVersion(), "webjar", set); } else { if (webjar.getFileset() == null) { webjar.setFileset(set); } else if (webjar.getFileset().getDirectory() == null) { getLog().info("No directory define in the webjar fileset - use the AssetOutputDirectory"); webjar.getFileset().setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); } if (webjar.getName() == null) { webjar.setName(project.getArtifactId()); } if (webjar.getVersion() == null) { webjar.setVersion(project.getVersion()); } if (webjar.getClassifier() == null) { webjar.setClassifier("webjar"); } } try { File out = process(); if (out != null) { projectHelper.attachArtifact(project, out, webjar.getClassifier()); if (deployWebJarToWisdom) { copyToDestination(out); } } } catch (Exception e) { throw new MojoExecutionException("Failure while building the webjar", e); } }  }
WebJarPackager extends AbstractWisdomWatcherMojo { @Override public void execute() throws MojoExecutionException { if (!enabled()) { removeFromWatching(); return; } FileSet set = new FileSet(); set.setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); if (webjar == null) { webjar = new WebJar(project.getArtifactId(), project.getVersion(), "webjar", set); } else { if (webjar.getFileset() == null) { webjar.setFileset(set); } else if (webjar.getFileset().getDirectory() == null) { getLog().info("No directory define in the webjar fileset - use the AssetOutputDirectory"); webjar.getFileset().setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); } if (webjar.getName() == null) { webjar.setName(project.getArtifactId()); } if (webjar.getVersion() == null) { webjar.setVersion(project.getVersion()); } if (webjar.getClassifier() == null) { webjar.setClassifier("webjar"); } } try { File out = process(); if (out != null) { projectHelper.attachArtifact(project, out, webjar.getClassifier()); if (deployWebJarToWisdom) { copyToDestination(out); } } } catch (Exception e) { throw new MojoExecutionException("Failure while building the webjar", e); } }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); }
WebJarPackager extends AbstractWisdomWatcherMojo { @Override public void execute() throws MojoExecutionException { if (!enabled()) { removeFromWatching(); return; } FileSet set = new FileSet(); set.setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); if (webjar == null) { webjar = new WebJar(project.getArtifactId(), project.getVersion(), "webjar", set); } else { if (webjar.getFileset() == null) { webjar.setFileset(set); } else if (webjar.getFileset().getDirectory() == null) { getLog().info("No directory define in the webjar fileset - use the AssetOutputDirectory"); webjar.getFileset().setDirectory(getInternalAssetOutputDirectory().getAbsolutePath()); } if (webjar.getName() == null) { webjar.setName(project.getArtifactId()); } if (webjar.getVersion() == null) { webjar.setVersion(project.getVersion()); } if (webjar.getClassifier() == null) { webjar.setClassifier("webjar"); } } try { File out = process(); if (out != null) { projectHelper.attachArtifact(project, out, webjar.getClassifier()); if (deployWebJarToWisdom) { copyToDestination(out); } } } catch (Exception e) { throw new MojoExecutionException("Failure while building the webjar", e); } }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file);  }