0

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!

4

1 回答 1

1

这通常是通过将这些类型的脚本作为 Maven 资源来完成的。使用 Maven 属性 ('jarName = "myApp-${project.version}.jar"') 而不是硬编码值,并激活对这些资源的过滤将使这变得简单。

如果这些脚本应该以不同于生成的 JAR 的方式打包,则程序集插件将能够完成这项工作。

于 2013-10-24T14:27:51.850 回答