簡體   English   中英

無法使用Eclipse構建Liferay項目(Ant Ivy)

[英]Failing to build a liferay project with eclipse (Ant ivy)

我收到這個錯誤

BUILD FAILED
C:\---\---\---\build-common-ivy.xml:7: Problem: failed to create task or type if
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.

我在定義屬性名稱=“ ivy.home”的那一行似乎失敗了:

<project name="build-common-ivy" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:ivy="antlib:org.apache.ivy.ant">
    <property name="ivy.home" value="${sdk.dir}/.ivy" />

<if>
        <not>
            <available file="${ivy.home}/ivy-${ivy.version}.jar" />
        </not>
        <then>
          ...

我認為未定義的是$ {sdk.dir},但在哪里可以定義呢?

正如@CAustin所解釋的,您的問題是“ if”任務不是標准的ANT功能。 它是ANT的第三方擴展的一部分,稱為ant-contrib ,我同意最好避免這樣做。

如果要自動執行有條件的ivy安裝,請嘗試如下操作:

<project name="demo" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">

    <available classname="org.apache.ivy.Main" property="ivy.installed"/> 

    <target name="install-ivy" unless="ivy.installed">
        <mkdir dir="${user.home}/.ant/lib"/>
        <get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar"/>
        <fail message="Ivy has been installed. Run the build again"/>
    </target>

    <target name="resolve" depends="install-ivy">
        <ivy:resolve/>

        ..
        ..    

希望這可以幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM