当前位置: 首页>>代码示例>>Java>>正文


Java Build类代码示例

本文整理汇总了Java中org.apache.maven.model.Build的典型用法代码示例。如果您正苦于以下问题:Java Build类的具体用法?Java Build怎么用?Java Build使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Build类属于org.apache.maven.model包,在下文中一共展示了Build类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCoSFile

import org.apache.maven.model.Build; //导入依赖的package包/类
private static File getCoSFile(MavenProject mp, boolean test) {
    if (mp == null) {
        return null;
    }
    Build build = mp.getBuild();
    if (build == null) {
        return null;
    }
    String path = test ? build.getTestOutputDirectory() : build.getOutputDirectory();
    if (path == null) {
        return null;
    }
    File fl = new File(path);
    fl = FileUtil.normalizeFile(fl);
    return  new File(fl, NB_COS);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:CosChecker.java

示例2: execute

import org.apache.maven.model.Build; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    initializeHandlers();

    for (AppBuildHandler appBuildHandler : appBuildHandlers) {
        appBuildHandler.handle();
    }

    final Build build = project.getBuild();
    final List<String> nonFilteredFileExtensions = getNonFilteredFileExtensions(build.getPlugins());


    MavenResourcesExecution mavenResourcesExecution =
            new MavenResourcesExecution(build.getResources(), new File(outputDirectory), project,
                    ENCODING, build.getFilters(), nonFilteredFileExtensions, session);

    try {
        mavenResourcesFiltering.filterResources(mavenResourcesExecution);
    } catch (MavenFilteringException e) {
        throw new WMRuntimeException("Failed to execute resource filtering ", e);
    }
}
 
开发者ID:wavemaker,项目名称:wavemaker-app-build-tools,代码行数:23,代码来源:AppBuildMojo.java

示例3: updateBuild

import org.apache.maven.model.Build; //导入依赖的package包/类
/**
 * Method updateBuild
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
//CHECKSTYLE_OFF: LineLength
protected void updateBuild( Build value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleElement( innerCount, root, "sourceDirectory", value.getSourceDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "scriptSourceDirectory", value.getScriptSourceDirectory(),
                                     null );
        findAndReplaceSimpleElement( innerCount, root, "testSourceDirectory", value.getTestSourceDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "testOutputDirectory", value.getTestOutputDirectory(), null );
        iterateExtension( innerCount, root, value.getExtensions(), "extensions", "extension" );
        findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null );
        iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
        iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" );
        findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null );
        findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" );
        updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
        iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
    }
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:34,代码来源:MavenJDOMWriter.java

示例4: getOrCreateResourcesPlugin

import org.apache.maven.model.Build; //导入依赖的package包/类
private static Plugin getOrCreateResourcesPlugin(Model mavenModel) {

		Build build = getOrCreateBuild(mavenModel);

		// Locate the plugin and returns if exists
		for (Iterator<Plugin> iterator = build.getPlugins().iterator(); iterator.hasNext();) {
			Plugin next = iterator.next();
			if ("maven-resources-plugin".equals(next.getArtifactId())) {
				return next;
			}
		}

		// Creates if couldn't be found.
		Plugin resourcesPlugin = new Plugin();
		resourcesPlugin.setGroupId("org.apache.maven.plugins");
		resourcesPlugin.setArtifactId("maven-resources-plugin");
		resourcesPlugin.setVersion("${maven.resources.plugin.version}");
		build.getPlugins().add(resourcesPlugin);
		return resourcesPlugin;
	}
 
开发者ID:awltech,项目名称:eclipse-asciidoctools,代码行数:21,代码来源:MavenEnablerJob.java

示例5: getSnapshotsFromManagement

import org.apache.maven.model.Build; //导入依赖的package包/类
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking managed plugins");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  Build build = project.getBuild();
  if (build != null) {
    PluginManagement pluginManagement = build.getPluginManagement();
    if (pluginManagement != null) {
      for (Plugin plugin : pluginManagement.getPlugins()) {
        Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
            new IsSnapshotDependency(propertyResolver));
        if (!snapshots.isEmpty()) {
          result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
              Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
        }
      }
    }
  }
  return result;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:21,代码来源:CheckPluginDependencyVersions.java

示例6: getSnapshots

import org.apache.maven.model.Build; //导入依赖的package包/类
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshots(MavenProject project,
    PomPropertyResolver propertyResolver) {
  this.log.debug("\t\tChecking direct plugin references");
  Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
  Build build = project.getBuild();
  if (build != null) {
    for (Plugin plugin : build.getPlugins()) {
      Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
          new IsSnapshotDependency(propertyResolver));
      if (!snapshots.isEmpty()) {
        result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
            Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
      }
    }
  }
  return result;
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:18,代码来源:CheckPluginDependencyVersions.java

示例7: handleAppYamlsDeprecation

import org.apache.maven.model.Build; //导入依赖的package包/类
/**
 * <p>If &lt;appYamls&gt; is explicitly set by the user, we'll display a warning.</p>
 * <p>If &lt;appYamls&gt; is explicitly set by the user and &lt;services&gt; is not (i.e. not
 * present in the configuration; <i>note: the </i>{@code services}<i> field will contain the
 * default value, so we cannot simply check if it's empty</i>), then we'll assign the value of
 * &lt;appYamls&gt; to &lt;services&gt; to be used in the run configuration.</p>
 * <p>If both &lt;appYamls&gt; and &lt;services&gt; are explicitly set in the configuration, we'll
 * throw an error.</p>
 *
 * @throws MojoExecutionException if both &lt;appYamls&gt; and &lt;services&gt; are explicitly set
 *     in the configuration
 */
protected void handleAppYamlsDeprecation() throws MojoExecutionException {
  if (CollectionUtil.isNullOrEmpty(appYamls)) {
    if (CollectionUtil.isNullOrEmpty(services)) {
      Build build = mavenProject.getBuild();
      services =
          Collections.singletonList(new File(build.getDirectory()).toPath()
              .resolve(build.getFinalName()).toFile());
    }
  } else {
    // no default value, so it was set by the user explicitly
    getLog().warn("<appYamls> is deprecated, use <services> instead.");
    if (CollectionUtil.isNullOrEmpty(services)) {
      services = appYamls;
    } else {
      throw new MojoExecutionException("Both <appYamls> and <services> are defined."
          + " <appYamls> is deprecated, use <services> only.");
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:app-maven-plugin,代码行数:32,代码来源:RunMojo.java

示例8: testRunFlexible

import org.apache.maven.model.Build; //导入依赖的package包/类
@Test
@Parameters({"1,V1", "2-alpha,V2ALPHA" })
public void testRunFlexible(String version, SupportedDevServerVersion mockVersion)
    throws MojoFailureException, MojoExecutionException, IOException {
  // wire up
  runMojo.devserverVersion = version;
  when(factoryMock.devServerRunSync(mockVersion)).thenReturn(devServerMock);
  when(mavenProjectMock.getBuild()).thenReturn(mock(Build.class));
  when(mavenProjectMock.getBuild().getDirectory()).thenReturn("/fake/project/build/directory");
  when(mavenProjectMock.getBuild().getFinalName()).thenReturn("artifact");

  // invoke
  expectedException.expect(MojoExecutionException.class);
  expectedException.expectMessage(
      "Dev App Server does not support App Engine Flexible Environment applications.");
  runMojo.execute();
}
 
开发者ID:GoogleCloudPlatform,项目名称:app-maven-plugin,代码行数:18,代码来源:RunMojoTest.java

示例9: AbstractProjectStub

import org.apache.maven.model.Build; //导入依赖的package包/类
AbstractProjectStub(String pomResourceName) throws IOException, XmlPullParserException {
    super(new MavenXpp3Reader().read(ITCompileBundleMojo.class.getResourceAsStream(pomResourceName)));

    Model model = getModel();
    setGroupId(model.getGroupId());
    setArtifactId(model.getArtifactId());
    setVersion(model.getVersion());
    setName(model.getName());
    setUrl(model.getUrl());
    setPackaging(model.getPackaging());

    SimpleArtifactStub artifact = new SimpleArtifactStub(
        model.getGroupId(), model.getArtifactId(), model.getVersion(), model.getPackaging());
    artifact.setArtifactHandler(new SimpleArtifactHandlerStub(model.getPackaging()));
    setArtifact(artifact);

    Build build = new Build();
    build.setFinalName(model.getArtifactId() + '-' + model.getVersion());
    setBuild(build);

    for (Dependency dependency: model.getDependencies()) {
        if (dependency.getScope() == null) {
            dependency.setScope(JavaScopes.COMPILE);
        }
    }
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:27,代码来源:AbstractProjectStub.java

示例10: testWhitespaceHandling2

import org.apache.maven.model.Build; //导入依赖的package包/类
@Test
public void testWhitespaceHandling2() throws IOException {
   File whitespace = new File( new File( "." ).getCanonicalFile(), WHITESPACE_DIR );

   // Save the real user.dir
   String dir = System.getProperty( "user.dir" );
   whitespace.mkdir();
   System.setProperty( "user.dir", whitespace.getCanonicalPath() );
   Build build = assertWhitespaceHandling( whitespace );

   String warning1 = "[WARNING] THERE IS WHITESPACE IN CLASSPATH ELEMENT [%s]%n";
   String warning2 = "Attempting relative path workaround%n";
   assertEquals( format( warning1 + warning2 + warning1 + warning2, build.getTestOutputDirectory(), build.getOutputDirectory() ), helper.logStream.toString() );

   // Restore the real user.dir (to prevent side-effects on other tests)
   System.setProperty( "user.dir", dir );
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:18,代码来源:CalcWikiFormatClasspathTest.java

示例11: assertWhitespaceHandling

import org.apache.maven.model.Build; //导入依赖的package包/类
private Build assertWhitespaceHandling( File whitespace ) throws IOException {
   // Save the real os.name
   String os = System.getProperty( "os.name" );
   System.setProperty( "os.name", "linux" );

   Build build = helper.mojo.project.getBuild();
   build.setOutputDirectory( mkdir( whitespace, build.getOutputDirectory() ) );
   build.setTestOutputDirectory( mkdir( whitespace, build.getTestOutputDirectory() ) );
   helper.mojo.project.setFile( new File( whitespace, "pom.xml" ) );

   assertEquals( "\n", helper.mojo.calcWikiFormatClasspath() );

   helper.classRealmAssertions();

   FileUtils.deleteQuietly( whitespace );

   // Restore the real os.name (to prevent side-effects on other tests)
   System.setProperty( "os.name", os );
   return build;
}
 
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:21,代码来源:CalcWikiFormatClasspathTest.java

示例12: customizeModel

import org.apache.maven.model.Build; //导入依赖的package包/类
void customizeModel( Model model )
{
    BuildSettings settings = configurator.getConfiguration().getBuildSettings();
    Build build = model.getBuild() != null ? model.getBuild() : new Build();
    List<Dependency> dependencies = model.getDependencies();
    List<Extension> extensions = build.getExtensions();
    List<Plugin> plugins = build.getPlugins();

    if ( settings.isSkipTests() )
        dependencies.removeIf( d -> StringUtils.equals( d.getScope(), "test" ) );

    dependencies.forEach( d -> d.setVersion( replaceVersion( d.getGroupId(), d.getArtifactId(),
                                                             d.getVersion() ) ) );
    extensions.forEach( e -> e.setVersion( replaceVersion( e.getGroupId(), e.getArtifactId(), e.getVersion() ) ) );
    plugins.forEach( p -> p.setVersion( replaceVersion( p.getGroupId(), p.getArtifactId(), p.getVersion() ) ) );

    plugins.stream().filter( p -> p.getGroupId().equals( "org.apache.maven.plugins" )
        && p.getArtifactId().equals( "maven-compiler-plugin" ) ).forEach( p -> configureCompiler( p ) );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:20,代码来源:XMvnModelValidator.java

示例13: DiffusionProjectStub

import org.apache.maven.model.Build; //导入依赖的package包/类
public DiffusionProjectStub(final File buildDirectory, final File pom)
        throws Exception {

    super(new DiffusionModelStub());

    setExecutionProject(this);

    setFile(pom);

    final Build build = new Build();
    build.setDirectory(buildDirectory.getAbsolutePath());
    setBuild(build);
    setDependencyArtifacts((Set)emptySet());
    setArtifacts((Set)emptySet());
    setPluginArtifacts((Set)emptySet());
    setReportArtifacts((Set)emptySet());
    setExtensionArtifacts((Set)emptySet());
    setRemoteArtifactRepositories((List)emptyList());
    setPluginArtifactRepositories((List)emptyList());
    setCollectedProjects((List)emptyList());
    setActiveProfiles((List)emptyList());
}
 
开发者ID:pushtechnology,项目名称:diffusion-maven-plugin,代码行数:23,代码来源:DiffusionProjectStub.java

示例14: getDefinedActiveBuilds

import org.apache.maven.model.Build; //导入依赖的package包/类
private Set<BuildBase> getDefinedActiveBuilds(MavenProject project) {
    HashSet<BuildBase> activeBuilds = new HashSet<>();
    final Model originalModel = project.getOriginalModel();
    final Build build = originalModel.getBuild();
    activeBuilds.add(build);

    final List<Profile> originalProfiles = originalModel.getProfiles();
    if (originalProfiles != null) {
        for (Profile profile : project.getActiveProfiles()) {
            // check active profile is defined in project
            for (Profile originalProfile : originalProfiles) {
                if (originalProfile.equals(profile)) {
                    activeBuilds.add(originalProfile.getBuild());
                }
            }
        }
    }
    // remove possible null entries
    activeBuilds.remove(null);
    return activeBuilds;
}
 
开发者ID:1and1,项目名称:ono-extra-enforcer-rules,代码行数:22,代码来源:AbstractRule.java

示例15: findDefiningParent

import org.apache.maven.model.Build; //导入依赖的package包/类
/**
 * Finds the ancestor project which defines the rule.
 *
 * @param project to inspect
 * @return the defining ancestor project.
 */
final MavenProject findDefiningParent( final MavenProject project )
{
    final Xpp3Dom invokingRule = createInvokingRuleDom();
    MavenProject parent = project;
    while ( parent != null )
    {
        final Model model = parent.getOriginalModel();
        final Build build = model.getBuild();
        if ( build != null )
        {
            final List<Xpp3Dom> rules = getRuleConfigurations( build );
            if ( isDefiningProject( rules, invokingRule ) )
            {
                break;
            }
        }
        parent = parent.getParent();
    }
    return parent;
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:27,代码来源:RequirePropertyDiverges.java


注:本文中的org.apache.maven.model.Build类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。