aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Building JAR's for linked projects... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Building JAR Watch "Building JAR New topic
Author

Building JAR's for linked projects...

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi guys... How can I automate the process of building a new jar file for a project in eclipse ? Is there a way to do this without perturbing the entire build process ? I would rather not use ANT because eclipse appears to be so smart, that I dont want to replace whatever logic eclipse uses under the hood with my own, somewhat buggy (possibly) logic for rebuilding a jar.

Essentially, I have 5 projects, and I want changes to the source in those projects to automatically result in construction of new Jar files, so that the main project, which depends on those 5, can be exported as an executable jar file which is 100% concurrent with the sub projects.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

I use Maven or Ant. I could probably find a way to make Eclipse do this, but I have a very firm rule that my builds should be assistable by IDEs, but not dependent on them.

I've got a long and sordid list of reasons why I'm so dogmatic about that, but I won't weary people by repeating it. If you're interested, look at some of my earlier messages in this forum.


Customer surveys are for companies who didn't pay proper attention to begin with.
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
I believe eclipse uses ant under the hood . How can I access the build process for eclipse projects ?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

Eclipse does not use Ant under the hood (as far as I know). (NetBeans uses Ant, however.) But you can change your project to be built with Ant. Go to Project > Properties, than under Builders, click New, choose Ant Builder and fill in the information. Then you can use the Ant build from Eclipse or from the command line or a script.

Beware, however, that Eclipse tries to be "helpful" when running the Ant build, and that can cause problems. You need to be careful that your Ant script always runs properly from the command line.


JBoss In Action
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
What do you mean by eclipse tries to be :helpful: ?
Ive been using to manage my complex java projects via eclipse for so long I'm not quite sure where to start moving into this brave new world of custom builds.
Where should I start ?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

If I recall correctly, Eclipse adds several system properties to the Ant command, which can cause the build to work correctly while being used within Eclipse, but incorrectly when used from a command line.

The best place to start learning Ant is with a good book - I recommend Ant in Action - I have the previous version of that book and find it indispensable.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

You can actually tell Eclipse to create build files to be able to run as stand-alone or as Eclipse build files. If you tell Eclipse not to use the Eclipse builder but the Ant builder as default, it creates build.xml files that can be run under Eclipse.

However, if you export the project as external build, then it creates ant-task that is totally independent of Eclipse.

Also, it is really easy to call the Eclipse builder from Hudson of Cruise.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Building JAR's for linked projects...