srs / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
864 stars 212 forks source link

outputs.dir property is ignored. #334

Open radhe-soni opened 5 years ago

radhe-soni commented 5 years ago

Hi Team,

I am trying to use this plugin in my spring-boot application. I am trying to build static files under "build/static" folder. plugin create a folder with same name and then it is deleted automatically. All the files are built in same "build" folder. My objective is to point build folder as my resources directory, so that they are available in my spring boot app. As per spring-boot structure I need my files under "resources/static" folder to be identified by default. Below is my plugin configuration -

def frontEndDir = file("${project.projectDir}/front-end")
sourceSets {
    main {
        resources { 
            srcDirs = ["${frontEndDir}/build", 'src/main/resources']
            }
    }
}
node {
    version = '6.11.5'
    npmVersion = '3.10.10'
    download = true
    nodeModulesDir = frontEndDir
}
npm_run_build {
    inputs.files fileTree("${frontEndDir}/public")
    inputs.files fileTree("${frontEndDir}/src")
    inputs.file "${frontEndDir}/package.json"
    inputs.file "${frontEndDir}/package-lock.json"
    outputs.dir "${frontEndDir}/build/static"
}
compileJava.dependsOn(npm_run_build)
bootRun.dependsOn(npm_run_build)

clean {
     delete "${frontEndDir}/build/static"
}