Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
UnitTestSupport.resetLaunchConfigurations(project);
}

@SuppressWarnings("unused")

Check warning on line 196 in org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java

View check run for this annotation

Jenkins - M2E / Compiler

Unnecessary Code

LOW: At least one of the problems in category 'unused' is not analysed due to a compiler option being ignored
protected IContainer getOutputLocation(ProjectConfigurationRequest request, IProject project) throws CoreException {
MavenProject mavenProject = request.mavenProject();
return getFolder(project, mavenProject.getBuild().getOutputDirectory());
Expand Down Expand Up @@ -569,7 +569,7 @@
// skip adding resource folders that are included by other resource folders
log.info("Skipping resource folder " + path + " since it's contained by another resource folder");
} else {
addResourceFolder(classpath, path, outputPath, addTestFlag);
addResourceFolder(classpath, path, outputPath, addTestFlag, resource);
}
// Set folder encoding (null = platform default)
if(r.exists() && !Objects.equals(r.getDefaultCharset(false), resourceEncoding)) {
Expand All @@ -582,14 +582,26 @@
}

private void addResourceFolder(IClasspathDescriptor classpath, IPath resourceFolder, IPath outputPath,
boolean addTestFlag) {
boolean addTestFlag, Resource resource) {
log.info("Adding resource folder " + resourceFolder);
IClasspathEntryDescriptor descriptor = classpath.addSourceEntry(resourceFolder, outputPath, DEFAULT_INCLUSIONS,
new IPath[] {IPath.fromOSString("**")}, false /*optional*/);
IClasspathEntryDescriptor descriptor = classpath.addSourceEntry(resourceFolder, outputPath,
toIPathList(resource.getIncludes(), null),
toIPathList(resource.getExcludes(), null), false /*optional*/);
descriptor.setClasspathAttribute(IClasspathManager.TEST_ATTRIBUTE, addTestFlag ? "true" : null);
descriptor.setClasspathAttribute(IClasspathAttribute.OPTIONAL, "true"); //$NON-NLS-1$
}

private IPath[] toIPathList(final List<String> fileNames, final String defaultPattern) {
if (fileNames == null) {
return defaultPattern != null ? new IPath[] {IPath.fromOSString(defaultPattern)} : DEFAULT_INCLUSIONS;
}
final List<IPath> retList = new ArrayList<>();
for (final String files : fileNames) {
retList.add(IPath.fromOSString(files));
}
return retList.toArray(DEFAULT_INCLUSIONS);
}

private void configureOverlapWithSource(IClasspathDescriptor classpath, IClasspathEntryDescriptor enclosing,
IPath resourceFolder) {
// resources and sources folders overlap. make sure JDT only processes java sources.
Expand Down
Loading