Thursday, October 20, 2005

ANT tool for customizing ArcGIS Server application

IDE projects introduce unnecessary complication and overhead. So I typically limit the use of IDE for Java development to build classes. This way I can keep my project simple and easily managable. Ant tool can instead be used for project development and deployment. ArcGIS Server uses ant for configuration and deployment of template application. It can also be used for extending the template web applications. I use the following approach to customize the ArcGIS Server java template web applications:

1. Create a workspace folder in a convenient place in your local directory. For example: C:/Temp/AGSProjects

2. Inside the workspace folder, create the project folder. For example: C:/Temp/AGSProjects/MapProject1

3. Inside the project folder, create this folder structure:

4. Use arcgisant tool to create an ArcGIS Server java template web application. Refer to ArcGIS Server Administration and Development Guide for more information.

5. Copy the web application folder built in ArcGIS\DeveloperKit\Templates\Java\build folder to the projectfolder. (MapProject1 folder in the above example.)

6. Create a file named build.xml with the following content:

<project default="build" basedir="../" name="ags" >
<!-- load environment variables -->
<property environment="env"/>
<property name="devkit.home" value="${env.AGSDEVKITHOME}" />
<property name="arcgisant.home" value="${devkit.home}/tools/ant"/>
<!-- library dependency settings -->
<property name="arcgis.dir"
<!-- jar file mappings -->
<property name="jintegra.jar" location="${arcgis.dir}/jintegra.jar"/>
<property name="arcobjects.jar"
<property name="arcgis_webcatalog.jar"
<!-- Project settings -->
<property name="project.distname" value="MapViewer1"/>
<!-- current project paths -->
<property file="${basedir}/ant/"/>
<property name="webroot.dir" value="${basedir}/${project.distname}"/>
<property name="webinf.dir" value="${webroot.dir}/WEB-INF"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="build"/>
<path id="arcgis.classpath">
<fileset dir="${arcgis.dir}">
<include name="*.jar" />
<!-- Check timestamp on files -->
<target name="prepare">
<!-- Copy any resource or configuration files -->
<target name="resources"
description="Copy any resource or configuration files">
<copy todir="${webinf.dir}/classes" includeEmptyDirs="no">
<fileset dir="${src.dir}">
<include name="**/*.conf"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<!-- compile-->
<target name="compile" depends="prepare,resources"
description="Compile the project classes">
<javac srcdir="${src.dir}" destdir="${webinf.dir}/classes">
<classpath refid="arcgis.classpath"/>
<!-- Remove existing compiled classes -->
<target name="clean"
description="Remove classes directory for clean build">
<delete dir="${webinf.dir}/classes"/>
<mkdir dir="${webinf.dir}/classes"/>
<!-- Build the project -->
<target name="build1" description="Build the project"
<target name="rebuild" description="Rebuild the project"
<!-- Create war file -->
<target name="build" depends="build1"
description="Create the war file for deployment">
<mkdir dir="${build.dir}"/>
<war basedir="${webroot.dir}"
<exclude name="WEB-INF/${build.dir}/**"/>
<exclude name="WEB-INF/src/**"/>
<exclude name="WEB-INF/web.xml"/>

7. Change the value in this line in the build.xml file to the name of the web application you create above.

<property name="project.distname" value="MapViewer1"/>

8. Customize the web application as necessary.

9. Add any java source code to src folder.

10. Open command prompt and CD to ant directory in your project. Type this command to build the project:
arcgisant build

11. Verify that a war file is built in the build folder. Deploy this war file directly or copy the web application folder and the war file back to ArcGIS\DeveloperKit\Templates\Java\build folder and use arcgisant to deploy it.

You can repeat the same steps to build any other web applications. You can use the same build file but make sure to update it with the new project name as mentioned above in step 7.


At 10:29 PM, Anonymous Geometric correction services said...

Information provided was helpful. Thanks for sharing.

GIS mapping services

At 11:09 AM, Anonymous get rid of genital warts said...

Information provided was helpful. Thanks for sharing.GIS mapping services

At 1:12 PM, Anonymous Kamagra said...

I am just beginning to use the IDE, however, I managed to understand what you are talking about, and that's so cool! I love programming!

At 4:16 PM, Anonymous miami web design said...

to understand a little better..

1. Create a workspace folder in your local directory. For example: C:/Temp/AGSProjects

2. Inside the workspace folder, create the project folder. For example: C:/Temp/AGSProjects/MapProject1

3. Inside the project folder, create this folder structure:

At 12:31 AM, Anonymous logo design said...

Really you have done great job,There are may person searching about that now they will find enough resources by your post.I like this blog.

At 12:04 PM, Blogger glass dining table said...

I thought I was strong with my ideas on this, but with your writing expertise you have managed to convert my beliefs your new dining table

At 1:19 PM, Anonymous buy online percocet said...

This blog post is very good! i glad i found it on blogspot

At 5:18 PM, Anonymous price per head bookmaking said...

Wonderful post. If only I'd of come across something as wise and straightforward when I was starting out! See you at the reading!

At 1:16 AM, Blogger Seacanoeist Mark said...

Welcome to mmoggg website to buy RS Gold, offer a lot, of course, Diablo 3 Gold or Diablo 3 Gold Kaufen and Cheap RS Gold, to be purchased at any time, at any time shipment, and look forward to your visit!

At 8:35 PM, Anonymous Anonymous said...

You can read more about this on page Diablo 3 Gold .Precisely what classes are offered? You have to choose one associated with ten distinct lessons. Fundamental essentials choices: Thief Cheap GW2 Gold, Elementalist, Professional, Warrior, Mesmer, Necromancer, Mother or father along with Ranger.My own persona possesses its own history?

At 6:00 PM, Blogger Kzaxcpnd Molluskxbny said...

A good book may be Cheap Runescape Gold among the best of friends. It is the same today that it always was, and it will Buy Runescape Gold never change. It always receives us with the same kindness; amusing and instructing us in youth, and comforting Runescape Gold and consoling us in age.

At 6:02 PM, Blogger Kzaxcpnd Molluskxbny said...

Think about the last time Runescape Gold you felt a negative emotion---like stress, anger, or rs gold frustration. What was going through your mind as you were going through that negativity? Was your mind RS GP cluttered with thoughts? Or was it paralyzed, unable to think?


Post a Comment

<< Home