Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Bricon2012-02-23 09:54:43 +0000
committerFred Bricon2012-02-28 14:58:45 +0000
commitb8faae0fec669fdf6158badad383ff37c200b34d (patch)
treeb98c8987ab7778ee19cdbe3ab4171ca9586b815a
parent607899f5a3582bfbc7ff6d4061c4f5e0612f9a4e (diff)
downloadm2e-core-b8faae0fec669fdf6158badad383ff37c200b34d.tar.gz
m2e-core-b8faae0fec669fdf6158badad383ff37c200b34d.tar.xz
m2e-core-b8faae0fec669fdf6158badad383ff37c200b34d.zip
370685 fixed resource folders being removed from classpath
Signed-off-by: Fred Bricon <fbricon@gmail.com>
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java20
1 files changed, 16 insertions, 4 deletions
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 61b4d3f7..6c0bc28a 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
@@ -409,15 +409,15 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
*/
log.error("Skipping resource folder " + r.getFullPath());
} else if(r != null && project.equals(r.getProject())) {
- IClasspathEntryDescriptor cped = getEnclosingEntryDescriptor(classpath, r.getFullPath());
- if(cped == null) {
+ IClasspathEntryDescriptor enclosing = getEnclosingEntryDescriptor(classpath, r.getFullPath());
+ if(enclosing == null || isResourceDescriptor(getEntryDescriptor(classpath, r.getFullPath()))) {
log.info("Adding resource folder " + r.getFullPath());
classpath.addSourceEntry(r.getFullPath(), outputPath, new IPath[0] /*inclusions*/, new IPath[] {new Path(
"**")} /*exclusion*/, false /*optional*/);
} else {
// resources and sources folders overlap. make sure JDT only processes java sources.
- log.info("Resources folder " + r.getFullPath() + " overlaps with sources folder " + cped.getPath());
- cped.addInclusionPattern(new Path("**/*.java"));
+ log.info("Resources folder " + r.getFullPath() + " overlaps with sources folder " + enclosing.getPath());
+ enclosing.addInclusionPattern(new Path("**/*.java"));
}
// Set folder encoding (null = platform default)
@@ -430,6 +430,18 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
}
}
+ private boolean isResourceDescriptor(IClasspathEntryDescriptor cped) {
+ //How can we know for sure this is a resource folder?
+ if (cped != null) {
+ IPath[] exclusionPatterns = cped.getExclusionPatterns();
+ if (exclusionPatterns != null && exclusionPatterns.length == 1) {
+ IPath excludeAllPattern = new Path("**");
+ return excludeAllPattern.equals(exclusionPatterns[0]);
+ }
+ }
+ return false;
+ }
+
protected void addJavaProjectOptions(Map<String, String> options, ProjectConfigurationRequest request,
IProgressMonitor monitor) throws CoreException {
MavenSession mavenSession = request.getMavenSession();

Back to the top