This topic provides instructions on how to get started
using the build utility.
Running the AutoBuild sample
Packaged
in the build utility core installation files is an AutoBuild sample.
This section provides instructions on how to run this AutoBuild sample.
Prerequisites
To run the AutoBuild sample:
- Create a backup copy of the original AutoBuild sample by archiving
the files under the BuildUtility\eclipse\samples\AutoBuild directory.
Otherwise, you will modify the sample by running it and no longer has
access to the original sample.
- Open a command prompt and set the workspace environment
variable. For details on setting the workspace environment variable,
see the Getting
Started section.
- If you have already run the AutoBuild sample and want to run it
again, you need to reset the environment:
- Verify that the directory defined for the workspace environment
variable is existing and empty. In other words, remove all files and
directories under the workspace that are from a previous run of the
AutoBuild sample.
- Replace the BuildUtility\eclipse\samples\AutoBuild directory
with a backup copy of the original packaged AutoBuild sample.
- Modify the following line in the AdderBuild.preferences file
available in the BuildUtility\eclipse\samples\AutoBuild directory:
targetRuntime.targetLocation=D:/WAS61
Replace D:/WAS61 with
the local WebSphere Application
Server v6.1 installation directory. In the file path to the local WebSphere Application Server
v6.1 installation directory, you must use forward slashes. Here is
an example:- Correct usage of the forward slashes:
- targetRuntime.targetLocation=C:/Program Files/IBM/WebSphere/AppServer
- Incorrect, the slashes are backward slashes:
- targetRuntime.targetLocation=C:\Program Files\IBM\WebSphere\AppServer
- To study what the AutoBuild sample does, open the AdderBuild.xml build
script in a text editor. You can find it in the BuildUtility\eclipse\samples\AutoBuild directory.
This script file implements the following Ant tasks:
- init
- Prints out information about the build including some of the variables
that are defined.
- Loads the preferences from the AdderBuild.preferences file.
- This sets up the AdderRuntime in the workspace
- Builds the workspace
- importAndBuildEverything
- Imports and builds all projects listed in the AdderBuildImport.psf file
by calling projectSetImportAndBuild Ant task
- Builds the workspace
- Builds the AdderEJBClient_UtilJar.jar file
- Imports and builds the AdderErrorWeb project
to demonstrate a build failure
- projectSetImportAndBuild
- Imports all the projects listed in the AdderBuildImport.psf file
by calling projectSetImport
- Builds all the projects listed in the AdderBuildImport.psf by
calling projectSetBuild
- projectImportAndBuild
- Imports the project projectName
- Builds the project projectName
- DebugTraceHighlight
- Prints out a debug message
- To study how to run the AutoBuild sample, open the buildAdderExample file
in a text editor. You can find it in the BuildUtility\eclipse\samples\AutoBuild directory.
Look for the following command in the script:
"%RUNANT_DIR%\..\..\bin\runant" -buildfile "%RUNANT_DIR%\AdderBuild.xml" %* importAndBuildEverything
This
command issues the runAnt command to start
the build utility with the build script file AdderBuild.xml,
and requests to start the importAndBuildEverything Ant
task.
- Switch back to the command prompt and run the buildAdderExample command.
For example on the Windows operating
system:
c:\BuildUtility\eclipse\samples\AutoBuild>buildAdderExample.bat
- In the AutoBuild sample there is a test for failure for the AdderErrorWeb project.
If you receive a similar BUILD FAILED message for this AdderErrorWeb project,
due to the test for failure you can safely ignore this message:
buildECLIPSE:
[echo] buildMASTER for AdderErrorWeb
[projectBuild] Building: AdderErrorWeb (Begin)
[projectBuild] (Begin)
[projectBuild] (Done)
[projectBuild] (Begin)
[projectBuild] (Done)
[projectBuild] The user operation is waiting for background work to complete. (Begin)
[projectBuild] The user operation is waiting for background work to complete. (Done)
[projectBuild] The user operation is waiting for background work to complete. (Begin)
[projectBuild] The user operation is waiting for background work to complete. (Done)
[projectGetErrors] ----------
[projectGetErrors] 1. ERROR in \AdderErrorWeb\src\AdderJavaErrors.java
[projectGetErrors] (at line 2) org.eclipse.jdt.core.problem
[projectGetErrors] The import xyz cannot be resolved
[projectGetErrors] ----------
[projectGetErrors] 2. ERROR in \AdderErrorWeb\src\AdderJavaErrors.java
[projectGetErrors] (at line 5) org.eclipse.jdt.core.problem
[projectGetErrors] Syntax error on token "x", delete this token
[projectGetErrors] ----------
[projectGetErrors] 3. ERROR in \AdderErrorWeb\WebContent\AdderJspErrors.jsp
[projectGetErrors] (at line 23) org.eclipse.jst.jsp.core.validationMarker
[projectGetErrors] badVariable cannot be resolved
BUILD FAILED
C:\IBM\SDP\7552\20100721_2133\samples\AutoBuild\AdderBuild.xml:110: The following error occurred while executing this line:
C:\IBM\SDP\7552\20100721_2133\samples\AutoBuild\AdderBuild.xml:153: The following error occurred while executing this line:
C:\IBM\SDP\7552\20100721_2133\samples\AutoBuild\AdderBuild.xml:163: The following error occurred while executing this line:
C:\IBM\SDP\7552\20100721_2133\samples\AutoBuild\AdderErrorWeb\build.xml:18: The following error occurred while executing this line:
C:\IBM\SDP\7552\20100721_2133\samples\AutoBuild\AdderBuild\buildMASTER.xml:173: The following error occurred while executing this line:
C:\IBM\SDP\7552\20100721_2133\samples\AutoBuild\AdderBuild\buildMASTER.xml:43: FAIL-ON-ERROR. projectName=AdderErrorWeb errorCount=3 errorMessage[1]=The import xyz cannot be resolved
Total time: 26 seconds
HeadlessWorkspaceSettings: RESTORED autoBuild=true maxFile=1048576
runAnt BUILD FAILED.
- The output for the AutoBuild sample is project archive files,
such as the EAR, WAR, and JAR files. The output is in the directory
defined for your java.io.tmpdir property, which typically
corresponds to the TMP environment variable
for your computer. For example, you can find the following project
archive files in the C:\Documents and Settings\Administrator\Local
Settings\Temp directory for Windows operating system; and /tmp or /var/tmp for Linux operating system:
- Adder.ear
- AdderClient.jar
- AdderEJB.jar
- AdderEJBClient_UtilJar.jar
- AdderStaticWeb.war
- AdderWeb.war
Alternatively, in the command prompt you can determine the directory
location of the output from the system output of running the AutoBuild
sample. For example, look for the following system output:[ejbExport] EJBExport completed to /tmp/AdderEJB.jar
...
[appClientExport] AppClientExport completed to /tmp/AdderClient.jar
...
[warExport] WARExport completed to /tmp/AdderWeb.war
...
In this example, the AdderEJB.jar, AdderClient.jar,
and AdderWeb.war are in the /tmp directory
for a Linux operating system.