Skip to content

Commit f82726e

Browse files
committed
Simplify getMojoParameterValue usage and remove obsolete
Plugin/ConfigurationContainer overload There where only two call sites left and both are unwrapping a mjoexecution. Passing the execution directly avoid to resolve it again.
1 parent 61ff447 commit f82726e

5 files changed

Lines changed: 3 additions & 40 deletions

File tree

org.eclipse.m2e.apt.core/src/org/eclipse/m2e/apt/internal/AbstractAptConfiguratorDelegate.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747

4848
import org.apache.maven.artifact.Artifact;
4949
import org.apache.maven.execution.MavenSession;
50-
import org.apache.maven.model.PluginExecution;
5150
import org.apache.maven.plugin.MojoExecution;
5251
import org.apache.maven.project.MavenProject;
5352

@@ -348,10 +347,7 @@ private IClasspathEntryDescriptor getEntryDescriptor(IClasspathDescriptor classp
348347

349348
protected <T> T getParameterValue(String parameter, Class<T> asType, MojoExecution mojoExecution)
350349
throws CoreException {
351-
PluginExecution execution = new PluginExecution();
352-
execution.setConfiguration(mojoExecution.getConfiguration());
353-
return mavenFacade.getMojoParameterValue(parameter, asType, mojoExecution.getPlugin(), execution,
354-
mojoExecution.getGoal(), null);
350+
return mavenFacade.getMojoParameterValue(mojoExecution, parameter, asType, null);
355351
}
356352

357353
}

org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMaven.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ <T> T getMojoParameterValue(MavenProject project, MojoExecution mojoExecution, S
181181
/**
182182
* @since 1.4
183183
* @deprecated use
184-
* {@link IMavenProjectFacade#getMojoParameterValue(String, Class, Plugin, ConfigurationContainer, String, IProgressMonitor)}
184+
* {@link IMavenProjectFacade#getMojoParameterValue(MojoExecution, String, Class, IProgressMonitor)}
185185
* instead to avoid a direct dependency on {@link MavenProject}
186186
*/
187187
@Deprecated

org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
import org.apache.maven.lifecycle.DefaultLifecycles;
4444
import org.apache.maven.lifecycle.MavenExecutionPlan;
4545
import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator;
46-
import org.apache.maven.model.ConfigurationContainer;
47-
import org.apache.maven.model.Plugin;
4846
import org.apache.maven.plugin.MojoExecution;
4947
import org.apache.maven.project.MavenProject;
5048

@@ -593,14 +591,6 @@ public <T> T getMojoParameterValue(MojoExecution mojoExecution, String parameter
593591
return manager.maven.getMojoParameterValue(getMavenProject(monitor), mojoExecution, parameter, asType, monitor);
594592
}
595593

596-
@Override
597-
@SuppressWarnings("deprecation")
598-
public <T> T getMojoParameterValue(String parameter, Class<T> type, Plugin plugin,
599-
ConfigurationContainer configuration, String goal, IProgressMonitor monitor) throws CoreException {
600-
return manager.maven.getMojoParameterValue(getMavenProject(monitor), parameter, type, plugin, configuration, goal,
601-
monitor);
602-
}
603-
604594
/**
605595
* Returns cached list of MojoExecutions bound to project's clean, default and site lifecycles. Returned
606596
* MojoExecutions are not fully setup and {@link IMaven#setupMojoExecution(MavenSession, MavenProject, MojoExecution)}

org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/IMavenProjectFacade.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import org.eclipse.core.runtime.IProgressMonitor;
2727

2828
import org.apache.maven.lifecycle.MavenExecutionPlan;
29-
import org.apache.maven.model.ConfigurationContainer;
30-
import org.apache.maven.model.Plugin;
3129
import org.apache.maven.plugin.MojoExecution;
3230
import org.apache.maven.project.MavenProject;
3331

@@ -192,24 +190,6 @@ List<MojoExecution> getMojoExecutions(String groupId, String artifactId, IProgre
192190
<T> T getMojoParameterValue(MojoExecution mojoExecution, String parameter, Class<T> asType,
193191
IProgressMonitor monitor) throws CoreException;
194192

195-
/**
196-
* Resolves a configuration parameter for the given {@code plugin}/{@code goal} combination. It coerces from String to
197-
* the given type and considers expressions and default values.
198-
*
199-
* @param <T>
200-
* @param parameter the name of the parameter (may be nested with separating {@code .})
201-
* @param type the type to coerce to
202-
* @param plugin the plugin declaring the parameter
203-
* @param configuration the configuration to look up the parameter value in
204-
* @param goal the goal of the plugin execution
205-
* @param monitor the progress monitor
206-
* @return the parameter value or {@code null} if the parameter with the given name was not found
207-
* @throws CoreException
208-
* @since 2.8
209-
*/
210-
<T> T getMojoParameterValue(String parameter, Class<T> type, Plugin plugin, ConfigurationContainer configuration,
211-
String goal, IProgressMonitor monitor) throws CoreException;
212-
213193
// lifecycle mapping
214194

215195
String getLifecycleMappingId();

org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ protected <T> T getParameterValue(MavenProject project, String parameter, Class<
195195
*/
196196
protected <T> T getParameterValue(IMavenProjectFacade projectFacade, String parameter, Class<T> asType,
197197
MojoExecution mojoExecution, IProgressMonitor monitor) throws CoreException {
198-
PluginExecution execution = new PluginExecution();
199-
execution.setConfiguration(mojoExecution.getConfiguration());
200-
return projectFacade.getMojoParameterValue(parameter, asType, mojoExecution.getPlugin(), execution,
201-
mojoExecution.getGoal(), monitor);
198+
return projectFacade.getMojoParameterValue(mojoExecution, parameter, asType, monitor);
202199
}
203200

204201
protected void assertHasNature(IProject project, String natureId) throws CoreException {

0 commit comments

Comments
 (0)