本文整理汇总了Java中org.apache.maven.model.Plugin.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.getConfiguration方法的具体用法?Java Plugin.getConfiguration怎么用?Java Plugin.getConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Plugin
的用法示例。
在下文中一共展示了Plugin.getConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNonFilteredFileExtensions
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private List<String> getNonFilteredFileExtensions(List<Plugin> plugins) {
for (Plugin plugin : plugins) {
if (MAVEN_RESOURCES_PLUGIN.equals(plugin.getArtifactId())) {
final Object configuration = plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom xpp3Dom = (Xpp3Dom) configuration;
final Xpp3Dom nonFilteredFileExtensions = xpp3Dom.getChild(NON_FILTERED_FILE_EXTENSIONS);
List<String> nonFilteredFileExtensionsList = new ArrayList<>();
final Xpp3Dom[] children = nonFilteredFileExtensions.getChildren();
for (Xpp3Dom child : children) {
nonFilteredFileExtensionsList.add(child.getValue());
}
return nonFilteredFileExtensionsList;
}
}
}
return null;
}
示例2: getCompileTargetVersion
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Determines the Java compiler target version by inspecting the project's maven-compiler-plugin
* configuration.
*
* @return The Java compiler target version.
*/
public String getCompileTargetVersion() {
// maven-plugin-compiler default is 1.5
String javaVersion = "1.5";
if (mavenProject != null) {
// check the maven.compiler.target property first
String mavenCompilerTargetProperty = mavenProject.getProperties()
.getProperty("maven.compiler.target");
if (mavenCompilerTargetProperty != null) {
javaVersion = mavenCompilerTargetProperty;
} else {
Plugin compilerPlugin = mavenProject
.getPlugin("org.apache.maven.plugins:maven-compiler-plugin");
if (compilerPlugin != null) {
Xpp3Dom config = (Xpp3Dom) compilerPlugin.getConfiguration();
if (config != null) {
Xpp3Dom domVersion = config.getChild("target");
if (domVersion != null) {
javaVersion = domVersion.getValue();
}
}
}
}
}
return javaVersion;
}
示例3: getRuleConfigurations
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Returns the list of <tt>requirePropertyDiverges</tt> configurations from the map of plugins.
*
* @param plugins
* @return list of requirePropertyDiverges configurations.
*/
List<Xpp3Dom> getRuleConfigurations( final Map<String, Plugin> plugins )
{
if ( plugins.containsKey( MAVEN_ENFORCER_PLUGIN ) )
{
final List<Xpp3Dom> ruleConfigurations = new ArrayList<Xpp3Dom>();
final Plugin enforcer = plugins.get( MAVEN_ENFORCER_PLUGIN );
final Xpp3Dom configuration = ( Xpp3Dom ) enforcer.getConfiguration();
// add rules from plugin configuration
addRules( configuration, ruleConfigurations );
// add rules from all plugin execution configurations
for ( Object execution : enforcer.getExecutions() )
{
addRules( ( Xpp3Dom ) ( ( PluginExecution ) execution ).getConfiguration(), ruleConfigurations );
}
return ruleConfigurations;
}
else
{
return new ArrayList();
}
}
示例4: getGwtModuleName
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Get the GWT Maven plugin 2 <moduleName/>.
*
* @param mavenProject
* @return the moduleName from configuration
*/
private String getGwtModuleName(MavenProject mavenProject) {
if (!isGwtMavenPlugin2(mavenProject)) {
return null;
}
Plugin gwtPlugin2 = getGwtMavenPlugin2(mavenProject);
if (gwtPlugin2 == null) {
return null;
}
Xpp3Dom gwtPluginConfig = (Xpp3Dom) gwtPlugin2.getConfiguration();
if (gwtPluginConfig == null) {
return null;
}
String moduleName = null;
for (Xpp3Dom child : gwtPluginConfig.getChildren()) {
if (child != null && GWT_MAVEN_MODULENAME.equals(child.getName())) {
moduleName = child.getValue().trim();
}
}
return moduleName;
}
示例5: getGwtModuleShortName
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Get the GWT Maven plugin 2 <moduleShort=Name/>.
*
* @param mavenProject
* @return the moduleName from configuration
*/
private String getGwtModuleShortName(MavenProject mavenProject) {
if (!isGwtMavenPlugin2(mavenProject)) {
return null;
}
Plugin gwtPlugin2 = getGwtMavenPlugin2(mavenProject);
if (gwtPlugin2 == null) {
return null;
}
Xpp3Dom gwtPluginConfig = (Xpp3Dom) gwtPlugin2.getConfiguration();
if (gwtPluginConfig == null) {
return null;
}
String moduleName = null;
for (Xpp3Dom child : gwtPluginConfig.getChildren()) {
if (child != null && GWT_MAVEN_MODULESHORTNAME.equals(child.getName())) {
moduleName = child.getValue().trim();
}
}
return moduleName;
}
示例6: getGwtMavenPluginHostedWebAppDirectory
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Get the GWT Maven <hostedWebapp/> directory.
*
* @param mavenProject
* @return the webapp directory
*/
private IPath getGwtMavenPluginHostedWebAppDirectory(MavenProject mavenProject) {
Plugin warPlugin = getGwtMavenPlugin(mavenProject);
if (warPlugin == null) {
return null;
}
Xpp3Dom warPluginConfig = (Xpp3Dom) warPlugin.getConfiguration();
if (warPluginConfig == null) {
return null;
}
IPath warOut = null;
for (Xpp3Dom child : warPluginConfig.getChildren()) {
if (child != null && HOSTED_WEB_APP_DIRECTORY.equals(child.getName())) {
String path = child.getValue().trim();
if (!path.isEmpty()) {
warOut = new Path(path);
}
}
}
return warOut;
}
示例7: getMavenWarPluginWebAppDirectory
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Return the war out directory via the Maven war plugin <webappDirectory/>.
*
* @param mavenProject
* @return path to web app direcotry
*/
protected IPath getMavenWarPluginWebAppDirectory(MavenProject mavenProject) {
Plugin warPlugin = getWarPlugin(mavenProject);
if (warPlugin == null) {
return null;
}
Xpp3Dom warPluginConfig = (Xpp3Dom) warPlugin.getConfiguration();
if (warPluginConfig == null) {
return null;
}
IPath warOut = null;
for (Xpp3Dom child : warPluginConfig.getChildren()) {
if (child != null && WEB_APP_DIRECTORY.equals(child.getName())) {
String path = child.getValue().trim();
if (!path.isEmpty()) {
warOut = new Path(path);
}
}
}
return warOut;
}
示例8: getGwtPlugin2WebAppDirectory
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Returns the Gwt Maven Plugin 2 web app directory <webappDirectory/>.
*
* @param mavenProject
* @return path to web app direcotry
*/
protected IPath getGwtPlugin2WebAppDirectory(MavenProject mavenProject) {
Plugin warPlugin = getGwtMavenPlugin2(mavenProject);
if (warPlugin == null) {
return null;
}
Xpp3Dom warPluginConfig = (Xpp3Dom) warPlugin.getConfiguration();
if (warPluginConfig == null) {
return null;
}
IPath warOut = null;
for (Xpp3Dom child : warPluginConfig.getChildren()) {
if (child != null && WEB_APP_DIRECTORY.equals(child.getName())) {
String path = child.getValue().trim();
if (!path.isEmpty()) {
warOut = new Path(path);
}
}
}
return warOut;
}
示例9: hasProjectNature
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Searches the Maven pom.xml for the given project nature.
*
* @param mavenProject a description of the Maven project
* @param natureId the nature to check
* @return {@code true} if the project
*/
protected boolean hasProjectNature(MavenProject mavenProject, String natureId) {
if (natureId == GWTNature.NATURE_ID || getGwtMavenPlugin(mavenProject) != null) {
return true;
}
// The use of the maven-eclipse-plugin is deprecated. The following code is
// only for backward compatibility.
Plugin plugin = getEclipsePlugin(mavenProject);
if (plugin != null) {
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom additionalBuildCommands = configuration.getChild("additionalProjectnatures");
if (additionalBuildCommands != null) {
for (Xpp3Dom projectNature : additionalBuildCommands.getChildren("projectnature")) {
if (projectNature != null && natureId.equals(projectNature.getValue())) {
return true;
}
}
}
}
}
return false;
}
示例10: getAuthors
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Lookup and returns the value of the <em>author</em> configuration.
* <p>
* The configuration string is split based on ',' so multiple authors can be
* defined.
*
* @param project project
* @return list of authors or null if not found
*/
protected static List<Author> getAuthors(MavenProject project) {
Plugin nbmPlugin = lookupNbmPlugin(project);
if (nbmPlugin != null) {
Xpp3Dom config = (Xpp3Dom) nbmPlugin.getConfiguration();
if (config != null && config.getChild("author") != null) {
String authorName = config.getChild("author").getValue();
String authorEmail = config.getChild("authorEmail") != null ? config.getChild("authorEmail").getValue() : null;
String authorUrl = config.getChild("authorUrl") != null ? config.getChild("authorUrl").getValue() : null;
Author author = new Author();
author.name = authorName;
author.email = authorEmail;
author.link = authorUrl;
return Arrays.asList(new Author[]{author});
}
}
return null;
}
示例11: getSourceCode
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
/**
* Lookup source code configuration or default to SCM.
*
* @param project project
* @param log log
* @return source code url or null
*/
protected static String getSourceCode(MavenProject project, Log log) {
Plugin nbmPlugin = lookupNbmPlugin(project);
if (nbmPlugin != null) {
Xpp3Dom config = (Xpp3Dom) nbmPlugin.getConfiguration();
if (config != null && config.getChild("sourceCodeUrl") != null) {
return config.getChild("sourceCodeUrl").getValue();
}
}
Scm scm = project.getScm();
if (scm != null && scm.getUrl() != null && !scm.getUrl().isEmpty()) {
log.debug("SCM configuration found, with url = '" + scm.getUrl() + "'");
return scm.getUrl();
} else {
}
return null;
}
示例12: getEffectiveReportPlugins
import org.apache.maven.model.Plugin; //导入方法依赖的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;
}
示例13: getThreadCount
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private int getThreadCount() throws JDOMException, IOException, XmlPullParserException {
int threadCount=0;
MavenXpp3Reader reader = new MavenXpp3Reader();
Model model = reader.read(new FileReader(pomFile));
ArrayList<Plugin> pluginsList = (ArrayList<Plugin>) model.getBuild().getPlugins();
for (Plugin plugin: pluginsList) {
if(plugin.getArtifactId().equals("cucumber-runner-maven-plugin")){
Xpp3Dom xpp = (Xpp3Dom) plugin.getConfiguration();
threadCount= Integer.parseInt(xpp.getChild("threadCount").getValue());
}
}
return threadCount;
}
示例14: buildRuntimeClasspaths
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
private URL[] buildRuntimeClasspaths() throws IOException {
final Map<String, File> actualClasspaths = getActualClasspaths();
List<URL> classpaths = new ArrayList<URL>();
for (Artifact artifact : artifacts) {
File artifactFile = actualClasspaths.get(artifact.getFile().getName());
if (artifactFile == null || !artifactFile.equals(artifact.getFile())) {
logger.debug(String.format("Artifact: %s (%s)", artifact, artifact.getFile()));
classpaths.add(artifact.getFile().toURI().toURL());
}
}
// Add project folders, if any.
String buildOutputDirectory = project.getBuild().getOutputDirectory();
classpaths.add(new File(buildOutputDirectory).toURI().toURL());
@SuppressWarnings("unchecked")
List<Plugin> buildPlugins = project.getBuildPlugins();
for (Plugin plugin : buildPlugins) {
if (StringUtils.equals(PLUGIN_KEY,plugin.getKey())) {
Xpp3Dom configuration = (Xpp3Dom)plugin.getConfiguration();
if (configuration != null) {
Xpp3Dom fixtureOutputDirectory = configuration.getChild("fixtureOutputDirectory");
String relativeDirectory = fixtureOutputDirectory.getValue();
if (!StringUtils.isEmpty(relativeDirectory)){
File directory = FileUtils.getFile(project.getBasedir(), relativeDirectory);
classpaths.add(directory.toURI().toURL());
}
}
break;
}
}
logger.debug("Classpath used: " + classpaths.toString(), null);
return toArray(classpaths, URL.class);
}
示例15: getGoalConfiguration
import org.apache.maven.model.Plugin; //导入方法依赖的package包/类
@Override
public Xpp3Dom getGoalConfiguration(
String pluginGroupId, String pluginArtifactId, String executionId, String goalId) {
Plugin plugin = getPlugin(pluginGroupId + ':' + pluginArtifactId);
Object configuration = plugin.getConfiguration();
return (Xpp3Dom) configuration;
}