uCosminexus Application Server, Application Development Guide

[Contents][Glossary][Index][Back][Next]

Appendix J.8 Building a project

In the environment prior to migration, a build file was specified in the properties of the project, and the building process was executed using the specified build file.

In WTP, though the building process is executed when deploying the J2EE application, you can also execute the building process using the build file as well. Also, if you turn ON the auto build functionality, the building process will be executed automatically when the folders and files of the project are updated.

Organization of this subsection
(1) Migrating a build file
(2) Modifying the build file

(1) Migrating a build file

The build file that was used in the environment prior to migration cannot be used as it is in WTP. The build file must be exported once in the environment prior to migration, and then modified.

This section describes how to migrate the build file of the environment prior to migration, and then execute the building process in WTP using the build file.

  1. Prepare the build file used in the environment prior to migration.
    Export the build file of the project in the environment prior to migration.
  2. Modify the build file exported in step 1.
    Modify the build file so as to enable its use in the WTP project. For details on how to modify the build file, see (2) Modifying the build file.
  3. In the Project Explorer view of WTP, select the build file modified in step 2., and then in the context menu, select Run - Ant Build.
    The building process will start. If the archive created during the building process is not displayed in the Project Explorer view, select a project in the Project Explorer view, and then in the Context menu, select Update.

(2) Modifying the build file

Modify the exported build file. The method of modifying the build file is as follows:

(a) How to modify the build file exported in the EAR project

To use the build-user.xml file exported in the EAR project in an enterprise application project of WTP, modify its contents. The following is an example of the modification of build-user.xml, and the modified contents. Modify the underlined part in the modification example. Note that the item numbers in the modification example of build-user.xml correspond to the item numbers in the table describing the modified contents.

Table J-18 Modification example of build-user.xml of the EAR project

Modification example Number of items in Table J-19
<?xml version="1.0" encoding="UTF-8"?> 1
<project name="Sample" default="create" basedir="./"> 2
<target name="create"> --
<delete file="./Sample.ear"/> --
<ear destfile="./Sample.ear" basedir="./" 3
appxml="./META-INF/application.xml" 4
excludes="Sample.ear,META-INF/application.xml"> --
<fileset dir="../SampleEJB" includes="SampleEJB.jar"/> --
<fileset dir="../SampleWeb" includes="SampleWeb.war"/> --
</ear> --
</target> --
</project> 5

Legend:
--: Not applicable

Table J-19 Modification contents of build-user.xml of the EAR project

No. Modification location Modification contents
1 XML header Remove the comment.
2 <project> tag Remove the comment.
3 basedir attribute of the <ear> tag Change to ./.
4 appxml attribute of the <ear> tag Change to the relative path of application.xml within the enterprise application project.
5 </project> tag Remove the comment.

Note that the EJB-JAR and WAR file to be incorporated into the EAR file must be created beforehand in the EJB project and dynamic Web project of WTP. For details on creating an archive, see Appendix J.9 Creating an archive file.

When creating the EJB-JAR file and WAR file using build-user.xml exported in the environment prior to migration, see the following explanation as well:

(b) How to modify the build file exported in the EJB-JAR project

To use the build-user.xml file exported in the EJB-JAR project in an EJB project of WTP, modify its contents. The following is an example of the modification of build-user.xml, and the modified contents. Modify the underlined part in the modification example. Note that the item numbers in the modification example of build-user.xml correspond to the item numbers in the table describing the modification contents.

Table J-20 Modification example of build-user.xml of the EJB-JAR project

Modification example Number of items in Table J-21
<?xml version="1.0" encoding="UTF-8"?> 1
<project name="SampleEJB" default="create" basedir="./"> 2
<target name="create"> --
<delete file="./SampleEJB.jar"/> --
<jar destfile="./SampleEJB.jar" basedir="./classes" 3
excludes="SampleEJB.jar"/> --
</target> --
</project> 4

Legend:
--:Not applicable

Table J-21 Modification contents of build-user.xml of the EJB-JAR project

No. Modification location Modification contents
1 XML header Remove the comment.
2 <project> tag Remove the comment.
3 basedir attribute of the <jar> tag Change the output folder of the EJB-JAR project to the output folder of the EJB project.
4 </project> tag Remove the comment.
(c) How to modify the build file exported in the WAR project

To use the build-user.xml file exported in the WAR project in a dynamic Web project of WTP, modify its contents. The following is an example of the modification of build-user.xml, and the modified contents. Modify the underlined part in the modification example. Note that the item numbers in the modification example of build-user.xml correspond to the item numbers in the table describing the modified contents.

Table J-22 Modification example of build-user.xml of the WAR project

Modification example Number of items in Table J-23
<?xml version="1.0" encoding="UTF-8"?> 1
<project name="SampleWeb" default="create" basedir="./"> 2
<property name="cjjspcdir" --
value="D:/Program Files/Hitachi/Cosminexus/CC/web/bin" /> --
<property name="rootpath" --
value="C:/ WTP//workspace/SampleWeb/WebRoot" /> 3
<target name="compile"> --
<delete includeemptydirs="true" failonerror="false"> --
<fileset dir="./WebRoot/WEB-INF/cosminexus_jsp_work" --
includes="**/*" /> --
</delete> --
<exec executable= --
"${cjjspcdir}/cjjspc.bat" newenvironment="true"> --
<arg value="-keepgenerated" /> --
<arg line='-source 1.4' /> --
<arg line='-pageencoding MS932' /> --
<arg line='-root "${rootpath}"' /> --
</exec> --
<move todir= --
"./WebRoot/WEB-INF/cosminexus_jsp_work/org/apache/jsp" --
flatten="true" failonerror="false"> --
<fileset dir="./WebRoot/WEB-INF/cosminexus_jsp_work" --
includes="**/*.java" --
excludes="**/org/apache/jsp/**/*.java" /> --
</move> --
</target> --
<target name="create" depends="compile"> --
<delete file="./SampleWeb.war" /> --
<war destfile="./SampleWeb.war" basedir="./WebRoot" --
webxml="./WebRoot/WEB-INF/web.xml" --
excludes="SampleWeb.war,WEB-INF/web.xml" /> --
</target> --
</project> 4

Legend:
--: Not applicable

Table J-23 Modification contents of build-user.xml of the WAR project

No. Modification location Modification contents
1 XML header Remove the comment.
2 <project> tag Remove the comment.
3 value attribute of the <property> tag (when WAR-project-name.location is specified) Change WAR-project-location-directory/WAR-root-folder to Web-project-location-directory/Web-root-folder.
4 </project> tag Remove the comment.

When executing JSP pre-compile
To execute JSP pre-compile using build-user.xml, export the build-user.xml file of the WAR project in which the settings for enabling JSP pre-compile are specified.