、&などの環境変数を環境変数にインストールして設定ant
せずに、ビルドスクリプトを実行したいと思います。Java
path
JAVA_HOME
ANT_HOME
の既にインストールされているフォルダーをコピーし、Jdk-1.7u17
あるマシンから別のマシンにフォルダーにコピーしました。Jre-1.7u17
apache-ant-1.9.0
C:\buildscript_required_files_v2
これで、build.xml が存在して実行されるパスに入るウィンドウ バッチ ファイルができました。ant
cd VersionBuild
C:\buildscript_required_files_v2\apache-ant-1.9.0\bin\ant
build.xml は Java クラスに準拠し、Jar ファイルを作成します。
<project name="VersionBuild" default="clean" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
</target>
<target name="CompilingBuildversion" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<C:\buildscript_required_files_v2\java\jdk64\bin\javac.exe srcdir="." destdir="."/>
</target>
<target name="Creating jar" depends="CompilingBuildversion">
<jar jarfile="VersionBuild.jar" basedir="."/>
</target>
<target name="clean" depends="Creating jar">
</target>
</project>
そのbachファイルを実行しているときに、次の例外が発生します-
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
環境変数ant
をインストールおよび設定せずにビルド スクリプトを実行できますか? ant をローカルにJava
指定して、フォルダから参照できるようにすることはできますか?JAVA_HOME
build.xml
ant
C:\buildscript_required_files_v2