Gradle: resources folder visible in the IDE
Published on 16 August 2019
In an application project driven by the Gradle build tool
It is more pleasant to have visibility on all the files.
participating in the development of the application,
as resource folders that are not
in the paths by convention
For example I want the src/jbake directory,
be visible as ‘resource folder’
it is possible to do this by entering the project configuration,
in the IDE’s wizards However this option is not saved on the next reload
of the Gradle project in the IDE. To make this configuration permanent
the solution is to override the source paths configuration
in the build.gradle configuration file, such as at lines 18, 19, 20 and 21:
build.gradle
plugins {
id "java"
id "groovy"
id "org.jbake.site" version "5.0.0"
id "org.ajoberstar.git-publish" version "2.1.1"
}
repositories {
mavenCentral()
jcenter()
}
group project_group
version project_version
sourceSets {
main {
java { srcDirs = [] }
groovy { srcDirs =["src/main/java", "src/main/groovy"] }
resources {
srcDirs =[
"src/main/resources",
"src/jbake"//in order to get site src content in the IDE
]
}
}
test {
java { srcDirs = [] }
groovy { srcDirs =["src/test/java", "src/test/groovy"] }
}
}
test {
useJUnitPlatform()
}
configurations {
ivy
}
dependencies {
ivy "org.apache.ivy:ivy:$ivy_version"
implementation "org.codehaus.groovy:groovy-all:$groovy_version"
implementation "org.asciidoctor:asciidoctor-java-integration:$asciidoctor_java_integration_version"
implementation "org.freemarker:freemarker:$freemarker_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5_version"
}
gitPublish {
repoUri = github_pages_blog_repository
branch = git_branch
contents {
from(file(jbake_content_from)) {
into jbake_content_to
}
}
}
tasks.withType(GroovyCompile) {
groovyClasspath += configurations.ivy
}