use of org.apache.maven.model.Plugin in project sling by apache.
the class MavenProjectUtils method getModelDirectoryCandidateLocations.
/**
* Returns a set of candidate locations for the project's model directory
*
* <p>The heuristics are based on the logic from <tt>org.apache.sling.maven.slingstart.ModelPreprocessor</tt>.
* The returned values may or may not exist on the filesystem, it is up to the client to check that.
* The values are ordered from the most likely to the least likely, so clients should iterate
* the returned candidates in order and pick the first one that exists.</p>
*
* @param mavenProject the project, must not be null
* @return an ordered set of candidates, never empty
*/
public static Set<String> getModelDirectoryCandidateLocations(MavenProject mavenProject) {
List<String> candidates = new ArrayList<>();
candidates.add("src/main/provisioning");
candidates.add("src/test/provisioning");
Plugin slingstartPlugin = mavenProject.getPlugin("org.apache.sling:slingstart-maven-plugin");
if (slingstartPlugin != null && slingstartPlugin.getConfiguration() instanceof Xpp3Dom) {
Xpp3Dom config = (Xpp3Dom) slingstartPlugin.getConfiguration();
Xpp3Dom modelDir = config.getChild("modelDirectory");
if (modelDir != null) {
candidates.add(0, modelDir.getValue());
}
}
return new LinkedHashSet<>(candidates);
}
use of org.apache.maven.model.Plugin in project docker-maven-plugin by fabric8io.
the class MojoExecutionServiceTest method expectNewPlugin.
// ============================================================================================
private Expectations expectNewPlugin() {
return new Expectations() {
{
project.getPlugin(PLUGIN_NAME);
result = new Plugin();
}
};
}
use of org.apache.maven.model.Plugin in project kie-wb-common by kiegroup.
the class DefaultPomEditor method getNewCompilerPlugin.
protected Plugin getNewCompilerPlugin() {
Plugin newCompilerPlugin = new Plugin();
newCompilerPlugin.setGroupId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGINS));
newCompilerPlugin.setArtifactId(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN));
newCompilerPlugin.setVersion(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN_VERSION));
PluginExecution execution = new PluginExecution();
execution.setId(MavenCLIArgs.COMPILE);
execution.setGoals(Arrays.asList(MavenCLIArgs.COMPILE));
execution.setPhase(MavenCLIArgs.COMPILE);
Xpp3Dom compilerId = new Xpp3Dom(MavenConfig.MAVEN_COMPILER_ID);
compilerId.setValue(compiler.name().toLowerCase());
Xpp3Dom configuration = new Xpp3Dom(MavenConfig.MAVEN_PLUGIN_CONFIGURATION);
configuration.addChild(compilerId);
execution.setConfiguration(configuration);
newCompilerPlugin.setExecutions(Arrays.asList(execution));
return newCompilerPlugin;
}
use of org.apache.maven.model.Plugin in project felix by apache.
the class SCRDescriptorMojo method getBundlePlugin.
/**
* We need the bundle plugin with a version higher than 2.5.0!
*/
private Plugin getBundlePlugin() {
Plugin bundlePlugin = null;
final List<Plugin> plugins = this.project.getBuildPlugins();
for (final Plugin p : plugins) {
if (p.getArtifactId().equals(BUNDLE_PLUGIN_ARTIFACT_ID) && p.getGroupId().equals(BUNDLE_PLUGIN_GROUP_ID)) {
final ArtifactVersion pluginVersion = new DefaultArtifactVersion(p.getVersion());
final ArtifactVersion requiredMinVersion = new DefaultArtifactVersion("2.5.0");
if (pluginVersion.compareTo(requiredMinVersion) > 0) {
bundlePlugin = p;
break;
}
}
}
return bundlePlugin;
}
use of org.apache.maven.model.Plugin in project pom-manipulation-ext by release-engineering.
the class Project method getResolvedProfilePlugins.
/**
* This method will scan the plugins in the potentially active Profiles in this project and
* return a fully resolved list. Note that while updating the {@link Plugin} reference
* returned will be reflected in the Model as it is the same object, if you wish to
* remove or add items to the Model then you must use {@link #getModel()}
*
* @param session MavenSessionHandler, used by {@link PropertyResolver}
* @return a list of fully resolved {@link ProjectVersionRef} to the original {@link Plugin}
* @throws ManipulationException if an error occurs
*/
public HashMap<Profile, HashMap<ProjectVersionRef, Plugin>> getResolvedProfilePlugins(MavenSessionHandler session) throws ManipulationException {
if (resolvedProfilePlugins == null) {
resolvedProfilePlugins = new HashMap<>();
for (final Profile profile : ProfileUtils.getProfiles(session, model)) {
HashMap<ProjectVersionRef, Plugin> profileDeps = new HashMap<>();
if (profile.getBuild() != null) {
resolvePlugins(session, profile.getBuild().getPlugins(), profileDeps);
}
resolvedProfilePlugins.put(profile, profileDeps);
}
}
return resolvedProfilePlugins;
}
Aggregations