Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-07-31 07:58:16 +0000
committerIgor Fedorenko2011-07-31 07:58:16 +0000
commitc47e215285d7c562d2e8c98c52a80349abe070b6 (patch)
tree7960aca2bfe35fdf5b1745332a7bb24c1b407dfd /org.eclipse.m2e.jdt
parente288b8a47e935b50a091b259cb96beebbe5c3ee7 (diff)
parent74e41f5cadf4d515ccb47e38a8656a7b111ef457 (diff)
downloadm2e-core-c47e215285d7c562d2e8c98c52a80349abe070b6.tar.gz
m2e-core-c47e215285d7c562d2e8c98c52a80349abe070b6.tar.xz
m2e-core-c47e215285d7c562d2e8c98c52a80349abe070b6.zip
Merge remote-tracking branch 'origin/master' into m2e-self-hosting
Diffstat (limited to 'org.eclipse.m2e.jdt')
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java2
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java79
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java2
3 files changed, 49 insertions, 34 deletions
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java
index 426dd3aa..9633121d 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java
@@ -22,7 +22,7 @@ import org.eclipse.m2e.core.project.IMavenProjectFacade;
/**
- * Instances of this class can be used to incrementally define IClasspathEntry[] arrays used by JDT to decribe Java
+ * Instances of this class can be used to incrementally define IClasspathEntry[] arrays used by JDT to describe Java
* Project classpath and contents of Java classpath containers.
*
* @author igor
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 00147116..e0a69e4d 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
@@ -253,37 +253,41 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
MavenSession mavenSession = request.getMavenSession();
- for(MojoExecution compile : projectFacade.getMojoExecutions(COMPILER_PLUGIN_GROUP_ID,
- COMPILER_PLUGIN_ARTIFACT_ID, mon.newChild(1), GOAL_COMPILE)) {
- mainSourceEncoding = maven.getMojoParameterValue(mavenSession, compile, "encoding", String.class); //$NON-NLS-1$
- try {
- inclusion = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
- "includes", String[].class)); //$NON-NLS-1$
- } catch(CoreException ex) {
- log.error("Failed to determine compiler inclusions, assuming defaults", ex);
- }
- try {
- exclusion = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
- "excludes", String[].class)); //$NON-NLS-1$
- } catch(CoreException ex) {
- log.error("Failed to determine compiler exclusions, assuming defaults", ex);
+ List<MojoExecution> executions = getCompilerMojoExecutions(request, mon.newChild(1));
+
+ for(MojoExecution compile : executions) {
+ if(isCompileExecution(compile)) {
+ mainSourceEncoding = maven.getMojoParameterValue(mavenSession, compile, "encoding", String.class); //$NON-NLS-1$
+ try {
+ inclusion = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
+ "includes", String[].class)); //$NON-NLS-1$
+ } catch(CoreException ex) {
+ log.error("Failed to determine compiler inclusions, assuming defaults", ex);
+ }
+ try {
+ exclusion = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
+ "excludes", String[].class)); //$NON-NLS-1$
+ } catch(CoreException ex) {
+ log.error("Failed to determine compiler exclusions, assuming defaults", ex);
+ }
}
}
- for(MojoExecution compile : projectFacade.getMojoExecutions(COMPILER_PLUGIN_GROUP_ID,
- COMPILER_PLUGIN_ARTIFACT_ID, mon.newChild(1), GOAL_TESTCOMPILE)) {
- testSourceEncoding = maven.getMojoParameterValue(mavenSession, compile, "encoding", String.class); //$NON-NLS-1$
- try {
- inclusionTest = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
- "testIncludes", String[].class)); //$NON-NLS-1$
- } catch(CoreException ex) {
- log.error("Failed to determine compiler test inclusions, assuming defaults", ex);
- }
- try {
- exclusionTest = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
- "testExcludes", String[].class)); //$NON-NLS-1$
- } catch(CoreException ex) {
- log.error("Failed to determine compiler test exclusions, assuming defaults", ex);
+ for(MojoExecution compile : executions) {
+ if(isTestCompileExecution(compile)) {
+ testSourceEncoding = maven.getMojoParameterValue(mavenSession, compile, "encoding", String.class); //$NON-NLS-1$
+ try {
+ inclusionTest = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
+ "testIncludes", String[].class)); //$NON-NLS-1$
+ } catch(CoreException ex) {
+ log.error("Failed to determine compiler test inclusions, assuming defaults", ex);
+ }
+ try {
+ exclusionTest = toPaths(maven.getMojoParameterValue(request.getMavenSession(), compile,
+ "testExcludes", String[].class)); //$NON-NLS-1$
+ } catch(CoreException ex) {
+ log.error("Failed to determine compiler test exclusions, assuming defaults", ex);
+ }
}
}
@@ -311,6 +315,14 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
}
}
+ protected boolean isTestCompileExecution(MojoExecution execution) {
+ return GOAL_TESTCOMPILE.equals(execution.getGoal());
+ }
+
+ protected boolean isCompileExecution(MojoExecution execution) {
+ return GOAL_COMPILE.equals(execution.getGoal());
+ }
+
private IPath[] toPaths(String[] values) {
if(values == null) {
return new IPath[0];
@@ -410,12 +422,9 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
String source = null, target = null;
- for(MojoExecution execution : request.getMavenProjectFacade().getMojoExecutions(COMPILER_PLUGIN_GROUP_ID,
- COMPILER_PLUGIN_ARTIFACT_ID, monitor, GOAL_COMPILE, GOAL_TESTCOMPILE)) {
-
+ for(MojoExecution execution : getCompilerMojoExecutions(request, monitor)) {
source = getCompilerLevel(mavenSession, execution, "source", source, SOURCES); //$NON-NLS-1$
target = getCompilerLevel(mavenSession, execution, "target", target, TARGETS); //$NON-NLS-1$
-
}
if(source == null) {
@@ -434,6 +443,12 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, "warning"); //$NON-NLS-1$
}
+ protected List<MojoExecution> getCompilerMojoExecutions(ProjectConfigurationRequest request, IProgressMonitor monitor)
+ throws CoreException {
+ return request.getMavenProjectFacade().getMojoExecutions(COMPILER_PLUGIN_GROUP_ID,
+ COMPILER_PLUGIN_ARTIFACT_ID, monitor, GOAL_COMPILE, GOAL_TESTCOMPILE);
+ }
+
private String getCompilerLevel(MavenSession session, MojoExecution execution, String parameter, String source,
List<String> levels) {
int levelIdx = getLevelIndex(source, levels);
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java
index 93260fa2..938ec521 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java
@@ -139,7 +139,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider {
IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
MavenJdtPlugin plugin = MavenJdtPlugin.getDefault();
IClasspathManager buildpathManager = plugin.getBuildpathManager();
- IClasspathEntry[] cp = buildpathManager.getClasspath(javaProject.getProject(), scope, false, new NullProgressMonitor());
+ IClasspathEntry[] cp = buildpathManager.getClasspath(javaProject.getProject(), scope, false, monitor);
for(IClasspathEntry entry : cp) {
switch (entry.getEntryKind()) {
case IClasspathEntry.CPE_PROJECT:

Back to the top