List of usage examples for org.apache.maven.project MavenProject getPlugin
public Plugin getPlugin(String pluginKey)
From source file:org.maven.ide.eclipse.wtp.RarPluginConfiguration.java
License:Open Source License
public RarPluginConfiguration(MavenProject mavenProject) { if (JEEPackaging.RAR != JEEPackaging.getValue(mavenProject.getPackaging())) throw new IllegalArgumentException("Maven project must have rar packaging"); this.rarProject = mavenProject; this.plugin = mavenProject.getPlugin("org.apache.maven.plugins:maven-rar-plugin"); }
From source file:org.maven.ide.querydsl.AptConfigurator.java
License:Open Source License
private QueryDslConfiguration getQueryDslConfiguration(final MavenFacade p_mavenFacade) throws CoreException { MavenProject mavenProject = p_mavenFacade.getMavenProject(); // find querydsl version so we can resolve matching one-jar from repo String queryDslVersion = "0.0.0"; List<Dependency> dependencies = mavenProject.getDependencies(); for (Dependency dependency : dependencies) { if ("com.mysema.querydsl".equals(dependency.getGroupId())) { queryDslVersion = dependency.getVersion(); break; }//from w w w . j a va 2 s . c o m } Plugin queryDslPlugin = mavenProject.getPlugin("com.mysema.maven:maven-apt-plugin"); QueryDslConfiguration queryDslConfiguration = new QueryDslConfiguration(queryDslPlugin, queryDslVersion, p_mavenFacade); return queryDslConfiguration; }
From source file:org.onos.yangtools.yang2sources.plugin.Util.java
License:Open Source License
/** * Read current project dependencies and check if it don't grab incorrect * artifacts versions which could be in conflict with plugin dependencies. * * @param project/* w ww . j av a2 s .c o m*/ * current project * @param repoSystem * repository system * @param localRepo * local repository * @param remoteRepos * remote repositories * @param log * logger */ static void checkClasspath(MavenProject project, RepositorySystem repoSystem, ArtifactRepository localRepo, List<ArtifactRepository> remoteRepos, Log log) { Plugin plugin = project.getPlugin(YangToSourcesMojo.PLUGIN_NAME); if (plugin == null) { log.warn(message("%s not found, dependencies version check skipped", YangToSourcesProcessor.LOG_PREFIX, YangToSourcesMojo.PLUGIN_NAME)); } else { Map<Artifact, Collection<Artifact>> pluginDependencies = new HashMap<>(); getPluginTransitiveDependencies(plugin, pluginDependencies, repoSystem, localRepo, remoteRepos, log); Set<Artifact> projectDependencies = project.getDependencyArtifacts(); for (Map.Entry<Artifact, Collection<Artifact>> entry : pluginDependencies.entrySet()) { checkArtifact(entry.getKey(), projectDependencies, log); for (Artifact dependency : entry.getValue()) { checkArtifact(dependency, projectDependencies, log); } } } }
From source file:org.opendaylight.yangtools.yang2sources.plugin.Util.java
License:Open Source License
/** * Read current project dependencies and check if it don't grab incorrect * artifacts versions which could be in conflict with plugin dependencies. * * @param project//from w w w .j a v a2 s . c om * current project * @param repoSystem * repository system * @param localRepo * local repository * @param remoteRepos * remote repositories */ static void checkClasspath(final MavenProject project, final RepositorySystem repoSystem, final ArtifactRepository localRepo, final List<ArtifactRepository> remoteRepos) { Plugin plugin = project.getPlugin(YangToSourcesMojo.PLUGIN_NAME); if (plugin == null) { LOG.warn("{} {} not found, dependencies version check skipped", YangToSourcesProcessor.LOG_PREFIX, YangToSourcesMojo.PLUGIN_NAME); } else { Map<Artifact, Collection<Artifact>> pluginDependencies = new HashMap<>(); getPluginTransitiveDependencies(plugin, pluginDependencies, repoSystem, localRepo, remoteRepos); Set<Artifact> projectDependencies = project.getDependencyArtifacts(); for (Map.Entry<Artifact, Collection<Artifact>> entry : pluginDependencies.entrySet()) { checkArtifact(entry.getKey(), projectDependencies); for (Artifact dependency : entry.getValue()) { checkArtifact(dependency, projectDependencies); } } } }
From source file:org.sonatype.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.java
License:Open Source License
protected Xpp3Dom getArchiveConfiguration(MavenProject mavenProject) { Plugin plugin = mavenProject.getPlugin(getPluginKey()); if (plugin == null) return null; Xpp3Dom pluginConfig = (Xpp3Dom) plugin.getConfiguration(); if (pluginConfig == null) { return null; }/*from ww w .j a v a 2s . c o m*/ return pluginConfig.getChild(ARCHIVE_NODE); }
From source file:org.sourcepit.maven.bootstrap.internal.core.PluginConfigurationReader.java
License:Apache License
public static List<Dependency> readExtensions(MavenProject bootProject, String pluginKey) { final List<Dependency> result = new ArrayList<Dependency>(); final Plugin plugin = bootProject.getPlugin(pluginKey); if (plugin != null) { final Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); if (configuration != null) { final Xpp3Dom extensions = configuration.getChild("extensions"); if (extensions != null) { for (Xpp3Dom extension : extensions.getChildren("extension")) { result.add(newDependency(extension)); }/*from w ww.j a v a 2 s. c o m*/ } } } return result; }
From source file:org.sourcepit.tpmp.resolver.tycho.TychoSurefirePluginConfigurationReader.java
License:Apache License
public TychoSurefirePluginConfiguration read(MavenProject project) { final Plugin plugin = project.getPlugin("org.eclipse.tycho:tycho-surefire-plugin"); if (plugin != null) { final TychoSurefirePluginConfiguration result = new TychoSurefirePluginConfiguration(); final Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); if (configuration != null) { readConfiguration(result, configuration); }//from w w w .j a v a2 s.c o m return result; } return null; }
From source file:org.springframework.ide.eclipse.maven.internal.core.DataNucleusProjectConfigurator.java
License:Open Source License
/** * {@inheritDoc}/*from w ww .ja va 2 s .co m*/ */ @Override protected void doConfigure(final MavenProject mavenProject, IProject project, ProjectConfigurationRequest request, final IProgressMonitor monitor) throws CoreException { if (configureNature(project, mavenProject, GAE_NATURE_ID, false, monitor)) { // Remove DN support if we use GAE if (mavenProject.getPlugin("org.datanucleus:maven-datanucleus-plugin") != null) { for (ProjectBuilderDefinition builderDefinition : ProjectBuilderDefinitionFactory .getProjectBuilderDefinitions()) { if (DN_BUILDER_ID.equals(builderDefinition.getId())) { builderDefinition.setEnabled(false, project); break; } } } } else { // Make sure that we add DN support if DN is being used in the pom.xml if (mavenProject.getPlugin("org.datanucleus:maven-datanucleus-plugin") != null) { for (ProjectBuilderDefinition builderDefinition : ProjectBuilderDefinitionFactory .getProjectBuilderDefinitions()) { if (DN_BUILDER_ID.equals(builderDefinition.getId())) { SpringCorePreferences.getProjectPreferences(project) .putBoolean(SpringCore.PROJECT_PROPERTY_ID, true); builderDefinition.setEnabled(true, project); break; } } } } }
From source file:org.wildfly.swarm.plugin.maven.MultiStartMojo.java
License:Apache License
protected Xpp3Dom getConfiguration(MavenProject project, String executionId) { Plugin plugin = project.getPlugin("org.wildfly.swarm:wildfly-swarm-plugin"); PluginExecution execution = null;/*from ww w. j a v a 2 s . c o m*/ for (PluginExecution each : plugin.getExecutions()) { if (executionId != null) { if (each.getId().equals(executionId)) { execution = each; break; } } else if (each.getGoals().contains("start")) { execution = each; break; } } Xpp3Dom config; if (execution == null) { config = new Xpp3Dom("configuration"); } else { config = (Xpp3Dom) execution.getConfiguration(); } Xpp3Dom pdom = new Xpp3Dom("project"); pdom.setValue("${project}"); config.addChild(pdom); pdom = new Xpp3Dom("repositorySystemSession"); pdom.setValue("${repositorySystemSession}"); config.addChild(pdom); pdom = new Xpp3Dom("remoteRepositories"); pdom.setValue("${project.remoteArtifactRepositories}"); config.addChild(pdom); return config; }