-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Problem with search path for type-checking extensions #1397
Comments
Can you share at least the structure of your project? Does eclipse recognize |
It does recognize the folder as a source folder. I am not sure about the "Groovy script filter"; I was unaware of the concept until now. |
Eclipse does not have the distinction of source and resource directories like Maven does. To have resources available through classpath, they must be source folders. Any groovy source unit in a source folder will be compiled, unless it is matched by a script filter. The m2e project configurator should probably apply a groovy script filter for any maven resource directory that is manifested as an eclipse source folder. Update: the script filter sits between full exclusion and full inclusion. As-is a source folder includes all files. An exclusion can be set so eclipse ignores files matching a pattern; this prevents compilation but also prevents copying to output folder. Script filter can prevent compilation while still supporting copying of scripts to the output folder (for classpath inclusion). |
I've used gradle to write script filters (see below). I think apply plugin: 'eclipse'
project.tasks.eclipse.doLast {
if (!file("${project.projectDir}/.classpath").exists()) return
file("${project.projectDir}/.settings/org.eclipse.jdt.groovy.core.prefs").with { prefs ->
if (!prefs.exists()) {
append('''\
eclipse.preferences.version=1
groovy.compiler.level=40
groovy.script.filters=**/*.gradle,n,**/script*.groovy,y,**/*resources/**/*.groovy,y,**/benchmarks/**/*.groovy,y
org.codehaus.groovy.eclipse.preferences.compiler.project=true
'''.stripIndent()
)
}
} |
I could look into changing the m2e project configurator to add script filters for resource directories. I'm not sure if m2e reapplies the configurator when you update a Maven project or if you would need to re-import the project. Thoughts? |
I'm actively working on a type-checking extension, which is in the
src/main/resources
of my project. My class has@CompileStatic(extensions = 'my/extension.groovy')
. This works correctly in the Maven CLI build and in Eclipse if I run Maven through at leastprocess-resources
, but using a Eclipse clean causesThe problem appears to be a sequencing problem regarding resource access.
The text was updated successfully, but these errors were encountered: