Hi,
i am trying to build an IDEA plugin (with gradle 2.2).
To run, debug or package the plugin from IDEA I need to write classes and resources into the same directory. Otherwise IDEA will ignore the resources.
My problem now is that classes and resource are duplicated in the final jar file. I tried to handle this by creating my own ‘jar’ task that does only include my target directory. Unfortunately it does not work as expected.
Interesting is that the file are not duplicated if I just run ‘gradle clean jar’. If I run ‘gradle clean build’ all files are duplicated in the jar.
Is there any explanation why this does happen? How can I solve it?
Another thing I do not understand is that running ‘gradle clean jar’ prints the debug stuff from ‘eachFile’ and ‘doLast’. Running ‘gradle clean build’ does not. Any idea what is happening here?
Here is my code:
sourceSets {
main {
output.classesDir = “$buildDir/plugin”
output.resourcesDir = “$buildDir/plugin”
} }
task jar (type: Jar, overwrite: true, dependsOn: ‘classes’) {
from “$buildDir/plugin”
eachFile {
println it
}
doLast {
println “#### JAR ####”
} }