Add new resources at execution phase into JAR


(aleks marchanka) #1

Hi guys,
I run into a problem and any help will be appreciated
The build process of my project is

  1. build frontend (some Exec tasks, they run “npm install” and etc.)
  2. move frontend artifacts(js, css, html) into resource folder of my java project
  3. make jar of java project

the problem is there are no any frontend artifacts from steps in 1 and 2 in the resulting JAR.
As I get, I have to add these new resources manually into gradle, but I don’t know how to to that.


(aleks marchanka) #2

hmm, adding it to the classpath works

project.sourceSets.main.runtimeClasspath += files(project.ext.artifactsDir );

UPD:
for some reason it’s not working on mac.
the multi platform solution is to move artifacts into buildDir and build frontend before JAR gradle task.