0

「if」タスクは、「ターゲット」ルートまたは何らかのアクションが期待される任意の場所で使用できることがわかります。しかし、パラメータを指定するときに使用できますか? たとえば、クラスパスを宣言できる ant-javafx タスク fx:deploy があります。

<fx:deploy ...>
    <fx:resources>
        <fx:fileset dir="..." ...>
        <fx:fileset dir="..." ...>
    </fx:resources>
</fx:deploy>

問題は、そのユースケースで「if」を使用できるかどうかです。例:

<fx:deploy ...>
    <fx:resources>
        <if>
          <available file="${lib.dir}" type="dir" />
          <then><fx:fileset dir="${lib.dir}" ...></then>
        </if>
        <fx:fileset dir="..." ...>
    </fx:resources>
</fx:deploy>
4

1 に答える 1

1

Okay, where are you getting your <if> tasks?

Are these from Ant-Contrib? If so, these are tasks and not sub-entities that can be used with in a task.

However, it MIGHT be possible to define a resource with in an <if> statement:

<if>
   <avaliable file="${lib.dir}" type="dir"/>
   <then>
       <fileset dir="${lib.dir}" id="lib.fileset">
           <includes name="..."/>
       </fileset>
    </then>
    <else>
        <fileset dir="${foo.dir}" id="lib.fileset">
            <include name="..."/>
        </fileset>
    </else>
</fi>

Now you would have a fileset with an id of lib.fileset that could be one of two different definitions. You can then use that as part of a sub-entity:

<jar destfile="${jar.name}">
    <fileset refid="lib.dir"/>
</jar>

I said MIGHT because I've never tried this, but I really can't see why it wouldn't. I have never used the JavaFX tasks, so I didn't want to give an example with that, but the documentation does say that <fx:resources> can use a reference id.

于 2013-02-05T15:24:21.437 に答える