aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Can the Ear file creation be automated using Eclipse IDE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Can the Ear file creation be automated using Eclipse IDE?" Watch "Can the Ear file creation be automated using Eclipse IDE?" New topic
Author

Can the Ear file creation be automated using Eclipse IDE?

Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
I'm using Eclipse Galileo (3.5.1.M2) with JBoss Tools (plugin) and am building an Enterprise JEE application which consists of Entities and Session Beans in an ejb jar file and Servlets/JSPs in a War file, all wrapped up in an application EAR file to be deployed on JBoss AS 5.1.0.GA.

I can build the application using a keyboard accelerator (Ctrl+B), but when creating the Ear file, I need to right-click on the project, select Export -> EAR, and use the wizard, having to select the target Ear file, etc.

Is there any way to have the creation of the Ear file happen automatically as a part of the build process?

If not, is there any way to get the IDE to remember the Ear settings, such that I can just click a single button to generate it again - without having to go through the menus and wizard?

I've gone through the Eclipse help, but can't seem to find anything that will help me here.

Thanks,
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

Mark,
Yes. You can create an Ant build.xml that does what you want. You then have one click access to run it. Or you can add that build.xml as a custom builder to your project so it happens automatically.


[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
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

To add a custom builder, go to project preferences > builders > new > ant builder and link it to your ant script
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Ahhh, sweet. I think that is just what I was looking for. Can I assume that when I add the Ant build to my project builders, that it will get run in the order specified each time I build my project using the Project -> Build All (Ctrl+B)?

Also, since the rest of the build process is already being done, all my Ant build script needs to do is cobble together the Ear file, right?

Therefore, I could name my Ant build something like 'Build EAR File', since that's all it would be doing?

Or am I thinking about this in the wrong way?

Thanks,
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Thanks for your help. I've created an Ant build script, and got it to work for the most part from within Eclipse.

The problem is that I've discovered I can't use Ctrl+B to execute the Build All when focus is on a source file editor window.
As I edit source files, I want to be able to Save them (Ctrl+S), then build the project (Ctrl+B).

I edited the configuration for General -> Editor -> Keys to remove the key binding for "Bold" (which was set to Ctrl+B in certain contexts) and now Ctrl+B executes the build regardless of the context.

I can see how I might want Ctrl+B to execute the Bold command when editing HTML/JSP files, but not when editing Java source files. However, I guess I can live without Ctrl+B = Bold. Can you think of any reason I would not want to solve my problem in this way?

Thanks,
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

Mark E Hansen wrote: Can you think of any reason I would not want to solve my problem in this way?

No. It sounds good. How often do we make things bold when writing code?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can the Ear file creation be automated using Eclipse IDE?