Configuring Eclipse for Remote Debugging
Pages: 1, 2, 3, 4, 5, 6, 7, 8

Building and Deploying with Ant

The compiling, packaging, and deploying of the web application is done in the Eclipse IDE with an Ant build.xml file. Develop an Ant build.xml file that consists of targets to compile the JBossServlet.java file and package and deploy the webapp.war web application. The build.xml file is listed below:




<project name="jbossApp" default="webapp" basedir="."> 
<property name="build" value="build"/>
<property name="src" value="." /> 
<property name="jboss.deploy"
 value="C:\JBoss\jboss-4.0.2\server\default\deploy"/>
<property name="dist" value="dist"/>
<property name="j2sdkee" value="C:\J2sdkee1.4"/>
<target name="init">
    <tstamp/>
  <mkdir dir="${build}" />
  <mkdir dir="${dist}" />
  <mkdir dir="${build}/WEB-INF" /> 
  <mkdir dir="${build}/WEB-INF/classes" />
</target>
<target name="compile" depends="init">
  <javac debug="true" classpath="${j2sdkee}/lib/j2ee.jar" 
  srcdir="${src}/WEB-INF/classes" 
destdir="${src}/WEB-INF/classes"> <include name="**/*.java" /> </javac> <copy todir="${build}/WEB-INF"> <fileset dir="WEB-INF" > <include name="web.xml" /> </fileset> </copy> <copy todir="${build}/WEB-INF/classes"> <fileset dir="${src}/WEB-INF/classes" > <include name="**/JBossServlet.class" /> </fileset> </copy> </target> <target name="webapp" depends="compile"> <war basedir="${build}" includes="**/*.class" destfile="${dist}/webapp.war" webxml="WEB-INF/web.xml"/> <copy file="${dist}/webapp.war" todir="${jboss.deploy}"/> </target> </project>

The build.xml file has the properties listed in the following table.

Property Description
build The build directory used to build the web application.
src The src directory has the source files for the web application.
jboss.deploy The JBoss directory in which the web application is deployed.
dist The directory in which the web application .war file is generated.
j2sdkee The J2sdkee directory.

build.xml also has the following targets:

Target Description
init The initialization target; the target to create the web application directories.
compile The target to compile the web application.
webapp The target to generate the .war file.

The debug attribute of the javac task in the build target is set to true to enable compilation in debug mode. By compiling an application in debug mode, the line number that generates the exception in a JBoss server application gets displayed in Eclipse's Debug perspective.

Back to Eclipse

Create a new project in the Eclipse IDE. Select File -> New -> Project, as shown in Figure 1.

New Project
Figure 1. New project

Pages: 1, 2, 3, 4, 5, 6, 7, 8

Next Pagearrow