use of org.eclipse.m2e.core.internal.markers.SourceLocation in project liferay-ide by liferay.
the class LiferayMavenProjectConfigurator method _installNewLiferayFacet.
// Copied from
// org.eclipse.m2e.wtp.AbstractProjectConfiguratorDelegate#configureDeployedName()
private MavenProblemInfo _installNewLiferayFacet(IFacetedProject facetedProject, ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
MavenProblemInfo retval = null;
String pluginType = MavenUtil.getLiferayMavenPluginType(request.getMavenProject());
if (pluginType == null) {
pluginType = ILiferayMavenConstants.DEFAULT_PLUGIN_TYPE;
}
Plugin liferayMavenPlugin = MavenUtil.getPlugin(request.getMavenProjectFacade(), ILiferayMavenConstants.LIFERAY_MAVEN_PLUGIN_KEY, monitor);
Action action = _getNewLiferayFacetInstallAction(pluginType);
if (action != null) {
try {
facetedProject.modify(Collections.singleton(action), monitor);
} catch (Exception e) {
try {
SourceLocation location = SourceLocationHelper.findLocation(liferayMavenPlugin, SourceLocationHelper.CONFIGURATION);
String problemMsg = NLS.bind(Msgs.facetInstallError, pluginType, e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
retval = new MavenProblemInfo(location, e);
retval.setMessage(problemMsg);
} catch (Exception e1) {
}
LiferayMavenCore.logError("Unable to install liferay facet " + action.getProjectFacetVersion(), e.getCause());
}
}
return retval;
}
use of org.eclipse.m2e.core.internal.markers.SourceLocation in project liferay-ide by liferay.
the class LiferayMavenProjectConfigurator method _findLiferayMavenPluginProblems.
private List<MavenProblemInfo> _findLiferayMavenPluginProblems(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
List<MavenProblemInfo> warnings = new ArrayList<>();
// first check to make sure that the AppServer* properties are available and
// pointed to valid location
Plugin liferayMavenPlugin = MavenUtil.getPlugin(request.getMavenProjectFacade(), ILiferayMavenConstants.LIFERAY_MAVEN_PLUGIN_KEY, monitor);
if (liferayMavenPlugin != null) {
Xpp3Dom config = (Xpp3Dom) liferayMavenPlugin.getConfiguration();
MavenProblemInfo validLiferayProblemInfo = _checkValidVersion(liferayMavenPlugin, config, ILiferayMavenConstants.PLUGIN_CONFIG_LIFERAY_VERSION);
if (validLiferayProblemInfo != null) {
warnings.add(validLiferayProblemInfo);
}
Version mavenPluginVersion = new Version(MavenUtil.getVersion(liferayMavenPlugin.getVersion()));
if ((mavenPluginVersion == null) || mavenPluginVersion.equals(ILiferayConstants.EMPTY_VERSION)) {
// could not get valid version for liferaymavenPlugin
SourceLocation location = SourceLocationHelper.findLocation(liferayMavenPlugin, "version");
String problemMsg = NLS.bind(Msgs.invalidVersion, "liferay-maven-plugin", liferayMavenPlugin.getVersion());
MavenProblemInfo versionProblem = new MavenProblemInfo(problemMsg, IMarker.SEVERITY_WARNING, location);
warnings.add(versionProblem);
}
String[] configDirParams = { ILiferayMavenConstants.PLUGIN_CONFIG_APP_SERVER_PORTAL_DIR };
for (String configParam : configDirParams) {
MavenProblemInfo configProblemInfo = _checkValidConfigDir(liferayMavenPlugin, config, configParam);
if (configProblemInfo != null) {
warnings.add(configProblemInfo);
}
}
}
return warnings;
}
use of org.eclipse.m2e.core.internal.markers.SourceLocation in project liferay-ide by liferay.
the class LiferayMavenProjectConfigurator method _checkValidVersion.
private MavenProblemInfo _checkValidVersion(Plugin plugin, Xpp3Dom config, String versionNodeName) {
MavenProblemInfo retval = null;
Version liferayVersion = null;
String version = null;
if (config != null) {
// check for version config node
Xpp3Dom versionNode = config.getChild(versionNodeName);
if (versionNode != null) {
version = versionNode.getValue();
try {
liferayVersion = new Version(MavenUtil.getVersion(version));
} catch (IllegalArgumentException iae) {
// bad version
}
}
}
if ((liferayVersion == null) || liferayVersion.equals(ILiferayConstants.EMPTY_VERSION)) {
// could not get valid liferayVersion
SourceLocation location = SourceLocationHelper.findLocation(plugin, SourceLocationHelper.CONFIGURATION);
String problemMsg = NLS.bind(Msgs.unusableConfigValue, versionNodeName, version);
retval = new MavenProblemInfo(problemMsg, IMarker.SEVERITY_WARNING, location);
}
return retval;
}
use of org.eclipse.m2e.core.internal.markers.SourceLocation in project liferay-ide by liferay.
the class LiferayMavenProjectConfigurator method _checkValidConfigDir.
private MavenProblemInfo _checkValidConfigDir(Plugin liferayMavenPlugin, Xpp3Dom config, String configParam) {
MavenProblemInfo retval = null;
String message = null;
String value = null;
if (configParam != null) {
if (config == null) {
message = NLS.bind(Msgs.missingConfigValue, configParam);
} else {
Xpp3Dom dirNode = config.getChild(configParam);
if (dirNode == null) {
message = NLS.bind(Msgs.missingConfigValue, configParam);
} else {
value = dirNode.getValue();
if (CoreUtil.isNullOrEmpty(value)) {
message = NLS.bind(Msgs.emptyConfigValue, configParam);
} else {
File configDir = new File(value);
if (FileUtil.notExists(configDir) || !configDir.isDirectory()) {
message = NLS.bind(Msgs.unusableConfigValue, configParam, value);
}
}
}
}
}
if (message != null) {
SourceLocation location = SourceLocationHelper.findLocation(liferayMavenPlugin, SourceLocationHelper.CONFIGURATION);
retval = new MavenProblemInfo(message, IMarker.SEVERITY_WARNING, location);
}
return retval;
}
Aggregations