Skip to content

Commit cd5feb8

Browse files
committed
Only consider the default-compile execution when update JDT settings
While in maven we can have many executions with many different settings, JDT only supports one set of settings. If there are multiple with conflicting settings currently "last win". This is especially bad when using multi-release configuration where it leads to the last execution overwrite the projects actual compile level. This now checks through the ececutions and only use the default-compile one to actually set up the project settings for JDT.
1 parent 89fed2d commit cd5feb8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ protected void addJavaProjectOptions(Map<String, String> options, ProjectConfigu
638638
boolean enablePreviewFeatures = false;
639639

640640
for(MojoExecution execution : getCompilerMojoExecutions(request, monitor)) {
641+
String id = execution.getExecutionId();
642+
if(!"default-compile".equals(id)) {
643+
//Maven can have many but JDT only supports one config!
644+
continue;
645+
}
641646
release = getCompilerLevel(request.mavenProject(), execution, "release", release, RELEASES, monitor);
642647
//XXX ignoring testRelease option, since JDT doesn't support main/test classpath separation - yet
643648
source = getCompilerLevel(request.mavenProject(), execution, "source", source, SOURCES, monitor); //$NON-NLS-1$

0 commit comments

Comments
 (0)