开发者

get maven to call a method before jar

how do i get maven to run a specific method of mine before it creates the jar file?

basically, i have java code in my junits folder (not a test, just a class with a

 main([path to save to])

) that generates an xml file that must be included in the jar. how do i get maven to follow this flow?

compile

run custom method to create xml file passing it the path of t开发者_Go百科he build folder (this method needs the full classpath of the project to run)

jar classes


Bind the maven exec plugin to the generate-resources phase. And your are done.


In short, make it a plugin/MOJO.

In long, philosophy of Maven is not having you to write the build logic inside. It is a more declarative approach.

Anyway, you still have a last resort: use maven-antrun plugin to write a short logic to call whatever u need as ant target.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜