简体   繁体   English

在Windows 7上安装apache ant

[英]apache ant installation on windows 7

I'm new into ANT, I have some trouble to figure the problem. 我是ANT的新手,我很难解决这个问题。

I set all my varaibles correctly, as: 我将所有变量正确设置为:

ANT_HOME="C:\Users\Spirithief\Documents\apache-ant-1.8.4"
JAVA_HOME="C:\Program Files\Java\jdk1.7.0_07"
PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin

I run the cmd line ant I got that the commande does not exists. 我运行cmd行蚂蚁,但我知道该命令不存在。

I went into the ant.bat in the \\bin file I set echo off to echo on. 我进入了\\ bin文件中的ant.bat文件,将echo off设置为echo on。

here the batch file in apache's svn. 这是apache svn中的批处理文件

The bug apears to be in this line : 该错误提示此行:

:stripAntHome
if not _%ANT_HOME:~-1%==_\ goto checkClasspath

it said that, it's not reconizable. 它说,它无法重新调整。

NB : echo %ANT_HOME% works great, others as well, so it's not the problem. 注意:echo%ANT_HOME%很好,其他也很好,所以这不是问题。

Any hints ?? 任何提示?

NB : Here's the batch file execution (my system is in french :p): 注意:这是批处理文件的执行(我的系统使用法语:p):

Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits réservés.

C:\Users\Spirithief>ant

C:\Users\Spirithief>REM  Licensed to the Apache Software Foundation (ASF) under
one or more

C:\Users\Spirithief>REM  contributor license agreements.  See the NOTICE file di
stributed with

C:\Users\Spirithief>REM  this work for additional information regarding copyrigh
t ownership.

C:\Users\Spirithief>REM  The ASF licenses this file to You under the Apache Lice
nse, Version 2.0

C:\Users\Spirithief>REM  (the "License"); you may not use this file except in co
mpliance with

C:\Users\Spirithief>REM  the License.  You may obtain a copy of the License at

C:\Users\Spirithief>REM

C:\Users\Spirithief>REM      http://www.apache.org/licenses/LICENSE-2.0

C:\Users\Spirithief>REM

C:\Users\Spirithief>REM  Unless required by applicable law or agreed to in writi
ng, software

C:\Users\Spirithief>REM  distributed under the License is distributed on an "AS
IS" BASIS,

C:\Users\Spirithief>REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ex
press or implied.

C:\Users\Spirithief>REM  See the License for the specific language governing per
missions and

C:\Users\Spirithief>REM  limitations under the License.

C:\Users\Spirithief>REM This is an inordinately troublesome piece of code, parti
cularly because it

C:\Users\Spirithief>REM tries to work on both Win9x and WinNT-based systems. If
we could abandon '9x

C:\Users\Spirithief>REM support, things would be much easier, but sadly, it is n
ot yet time.

C:\Users\Spirithief>REM Be cautious about editing this, and only add WinNT speci
fic stuff in code that

C:\Users\Spirithief>REM only runs on WinNT.

C:\Users\Spirithief>if "" == "" goto homeDrivePathPre

C:\Users\Spirithief>if "C:\Users\Spirithief" == "" goto userProfilePre

C:\Users\Spirithief>if "C:\Users\Spirithief" == "" goto userProfilePre

C:\Users\Spirithief>if exist "C:\Users\Spirithief\antrc_pre.bat" call "C:\Users\
Spirithief\antrc_pre.bat"

C:\Users\Spirithief>if "C:\Users\Spirithief" == "" goto alpha

C:\Users\Spirithief>if "C:\Users\Spirithief" == "" goto alpha

C:\Users\Spirithief>if "C:\Users\Spirithief" == "C:\Users\Spirithief" goto alpha


C:\Users\Spirithief>if "Windows_NT" == "Windows_NT"

C:\Users\Spirithief>if "Windows_NT" == "WINNT"

C:\Users\Spirithief>if ""C:\Users\Spirithief\Documents\apache-ant-1.8.4"" == ""
goto setDefaultAntHome
La syntaxe de la commande n'est pas correcte.
C:\Users\Spirithief>if not _"==_\ goto checkClasspath
C:\Users\Spirithief>

删除环境变量中的引号,因为它不是必需的,并且ant脚本已经为您添加了引号。

Not the answer you asked, but this maybe relevant and should help you : 不是您要求的答案,但这可能很重要,应该可以帮助您:

http://wiki.apache.org/ant/AntOnWindows http://wiki.apache.org/ant/AntOnWindows

and I can personally vouch for : http://code.google.com/p/winant/ 而且我可以亲自担保: http : //code.google.com/p/winant/

I got the link from the wiki, so I would trust it, and also it worked in one shot. 我从Wiki获得了链接,所以我会相信它,而且它也可以一口气工作。 :) :)

仅供参考,它适用于二进制分发(不是源分发版),因为默认情况下二进制包含\\ bin目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM