This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Automation Task:Help Required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Automation Task:Help Required" Watch "Automation Task:Help Required" New topic
Author

Automation Task:Help Required

Nikhil Nagrani
Greenhorn

Joined: Dec 23, 2010
Posts: 24
Hi,

Actually i have been given a task of automating the build process of my project.For this i need to make a ant file for it i guess.

Steps to automate(These steps are done manually on daily basis):

1)Downloading latest project workspace from PVCS to a particular directory.
2)Then compiling those files and making ear for it.
3)Now deleting the ear files of the previous day of the same project from WebLogicServer(here it is deployed daily after the build process).
4)Running the build command from the command prompt for the latest ear files which i got in step-2.Hence the latest ear got updated in the Web-Logic Server.

This is process followed till now.I need to automate this by writing a ant-script for the same.

Please help me how to approach the same as i haven't worked before with ant script..Thanks..
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30404
    
150

What do you know how to do? Do you know how to create an Ant build.xml that echos "Hello World"? If not, I recommend starting with the official tutorial or a book like Ant in Action.

Then you can start trying tasks. For example the PVCS task comes with documentation about each attribute and and an example at the bottom.

Give it a try and post back when you have some more specific questions. Then you can say what you tried, what the error was or why you are stuck.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Nikhil Nagrani
Greenhorn

Joined: Dec 23, 2010
Posts: 24
@Jeanne

Actually i need to automate the process i mentioned below as early as possible.

As you said i have looked through the basic examples....but going through the complete book would take time...so trying to figure out the neccessary commands which would help me to make a build file for the task given to me.

Do you know the command related to downloading the workspace from a pvcs repository to a specified folder?

Waiting for your reply.Thanks.

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

See another possibility - use Jenkins (aka Hudson) to manager your builds. There is a PVCS plugin for Jenkins, and thus Jenkins can be configured to pull the project sources from PVCS and then run the build.
http://jenkins-ci.org/

JBoss In Action
Nikhil Nagrani
Greenhorn

Joined: Dec 23, 2010
Posts: 24
@Peter

I am confused whether to use tools like ant,maven in which i need to write scripts for the automation or to go for software tools like hudson as you mentioned or many others available in the market.

Please guide me regarding which option would be better as i don't wan't to waste time in re-work.

Please Reply.Thanks.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30404
    
150

Nikhil Nagrani wrote:Do you know the command related to downloading the workspace from a pvcs repository to a specified folder?

It is on the Ant PVCS task page that I linked to in my original reply.

Nikhil Nagrani wrote:Actually i need to automate the process i mentioned below as early as possible.

That doesn't change anything. You still need to understand what you are doing. The Ant manual isn't long and I can't imagine how you plan to write an Ant task without understanding Ant. That's like saying "I want to write a Java program, but don't have time to learn Java."

As far as Jenkins vs Ant/Maven, it is not that one is better or worse. Ant/Maven give you more control. Jenkins gets a project off the ground faster. Either way, you will need to learn something.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

And, Maven and Hudson/Jenkins are all very different.

Both Ant and Maven can build Java apps. Ant is more of a scripting tool where you have to tell it everything to do and how to do it. Maven is a black box that know how to do a certain number of things and can do those things automatically with little configuration. Usually, if I find that Maven knows how to do what I want it to, I use Maven. If it doesn't, I use Ant. And I have used Ant for some very strange tasks that had nothing to do with building Java apps.

Hudson/Jenkins, on the other hand, cannot compile or build anything. What it can do, however, is fire off scripts, either at given intervals or on detecting that someone checked changes into version control. So you still have to write the script to build the code. But at least Hudson/Jenkins can handle the checkout of the code from version control for you.

If you are really set up the build process for a team of developers, then you should use Jenkins to manage your builds and either Maven or Ant to perform the actual build. If you have multiple projects, Jenkins can manage all of them. And Jenkins gives you a nice, centralized way to view the build results.
 
wood burning stoves
 
subject: Automation Task:Help Required