开发者

ANT->Maven task translator(or just use Maven Ant Tasks)

开发者 https://www.devze.com 2023-03-28 17:45 出处:网络
Is there a guide that outlines how to perform each of the following ant tasks using Maven? http://ant.apache.org/manual开发者_StackOverflow/tasklist.html

Is there a guide that outlines how to perform each of the following ant tasks using Maven?

http://ant.apache.org/manual开发者_StackOverflow/tasklist.html

Is it considered best practice to use Maven for these tasks or just run them in ANT via ant tasks feature.


There is no mapping between ant tasks and "Maven tasks", because Maven doesn't have tasks. Its philosophy is completely different.

Ant is imperative: you tell Ant what to do with a sequence of parameterized tasks.

Maven is descriptive: you describe which kind of project you have, respect a set of conventions (or describe how you broke these conventions, and Maven decides which tasks it must do.


Somewhere there's a table that shows Maven plugins that are analagous to given Ant tasks, but I can't seem to find it. The "Available Plugins" list might help you out.


There is a list of ant-task-to-maven-plugin at the end of this page -> http://maven.apache.org/plugins/maven-antrun-plugin/usage.html

Unfortunately, it only covers a small subset of ant tasks.

I've recently mavenized ant-based project (I really had it with dependency management) and from that experience I had very little need to retain Ant code. The only place I've used antrun plugin was around custom code generation.

I think that it's perfectly fine to delegate some tasks to ant (and sometimes even to scripts) if that's well documented and saves time and maintenance cost.

One other place where I still use antrun is for echoing some environment properties and generic text to a build output, but maybe it's just my ignorance and there is a Maven way for that.

0

精彩评论

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

关注公众号