Ensure that projects can be imported into Eclipse IDE
Recently the Spring Framework projects could no longer be imported into Eclipse IDE without compilation errors in JMH sources. This commit addresses this issue by applying workarounds for bugs in Gradle and the JMH plugin for Gradle. Gradle bug: https://github.com/gradle/gradle/issues/14932 JMH plugin bug: https://github.com/melix/jmh-gradle-plugin/issues/157 The Gradle bug has already been fixed in Gradle 6.8 RC1; however, the issue for the JMH plugin bug seems not to have been triaged yet. Closes gh-26140
This commit is contained in:
parent
4ed645e710
commit
298cb22bfe
|
|
@ -29,12 +29,11 @@ eclipse.classpath.file.whenMerged { classpath ->
|
|||
classpath.entries.removeAll { entry -> (entry.path =~ /(?!.*?repack.*\.jar).*?\/([^\/]+)\/build\/libs\/[^\/]+\.jar/) }
|
||||
}
|
||||
|
||||
|
||||
// Use separate main/test outputs (prevents WTP from packaging test classes)
|
||||
eclipse.classpath.defaultOutputDir = file(project.name+"/bin/eclipse")
|
||||
eclipse.classpath.file.beforeMerged { classpath ->
|
||||
classpath.entries.findAll{ it instanceof SourceFolder }.each {
|
||||
if(it.output.startsWith("bin/")) {
|
||||
if (it.output.startsWith("bin/")) {
|
||||
it.output = null
|
||||
}
|
||||
}
|
||||
|
|
@ -56,6 +55,23 @@ eclipse.classpath.file.whenMerged { classpath ->
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure that test fixture dependencies are handled properly in Gradle 6.7.
|
||||
// Bug fixed in Gradle 6.8: https://github.com/gradle/gradle/issues/14932
|
||||
eclipse.classpath.file.whenMerged {
|
||||
entries.findAll { it instanceof ProjectDependency }.each {
|
||||
it.entryAttributes.remove('without_test_code')
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that JMH sources and resources are treated as test classpath entries
|
||||
// so that they can see test dependencies such as JUnit Jupiter APIs.
|
||||
// https://github.com/melix/jmh-gradle-plugin/issues/157
|
||||
eclipse.classpath.file.whenMerged {
|
||||
entries.findAll { it.path =~ /src\/jmh\/(java|resources)/ }.each {
|
||||
it.entryAttributes['test'] = 'true'
|
||||
}
|
||||
}
|
||||
|
||||
// Allow projects to be used as WTP modules
|
||||
eclipse.project.natures "org.eclipse.wst.common.project.facet.core.nature"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue