Search code examples
javagradlebpmn

Gradle war does not include bpmn diagram folder


My project contains bpmn diagrams in folder : src/main/java/com/company/core/bpm/diagram

While taking war from commend prompt with commend gradle war or gradle build the war file is not included in the war. But taking the war using eclipse it include the diagram folder.

It considers the diagram folder as empty folder and not including i think, is there any way to include the diagram folder in war when build from commend prompt


Solution

  • Resources, that is files that aren't .java files should go in the resources subfolder and gradle will pick them up from there. See the see section 23.4 of the Gradle documentation

    If for some reason you need your resources somewhere else, you can change the project layout to fit what you need. For example

    sourceSets {
        main {
            resources {
                 srcDir 'src/resources'
            }
        }
    }
    

    But if you make you java source directory and the resource directory the same, I'd expect all you source files to end up in the war as well. So better to keep them separated.