The Artima Developer Community
Sponsored Link

Java Buzz Forum
preGoal/postGoal vs. depends=

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
preGoal/postGoal vs. depends= Posted: Nov 26, 2004 1:33 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: preGoal/postGoal vs. depends=
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
One thing I really like about Maven is the pre and postGoals support. I find this functionality MUCH better than hacking around with targets in ant, and having to setup the correct depends="..." path. With pre/postGoals I don't have to go to the goal which I want to add functionality too. I can intercept it. This is infinitely nicer. It also makes a lot more sense in Maven, as you have so many predefined goals, and many more plugins ready for you to install. Example One: Tweaking the way your war is built Out of the box maven can package a war (in various ways). What if you want to do something "different" than the standard packaging? Well, we wanted to make sure a certain file was put in the classes directory, so we simply use a preGoal: <preGoal name="war:init"> <copy todir="${build.webinf.classes}"> <fileset dir="${basedir}/../../"> <include name="project.properties"/> </fileset> </copy> </preGoal> Example Two: Kicking off a pre-compile step We use XDoclet to generate Hibernate mappings, and can use a simple preGoal around the standard java:compile goal: <preGoal name="java:compile"> <taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask" classpathref="maven.dependency.classpath" /> <hibernatedoclet destdir="${build.webinf.classes}" excludedtags="@version,@author,@todo" force="true" verbose="true"> <hibernate version="2.0" validateXML="true"/> <fileset dir="${maven.src.dir}/java"> <include name="project/model/*.java"/> </fileset> </hibernatedoclet> </preGoal> I haven't checked, but it would be really nice to be able to have the preGoal STOP the processing of the actual goal etc. Much nicer.

Read: preGoal/postGoal vs. depends=

Topic: Apache Geronimo 1.0 M3 Released Previous Topic   Next Topic Topic: Pebble 1.6-beta3 available

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use