• 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

Building JAR's for linked projects...

 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe eclipse uses ant under the hood . How can I access the build process for eclipse projects ?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic