Reputation: 133
I've created simple app based on jhipster and I had to add some libraries to build.gradle to develop what I wanted. That worked correctly. Then I had to regenerate my app since I wanted to add/remove features of jhipster itself. Because my build.gradle was modified and jhipster wanted to regenerate it from it's source I was wondering if there is a place where I can put my stuff in so it would be there whenever I would have to regenerate it again?
In generated files for jhipster one can spot lines like:
//jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
So assuming if I understand it correctly that jhipster have additional "registry" of modification which should be applied to original template of the file. But where it is or how to use this so jhipster would know that something although is modified from source is ok and should stay (I mean in the diff view)?
Let's say I need additional plugin for javacc which would be:
id "ca.coglinc2.javacc" version "3.0.0"
and additional section of build.gradle like this:
compileJavacc {
arguments = [
grammar_encoding: 'UTF-8',
static: "false",
debug_parser: "false",
debug_lookahead: "false"
]
inputDirectory = file('src/main/javacc')
outputDirectory = file('src/main/generated/javacc')
}
compileJava.dependsOn processResources,compileJavacc
bootWar.dependsOn war
processResources.dependsOn cleanResources,bootBuildInfo
bootBuildInfo.mustRunAfter cleanResources
sourceSets {
main {
java {
srcDirs 'src/main/java'
srcDirs 'src/main/generated/javacc'
}
}
test {
java {
srcDirs 'src/test/java'
}
}
}
Where to put it that whenever I would have to regenerate the code it would be there and not removed by jhipster?
Upvotes: 0
Views: 82
Reputation: 701
There is basically no place where you can put your code. What works quite well in most cases is, that you create an own gradle script file (like custom.gradle
) and just apply that file in the main build.gradle
file (there already some apply from ...
lines.
With that you can quite easily manage your custom settings even in case jhipster wants to overwrite build.gradle
.
Upvotes: 1