smeeb
smeeb

Reputation: 29487

Gradle Wrapper to wrap runtime args in build invocation

Currently we have an app that builds with Gradle 2.3 (that uses the ShadowJar plugin to build self-contained "fat JARS") that builds with the following build invocation:

gradle clean build shadowJar

This produces a fat JAR under build/distributions.

To actually run the app, there are a ton of runtime arguments, for example:

java -jar build/distributions/myapp.jar -Dfizz=true -Dbuzz=false -Dfoo=1 -Dbar=yes -Dgizmo=405

In reality there are dozens of other args. These runtime args are environment specific and are different on each machine this app runs on, and hence they can't be hardcoded somewhere inside the build.gradle file. Someone mentioned to me that it would be possible to use the Grails Wrapper to abstract these runtime args, so that perhaps I could just run ./gradlew run and have that configured to do the same thing as the java -jar command above.

If this is true, what would this setup look like? If it's not true, why?

Upvotes: 1

Views: 142

Answers (1)

Lajos Arpad
Lajos Arpad

Reputation: 76434

I believe you should have a folder called ini, where you would have ini files, like

android.ini

In each .ini file you would define the values and you should create a loader which would determine what ini needs to be used, would load the file, parse its content and store them into settings variables.

Upvotes: 1

Related Questions