カスタムの入れ子型を受け入れる必要のあるカスタムAntタスクを作成しています。Antのカスタムタスク:addTYPE(TYPE x)vs add(TYPE x)(後者は機能しません)
the Ant manualによると、addConfiguredTYPE(TYPE x)ではなくaddConfigured(TYPE x)を使用できるはずです。また、Ant 1.6では、this article(セクションNew Reflectionの規則、Ant 1.6の多態性)addConfigured(TYPE x)のサポートが追加されました。しかし
Build Failed: custom-task doesn't support the nested "custom-type" element.
、私は
を変更する場合:<taskdef name="custom-task" classname="com.acme.CustomTask">
<classpath refid="task.classpath" />
</taskdef>
<typedef name="custom-type" classname="com.acme.CustomTask$CustomType">
<classpath refid="task.classpath" />
</typedef>
...
<custom-task>
<custom-type/>
</custom-task>
タスクは、私はビルドスクリプトを実行しようとすると、私は次の例外を取得するJava
public class CustomTask extends Task
{
...
public void addConfigured(CustomType t)
{...}
....
public static class CustomType
{...}
}
に実装されています
<typedef name="custom-type" classname="com.acme.CustomTask$CustomType">
...
<custom-task>
<custom-type/>
</custom-task>
...
public void addConfigured(CustomType t)
~
<typedef name="customtype" classname="com.acme.CustomTask$CustomType">
...
<custom-task>
<customtype/>
</custom-task>
...
public void addConfiguredCustomType(CustomType t)
すべて正常に動作します。
私の場合、一般的なaddConfigured(TYPE x)技法が機能しないような理由はありますか?
PS:Antのバージョンのことを指定しないAnt manualを考慮1.7.0
'typedef name =" my-custom-type "'または 'typedef name =" mycustomtype "'としますか? – VonC
いいえ、私は最初の部分で "私のカスタムタイプ"を意味しました。名前にダッシュを付けることが、汎用のaddConfigured(TYPE x)メソッドを使用する唯一の理由です。 – niktech
はい、私は分かりますが、最初の例では、 ' '要素を使用する直前に' typedef name = "カスタム型"と書いています。 –
VonC