use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class ThemePluginBuildParticipant method build.
@Override
public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception {
IMavenProjectFacade facade = getMavenProjectFacade();
if (!shouldBuild(kind, facade)) {
return null;
}
ICallable<IStatus> callable = new ICallable<IStatus>() {
public IStatus call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
return executeThemeMojo(facade, context, monitor);
}
};
IStatus retval = null;
try {
retval = executeMaven(facade, callable, monitor);
} catch (Exception e) {
retval = LiferayMavenCore.createErrorStatus(getGoal() + " build error", e);
}
if ((retval != null) && !retval.isOK()) {
LiferayMavenCore.log(retval);
}
try {
facade.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (CoreException ce) {
}
monitor.worked(10);
return null;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class LiferayMavenProject method adapt.
@Override
public <T> T adapt(Class<T> adapterType) {
T adapter = super.adapt(adapterType);
if (adapter != null) {
return adapter;
}
IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), new NullProgressMonitor());
if (facade != null) {
if (IProjectBuilder.class.equals(adapterType)) {
IProjectBuilder projectBuilder = new MavenProjectBuilder(getProject());
return adapterType.cast(projectBuilder);
} else if (IRemoteServerPublisher.class.equals(adapterType)) {
IRemoteServerPublisher remoteServerPublisher = new MavenProjectRemoteServerPublisher(getProject());
return adapterType.cast(remoteServerPublisher);
}
}
return null;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade 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;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class LiferayPortalMaven method getVersion.
@Override
public String getVersion() {
String retval = null;
IMavenProjectFacade projectFacade = MavenUtil.getProjectFacade(this._lrMvnProject.getProject());
if (projectFacade != null) {
try {
MavenProject mavenProject = projectFacade.getMavenProject(new NullProgressMonitor());
String liferayVersion = MavenUtil.getLiferayMavenPluginConfig(mavenProject, ILiferayMavenConstants.PLUGIN_CONFIG_LIFERAY_VERSION);
if (liferayVersion == null) {
liferayVersion = mavenProject.getProperties().getProperty("liferay.version");
if (liferayVersion == null) {
// look through dependencies for portal-service
List<Dependency> deps = mavenProject.getDependencies();
if (deps != null) {
for (Dependency dep : deps) {
if (dep.getArtifactId().startsWith("portal-") && dep.getGroupId().startsWith("com.liferay")) {
liferayVersion = dep.getVersion();
break;
}
}
}
}
}
if (liferayVersion != null) {
retval = MavenUtil.getVersion(liferayVersion);
}
} catch (CoreException ce) {
}
}
return retval;
}
use of org.eclipse.m2e.core.project.IMavenProjectFacade in project liferay-ide by liferay.
the class MavenBundlePluginProject method getOutputBundlePath.
@Override
public IPath getOutputBundlePath() {
IPath outputJar = null;
try {
IMavenProjectFacade projectFacade = MavenUtil.getProjectFacade(getProject(), null);
MavenProject mavenProject = projectFacade.getMavenProject(null);
String targetName = mavenProject.getBuild().getFinalName() + "." + getBundleShape();
IFolder targetFolder = getProject().getFolder("target");
if (FileUtil.exists(targetFolder)) {
IPath targetFile = targetFolder.getRawLocation().append(targetName);
if (FileUtil.exists(targetFile)) {
outputJar = targetFile;
}
}
} catch (Exception e) {
LiferayMavenCore.logError(e);
}
return outputJar;
}
Aggregations