Solved

How to schedule pre- or post-build actions for a java project in eclipse

Posted on 2008-10-22
3
2,111 Views
Last Modified: 2013-12-15
I need to know how to schedule pre- or post-build actions for a java project in eclipse. I need to launch a script for creating custom configuration files and directories. Ideally, the script should ask a parameter to the developer or (even better) read a environment variable.
0
Comment
Question by:fhoster
3 Comments
 

Accepted Solution

by:
Matt_Bu earned 125 total points
ID: 22840170
Right-click on the project and select --> build path --> Configure build path...
Select the Builders option from the left list.
From there you have several options depending on your configuration and plugins.

I think base eclipse in a java project has at least Ant builder and program.  I have had the most joy using ant builders because I haven't found anything I had to do that I couldn't do with ant but you can do another java program, a shell script, etc.

I'll explain the ant method in more detail:
From the Builders option select the new button on the right.  Then select the Ant Builder and choose the ant build.xml file containing the targets you want to run which should already have been created and stored somewhere in the workspace (I always create them in the project I'm working on but they can be in another project.  

Then you have tons of options and configurations available such as refreshing the workspace after the build, what types of builds to run (the order that the builders appear in the list is the order they will run) and which targets in the ant file to run, use the built-in JRE or an external one, classpath options, allocate console to view the results of the build action, etc.

You have access to several built-in variables when running ant scripts inside the IDE and you can create new ones or reference properties files in the configuration.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question