Search in sources :

Example 6 with DefaultPathTranslator

use of org.apache.maven.project.path.DefaultPathTranslator in project intellij-community by JetBrains.

the class Maven30ServerEmbedderImpl method interpolateAndAlignModel.

@NotNull
public static MavenModel interpolateAndAlignModel(MavenModel model, File basedir) throws RemoteException {
    Model result = MavenModelConverter.toNativeModel(model);
    result = doInterpolate(result, basedir);
    PathTranslator pathTranslator = new DefaultPathTranslator();
    pathTranslator.alignToBaseDirectory(result, basedir);
    return MavenModelConverter.convertModel(result, null);
}
Also used : DefaultPathTranslator(org.apache.maven.project.path.DefaultPathTranslator) PathTranslator(org.apache.maven.project.path.PathTranslator) DefaultPathTranslator(org.apache.maven.project.path.DefaultPathTranslator) Model(org.apache.maven.model.Model) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with DefaultPathTranslator

use of org.apache.maven.project.path.DefaultPathTranslator in project intellij-community by JetBrains.

the class Maven30ServerEmbedderImpl method doInterpolate.

private static Model doInterpolate(Model result, File basedir) throws RemoteException {
    try {
        AbstractStringBasedModelInterpolator interpolator = new CustomMaven3ModelInterpolator(new DefaultPathTranslator());
        interpolator.initialize();
        Properties props = MavenServerUtil.collectSystemProperties();
        ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setExecutionProperties(props);
        config.setBuildStartTime(new Date());
        result = interpolator.interpolate(result, basedir, config, false);
    } catch (ModelInterpolationException e) {
        Maven3ServerGlobals.getLogger().warn(e);
    } catch (InitializationException e) {
        Maven3ServerGlobals.getLogger().error(e);
    }
    return result;
}
Also used : ModelInterpolationException(org.apache.maven.project.interpolation.ModelInterpolationException) AbstractStringBasedModelInterpolator(org.apache.maven.project.interpolation.AbstractStringBasedModelInterpolator) DefaultPathTranslator(org.apache.maven.project.path.DefaultPathTranslator) SystemProperties(com.intellij.util.SystemProperties) InitializationException(org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException)

Aggregations

DefaultPathTranslator (org.apache.maven.project.path.DefaultPathTranslator)7 AbstractStringBasedModelInterpolator (org.apache.maven.project.interpolation.AbstractStringBasedModelInterpolator)4 ModelInterpolationException (org.apache.maven.project.interpolation.ModelInterpolationException)4 InitializationException (org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException)4 NotNull (org.jetbrains.annotations.NotNull)4 Model (org.apache.maven.model.Model)3 PathTranslator (org.apache.maven.project.path.PathTranslator)3 SystemProperties (com.intellij.util.SystemProperties)2 Date (java.util.Date)1 Properties (java.util.Properties)1 DefaultProjectBuilderConfiguration (org.apache.maven.project.DefaultProjectBuilderConfiguration)1 ProjectBuilderConfiguration (org.apache.maven.project.ProjectBuilderConfiguration)1