From 3c5a8876a51a84721ec586e5f32e6745b8b9c857 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Tue, 18 Oct 2022 18:44:25 +0200 Subject: [PATCH] Use enhanced Mojo-Configuration methods --- .../AbstractAptConfiguratorDelegate.java | 9 +- .../MavenCompilerBuildParticipant.java | 16 ++-- .../org/eclipse/m2e/core/embedder/IMaven.java | 1 + .../LifecycleMappingFactory.java | 18 ++-- .../AbstractProjectConfigurator.java | 12 ++- .../AbstractJavaProjectConfigurator.java | 94 ++++++++----------- .../PDEMavenBundlePluginConfigurator.java | 11 ++- 7 files changed, 75 insertions(+), 86 deletions(-) diff --git a/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/AbstractAptConfiguratorDelegate.java b/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/AbstractAptConfiguratorDelegate.java index 6d2442128..2bd521357 100644 --- a/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/AbstractAptConfiguratorDelegate.java +++ b/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/AbstractAptConfiguratorDelegate.java @@ -50,12 +50,12 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.PluginExecution; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.project.MavenProject; import org.eclipse.m2e.apt.internal.utils.ProjectUtils; import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationParameter; import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.configurator.AbstractBuildParticipant; import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator; @@ -357,13 +357,12 @@ private IClasspathEntryDescriptor getEntryDescriptor(IClasspathDescriptor classp protected T getParameterValue(String parameter, Class asType, MojoExecution mojoExecution) throws CoreException { - PluginExecution execution = new PluginExecution(); - execution.setConfiguration(mojoExecution.getConfiguration()); MavenProject mavenProject = mavenFacade.getMavenProject(); return mavenFacade.createExecutionContext().execute(mavenProject, (context, monitor) -> { //TODO provide as part of the execution context? We then probably won't need the project parameter at all? - return MavenPlugin.getMaven().getMojoParameterValue(mavenProject, parameter, asType, mojoExecution.getPlugin(), - execution, mojoExecution.getGoal(), null); + IConfigurationParameter configParameter = MavenPlugin.getMaven() + .getMojoConfiguration(mavenProject, mojoExecution, null).get(parameter); + return configParameter.exists() ? configParameter.as(asType) : null; }, null); } diff --git a/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/compiler/MavenCompilerBuildParticipant.java b/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/compiler/MavenCompilerBuildParticipant.java index e538dd80e..0d60f3b05 100644 --- a/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/compiler/MavenCompilerBuildParticipant.java +++ b/org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/compiler/MavenCompilerBuildParticipant.java @@ -35,6 +35,8 @@ import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.embedder.IMaven; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationElement; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationParameter; import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant; @@ -64,12 +66,13 @@ public Set build(int kind, IProgressMonitor monitor) throws Exception //TODO check delta / scan source for *.java IMavenProjectFacade mavenProjectFacade = getMavenProjectFacade(); MavenProject project = mavenProjectFacade.getMavenProject(); - String compilerArgument = maven.getMojoParameterValue(project, mojoExecution, "compilerArgument", String.class, - null); - boolean isAnnotationProcessingEnabled = (compilerArgument == null) || !compilerArgument.contains("-proc:none"); + IConfigurationElement config = maven.getMojoConfiguration(project, mojoExecution, null); + IConfigurationParameter compilerArgumentConfig = config.get("compilerArgument"); + boolean isAnnotationProcessingEnabled = !compilerArgumentConfig.exists() + || !compilerArgumentConfig.as(String.class).contains("-proc:none"); if(isAnnotationProcessingEnabled) { - String proc = maven.getMojoParameterValue(project, mojoExecution, PROC, String.class, null); - isAnnotationProcessingEnabled = !"none".equals(proc); + IConfigurationParameter procConfig = config.get(PROC); + isAnnotationProcessingEnabled = !procConfig.exists() || !"none".equals(procConfig.as(String.class)); } if(!isAnnotationProcessingEnabled) { return Collections.emptySet(); @@ -112,8 +115,7 @@ public Set build(int kind, IProgressMonitor monitor) throws Exception } // tell m2e builder to refresh generated files - File generated = maven.getMojoParameterValue(project, getMojoExecution(), - MavenCompilerJdtAptDelegate.OUTPUT_DIRECTORY_PARAMETER, File.class, null); + File generated = maven.getMojoConfiguration(project, getMojoExecution(), null).get(MavenCompilerJdtAptDelegate.OUTPUT_DIRECTORY_PARAMETER).as(File.class); if(generated != null) { buildContext.refresh(generated); } diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMaven.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMaven.java index 35d83aea7..58a753e26 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMaven.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMaven.java @@ -193,6 +193,7 @@ default T getMojoParameterValue(MavenProject project, MojoExecution mojoExec /** * @since 1.4 */ + //TODO: deprecate that as well? Without 1:1 replacement? M2E code base does not use it anymore T getMojoParameterValue(MavenProject project, String parameter, Class type, Plugin plugin, ConfigurationContainer configuration, String goal, IProgressMonitor monitor) throws CoreException; diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java index 4f896b734..d9bdd8df0 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java @@ -38,7 +38,6 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; -import java.util.Map.Entry; import java.util.Objects; import java.util.Set; import java.util.jar.JarFile; @@ -83,6 +82,7 @@ import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.embedder.IMaven; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationParameter; import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.internal.MavenPluginActivator; import org.eclipse.m2e.core.internal.Messages; @@ -705,14 +705,14 @@ private static List applyParametersFilter(List parameters = metadata.getFilter().getParameters(); - for(Entry entry : parameters.entrySet()) { - MojoExecution setupExecution = maven.setupMojoExecution(mavenProject, execution, monitor); - String value = maven.getMojoParameterValue(mavenProject, setupExecution, entry.getKey(), String.class, monitor); - if(!Objects.equals(entry.getValue(), value)) { - return false; - } - } - return true; + MojoExecution setupExecution = maven.setupMojoExecution(mavenProject, execution, monitor); + org.eclipse.m2e.core.embedder.IMaven.IConfigurationElement mojoConfig = maven.getMojoConfiguration(mavenProject, + setupExecution, monitor); + + return parameters.entrySet().stream().allMatch(e -> { + IConfigurationParameter parameter = mojoConfig.get(e.getKey()); + return parameter.exists() && Objects.equals(parameter.as(String.class), e.getValue()); + }); } private static boolean isValidPluginExecutionMetadata(PluginExecutionMetadata metadata) { diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java index 2852250ac..731b24c86 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java @@ -34,12 +34,12 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.apache.maven.model.PluginExecution; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.project.MavenProject; import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.embedder.IMaven; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationParameter; import org.eclipse.m2e.core.embedder.IMavenConfiguration; import org.eclipse.m2e.core.internal.Messages; import org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory; @@ -178,13 +178,15 @@ public static void addNature(IProject project, String natureId, int updateFlags, /** * @since 1.4 + * @deprecated use {@link IMaven#getMojoConfiguration(MavenProject, MojoExecution, IProgressMonitor)} directly instead + * and query the returned {@link org.eclipse.m2e.core.embedder.IMaven.IConfigurationElement} */ + @Deprecated(forRemoval = true, since = "2.1") protected T getParameterValue(MavenProject project, String parameter, Class asType, MojoExecution mojoExecution, IProgressMonitor monitor) throws CoreException { - PluginExecution execution = new PluginExecution(); - execution.setConfiguration(mojoExecution.getConfiguration()); - return maven.getMojoParameterValue(project, parameter, asType, mojoExecution.getPlugin(), execution, - mojoExecution.getGoal(), monitor); + IConfigurationParameter configParameter = maven.getMojoConfiguration(project, mojoExecution, monitor) + .get(parameter); + return configParameter.exists() ? configParameter.as(asType) : null; } protected void assertHasNature(IProject project, String natureId) throws CoreException { diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java index acebe4f8c..7e984e0dc 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java @@ -55,6 +55,8 @@ import org.apache.maven.project.MavenProject; import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationElement; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationParameter; import org.eclipse.m2e.core.internal.M2EUtils; import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.IProjectConfigurationManager; @@ -311,8 +313,8 @@ protected void addProjectSourceFolders(IClasspathDescriptor classpath, Map executions = getCompilerMojoExecutions(request, mon.newChild(1)); for(MojoExecution compile : executions) { if(isCompileExecution(compile, mavenProject, options, monitor)) { - mainSourceEncoding = maven.getMojoParameterValue(mavenProject, compile, "encoding", String.class, monitor); //$NON-NLS-1$ - try { - inclusion = toPaths( - maven.getMojoParameterValue(mavenProject, compile, "includes", String[].class, monitor)); //$NON-NLS-1$ - } catch(CoreException ex) { - log.error("Failed to determine compiler inclusions, assuming defaults", ex); - } - try { - exclusion = toPaths( - maven.getMojoParameterValue(mavenProject, compile, "excludes", String[].class, monitor)); //$NON-NLS-1$ - } catch(CoreException ex) { - log.error("Failed to determine compiler exclusions, assuming defaults", ex); - } + IConfigurationElement mojoConfig = maven.getMojoConfiguration(mavenProject, compile, monitor); + mainSourceEncoding = mojoConfig.get("encoding"); //$NON-NLS-1$ + inclusion = toPaths(mojoConfig.get("includes")); //$NON-NLS-1$ + exclusion = toPaths(mojoConfig.get("excludes")); //$NON-NLS-1$ } } for(MojoExecution compile : executions) { if(isTestCompileExecution(compile, mavenProject, options, monitor)) { - testSourceEncoding = maven.getMojoParameterValue(mavenProject, compile, "encoding", String.class, monitor); //$NON-NLS-1$ - try { - inclusionTest = toPaths( - maven.getMojoParameterValue(mavenProject, compile, "testIncludes", String[].class, monitor)); //$NON-NLS-1$ - } catch(CoreException ex) { - log.error("Failed to determine compiler test inclusions, assuming defaults", ex); - } - try { - exclusionTest = toPaths( - maven.getMojoParameterValue(mavenProject, compile, "testExcludes", String[].class, monitor)); //$NON-NLS-1$ - } catch(CoreException ex) { - log.error("Failed to determine compiler test exclusions, assuming defaults", ex); - } + IConfigurationElement mojoConfiguration = maven.getMojoConfiguration(mavenProject, compile, monitor); + testSourceEncoding = mojoConfiguration.get("encoding"); + inclusionTest = toPaths(mojoConfiguration.get("testIncludes")); //$NON-NLS-1$ + exclusionTest = toPaths(mojoConfiguration.get("testExcludes")); //$NON-NLS-1$ } } for(MojoExecution resources : projectFacade.getMojoExecutions(RESOURCES_PLUGIN_GROUP_ID, RESOURCES_PLUGIN_ARTIFACT_ID, mon.newChild(1), GOAL_RESOURCES)) { - mainResourcesEncoding = maven.getMojoParameterValue(mavenProject, resources, "encoding", String.class, monitor); //$NON-NLS-1$ + mainResourcesEncoding = maven.getMojoConfiguration(mavenProject, resources, monitor).get("encoding") //$NON-NLS-1$ + .as(String.class); } for(MojoExecution resources : projectFacade.getMojoExecutions(RESOURCES_PLUGIN_GROUP_ID, RESOURCES_PLUGIN_ARTIFACT_ID, mon.newChild(1), GOAL_TESTRESOURCES)) { - testResourcesEncoding = maven.getMojoParameterValue(mavenProject, resources, "encoding", String.class, monitor); //$NON-NLS-1$ + testResourcesEncoding = maven.getMojoConfiguration(mavenProject, resources, monitor).get("encoding") //$NON-NLS-1$ + .as(String.class); } addSourceDirs(classpath, project, mavenProject.getCompileSourceRoots(), classes.getFullPath(), inclusion, exclusion, mainSourceEncoding, mon.newChild(1), false); @@ -391,16 +377,16 @@ protected boolean isCompileExecution(MojoExecution execution, MavenProject maven private boolean isCompliant(MojoExecution execution, MavenProject mavenProject, Map options, IProgressMonitor monitor) throws CoreException { - String release = maven.getMojoParameterValue(mavenProject, execution, "release", String.class, monitor); //$NON-NLS-1$ + String release = maven.getMojoConfiguration(mavenProject, execution, monitor).get("release").as(String.class); //$NON-NLS-1$ if(release != null && !sanitizeJavaVersion(release).equals(options.get(JavaCore.COMPILER_COMPLIANCE))) { return false; } if(release == null) { - String source = maven.getMojoParameterValue(mavenProject, execution, "source", String.class, monitor); //$NON-NLS-1$ + String source = maven.getMojoConfiguration(mavenProject, execution, monitor).get("source").as(String.class); //$NON-NLS-1$ if(source != null && !sanitizeJavaVersion(source).equals(options.get(JavaCore.COMPILER_SOURCE))) { return false; } - String target = maven.getMojoParameterValue(mavenProject, execution, "target", String.class, monitor); //$NON-NLS-1$ + String target = maven.getMojoConfiguration(mavenProject, execution, monitor).get("target").as(String.class); //$NON-NLS-1$ if(target != null && !sanitizeJavaVersion(target).equals(options.get(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))) { return false; @@ -409,22 +395,17 @@ private boolean isCompliant(MojoExecution execution, MavenProject mavenProject, return true; } - private IPath[] toPaths(String[] values) { - if(values == null) { + private IPath[] toPaths(IConfigurationParameter configParameter) { + if(!configParameter.exists()) { return new IPath[0]; } - IPath[] paths = new IPath[values.length]; - for(int i = 0; i < values.length; i++ ) { - if(values[i] != null && !"".equals(values[i].trim())) { - paths[i] = new Path(values[i]); - } - } - return paths; + return Arrays.stream(configParameter.as(String[].class)).filter(v -> v != null && !v.isBlank()).map(Path::new) + .toArray(Path[]::new); } private void addSourceDirs(IClasspathDescriptor classpath, IProject project, List sourceRoots, - IPath outputPath, IPath[] inclusion, IPath[] exclusion, String sourceEncoding, IProgressMonitor monitor, - boolean addTestFlag) throws CoreException { + IPath outputPath, IPath[] inclusion, IPath[] exclusion, IConfigurationParameter sourceEncoding, + IProgressMonitor monitor, boolean addTestFlag) throws CoreException { for(String sourceRoot : sourceRoots) { IFolder sourceFolder = getFolder(project, sourceRoot); @@ -445,7 +426,7 @@ private void addSourceDirs(IClasspathDescriptor classpath, IProject project, Lis // Set folder encoding (null = platform/container default) if(sourceFolder.exists()) { - sourceFolder.setDefaultCharset(sourceEncoding, monitor); + sourceFolder.setDefaultCharset(sourceEncoding.exists() ? sourceEncoding.as(String.class) : null, monitor); } IClasspathEntryDescriptor enclosing = getEnclosingEntryDescriptor(classpath, sourceFolder.getFullPath()); @@ -619,8 +600,8 @@ protected void addJavaProjectOptions(Map options, ProjectConfigu || isEnablePreviewFeatures(request.mavenProject(), execution, monitor); // process -err:+deprecation , -warn:-serial ... - for(Object o : maven.getMojoParameterValue(request.mavenProject(), execution, "compilerArgs", List.class, - monitor)) { + for(Object o : maven.getMojoConfiguration(request.mavenProject(), execution, monitor).get("compilerArgs") + .as(List.class)) { if(o instanceof String compilerArg) { boolean err = false/*, warn = false*/; String[] settings = new String[0]; @@ -706,7 +687,8 @@ private boolean isGenerateParameters(MavenProject mavenProject, MojoExecution ex Boolean generateParameters = null; //1st, check the parameters option try { - generateParameters = maven.getMojoParameterValue(mavenProject, execution, "parameters", Boolean.class, monitor);//$NON-NLS-1$ + generateParameters = maven.getMojoConfiguration(mavenProject, execution, monitor).get("parameters") //$NON-NLS-1$ + .as(Boolean.class); } catch(Exception ex) { //ignore } @@ -714,7 +696,7 @@ private boolean isGenerateParameters(MavenProject mavenProject, MojoExecution ex //2nd, check the parameters flag in the compilerArgs list if(!Boolean.TRUE.equals(generateParameters)) { try { - List args = maven.getMojoParameterValue(mavenProject, execution, "compilerArgs", List.class, monitor);//$NON-NLS-1$ + List args = maven.getMojoConfiguration(mavenProject, execution, monitor).get("compilerArgs").as(List.class);//$NON-NLS-1$ if(args != null) { generateParameters = args.contains(JavaSettingsUtils.PARAMETERS_JVM_FLAG); } @@ -726,8 +708,8 @@ private boolean isGenerateParameters(MavenProject mavenProject, MojoExecution ex //3rd, check the parameters flag in the compilerArgument String if(!Boolean.TRUE.equals(generateParameters)) { try { - String compilerArgument = maven.getMojoParameterValue(mavenProject, execution, "compilerArgument", String.class, //$NON-NLS-1$ - monitor); + String compilerArgument = maven.getMojoConfiguration(mavenProject, execution, monitor).get("compilerArgument") + .as(String.class); if(compilerArgument != null) { generateParameters = compilerArgument.contains(JavaSettingsUtils.PARAMETERS_JVM_FLAG); } @@ -743,7 +725,7 @@ private boolean isEnablePreviewFeatures(MavenProject mavenProject, MojoExecution IProgressMonitor monitor) { //1st, check the --enable-preview flag in the compilerArgs list try { - List args = maven.getMojoParameterValue(mavenProject, execution, "compilerArgs", List.class, monitor);//$NON-NLS-1$ + List args = maven.getMojoConfiguration(mavenProject, execution, monitor).get("compilerArgs").as(List.class);//$NON-NLS-1$ if(args != null && args.contains(JavaSettingsUtils.ENABLE_PREVIEW_JVM_FLAG)) { return true; } @@ -753,8 +735,8 @@ private boolean isEnablePreviewFeatures(MavenProject mavenProject, MojoExecution //2nd, check the --enable-preview flag in the compilerArgument String try { - String compilerArgument = maven.getMojoParameterValue(mavenProject, execution, "compilerArgument", String.class, //$NON-NLS-1$ - monitor); + String compilerArgument = maven.getMojoConfiguration(mavenProject, execution, monitor).get("compilerArgument") + .as(String.class); if(compilerArgument != null && compilerArgument.contains(JavaSettingsUtils.ENABLE_PREVIEW_JVM_FLAG)) { return true; } @@ -804,7 +786,7 @@ private String getCompilerLevel(MavenProject mavenProject, MojoExecution executi int levelIdx = getLevelIndex(source, levels); try { - source = maven.getMojoParameterValue(mavenProject, execution, parameter, String.class, monitor); + source = maven.getMojoConfiguration(mavenProject, execution, monitor).get(parameter).as(String.class); } catch(CoreException ex) { log.error("Failed to determine compiler " + parameter + " setting, assuming default", ex); } @@ -958,7 +940,7 @@ private List getCompilerArguments(MavenProject mavenProject, MojoExecuti //1st, get the arguments in the compilerArgs list try { - List args = maven.getMojoParameterValue(mavenProject, execution, "compilerArgs", List.class, monitor);//$NON-NLS-1$ + List args = maven.getMojoConfiguration(mavenProject, execution, monitor).get("compilerArgs").as(List.class);//$NON-NLS-1$ if(args != null) {//$NON-NLS-1$ args.stream().filter(a -> a != null).forEach(a -> arguments.add(a.toString())); } diff --git a/org.eclipse.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java b/org.eclipse.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java index fa0a3c1d8..b3afb658f 100644 --- a/org.eclipse.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java +++ b/org.eclipse.m2e.pde.connector/src/org/eclipse/m2e/pde/connector/PDEMavenBundlePluginConfigurator.java @@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.embedder.IMaven; +import org.eclipse.m2e.core.embedder.IMaven.IConfigurationParameter; import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.internal.markers.IMavenMarkerManager; import org.eclipse.m2e.core.internal.markers.MavenProblemInfo; @@ -67,9 +68,10 @@ public void configure(ProjectConfigurationRequest request, IProgressMonitor moni if (isFelix(plugin)) { if (isFelixManifestGoal(execution)) { IMaven maven = MavenPlugin.getMaven(); - Boolean supportIncremental = maven.getMojoParameterValue(request.mavenProject(), execution, - FELIX_PARAM_SUPPORTINCREMENTALBUILD, Boolean.class, monitor); - if (supportIncremental == null || !supportIncremental.booleanValue()) { + IConfigurationParameter incrementalBuildConfig = maven + .getMojoConfiguration(request.mavenProject(), execution, monitor) + .get(FELIX_PARAM_SUPPORTINCREMENTALBUILD); + if (!incrementalBuildConfig.exists() || !incrementalBuildConfig.as(Boolean.class).booleanValue()) { createWarningMarker(request, execution, SourceLocationHelper.CONFIGURATION, "Incremental updates are currently disabled, set supportIncrementalBuild=true to support automatic manifest updates for this project."); } @@ -138,7 +140,8 @@ private IPath getMetainfPath(IMavenProjectFacade facade, List exe Plugin plugin = execution.getPlugin(); MavenProject project = facade.getMavenProject(monitor); String manifestParameter = isBND(plugin) ? BND_PARAM_MANIFESTLOCATION : FELIX_PARAM_MANIFESTLOCATION; - File location = maven.getMojoParameterValue(project, execution, manifestParameter, File.class, monitor); + File location = maven.getMojoConfiguration(project, execution, monitor).get(manifestParameter) + .as(File.class); if (location != null) { return facade.getProjectRelativePath(location.getAbsolutePath()); }