I’m using gradle-7.5.1 and i have a spring boot application and this is my structure:
I’ve moved configurations files like application,properties, messages.properties, some json files etc to external conf folder which is in parallel to “src” so that customizations can be done to configuration files without re-building war.
But for local development, when i run as SpringBootApplication in eclipse which uses embedded tomcat, i need to set that folder in classpath so that application runs fine. I want to set it in build.gradle itself so that whenever project imported into eclipse, it will be set automatically without manually setting it like this:

I tried multiple ways, but none of them are satisfactory:
- I tried setting
conffolder as additional resources directory. This works fine in eclipse becauseconffolder contents getting copiedWEB-INF\classeswhich i don’t want because when i’m building war these are being included intowarfile which i want to exclude because when i deployed this war file to external tomcat, each server will have its ownconfdirectory and set it in tomcat CLASSPATH.
sourceSets {
main {
resources {
srcDirs 'conf' //specify additional resources directory apart from src/main/resources
}
}
}
- Had this configuration.
// Eclipse plugin configuration
eclipse {
classpath {
file {
withXml {
def node = it.asNode()
node.appendNode('classpathentry', [kind: 'lib', path: 'conf'])
}
}
}
}
This works when i’m running gradle eclipse from command line but not working with Eclipse Gradle -> Refresh Project
- Tried this
eclipse.classpath.file {
whenMerged { classpath ->
def lib = new org.gradle.plugins.ide.eclipse.model.Library(fileReference(file('conf')))
lib.exported = true
classpath.entries << lib
}
}
But this is adding inside Project & External Dependencies section, due to this, im not able to edit the files:

So this is my problem summary:
i want a folder to be added in eclipse classpath to run the application locally but not to be included in war file.

