开发者

Maven: How to write custom plugin to copy static resources?

All our projects that are using docbook for creating documentation must have a set of static resources (images, css files and the like) in a particular target folder structure during site generation.

To assemble these resources and do the copying, I wanted to write a custom plugin that just has to be added in those projects, is bound to appropriate lifecycle phase and on execution copies all required files.

First approach was to create Ant based plugin, since the copy task is written down in a couple of lines. However, Ant's copy tasks开发者_如何学编程 copies what's in the filesystem... but on execution of the plugin the resources are in plugin's classpath and not available in filesystem. Right?

So I probably do have to write a MOJO (Java based). I guess binary copying of resource files and folders from plugin's classpath to the project's target folder is more or less a standard task, so what support do I get in developing the plugin? Are there any base or utility classes I should use, or any plugin I can copy some code from?


The maven-site-plugin exactly has already that kind of functionality. Take a deeper look into the docs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜