Question

I have a Java project that's paired with a bash script to make it easier to deploy on Linux. The script is a lot more complicated than this, but the part that matters is a section like this:

directory="/default/install/directory"
jarName = "myApp-0.0.1.jar"
command="/usr/bin/java -DARG=$argValue -jar $directory/$jarName"

When I update the version to 0.0.2, I would like maven to automatically change this line in my script, simply to:

jarName = "myApp-0.0.2.jar"

I'm sure this would involve maven-release-plugin in some way - possibly with sed -i, but my development machine is Windows so such tools are not so readily available (though I do use cygwin) - but I'm not really sure how. Thanks!

Was it helpful?

Solution

This is typically done by placing these kind of scripts as Maven resources. Using Maven properties ('jarName = "myApp-${project.version}.jar"') instead of hardcoded values, and activating filtering on these resources will make this straightforward.

If these scripts should be packaged in a different way than just inside the JAR produced, the assembly plugin will be able to do the job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top