2013-03-18 79 views
0

我一直在試圖克隆和在我的Windows 7盒建一個項目,像這樣:配置Apache Ant和艾維在Windows 7

git clone [email protected]:corvec/project-name.git 
cd project-name 
git submodule init 
git submodule update 
ant clean 
ant resolve 

所有的命令,直到ant resolve工作不如預期,這給我下面的錯誤信息:

Buildfile: c:\workspace\project-name\build.xml 

clean-lib: 
    [delete] Deleting directory c:\workspace\project-name\lib 

load-ivy: 

resolve: 
    [echo] Storing dependencies in lib dir: lib 
    [mkdir] Created dir: c:\workspace\project-name\lib 
[ivy:retrieve] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ :: 
[ivy:retrieve] :: loading settings :: file = c:\workspace\project-name\core-build\xml\ant\ivy\ivysettings.xml 

BUILD FAILED 
c:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml:55: impossible to configure 
ivy:settings with given file: c:\workspace\project-name\core-build\xml\ant\ivy\ivysettings.xml 
: java.text.ParseException: failed to load settings from file:/c:/workspace/project-name/core-build/xml/ant/ivy/ivysettings.xml: io problem while parsing config file: unknown protocol: c 
     at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:165) 
     at org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150) 
     at org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:384) 
     at org.apache.ivy.Ivy.configure(Ivy.java:411) 
     at org.apache.ivy.ant.IvyAntSettings.createIvyEngine(IvyAntSettings.java:272) 
     at org.apache.ivy.ant.IvyAntSettings.getConfiguredIvyInstance(IvyAntSettings.java:237) 
     at org.apache.ivy.ant.IvyTask.getIvyInstance(IvyTask.java:92) 
     at org.apache.ivy.ant.IvyTask.prepareTask(IvyTask.java:256) 
     at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:276) 
     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
     at org.apache.tools.ant.Task.perform(Task.java:348) 
     at org.apache.tools.ant.Target.execute(Target.java:435) 
     at org.apache.tools.ant.Target.performTasks(Target.java:456) 
     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) 
     at org.apache.tools.ant.Project.executeTarget(Project.java:1364) 
     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 
     at org.apache.tools.ant.Project.executeTargets(Project.java:1248) 
     at org.apache.tools.ant.Main.runBuild(Main.java:851) 
     at org.apache.tools.ant.Main.startAnt(Main.java:235) 
     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 
Caused by: java.net.MalformedURLException: unknown protocol: c 
     at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:234) 
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) 
     at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179) 
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343) 
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) 
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) 
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) 
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) 
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) 
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) 
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) 
     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) 
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) 
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:277) 
     at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160) 
     ... 24 more 
Caused by: java.net.MalformedURLException: unknown protocol: c 
     at java.net.URL.<init>(URL.java:574) 
     at java.net.URL.<init>(URL.java:464) 
     at org.apache.ivy.core.settings.XmlSettingsParser.includeStarted(XmlSettingsParser.java:409) 
     at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:211) 
     ... 38 more 

Total time: 0 seconds 

編輯:隨着應用的詳細標誌,我現在得到以下信息:

Apache Ant(TM) version 1.9.0 compiled on March 5 2013 
Trying the default build file: build.xml 
Buildfile: C:\workspace\project-name\build.xml 
Detected Java version: 1.6 in: c:\Program Files\Java\jdk1.6.0_25\jre 
Detected OS: Windows 7 
parsing buildfile C:\workspace\project-name\build.xml with URI = file:/C:/workspace/project-name/build.xml 
Project base dir set to: C:\workspace\project-name 
parsing buildfile jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file 
[property] Loading C:\workspace\project-name\build.properties 
Importing file C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml from C:\workspace\project-name\build.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-basic-targets.xml 
Already defined in main or a previous import, ignore build-tests 
Already defined in main or a previous import, ignore dist-war 
Already defined in main or a previous import, ignore all 
Already defined in main or a previous import, ignore console 
Importing file C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml from 
C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-ant-contrib-targets.xml 
Overriding previous definition of reference to ant.projectHelper 
Importing file C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml from C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-ivy-targets.xml 
Importing file C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml from 
C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml 
Skipped already imported file: 
    C:\workspace\project-name\core-build\xml\ant\build-ant-contrib-targets.xml 

Importing file C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml from C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml 
Skipped already imported file: 
    C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml 

[property] Loading C:\workspace\project-name\placeholder.build.properties 
[property] Unable to find property file: C:\workspace\project-name\placeholder.build.properties 
[property] Loading C:\workspace\project-name\core-build\xml\ant\ivy\ivysettings.properties 
Property "ivy.basedir" has not been set 
Property "ivy.basedir" has not been set 
Override ignored for property "shared.base" 
Override ignored for property "shared.lib" 
Overriding previous definition of reference to ant.projectHelper 
[property] Loading C:\workspace\project-name\placeholder.build.properties 
[property] Unable to find property file: C:\workspace\project-name\placeholder.build.properties 
Override ignored for property "conf.web.dir" 
Override ignored for property "jdk.lib" 
Importing file C:\workspace\project-name\core-build\xml\ant\build-testing-targets.xml from C:\workspace\project-name\core-build\xml\ant\build-basic-targets.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-testing-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-testing-targets.xml 
[macrodef] creating macro do-testing 
[macrodef] creating macro test-one-class 
[macrodef] creating macro test-classes 
Overriding previous definition of reference to ant.projectHelper 
Overriding previous definition of reference to ant.projectHelper 
Importing file C:\workspace\project-name\core-build\xml\ant\build-eclipse-classpath.xml from C:\workspace\project-name\build.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-eclipse-classpath.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-eclipse-classpath.xml 
[property] Loading C:\workspace\project-name\placeholder.build.properties 
[property] Unable to find property file: C:\workspace\project-name\placeholder.build.properties 
Overriding previous definition of reference to ant.projectHelper 
Importing file C:\workspace\project-name\core-build\xml\ant\build-findBugs-targets.xml from C:\workspace\project-name\build.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-findBugs-targets.xml with 
URI = file:/C:/workspace/project-name/core-build/xml/ant/build-findBugs-targets.xml 
Override ignored for property "shared.lib" 
Overriding previous definition of reference to ant.projectHelper 
Importing file C:\workspace\project-name\core-build\xml\ant\build-pmd-targets.xml from C:\workspace\project-name\build.xml 
Overriding previous definition of reference to ant.projectHelper 
parsing buildfile C:\workspace\project-name\core-build\xml\ant\build-pmd-targets.xml with URI = file:/C:/workspace/project-name/core-build/xml/ant/build-pmd-targets.xml 
Override ignored for property "shared.lib" 
Overriding previous definition of reference to ant.projectHelper 
Overriding previous definition of reference to lib.jars 
Build sequence for target(s) `resolve' is [clean-lib, load-ivy, resolve] 
Complete build sequence is [clean-lib, load-ivy, resolve, build, build-tests, -missing-test-param, project-name.run-one-test-plain, project-name.run-tests-xml, project-name.clean, check-findbugs-filters, runFindBugsFiltered, runFindBugsUnfiltered, project-name.runFindBugs, eclipse-classpath, dist, dist-war, project-name.run-one-test-html, pmd.pmd-html, report, runFindBugsFiltered-html, runFindBugsUnfiltered-html, runFindBugs-html, project-name.dist, project-name.dist-onejar, project-name.eclipse-classpath-with-conf, project-name.clean-cache, instrument-classes, run-tests, report-tests, report-coverage, ivy-version, publish-nodeps, 
publish, project-name.publish-nodeps, project-name.run-tests, cpd, run-tests-html, cpd-html, pmd, pmd-all, project-name.ivy-local-version, project-name.create-javadoc, run-one-test-html, project-name.publish, project-name.runFindBugsFiltered-html, resolve-all, run-master-testsuites, clean-local, pmd-html, pmd.pmd-all-html, ivy-local-version, project-name.clean-all-local, runFindBugs, console, pmd.pmd-all, run-one-test-plain, clean-all-local, project-name.resolve_delivered, project-name.report, project-name.load-ivy, project-name.runFindBugs-html, project-name.clean-lib, project-name.post-resolve-echo, project-name.dist-war, project-name.ivy-version, pmd.cpd-html, project-name.ivy-new-version, dist-jar, ivy-new-version, resolve_delivered, project-name.runFindBugsFiltered, project-name.copy-dependencies, project-name.publish-local-nodeps, post-resolve-echo, dist-onejar, clean-cache, project-name.run-tests-plain, create-javadoc, project-name.build, run-test, project-name.all, run-tests-plain, pmd.cpd, test, copy-dependencies, publish-local-nodeps, publish-local, project-name.pom, project-name.report-coverage-xml, report-coverage-xml, project-name.console, project-name.report-tests, project-name.test, project-name.instrument-classes, pmd.pmd, clean, project-name.publish-local, copy-dist, run-jar, dist-reports, project-name.build-tests, project-name.copy-dist, project-name.run-one-test, project-name.dist-reports, project-name.check-findbugs-filters, project-name.-missing-test-param, run-one-test-xml, run-one-test, report-master-testsuites, 
project-name.runFindBugsUnfiltered-html, project-name.resolve, build-dep, project-name.dist-jar, project-name.runFindBugsUnfiltered, all, project-name.report-master-testsuites, project-name.build-dep, project-name.resolve-all, project-name.clean-local, pom, project-name.run-tests-html, eclipse-classpath-with-conf, project-name.run-master-testsuites, run-tests-xml, project-name.eclipse-classpath, project-name.run-test, project-name.run-jar, pmd-all-html, project-name.report-coverage, project-name.run-one-test-xml, ] 

clean-lib: 

load-ivy: 
    [taskdef] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found. 
[antlib:org.apache.ivy.ant] Could not load definitions from resource org/apache/ivy/ant/antlib.xml. It could not be found. 

BUILD FAILED 
C:\workspace\project-name\core-build\xml\ant\build-ivy-targets.xml:24: Problem: failed to create task or type antlib:org.apache.ivy.ant:settings 
Cause: The name is undefined. 
Action: Check the spelling. 
Action: Check that any custom tasks/types have been declared. 
Action: Check that any <presetdef>/<macrodef> declarations have taken place. 
No types or tasks have been defined in this namespace yet 

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of: 
     -c:\apache-ant-1.9.0\lib 
     -C:\Users\localuser\.ant\lib 
     -a directory added on the command line with the -lib argument 

     at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:487) 
     at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:419) 
     at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163) 
     at org.apache.tools.ant.Task.perform(Task.java:347) 
     at org.apache.tools.ant.Target.execute(Target.java:435) 
     at org.apache.tools.ant.Target.performTasks(Target.java:456) 
     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) 
     at org.apache.tools.ant.Project.executeTarget(Project.java:1364) 
     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 
     at org.apache.tools.ant.Project.executeTargets(Project.java:1248) 
     at org.apache.tools.ant.Main.runBuild(Main.java:851) 
     at org.apache.tools.ant.Main.startAnt(Main.java:235) 
     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 

Total time: 0 seconds 

我懷疑這是項目特定的配置問題;我並不是這個項目的唯一開發人員,其他開發人員也一直在努力。更可能的是,這與我的系統配置有關。他們正在運行Linux和Mac OS,如果這有所作爲。我想這可能與一些沒有被git跟蹤的文件有關,但我認爲其他開發者之一會注意到這一點。

試圖更新在build.properties文件路徑使用絕對路徑而不是相對一個,如下所示(基於this recommendation):

shared.base=file:///c:/workspace/project-name/core-build 

代替

shared.base=core-build 

當我這樣做時,我收到以下錯誤消息:

Apache Ant(TM) version 1.9.0 compiled on March 5 2013 
Trying the default build file: build.xml 
Buildfile: C:\workspace\project-name\build.xml 
Detected Java version: 1.6 in: c:\Program Files\Java\jdk1.6.0_25\jre 
Detected OS: Windows 7 
parsing buildfile C:\workspace\project-name\build.xml with URI = file:/C:/workspace/project-name/build.xml 
Project base dir set to: C:\workspace\project-name 
parsing buildfile jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/c:/apache-ant-1.9.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file 
[property] Loading C:\workspace\project-name\build.properties 
Importing file C:\workspace\project-name\file:\C:\workspace\project-name\project-name\core-build\xml\ant\build-basic-targets.xml from C:\workspace\project-name\build.xml 

BUILD FAILED 
C:\workspace\project-name\build.xml:5: Cannot find C:\workspace\project-name\file:\C:\workspace\project-name\project-name\core-build\xml\ant\build-basic-targets.xml imported from C:\workspace\project-name\build.xml 
     at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:181) 
     at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:162) 
     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
     at java.lang.reflect.Method.invoke(Method.java:597) 
     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
     at org.apache.tools.ant.Task.perform(Task.java:348) 
     at org.apache.tools.ant.Target.execute(Target.java:435) 
     at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179) 
     at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82) 
     at org.apache.tools.ant.Main.runBuild(Main.java:826) 
     at org.apache.tools.ant.Main.startAnt(Main.java:235) 
     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 

Total time: 0 seconds 

爲此,這裏是從我的系統中的一些相關細節:

PATH = %AMDAPPSDKROOT%bin\x86_64;%AMDAPPSDKROOT%bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%MAVEN%;%SBT_HOME%;%IRONRUBY_11%;%JAVA_HOME%\bin;%GRAILS_HOME%\bin;%GROOVY_HOME%\bin;%SUBVERSION%\bin;%GIT%\cmd;C:\Utilities;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;%ANT_HOME%\bin 
echo %PATH% = c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apache-maven-3.0.4\bin;C:\Program Files (x86)\sbt\;C:\Program Files (x86)\IronRuby 1.1\bin;C:\Program Files\Java\jdk1.6.0_25\bin;C:\Grails\grails-2.1.0\bin;C:\Program Files (x86)\Groovy\Groovy-2.1.1\bin;C:\Program Files (x86)\Subversion\bin;C:\Program Files (x86)\Git\cmd;C:\Utilities;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\apache-ant-1.9.0\bin;C:\Program Files (x86)\vim\vim73;C:\Ruby193\bin;C:\Python27 
%ANT_HOME% = C:\apache-ant-1.9.0 
%JAVA_HOME% = C:\Program Files\Java\jdk1.6.0_25 
javac -version = 1.6.0_25 

我也嘗試使用常春藤的新版本,常春藤2.3.0,但我遇到類似的錯誤。

我覺得這部分是常春藤解析目標:

<target name="resolve" depends="clean-lib, load-ivy" description="--> resolve and retrieve dependencies with ivy"> 
    <echo message="Storing dependencies in lib dir: ${lib.dir}" /> 
    <mkdir dir="lib"/> 
    <ivy:retrieve /> 

    <ivy:deliver deliverpattern="ivy_delivered.xml" /> 
</target> 

路徑

我已經包含在build.properties和其他相關文件下面的路徑的相關摘錄:

// build.xml 
<property file="build.properties" /> 
// build.properties 
shared.base=core-build 
shared.xml=${shared.base}/xml 
// build-ivy-targets.xml (imported into build.xml) 
<property name="ivy.settings.dir" value="${shared.xml}/ant/ivy" /> 

常春藤配置

<!-- build-ivy-targets.xml (stripped down quite a bit): --> 
<project basedir="." default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant"> 
    <import file="build-ant-contrib-targets.xml" /> 
    <import file="build-basic-targets.xml" /> 

    <property file="placeholder.build.properties" /> 
    <property name="ivy.settings.dir" value="${shared.xml}/ant/ivy" /> 
    <property file="${ivy.settings.dir}/ivysettings.properties" /> 

    <path id="ivy.lib.path"> 
     <fileset dir="${shared.lib}"> 
      <include name="ant-extensions/ivy*.jar" /> 
     </fileset> 
    </path> 

    <path id="lib.jars"> 
     <fileset id="lib.jars.fileset" dir="lib" erroronmissingdir="false"> 
      <include name="*.jar" /> 
     </fileset> 
    </path> 

    <!-- `ivy:settings file` is only set here: --> 
    <target name="load-ivy"> 
     <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" /> 
     <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" /> 
    </target> 
    <target name="resolve" depends="clean-lib, load-ivy" description="--> resolve and retrieve dependencies with ivy"> 
     <echo message="Storing dependencies in lib dir: ${lib.dir}" /> 
     <mkdir dir="lib"/> 
     <ivy:retrieve /> 

     <ivy:deliver deliverpattern="ivy_delivered.xml" /> 
    </target> 
    <target name="clean-lib" description="--> clean the project libraries directory (dependencies)"> 
     <delete includeemptydirs="true" dir="${lib.dir}" /> 
    </target> 

</project> 

我發現Apache Ivy錯誤信息意味着某個地方無法解析目錄,而是將其作爲URL讀取。我應該採取什麼措施來解決這個問題?

+0

您已指定錯誤消息,但尚未列出ANT代碼。我懷疑問題是您已經爲設置任務指定了命名空間。例如「ivy:settings」 – 2013-03-19 01:02:25

+0

你可以粘貼'resolve'目標嗎?我認爲你的安裝常青藤是不完整的,或者你將錯誤的路徑傳遞給'ivysettings.xml'。也許這個路徑是硬編碼的? – pepuch 2013-03-19 06:13:20

+0

@pepuch - 你認爲'resolve'目標是什麼意思?那是以''?或者它只是從'\t 解決並檢索與ivy的依賴關係的部分」>'?我會將後者粘貼到我的問題中。 – corvec 2013-03-19 14:35:54

回答

1

Windows上的Ivy需要將ivy-settings變量設置爲與Linux上不同。

更改行<ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />到:

<ivy:settings url="file:/C://workspace//project-name//core-build//xml//ant//ivy//ivysettings.xml" /> 

要注意的是兩件事情改變這一點很重要:

  1. ,而不是設置ivy.settings.file,要設置ivy.settings.url
  2. 要設置一個絕對路徑而不是相對的。
+0

至少在今天的其他時間裏,我會避免接受這種情況,以防萬一有人理解*爲什麼*常春藤這樣做是否希望在答案中對其進行闡述。我寧願接受這樣的答案。 – corvec 2013-03-19 16:26:56

0

問題是,螞蟻試圖解析從相對路徑而不是絕對位置的導入。在你的錯誤中看到這一行?

找不到C:\ workspace \ project-name \ file:\ C:\ workspace \ project-name \ project-name \ core-build \ xml \ ant \ build-basic-targets.xml從C:\工作區\項目名稱\版本。xml

使導入文件的路徑爲相對於build.xml目錄的路徑,如「project-name/core-build/xml/ant/basic-build-targets.xml」,以及您的導入語句如下所示:

<import file="${basedir}/${shared.base}"/> 
+0

我只是在將路徑改爲絕對路徑時纔看到該錯誤消息。在執行'ant'命令時,其他錯誤消息都被接收到了一個相對於'build.xml'和當前工作目錄的路徑。 – corvec 2013-03-19 14:52:30