Google
 

mardi 8 janvier 2008

Put Ant to Work

Although it might be surprising, the first few things you need to get Hibernate running have nothing directly to do with Hibernate. They set up an environment in which the remaining examples work and have the pleasant side effect of building a solid foundation for any actual project you might be undertaking.

If you’re not already using Ant to manage the building, testing, running, and packaging of your Java projects, now is the time to start. The examples in this articles are Ant-driven, so you’ll need a working Ant installation to run them and experiment with variations on your own system, which is the best way to learn.

The examples use Ant for several reasons. It’s convenient and powerful, it’s increasingly (almost universally) the standard simple build tool for Java-based development, it’s free, and it’s cross-platform. Using Ant means the examples can work equally well anywhere there’s a Java environment, which means you won't be frustrated or annoyed. Happily, it also means we can do many more cool things with less effort—especially since several Hibernate tools have explicit Ant support, which I’ll show how to leverage. (I should note that more complex Java projects these days often use Maven1, which adds many other project management capabilities.)