use of org.apache.maven.model.Plugin in project pom-manipulation-ext by release-engineering.
the class PluginState method setRemoteRESTOverrides.
public void setRemoteRESTOverrides(Map<ArtifactRef, String> overrides) {
for (ArtifactRef a : overrides.keySet()) {
Plugin p = new Plugin();
p.setGroupId(a.getGroupId());
p.setArtifactId(a.getArtifactId());
p.setVersion(overrides.get(a));
remoteRESTplugins.add(p);
}
}
use of org.apache.maven.model.Plugin in project meghanada-server by mopemope.
the class POMParser method parsePlugins.
private void parsePlugins(POMInfo pomInfo, Build build) {
for (Plugin plugin : build.getPlugins()) {
if (plugin.getArtifactId().equals("build-helper-maven-plugin")) {
for (PluginExecution pluginExecution : plugin.getExecutions()) {
Object conf = pluginExecution.getConfiguration();
if (nonNull(conf) && conf instanceof Xpp3Dom) {
Xpp3Dom confDom = (Xpp3Dom) conf;
Xpp3Dom sources = confDom.getChild("sources");
if (nonNull(sources)) {
Xpp3Dom[] children = sources.getChildren();
if (nonNull(children)) {
for (Xpp3Dom s : sources.getChildren()) {
String value = s.getValue();
if (!Strings.isNullOrEmpty(value)) {
pomInfo.sourceDirectory.add(normalize(pomInfo, value));
}
}
}
}
}
}
}
if (plugin.getArtifactId().equals("maven-compiler-plugin")) {
Object conf = plugin.getConfiguration();
if (nonNull(conf) && conf instanceof Xpp3Dom) {
Xpp3Dom confDom = (Xpp3Dom) conf;
Xpp3Dom source = confDom.getChild("source");
if (nonNull(source)) {
pomInfo.compileSource = source.getValue();
}
Xpp3Dom target = confDom.getChild("target");
if (nonNull(target)) {
pomInfo.compileTarget = target.getValue();
}
}
}
}
}
use of org.apache.maven.model.Plugin in project maven-git-versioning-extension by qoomon.
the class VersioningModelProcessor method addBuildPlugin.
private void addBuildPlugin(Model model) {
GAV projectGav = GAV.of(model);
logger.debug(projectGav + " temporary add build plugin");
if (model.getBuild() == null) {
model.setBuild(new Build());
}
Plugin projectPlugin = VersioningPomReplacementMojo.asPlugin();
PluginExecution execution = new PluginExecution();
execution.setId(VersioningPomReplacementMojo.GOAL);
execution.getGoals().add(VersioningPomReplacementMojo.GOAL);
projectPlugin.getExecutions().add(execution);
model.getBuild().getPlugins().add(projectPlugin);
}
use of org.apache.maven.model.Plugin in project liferay-ide by liferay.
the class MavenUtil method executeMojoGoal.
public static IStatus executeMojoGoal(IMavenProjectFacade facade, IMavenExecutionContext context, String goal, IProgressMonitor monitor) throws CoreException {
IStatus retval = null;
IMaven maven = MavenPlugin.getMaven();
List<String> goals = Collections.singletonList(goal);
MavenProject mavenProject = facade.getMavenProject(monitor);
MavenExecutionPlan plan = maven.calculateExecutionPlan(mavenProject, goals, true, monitor);
Plugin plugin6x = getPlugin(facade, ILiferayMavenConstants.LIFERAY_MAVEN_PLUGIN_KEY, monitor);
String executionArtifactId = null;
if (plugin6x != null) {
executionArtifactId = ILiferayMavenConstants.LIFERAY_MAVEN_PLUGIN_ARTIFACT_ID;
} else {
Plugin plugin7x = getPlugin(facade, ILiferayMavenConstants.SERVICE_BUILDER_PLUGIN_KEY, monitor);
if (plugin7x != null) {
executionArtifactId = ILiferayMavenConstants.SERVICE_BUILDER_PLUGIN_ARTIFACT_ID;
}
}
MojoExecution liferayMojoExecution = getExecution(plan, executionArtifactId);
if (liferayMojoExecution != null) {
ResolverConfiguration configuration = facade.getResolverConfiguration();
configuration.setResolveWorkspaceProjects(true);
maven.execute(mavenProject, liferayMojoExecution, monitor);
}
MavenSession session = context.getSession();
List<Throwable> exceptions = session.getResult().getExceptions();
if (exceptions.size() == 1) {
retval = LiferayMavenCore.createErrorStatus(exceptions.get(0));
} else if (exceptions.size() > 1) {
List<IStatus> statues = new ArrayList<>();
for (Throwable t : exceptions) {
statues.add(LiferayMavenCore.createErrorStatus(t));
}
IStatus firstStatus = statues.get(0);
retval = new MultiStatus(LiferayMavenCore.PLUGIN_ID, IStatus.ERROR, statues.toArray(new IStatus[0]), firstStatus.getMessage(), firstStatus.getException());
}
if (retval == null) {
return Status.OK_STATUS;
}
return retval;
}
use of org.apache.maven.model.Plugin in project liferay-ide by liferay.
the class LiferayMavenProject method getLiferayMavenPluginVersion.
public String getLiferayMavenPluginVersion() {
String retval = null;
IMavenProjectFacade projectFacade = MavenPlugin.getMavenProjectRegistry().getProject(getProject());
if (projectFacade != null) {
try {
NullProgressMonitor npm = new NullProgressMonitor();
MavenProject mavenProject = projectFacade.getMavenProject(npm);
if (mavenProject != null) {
Plugin liferayMavenPlugin = MavenUtil.getPlugin(projectFacade, ILiferayMavenConstants.LIFERAY_MAVEN_PLUGIN_KEY, npm);
retval = liferayMavenPlugin.getVersion();
}
} catch (CoreException ce) {
}
}
return retval;
}
Aggregations