• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

This weeks Giveaway

 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This week we are giving away 4 copies of the book:
"Java Development with Ant"
The best part, the Authors Erik Hatcher and Steve Loughran will be here to answer your questions.
Let's all give them a warm JavaRanch Welcome!
Thanks to the good people at Manning Publishing for the books.
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erik and Steve,
Welcome to this ranch!
I note that Erik has participated in many discussions here. Hope you all have a good stay this week.
 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this book cover ANT automation from java classes or servlets? I remember seeing an article about this suggesting it was a good way to run shell-type scripts using a servlet.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no, we dont cover how to call ant from inside other apps, 'embedded ant'. There is an article on onjava.com this week on that subject, and someone in the Ant dev team is working on a redesign of bits of ant to make it easier.
We do get into creating tasks inside an ant task, that being a standard way to get work done.
-steve
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can you tell us a little about what Ant is and what it is used for? I am new to Java and have not heard of it before.
Thanx!
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Erik and Steve!
I would like to know how can i log (if possible) the result of my ant build to non standard outputs, like email, or a unix syslog daemon using BuildListeners features.
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Daniel Ng:
Hi,
Can you tell us a little about what Ant is and what it is used for? I am new to Java and have not heard of it before.
Thanx!


Take a look at the Ant web page. It is basically a Java build tool.
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Logging output to email or syslog daemons? That can be done.
You have to run ant with a named logger, for mail you go
ant -logger org.apache.tools.ant.listener.MailLogger
you need to configure ant with some properties to set the destination, mailserver and so on.
For syslog stuff you'd need to use log4J, with the log4J listener, then config log4j to send the stuff wherever it can.
ant -listener org.apache.tools.ant.listener.Log4jListener
Configuring log4j is, as usual, troublesome, at least for me.
We cover this in our book in various places, but you can start with the ant manual page:
http://jakarta.apache.org/ant/manual/listeners.html
-Steve
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you dont know what ant is, here is a quick description:
its a tool that takes an XML description of the stages needed to build, test and deploy your project, and does what is needed to do exactly that. It is java based and easily extended through ant 'tasks', that are simply java classes.
If you are just starting off learning java, I'd probably encourage you to start with an IDE with a good debugger and integrated build process, such as Forte, Jbuilder or (my current favourite) IDEA. All of these IDEs also run Ant, so you can use ant from inside them, but it is extra complexity when you are starting out.
Ant is important not just because it understands about deployment -ftp, email, web application servers and the like, nor just because it knows about the problems of creating WAR files, EJB beans, or javadocs. It is important because it makes it easy to integrate tests into your build process, so you simply cannot deploy something that doesnt pass the unit tests, and after deployment ant can run fancy functional tests against your server to verify the code really works as planned.
It is also portable across many platforms, and scales up well, both of which make it very handy in big projects, ones with many people involved.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why Should someone use ant if they can instead use make?
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Birru:
Why Should someone use ant if they can instead use make?


Ant is platform independent because it is Java based.
 
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the key differences between make and Ant is in how the dependency checking works and who is responsible for it. Make's dependency checking is file timestamp based. Ant's dependency checking uses whatever is appropriate for the current task - tasks are responsible for their own dependency checking. For example - the FTP task of Ant can check the date of a remote resource and only download it if it is newer, whereas make would require some external tool to deal with such checks.
I hope that helps clarify it a bit.
 
Raj Birru
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erik and Matthew,
Thanks, that helps , I am convinced ant is better than make.
 
Raj Birru
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erik/Steve ,
What differentiates your book from others that are in the market, say Ant: The Definitive Guide.
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great! I just started using ANT. I like it a lot!
 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have two questions:
a) Does ant integrate with cvs e.g. automated checkouts ?
b) When an IDE proclaims that it supports ant
integration, what does that mean exactly ?
I am used to running ant from the command line.
Thanks
Pho
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Birru:
Erik/Steve ,
What differentiates your book from others that are in the market, say Ant: The Definitive Guide.


good q. When ours hits the bookshops you can flick through them side by side and see for yourself, but a glance
-we both have introductions to ant for new users, about 8 chapters each.
-we then add 10 chapters on how to use ant in big projects, web services, EJB, web apps, native apps, continuous integration and so on.
-we are up to date with ant1.5. ant:tdg only covers ant 1.4, which came out last september. There has been a lot of changes since then.
-As erik and I are committers on the project, we know a lot of the details and why things are as they are.
-we end up with 550 pages of content, plus a task quick reference, ant:tdg is more about 120 pages of content, plus 130 of detailed task reference.
Like I said, if you can compare them in the book shop; that is still my favourite way of buying books, and I am confident you will go for ours.
The other 'competitor' is the ant documentation itself. We actually view that as invaluable and a good adjunct to our book; it is still the most accurate listing of all ant tasks, with examples, and a great example of how open source projects can benefit from submitted documentation.
If you have the ant docs to hand, locate Ant in Anger in the documentation directory and you'll get an idea of what the second section of the book will be like -Some of the stuff I write about in ant in anger gets expanded in much detail in the book.
Also, go to manning.com/antbook
and you can see some of the example chapters... there are also still some earlier drafts of other chapters up on CoderCoop, which is a work-in-progress site run by the publisher (registration required).
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pho Tek:
Hi,
I have two questions:
a) Does ant integrate with cvs e.g. automated checkouts ?
b) When an IDE proclaims that it supports ant
integration, what does that mean exactly ?
I am used to running ant from the command line.
Thanks
Pho


a) yes, most of the popula SCM products have supporting tasks in ant for the basics of checkin and checkout.
b) "Ant support" in an IDE usually means you can define a build file for a project, see a list of targets and run them, with errors appearing in an error window where you can click on them to go to the lines in the file.
Some IDEs (Forte, jEdit) have dialog boxes to help you configure tasks.
One issue with IDEs is that they tend to lag with ant versions, so have bugs that were fixed ages ago. For example eclipse and forte have trouble running some build files on XP/Java1.4 because of an ant1.4.1 bug that was fixed.
I use jedit and intelliJ idea as my editors; I like jedit for XML and running builds better, IDEA is my favourite for java coding and debugging. But with ant I can work with whatever is the right one at the time.
-steve
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Birru:
Why Should someone use ant if they can instead use make?


Ant understands java better -it knows about how java files are compiled, how to run junit tests, how to update files inside a JAR or WAR file without rebuilding the whole file, and so on. And because it can do all this stuff inside a single JVM it flies through a build.
It also understands deployment, which is an essential part of a project.
At the same time, it is [usually] simpler than a makefile, which makes it easier to maintain.
So, you get speed, functionality and lower maintenance costs, alongside the portability argument already mentioned.
all the open source projects use it because it is easy to use and platform independent. There is now a nightly build of everything (the gump), that builds ant and then most other popular java projects from their CVS repositories every six hours, with nag mail sent out whenever a project wont build. That shows how Ant scales up, and how popular it is.
Try it: you might just like it.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please start a new thread if you have a question to ask.

Welcome to JavaRanch, Eric and Steve.
 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome Eric ans Steve,
It would be nice if you guys explain us as to where exactly should we use Ant.
What purpose does it solves in development and
production stage
Rishi
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marilyn de Queiroz:
Please start a new thread if you have a question to ask.


Originally posted by Rishi Singh:
It would be nice if you guys explain us as to where exactly should we use Ant.
What purpose does it solves in development and
production stage



Besides that, welcome guys!
I came in a bit late but enjoyed following the conversations and catching up...
 
Erik Hatcher
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rishi Singh:
Welcome Eric ans Steve,
It would be nice if you guys explain us as to where exactly should we use Ant.
What purpose does it solves in development and
production stage
Rishi


Ant should be used whenever you're doing Java development. At the moment I could not accomplish the time saving capabilities that XDoclet brings to the table without using Ant. Not only is Ant great for pure Java development, but it works nicely as a "task engine" to automate many of the mundane tasks typically encountered, such as generating documentation or transforming XML files., uploading files to FTP servers, fetching files from web servers, deploying applications, restarting app. servers, and much more.
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rishi Singh:
Welcome Eric ans Steve,
It would be nice if you guys explain us as to where exactly should we use Ant.
What purpose does it solves in development and
production stage
Rishi


Like everyone says, this should be a new thread. But ignoring that, and supplementing Erik's comment, I have to own up to sometimes starting up a project using my favourite IDE (currently IntelliJ IDEA) to start coding the project and a few unit tests to go with it.
But as soon as I have more than a couple of junit tests, I add an ant build file so that I can bulk execute all the tests every build, then add more stuff over time : jar of the file, execution of the jar, deployment and delivery, etc.
You dont need to write a fully complete ant build file from the outset, just evolve it as your project proceeds.
ant can also automate deployment, which is a very powerful feature, so powerful we ended up with two chapters on it. Basic deployment involves ftp, restarting tomcat, email, etc.
production side deployment involves validating datestamps, going via obscure routes (cd burns), generating different builds of your app for different target servers, etc. And once deployed, ant runs httpunit tests against my app, then generates an HTML report if it fails.
I should warn you: Ant does make automated deployment possible, but it can be hard work getting it right. Even with our book, it is hard, because production systems are often managed by operations people who dont trust engineers.
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Steve Loughran:


I should warn you: Ant does make automated deployment possible, but it can be hard work getting it right. Even with our book, it is hard, because production systems are often managed by operations people who dont trust engineers.


I almost forgot, I have a presentation on this subject online, When Web Services Go Bad, that talks about automated, integrated build, test and deploy processes. I have a theory that if you apply the development processes of use cases and testing to that of deployment and operations, server side dev is a lot easier. Ant is the basis for such a process.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this book has some info about Centepede which build under Ant?
 
Erik Hatcher
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We mention Centipede and Maven in our book, but we do not cover it at all. Both of those were highly in flux at the time of writing, so we simply chose to point readers to them instead of attempt writing against something immediately out of date.
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Steve Loughran:

good q. When ours hits the bookshops you can flick through them side by side and see for yourself, but a glance
-we both have introductions to ant for new users, about 8 chapters each.
-we then add 10 chapters on how to use ant in big projects, web services, EJB, web apps, native apps, continuous integration and so on.
-we are up to date with ant1.5. ant:tdg only covers ant 1.4, which came out last september. There has been a lot of changes since then.
-As erik and I are committers on the project, we know a lot of the details and why things are as they are.
-we end up with 550 pages of content, plus a task quick reference, ant:tdg is more about 120 pages of content, plus 130 of detailed task reference.
Like I said, if you can compare them in the book shop; that is still my favourite way of buying books, and I am confident you will go for ours.
The other 'competitor' is the ant documentation itself. We actually view that as invaluable and a good adjunct to our book; it is still the most accurate listing of all ant tasks, with examples, and a great example of how open source projects can benefit from submitted documentation.
If you have the ant docs to hand, locate Ant in Anger in the documentation directory and you'll get an idea of what the second section of the book will be like -Some of the stuff I write about in ant in anger gets expanded in much detail in the book.
Also, go to manning.com/antbook
and you can see some of the example chapters... there are also still some earlier drafts of other chapters up on CoderCoop, which is a work-in-progress site run by the publisher (registration required).


Seems that your book is intended to put ant into practice. That's great! Another similar book in the market is "Java Tools for XP".
Hope your book top amazon.com list just like JTFXP!
 
Erik Hatcher
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Wang:

Seems that your book is intended to put ant into practice. That's great! Another similar book in the market is "Java Tools for XP".
Hope your book top amazon.com list just like JTFXP!


And in case its relevant: I contributed to Java Tools for Extreme Programming. Rick and Nick are good buddies of mine, and I used to work with them when they were writing that book.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a question for Erik and Steve.
Let's say you wanted to use ant to help with ejb development.
Would it be possible to write up an ant script to instantiate a bean, test its methods, then once the bean passes the tests, the script could hot deploy the bean into the container. What way would you do this to make it the most feasible, in your opinion?
 
Erik Hatcher
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by chris coleman:
Here is a question for Erik and Steve.
Let's say you wanted to use ant to help with ejb development.
Would it be possible to write up an ant script to instantiate a bean, test its methods, then once the bean passes the tests, the script could hot deploy the bean into the container. What way would you do this to make it the most feasible, in your opinion?


Cactus is the best way I know of to test server-side things like session and entity beans.
You could code JUnit test cases to look up a remote interface to a session bean and invoke its methods, and in fact this is done in our books code, but it requires the app. server to be running already of course, and that you've got all the JNDI lookup stuff in the client-side classpath, etc. Cactus is the recommended way though.
 
Pho Tek
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Erik,
Cactus offers two options in testing - MockObjects or in-container testing. I run my
MockObjects junit testing from ant without any
problems e.g. simulating a servlet environment
for example.
You can use mockmaker to generate your stubbed mock objects for you.
Cheers,
Pho
 
Doug Wang
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Erik Hatcher:

And in case its relevant: I contributed to Java Tools for Extreme Programming. Rick and Nick are good buddies of mine, and I used to work with them when they were writing that book.


Its more and more interesting to me. Seems that these two books have many in common. I wonder whats the difference between them?
 
Erik Hatcher
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java Tools for Extreme Programming is a broad look at many tools such as Cactus, HttpUnit, JMeter, and of course Ant. But it does not delve deep into Ant and its best practices.
Our book is a comprehensive book on Ant and what it takes to use it in the real projects encountering tough issues. We also provide some coverage of Cactus, but must less than the Java Tools book, and with emphasis on the entire Ant build process incorporating Cactus and HttpUnit, as well as an interesting tool called Canoo WebTest.
 
Erik Hatcher
Author
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pho Tek:
Erik,
Cactus offers two options in testing - MockObjects or in-container testing. I run my
MockObjects junit testing from ant without any
problems e.g. simulating a servlet environment
for example.


I do not believe Cactus "offers" MockObjects per se. They can be used outside of Cactus and are noted as complimentary to Cactus on the Cactus website's Mock versus Cactus document.
Are you using MockObjects to test EJB's, particularly Session Beans? If so, I'd love to know how!
 
Steve Loughran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Doug Wang:

Its more and more interesting to me. Seems that these two books have many in common. I wonder whats the difference between them?


ours is pure ant, with topics (testing, ejb, web services) done with a 'how to do this with ant' theme. Also we dont mandate XP; there are a lot of places that the XP "dont plan ahead" ethos doesnt work, yet you can still use an ant based, test centric process to build, test and deploy your code.
I have a copy of the Java Tools book at work, and look at it for detail on things like HttpUnit, cactus, load testing etc. Just not the ant part
Also they cite me in it for Ant in Anger, and mention Erik too (he helped them in a Chapter), so we like them.
I dont know if they are doing an update to the book , I had heard a mention that one was planned; if so it will be updated to ant1.5 and no doubt benefit from the contents of our book too.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic