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


Java MavenProject.getArtifactId方法代码示例

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


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

示例1: findVersion

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
protected String findVersion ( final String id )
{
    getLog ().debug ( String.format ( "Looking for '%s'", id ) );
    for ( final MavenProject p : getReactorProjects () )
    {
        final String artifactId = p.getArtifactId ();
        final String packaging = p.getPackaging ();

        getLog ().debug ( String.format ( "Found %s:%s:%s:%s", p.getGroupId (), p.getArtifactId (), p.getVersion (), p.getPackaging () ) );

        if ( "eclipse-plugin".equals ( packaging ) && artifactId.equals ( id ) )
        {
            return getVersion ( p );
        }
        if ( "eclipse-feature".equals ( packaging ) && ( artifactId + ".feature.group" ).equals ( id ) )
        {
            return getVersion ( p );
        }
    }

    throw new IllegalStateException ( String.format ( "Unable to find installable unit: %s", id ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:UpdateMojo.java

示例2: getDisplayName

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
@Messages({
    "# {0} - dir basename", "LBL_misconfigured_project={0} [unloadable]",
    "# {0} - path to project", "TXT_Maven_project_at=Maven project at {0}"
})
private String getDisplayName(NbMavenProject nb) {
    MavenProject pr = nb.getMavenProject();
    if (NbMavenProject.isErrorPlaceholder(pr)) {
        return LBL_misconfigured_project(project.getProjectDirectory().getNameExt());
    }
    String custom = project.getLookup().lookup(AuxiliaryProperties.class).get(Constants.HINT_DISPLAY_NAME, true);
    if (custom == null) {
        custom = NbPreferences.forModule(Info.class).get(MavenSettings.PROP_PROJECTNODE_NAME_PATTERN, null);
    }
    if (custom != null) {
        //we evaluate because of global property and property in nb-configuration.xml file. The pom.xml originating value should be already resolved.
        ExpressionEvaluator evaluator = PluginPropertyUtils.createEvaluator(project);
        try {
            Object s = evaluator.evaluate(custom);
            if (s != null) {
                //just make sure the name gets resolved
                String ss = s.toString().replace("${project.name)", "" + pr.getGroupId() + ":" + pr.getArtifactId());
                return ss;
            }
        } catch (ExpressionEvaluationException ex) {
            //now just continue to the default processing
            LOG.log(Level.INFO, "bad display name expression:" + custom, ex);
        }
    }

    String toReturn = pr.getName();
    if (toReturn == null) {
        String grId = pr.getGroupId();
        String artId = pr.getArtifactId();
        if (grId != null && artId != null) {
            toReturn = grId + ":" + artId; //NOI18N
        } else {
            toReturn = TXT_Maven_project_at(FileUtil.getFileDisplayName(project.getProjectDirectory()));
        }
    }
    return toReturn;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:Info.java

示例3: execute

import org.apache.maven.project.MavenProject; //导入方法依赖的package包/类
public void execute() throws MojoExecutionException {
    log = getLog();
    try {
        OakProperties properties = new OakProperties();
        dependencyArtifacts = "io.github.wanghuayao:maven-plugin-oaktree:" + properties.getVersion() + ":dependency-artifacts";

        filter = new ProcessingFilter(likePatten, hitePatten, deep);

        MavenProject mp = (MavenProject) this.getPluginContext().get("project");
        String mavenHomeStr = removeUnusedCharInPath(mavenHome.getPath());
        File mvnExecFile = new File(mavenHomeStr + "/bin/mvn");
        mvnExec = mvnExecFile.getPath();
        String os = System.getProperty("os.name");
        if (os.toLowerCase().startsWith("win")) {
            mvnExec = mvnExec + ".cmd";
            isWindwos = true;
        }

        File okaBaseDir = new File(outputDirectory, "oaktree");
        File okadependencyDir = new File(okaBaseDir, "dependency");
        if (!okadependencyDir.exists()) {
            okadependencyDir.mkdirs();
        }
        okadependencyOutputDir = okadependencyDir.getPath();

        ArtifactItem rootItem = new ArtifactItem(mp.getGroupId(), mp.getArtifactId(), mp.getPackaging(), mp.getVersion());

        File rootPom = mp.getFile();
        int startDeep = 2;
        for (Object obj : mp.getDependencyArtifacts()) {
            DefaultArtifact artifact = (DefaultArtifact) obj;
            ArtifactItem chieldern = ArtifactItem.valueOf(artifact);
            if (filter.isGoOnProcessing(chieldern, startDeep)) {
                calcDependancy(chieldern, startDeep);
                rootItem.addChildren(chieldern);
            }
        }



        FileWriter w = null;
        try {
            File okaFile = new File(okaBaseDir,"okatree.txt");
            if(okaFile.exists()) {
                okaFile.delete();
            }
            w = new FileWriter(okaFile);
            log.info("writing file :  " + okaFile.getPath());
            printArtifactItem(w, rootItem, "");
            log.info("writing complete.");
        }finally {
            StreamUtils.quiteClose(w);
        }
    } catch (Exception ex) {
        getLog().error(ex.getMessage(), ex);
        throw new MojoExecutionException(ex.getMessage(), ex);
    }
}
 
开发者ID:wanghuayao,项目名称:maven-plugin-oaktree,代码行数:59,代码来源:CreateTreeMojo.java


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