Solved

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

Posted on 2008-10-22
3
2,062 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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 keystrokes in Netbeans IDE 8.0 for Windows.

776 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