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


Java MavenProject.getBuildPlugins方法代碼示例

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


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

示例1: getEffectiveReportPlugins

import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
/**
 * Should handle both deprecated 2.x-style report section, and 3.x-style Site Plugin config.
 * https://jira.codehaus.org/browse/MSITE-484 and https://jira.codehaus.org/browse/MSITE-443 if and when implemented may require updates.
 */
private static @NonNull Iterable<ReportPlugin> getEffectiveReportPlugins(@NonNull MavenProject prj) {
    List<ReportPlugin> plugins = new ArrayList<ReportPlugin>();
    for (Plugin plug : prj.getBuildPlugins()) {
        if (Constants.GROUP_APACHE_PLUGINS.equals(plug.getGroupId()) && Constants.PLUGIN_SITE.equals(plug.getArtifactId())) {
            Xpp3Dom cfg = (Xpp3Dom) plug.getConfiguration(); // MNG-4862
            if (cfg == null) {
                continue;
            }
            Xpp3Dom reportPlugins = cfg.getChild("reportPlugins");
            if (reportPlugins == null) {
                continue;
            }
            for (Xpp3Dom plugin : reportPlugins.getChildren("plugin")) {
                ReportPlugin p = new ReportPlugin();
                Xpp3Dom groupId = plugin.getChild("groupId");
                if (groupId != null) {
                    p.setGroupId(groupId.getValue());
                }
                Xpp3Dom artifactId = plugin.getChild("artifactId");
                if (artifactId != null) {
                    p.setArtifactId(artifactId.getValue());
                }
                Xpp3Dom version = plugin.getChild("version");
                if (version != null) {
                    p.setVersion(version.getValue());
                }
                p.setConfiguration(plugin.getChild("configuration"));
                // XXX reportSets
                // maven-site-plugin does not appear to apply defaults from plugin.xml (unlike 2.x?)
                plugins.add(p);
            }
        }
    }
    @SuppressWarnings("deprecation") List<ReportPlugin> m2Plugins = prj.getReportPlugins();
    plugins.addAll(m2Plugins);
    return plugins;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:42,代碼來源:PluginPropertyUtils.java


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