1. Download the src version dojo from dojo's offical site.
http://download.dojotoolkit.org/release-1.5.0/dojo-release-1.5.0-src.zip
2. Make sure you have already install the Ant successfully. The version should bigger than 1.7.
3. Update the build.xml according the definition xml.
The core definition is already be marked as red.
<project name="DojoWAR" default="production" basedir="."
>
<!-- The directory where build artifacts are created -->
<property name="dir.build" location="build"/>
<!-- The directory where the war file will be placed -->
<property name="dir.dist" location="${dir.build}/dist"/>
<target name="production" depends="buildDojoProfile, generateDistributable"/>
<target name="generateDistributable"
description="Builds the distributable Dojo War file">
<!-- Build up the WAR -->
<mkdir dir="${basedir}/temp"/>
<mkdir dir="${basedir}/build/dist"/>
<war destfile="${dir.dist}/DojoWEB.war" >
<zipfileset dir="${basedir}/WebContent/" includes="**/**" />
</war>
</target>
<target name="buildDojoProfile">
<property name="dir.profile"
location="${basedir}/dojo-release-1.5.0-src"/
>
<echo message="Building Dojo profile..."/>
<!-- Start the profile build by forking a java process to run ShrinkSafe -->
<java fork="true"
dir="${dir.profile}/util/buildscripts"
classname="org.mozilla.javascript.tools.shell.Main">
<classpath>
<pathelement location="${dir.profile}/util/shrinksafe/js.jar"/>
<pathelement location="${dir.profile}/util/shrinksafe/shrinksafe.jar"/>
</classpath>
<arg value="${dir.profile}/util/buildscripts/build.js"/>
<arg value="version=1.5.0"/>
<arg value="profileFile=${dir.profile}/util/buildscripts/profiles/baseplus.profile.js"/>
<arg value="action=release"/>
<arg value="optimize=shrinksafe"/>
<arg value="cssOptimize=comments.keepLines"/>
</java>
<!-- remove unused Dojo files and directories -->
<!-- that we don't want to include -->
<delete includeemptydirs="true">
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/tests/**/"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/demos/**/"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="util/**"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/*.psd"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/*.fla"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/*.svg"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/*.as"/>
<fileset dir="${dir.profile}/release/dojo/dojo" includes="**/*.swf"/>
<fileset dir="${dir.profile}/release/dojo/dijit/themes/"
includes="**/themeTester*"/>
<fileset dir="${dir.profile}/release/dojo/" includes="**/*.uncompressed.js"/>
</delete>
<copy toDir="${basedir}/WebContent/">
<fileset dir="${dir.profile}/release/dojo" excludes="**/util/**" />
</copy>
</target>
<!-- Simple cleanup -->
<target name="clean" description="Cleans out build files">
<delete dir="${dir.build}"/>
<delete dir="${basedir}/WebContent/dijit"/>
<delete dir="${basedir}/WebContent/dojo"/>
<delete dir="${basedir}/WebContent/dojox"/>
<delete file="${basedir}/WebContent/dojo_extraction_revision.txt"/>
<delete file="${basedir}/WebContent/dojo_extraction.log"/>
<delete file="${basedir}/WebContent/version.txt"/>
</target>
</project>
4. You can write your own definition like below. Put your required components to the definition file.
It already be marked as red.
dependencies = {
layers: [
{
// This is a specially named layer, literally 'dojo.js'
// adding dependencies to this layer will include the modules
// in addition to the standard dojo.js base APIs.
name: "dojo.js",
dependencies: [
"dijit.form.ValidationTextBox",
"dijit.form.FilteringSelect",
"dijit.form.DateTextBox",
"dijit.Tooltip",
"dijit.form.Button"
]
}
],
prefixes: [
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ]
]
}
5. Run Ant in the folder.
Build your customization dojo
最新推荐文章于 2026-04-13 15:15:01 发布
本文介绍如何从源代码下载并使用Ant构建定制版Dojo Toolkit的过程,包括更新构建文件、选择所需组件、清理无用文件及最终打包成WAR文件。

2257

被折叠的 条评论
为什么被折叠?



