Application Build And Deploy
You can use workspaceBuild and EGLCMD Ant™ tasks to perform a headless build and deploy of a multi-project EGL application.
This sample scenario:
- Loads a RUI application with services into an empty workspace. The application consists of five EGL source projects plus a web project used only for deployment into an empty workspace.
- Uses an EGLCMD Ant task implemented in the example to deploy the services and RUI projects along with shared code from the other projects to the Web project.
This scenario was developed in response to several queries and comments related to previous headless hints. Major differences from previous headless hints are:
- A fix test to RBD version 184.108.40.206 is required to run the scenario. The fix test ensures that automatic generation in the headless build runs in the foreground instead of the background, ensuring that the generation runs to completion before the Ant build ends.
- The scenario uses the com.ibm.etools.j2ee.ant.RunAnt application instead of the org.eclipse.ant.core.antRunner application to run the Ant workspace build task. Apparently one of the reasons the RunAnt was written was to allow all workspace changes to be saved when the ant task completes.
- The scenario supplies an EGLBuildPlugin which provides two Ant task extensions to your IDE: one to run an EGLCMD cmdfile and the other to implement an EGL generation listener to log any generation errors encountered in the build.
- There are two ways to run the scenario. The first builds and deploys a RUI/services application using projects that have no errors in them and demonstrates the ability to build and deploy an application that can then be published to a server and run. The second includes a project with EGL build and generation errors, Java build errors and EGL deploy errors. This second scenario demonstrates how error messages are captured in separate build logs.
To Setup The Scenario:
- Download BuildWebWorkspaceDemo.zip and unzip the files into a temporary directory.
- Copy file plugins\EGLBuildPlugin_1.0.0 jar from the temporary directory into the dropins directory in your IDE install directory.
- Install fixtest EGLFixtest201205210813_headless_fixes.zip onto your Version 220.127.116.11 RBD IDE. Skip this step if you are using RBD Version 18.104.22.168 or later or Version 8.6 or later.
- Edit setRBDEnvironment.cmd and change variable settings as necessary to be correct for your installation of RBD.
- Capture you own clean workspace:
- Bring up your IDE with the -clean option in a new workspace.
- Specify * as an "Ignored resources" option on the "Web, Links" preferences view to prevent the linker from running during your headless build.
- Define a Tomcat 6.0 Server in the workspace.
- Close the IDE.
- Enter the following command from your temporary directory: CaptureWorkspace myWorkspacePath
To Run the Scenario:
- Enter the following command to run a headless build with no errors: RunBuildMyProjects.cmd. When the build is complete, output logs will be in the logs directory. You should be able to bring up the IDE and run the test RUI handler, ARUI-en_US.html, on the server
- Enter the following command to run a headless build with a project which has errors in it: RunBuildMyErrorProjects.cmd. Look at the logs directory to see the output for a build which fails.
Some Important Files to Understand
This command file uses com.ibm.etools.j2ee.ant.RunAnt application to run an Ant file in the IDE. Using this application seems to avoid hangs in the headless build.
Notice this file invokes the projectImport Ant task before unzipping the source files into the project directory. Loading the source file after the import prevents automatic build from running against the project before all the other projects have been loaded in the workspace. When all projects are loaded, the workspaceBuild Ant task refreshes all files in all directories before the build starts.
This Ant file is used to extract only the build or deploy error messages from a larger log file. The error logs identify issues that need to be corrected for the build to be correct.
More Information On Ant and Ant In Eclipse
Your questions and comments would be appreciated. I'm especially interested in about your experiences in applying this process to your own applications.