Okay, so feel free to chime in if I’m doing anything wrong or if there are better ways to do things. I am essentially new to Java, and Java build tools. I am just getting my bearings for Tasks, Groovy, etc… I have a project that I am creating a JAR of by using the application plugin and calling the task installDist.
Short Version: How do I optionally include JVM arguments depending on whether I am running a Distribution task, or a Run task? Or, how am I intended to manipulate the batch file that’s included with the distribution process (e.g. /build/install/MyAppName/bin/MyAppName.bat).
Long Version: I am using Apache Camel Main which automatically picks up an application.properties file in the /resources/ folder when running my project within the IDE (via gradle run). In order to override this property file after distributing my project into a JAR, I need to supply JVM arguments (-Dcamel.main.override-properties-location=file:application.properties). If I specify the arguments with the applicationDefaultJvmArgs option it will work for my distributed JAR but won’t work for my locally run IDE version (due to it trying to find a file that doesn’t exist). I know I can comment/uncomment out code for running but that seems like a poor workaround. I want to be able to include the JVM args only in the distribution.