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


Java Model.setArtifactId方法代码示例

本文整理汇总了Java中org.apache.maven.model.Model.setArtifactId方法的典型用法代码示例。如果您正苦于以下问题:Java Model.setArtifactId方法的具体用法?Java Model.setArtifactId怎么用?Java Model.setArtifactId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Model的用法示例。


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

示例1: ModelTree

import org.apache.maven.model.Model; //导入方法依赖的package包/类
/**
     * This is a tree of Maven artifacts, which are represented by {@link Model} objects.
     * The idea here is, given a list of Maven pom.xml {@link File} objects, create a tree
     * based on dependency among them, but specifying explicitly which Maven artifact should
     * be at the root of the tree. That means, if any artifact in the list is not a child,
     * directly or indirectly, of the root artifact, then it will end up no being in the tree.
     * <br>
     * As a result of building this tree, it is possible to know, out of the initial pom.xml files list,
     * which ones actually inherit, directly or not, from the root artifact. The result is retrieved
     * by calling {@link #getPomFilesInTree()}
     *
     * @param rootGroupId the group id of the artifact that should be at the root of the tree
     * @param rootArtifactId the artifact id of the artifact that should be at the root of the tree
     * @param rootVersion the version of the artifact that should be at the root of the tree
     * @param pomFiles a list of pom.xml files used to make the tree
     */
    public ModelTree(String rootGroupId, String rootArtifactId, String rootVersion, List<File> pomFiles) {
        Model rootModel = new Model();
        rootModel.setGroupId(rootGroupId);
        rootModel.setArtifactId(rootArtifactId);
        rootModel.setVersion(rootVersion);

        List<Model> models = new ArrayList<>();
        models.add(rootModel);

        for (File pomFile : pomFiles) {
            models.add(createModel(pomFile));
        }

// TODO we can comment this out in the future if we need this feature
//        modelsNotInTree = add(models);
        add(models);
    }
 
开发者ID:paypal,项目名称:butterfly,代码行数:34,代码来源:ModelTree.java

示例2: pomFileWithDependencies

import org.apache.maven.model.Model; //导入方法依赖的package包/类
@And("^POM file with dependencies:$")
public void pomFileWithDependencies(List<MavenDependencySpec> dependencies) throws Throwable {
  for (MavenDependencySpec dependency : dependencies) {
    dependency.setExcludes(dependency.excludes);
  }

  Model model = new Model();
  model.setModelVersion("4.0.0");
  model.setGroupId("com.example");
  model.setArtifactId("example-artifact");
  model.setVersion("1.0.0-SNAPSHOT");
  model.setPackaging("pom");
  dependencies.forEach(model::addDependency);

  Path pomFile = projectDir.resolve("pom.xml");
  new MavenXpp3Writer().write(Files.newBufferedWriter(pomFile), model);
}
 
开发者ID:bsideup,项目名称:gradle-maven-sync-plugin,代码行数:18,代码来源:GradleStepdefs.java

示例3: POMData

import org.apache.maven.model.Model; //导入方法依赖的package包/类
public POMData(ParentData parentData, String groupId, String artifactId, String versionId,
               List<DependencyData>
        dependencies, List<RepositoryData> repositories) throws IOException {
    Model model = new Model();
    parentData.write(model);
    model.setGroupId(groupId);
    model.setArtifactId(artifactId);
    model.setVersion(versionId);
    model.setModelVersion("4.0.0");
    dependencies.forEach((dependencyData -> dependencyData.write(model)));
    repositories.forEach((repositoryData -> repositoryData.write(model)));
    this.dependencies = dependencies;
    this.repositories = repositories;
    this.groupId = groupId;
    this.artifactId = artifactId;
    this.version = versionId;
    StringWriter writer = new StringWriter();
    new MavenXpp3Writer().write(writer, model);
    this.xml = writer.toString();
}
 
开发者ID:PizzaCrust,项目名称:IodineToolkit,代码行数:21,代码来源:POMData.java

示例4: model

import org.apache.maven.model.Model; //导入方法依赖的package包/类
private ModelWrapper model(String projectName) {
	Model parent = new Model();
	parent.setArtifactId(projectName);
	return new ModelWrapper(parent);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:6,代码来源:PomUpdaterTests.java

示例5: createProjectDependencyPomModel

import org.apache.maven.model.Model; //导入方法依赖的package包/类
private Model createProjectDependencyPomModel(Model processingPomModel) {
    Model templateModel = new Model();
    templateModel.setModelVersion(processingPomModel.getModelVersion());
    templateModel.setGroupId("org.processing.idea");
    templateModel.setArtifactId("core");
    templateModel.setVersion("1.0.0");

    List<Dependency> artifactDependencies = new ArrayList<>(6);

    String joglVersion = null;
    for (Dependency dependency : processingPomModel.getDependencies()) {
        if (dependency.getGroupId().equals("org.jogamp.jogl") && dependency.getArtifactId().equals("jogl")) {
            joglVersion = dependency.getVersion();
        }
    }

    if (joglVersion == null) {
        throw new IllegalStateException("Unable to determine JOGL version used for this build of Processing.");
    }

    Dependency core = new Dependency();
    core.setGroupId("org.processing");
    core.setArtifactId("core");
    core.setVersion(version.toString());
    artifactDependencies.add(core);

    Dependency pdfExport = new Dependency();
    pdfExport.setGroupId(VanillaLibrary.PDF_EXPORT.getGroupId());
    pdfExport.setArtifactId(VanillaLibrary.PDF_EXPORT.getArtifactId());
    pdfExport.setVersion(version.toString());
    artifactDependencies.add(pdfExport);

    Dependency serial = new Dependency();
    serial.setGroupId(VanillaLibrary.SERIAL.getGroupId());
    serial.setArtifactId(VanillaLibrary.SERIAL.getArtifactId());
    serial.setVersion(version.toString());
    artifactDependencies.add(serial);

    Dependency network = new Dependency();
    network.setGroupId(VanillaLibrary.NETWORK.getGroupId());
    network.setArtifactId(VanillaLibrary.NETWORK.getArtifactId());
    network.setVersion(version.toString());
    artifactDependencies.add(network);

    Dependency gluegenRt = new Dependency();
    gluegenRt.setGroupId("org.jogamp.gluegen");
    gluegenRt.setArtifactId("gluegen-rt-main");
    gluegenRt.setVersion(joglVersion);
    artifactDependencies.add(gluegenRt);

    Dependency joglAllMain = new Dependency();
    joglAllMain.setGroupId("org.jogamp.jogl");
    joglAllMain.setArtifactId("jogl-all-main");
    joglAllMain.setVersion(joglVersion);
    artifactDependencies.add(joglAllMain);

    if (SystemInfo.isMac) {
        Dependency appleExtensions = new Dependency();
        appleExtensions.setGroupId("com.apple");
        appleExtensions.setArtifactId("AppleJavaExtensions");
        appleExtensions.setVersion("LATEST");
        artifactDependencies.add(appleExtensions);
    }

    templateModel.setDependencies(artifactDependencies);

    return templateModel;
}
 
开发者ID:mistodev,项目名称:processing-idea,代码行数:69,代码来源:CreateVersionedProcessingPom.java

示例6: createDependencyReducedPom

import org.apache.maven.model.Model; //导入方法依赖的package包/类
private void createDependencyReducedPom( Set<String> artifactsToRemove )
    throws IOException, DependencyGraphBuilderException, ProjectBuildingException
{
    List<Dependency> dependencies = new ArrayList<Dependency>();

    boolean modified = false;

    List<Dependency> transitiveDeps = new ArrayList<Dependency>();

    // NOTE: By using the getArtifacts() we get the completely evaluated artifacts
    // including the system scoped artifacts with expanded values of properties used.
    for ( Artifact artifact : project.getArtifacts() )
    {
        if ( "pom".equals( artifact.getType() ) )
        {
            // don't include pom type dependencies in dependency reduced pom
            continue;
        }

        // promote
        Dependency dep = createDependency( artifact );

        // we'll figure out the exclusions in a bit.
        transitiveDeps.add( dep );
    }
    List<Dependency> origDeps = project.getDependencies();

    if ( promoteTransitiveDependencies )
    {
        origDeps = transitiveDeps;
    }

    Model model = project.getOriginalModel();
    // MSHADE-185: We will remove all system scoped dependencies which usually
    // have some kind of property usage. At this time the properties within
    // such things are already evaluated.
    List<Dependency> originalDependencies = model.getDependencies();
    removeSystemScopedDependencies( artifactsToRemove, originalDependencies );

    for ( Dependency d : origDeps )
    {
        dependencies.add( d );

        String id = getId( d );

        if ( artifactsToRemove.contains( id ) )
        {
            modified = true;

            if ( keepDependenciesWithProvidedScope )
            {
                d.setScope( "provided" );
            }
            else
            {
                dependencies.remove( d );
            }
        }
    }

    // MSHADE-155
    model.setArtifactId( shadedArtifactId );

    // MSHADE-185: We will add those system scoped dependencies
    // from the non interpolated original pom file. So we keep
    // things like this: <systemPath>${tools.jar}</systemPath> intact.
    addSystemScopedDependencyFromNonInterpolatedPom( dependencies, originalDependencies );

    // Check to see if we have a reduction and if so rewrite the POM.
    rewriteDependencyReducedPomIfWeHaveReduction( dependencies, modified, transitiveDeps, model );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:72,代码来源:ShadeMojo.java


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