Reputation: 8606
I have a value that I want to append at the end of a file, but I cannot figure which plugin to use.
Example: the value I want to append: "myValue"
file:
value1
value2
myValue # after append
I know I can do it using the antrun-plugin, but is it possible to do this with a maven plugin?
I've also looked over maven-shade-plugin
, but from the few examples on their website I only saw doing append of 2 files instead of what I need (value to append to one file)
Upvotes: 4
Views: 3004
Reputation: 1155
You can use maven filtering to achieve what you are looking for.
Upvotes: 1
Reputation: 14951
The Codehaus gmaven-plugin is another option for tasks like these.
Upvotes: 0
Reputation: 54457
Sorry to say, but I think your best option really is the Ant plugin.
I shudder every time I have to use Ant in my pom.xml, but in some cases, it's the easiest option. Learn to embrace it, it will save you some headaches :-)
You could probably also write your own Maven plugin, but that would likely be more work.
One other option would be to create a shell script to append the value, and then call that using the maven-exec-plugin
. You'll have to deal with different operating systems in that case, though.
Upvotes: 2