當前位置: 首頁>>代碼示例>>Java>>正文


Java MavenProjectHelper類代碼示例

本文整理匯總了Java中org.apache.maven.project.MavenProjectHelper的典型用法代碼示例。如果您正苦於以下問題:Java MavenProjectHelper類的具體用法?Java MavenProjectHelper怎麽用?Java MavenProjectHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MavenProjectHelper類屬於org.apache.maven.project包,在下文中一共展示了MavenProjectHelper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDefaultPackaging

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
@Test
public void testDefaultPackaging() throws MojoExecutionException, IOException {
    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.1");
    when(packager.project.getBasedir()).thenReturn(fake);
    packager.buildDirectory = new File("target/junk");
    copy();
    packager.packageWebJar = true;
    packager.deployWebJarToWisdom = true;
    packager.execute();
    final File wj = new File(packager.buildDirectory, "test-1.1-webjar.jar");
    assertThat(wj).isFile();
    JarFile jar = new JarFile(wj);
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.1/less/style.less")).isNotNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.1/missing")).isNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.1/coffee/script.coffee")).isNotNull();
    Attributes attributes = jar.getManifest().getMainAttributes();
    assertThat(attributes.getValue("Webjar-Name")).isEqualTo("test");
    assertThat(attributes.getValue("Webjar-Version")).isEqualTo("1.1");
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:24,代碼來源:WebJarPackagerTest.java

示例2: testNameVersionAndClassifierCustomization

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
@Test
public void testNameVersionAndClassifierCustomization() throws MojoExecutionException, IOException {
    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(fake);
    packager.buildDirectory = new File("target/junk");
    copy();
    packager.webjar = new WebJar();
    packager.webjar.setName("library");
    packager.webjar.setVersion("2.0");
    packager.webjar.setClassifier("wb");
    packager.execute();
    final File wj = new File(packager.buildDirectory, "library-2.0-wb.jar");
    assertThat(wj).isFile();
    JarFile jar = new JarFile(wj);
    assertThat(jar.getEntry(WebJarPackager.ROOT + "library/2.0/missing")).isNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "library/2.0/coffee/script.coffee")).isNotNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "library/2.0/less/style.less")).isNotNull();
    Attributes attributes = jar.getManifest().getMainAttributes();
    assertThat(attributes.getValue("Webjar-Name")).isEqualTo("library");
    assertThat(attributes.getValue("Webjar-Version")).isEqualTo("2.0");
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:26,代碼來源:WebJarPackagerTest.java

示例3: testIncludesCustomization

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
@Test
public void testIncludesCustomization() throws MojoExecutionException, IOException {
    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(fake);
    packager.buildDirectory = new File("target/junk");
    copy();
    packager.webjar = new WebJar();
    FileSet set = new FileSet();
    set.setDirectory(new File(classes, "assets").getAbsolutePath());
    set.setIncludes(ImmutableList.of("**/coffee/*"));
    packager.webjar.setFileset(set);

    packager.execute();
    final File wj = new File(packager.buildDirectory, "test-1.0-webjar.jar");
    assertThat(wj).isFile();
    JarFile jar = new JarFile(wj);
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.0/missing")).isNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.0/coffee/script.coffee")).isNotNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.0/less/style.less")).isNull();
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:25,代碼來源:WebJarPackagerTest.java

示例4: testExcludesCustomization

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
@Test
public void testExcludesCustomization() throws MojoExecutionException, IOException {
    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(fake);
    packager.buildDirectory = new File("target/junk");
    copy();
    packager.webjar = new WebJar();
    FileSet set = new FileSet();
    set.setDirectory(new File(classes, "assets").getAbsolutePath());
    set.setExcludes(ImmutableList.of("**/less/*"));
    packager.webjar.setFileset(set);

    packager.execute();
    final File wj = new File(packager.buildDirectory, "test-1.0-webjar.jar");
    assertThat(wj).isFile();
    JarFile jar = new JarFile(wj);
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.0/missing")).isNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.0/coffee/script.coffee")).isNotNull();
    assertThat(jar.getEntry(WebJarPackager.ROOT + "test/1.0/less/style.less")).isNull();
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:25,代碼來源:WebJarPackagerTest.java

示例5: testDefaultConfiguration

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
@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();
    // No file, so no creation
    assertThat(new File(packager.buildDirectory, "test-1.0-webjar.jar")).doesNotExist();
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:16,代碼來源:WebJarPackagerTest.java

示例6: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
/**
 * @return {@link #projectHelper}
 */
public MavenProjectHelper getProjectHelper() {
    return projectHelper;
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:7,代碼來源:SeimiMojo.java

示例7: setProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
/**
 * @param projectHelper {@link #projectHelper}
 */
public void setProjectHelper(MavenProjectHelper projectHelper) {
    this.projectHelper = projectHelper;
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:7,代碼來源:SeimiMojo.java

示例8: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
public MavenProjectHelper getProjectHelper() {
	return projectHelper;
}
 
開發者ID:dajester2013,項目名稱:lucee-maven-plugin,代碼行數:4,代碼來源:AbstractLarMojo.java

示例9: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
/**
 * @return the projectHelper
 */
public MavenProjectHelper getProjectHelper()
{
    return projectHelper;
}
 
開發者ID:cjnygard,項目名稱:rest-maven-plugin,代碼行數:8,代碼來源:Plugin.java

示例10: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
public MavenProjectHelper getProjectHelper()
{
    return projectHelper;
}
 
開發者ID:khmarbaise,項目名稱:multienv-maven-plugin,代碼行數:5,代碼來源:AbstractMultiEnvMojo.java

示例11: execute

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
public static void execute(WebSphereModel model, PlexusConfiguration target, MavenProject project,
                           MavenProjectHelper projectHelper, List<Artifact> pluginArtifact, Log logger)
    throws IOException, MojoExecutionException {
  // The fileName should probably use the plugin executionId instead of the targetName
  boolean useDefaultTargetName = false;
  String antTargetName = target.getAttribute("name");
  if (null == antTargetName) {
    antTargetName = DEFAULT_ANT_TARGET_NAME;
    useDefaultTargetName = true;
  }
  StringBuilder fileName = new StringBuilder(50);
  fileName.append("build");
  if (StringUtils.isNotBlank(model.getHost())) {
    fileName.append("-").append(model.getHost());
  }
  if (StringUtils.isNotBlank(model.getApplicationName())) {
    fileName.append("-").append(model.getApplicationName());
  }
  fileName.append("-").append(antTargetName).append("-").append(CommandUtils.getTimestampString()).append(".xml");
  File buildFile = getBuildFile(project, fileName.toString());

  if (model.isVerbose()) {
    logger.info("ant fileName: " + fileName);
  }

  if (buildFile.exists()) {
    logger.info("[SKIPPED] already executed");
    return;
  }

  StringWriter writer = new StringWriter();
  AntXmlPlexusConfigurationWriter xmlWriter = new AntXmlPlexusConfigurationWriter();
  xmlWriter.write(target, writer);

  StringBuffer antXML = writer.getBuffer();

  if (useDefaultTargetName) {
    stringReplace(antXML, "<target", "<target name=\"" + antTargetName + "\"");
  }

  final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
  antXML.insert(0, xmlHeader);
  final String projectOpen = "<project name=\"" + Constants.PLUGIN_ID + "\" default=\"" + antTargetName + "\">\n";
  int index = antXML.indexOf("<target");
  antXML.insert(index, projectOpen);

  final String projectClose = "\n</project>";
  antXML.append(projectClose);

  buildFile.getParentFile().mkdirs();
  FileUtils.fileWrite(buildFile.getAbsolutePath(), "UTF-8", antXML.toString());

  Project antProject = generateAntProject(model, buildFile, project, projectHelper, pluginArtifact, logger);
  antProject.executeTarget(antTargetName);
}
 
開發者ID:orctom,項目名稱:was-maven-plugin,代碼行數:56,代碼來源:AntTaskUtils.java

示例12: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
public MavenProjectHelper getProjectHelper() {
    return projectHelper;
}
 
開發者ID:hitakaken,項目名稱:bigfoot-maven-plugins,代碼行數:4,代碼來源:AbstractJbiMojo.java

示例13: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
public MavenProjectHelper getProjectHelper() {
  return projectHelper;
}
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:4,代碼來源:AbstractXapiMojo.java

示例14: getProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
/**
 * Method description
 *
 *
 * @return
 */
public MavenProjectHelper getProjectHelper()
{
  return projectHelper;
}
 
開發者ID:sdorra,項目名稱:nativepkg-maven-plugin,代碼行數:11,代碼來源:NativePkgMojo.java

示例15: setProjectHelper

import org.apache.maven.project.MavenProjectHelper; //導入依賴的package包/類
/**
 * Method description
 *
 *
 * @param projectHelper
 */
public void setProjectHelper(MavenProjectHelper projectHelper)
{
  this.projectHelper = projectHelper;
}
 
開發者ID:sdorra,項目名稱:nativepkg-maven-plugin,代碼行數:11,代碼來源:NativePkgMojo.java


注:本文中的org.apache.maven.project.MavenProjectHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。