Non-java file changes


(Klaus Christiansen) #1

I have a Java project that uses StringTemplates. Gradle does not see changes in the *.st or *.stg files.
How can I make gradle aware of non-java file changes?


(Lance Java) #2

You have not given enough information

  1. When are these *.st and *.stg files used? (build time or runtime)
  2. Where are these *.st and *.stg files located?
  3. What do you mean by aware?

If they are under src/main/resources then gradle will be “aware” of them (ie the jar will be rebuilt if they change)


(Klaus Christiansen) #3
  1. The *.st(g) files are used at run time.
  2. They are places in src/dk/kec/templates.
  3. “Aware”; gradle states that all tasks are up-to-date even if a change a String Template.
    When I change a StringTemplate a new Jar files has to be made and test has to be run. StringTemplate are used to generate files.

(Lance Java) #4

Please include the relevant gradle snippet(s) which adds src/dk/kec/templates to the jar file. I’m guessing the directory needs to be added as a task input


(Klaus Christiansen) #5
apply plugin: 'java'

sourceSets {
	main.java.srcDirs = ['src']
}

(pwchan) #6

Try this.

sourceSets {
main.resources.srcDirs = [‘src/dk/kec/templates’]
}