Running the AutoBuild sample within the product
The AutoBuild sample demonstrates the functions of the Rational® Application Developer
for WebSphere® Software
build utility (the build utility) that is included with the product
installation files in two ways: from the workbench or command
line. You can use the workbench to run the AutoBuild sample
within an integrated development environment. Alternatively, you can
run the AutoBuild sample using the command line (in headless
mode) without opening the workbench at all.
About this task
- c:\Program Files\IBM\SDP\samples
- /opt/IBM/SDP/samples
- c:\Program Files\IBM\SDP\samples
- /opt/IBM/SDP/samples
Procedure
- Create a workspace for your build utility session to store
your projects and metadata in a folder, and run the Autobuild sample
in the workbench or from the command line.
Option Description Workbench Start the product. In the workspace Launcher dialog box specify a workspace folder in the workspace field. Command-line Open a command prompt and set the workspace environment variable. See To run your build scripts from the command-line section in the Running the build utility within the product topic. - If you have already run the AutoBuild sample and want to
run it again, you need to reset the environment:
- Verify that a directory is defined for the workspace and is empty. Remove any files and directories under the workspace that are from a previous run of the AutoBuild sample.
- Use the AutoBuild.zip backup copy to
replace the following \samples\AutoBuild directory:
- c:\Program Files\IBM\SDP\samples\AutoBuild
- /opt/IBM/SDP/samples/AutoBuild
- Import the AutoBuild sample into your workspace:
Option Description Workbench - In the toolbar select File > New > Project.
- In the New Project wizard, expand the General folder and select Project. Click Next.
- In the Project name field, specify a label for your project that contains the AutoBuild sample. For example, type samples. Click Finish.
- In the toolbar, select File > New > Folder.
- In the New Folder wizard, verify the newly created project is specified in the Enter or select the parent folder field.
- Click Advanced.
- Select the Link to folder in the file system check box.
- Click Browse and navigate to the AutoBuild
sample. For example:
- c:\Program Files\IBM\SDP\samples\AutoBuild
- /opt/IBM/SDP/samples/AutoBuild
- Click OK > Finish.
Command-line Continue with the next step. - To study what the AutoBuild sample does, open the AdderBuild.xml build script in a text editor. You can
find it in the \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
- 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
- Run the AutoBuild sample.
Option Description Workbench - Right-click AdderBuild.xml file and select Run As > Ant Build ....
- By default the Targets tab opens of the Edit Configuration wizard. Under the Check targets to execute list, the importAndBuildEverything Ant task is selected to run first.
- Click the JRE tab. Under the Runtime JRE section, select Run in the same
JRE as the Workspace option. Click Apply and then Run.Tip: By default the Separate JRE option is selected. The Run in the same JRE as the Workspace option enables the classpath of the workbench to access the additional Ant tasks that perform operations that are specific to the workbench, such as projectImport, projectBuild, workspaceBuild, ejbDeploy, or earExport. If your Ant build script uses any Ant tasks that perform workbench operations, verify that you selected the Run in the same JRE as the Workspace option; otherwise you might get the following error message in the Console view:
Where <Ant task> is the name of the Ant task that perform workbench operations. See Ant tasks for workbench operations topic for a list of Ant tasks that perform operations specific to the workbench.Problem: failed to create task or type <Ant task> Cause: The name is undefined.
Command-line You can study how the AutoBuild sample runs, open the buildAdderExample file in a text editor. You can find it in the \samples\AutoBuild directory. Look for the following command in the script:
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:"%RUNANT_DIR%\..\..\bin\runant" -buildfile "%RUNANT_DIR%\AdderBuild.xml" %* importAndBuildEverything
- c:\Program Files\IBM\SDP\samples\AutoBuild>buildAdderExample.bat
- /opt/IBM/SDP/samples/AutoBuild>./buildAdderExample.sh
- 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 located
in the directory defined for your java.io.tmpdir property,
which typically corresponds to your system's TMP environment variable. For example, you can find the following project
archive files in the C:\Documents and Settings\Administrator\Local
Settings\Temp directory; and /tmp or /var/tmp for Linux operating system:
- Adder.ear
- AdderClient.jar
- AdderEJB.jar
- AdderEJBClient_UtilJar.jar
- AdderStaticWeb.war
- AdderWeb.war
In this example, the AdderEJB.jar, AdderClient.jar, and AdderWeb.war are located in the /tmp directory for a Linux operating system.[ejbExport] EJBExport completed to /tmp/AdderEJB.jar ... [appClientExport] AppClientExport completed to /tmp/AdderClient.jar ... [warExport] WARExport completed to /tmp/AdderWeb.war ...
Related tasks:
Feedback