簡體   English   中英

如何設置Gradle自定義ant任務類路徑?

[英]How to set Gradle custom ant task classpath?

我在我的代碼庫中有一個自定義Ant任務,我需要在Gradle中使用它。 有很多關於如何使用打包在jar文件中的任務的示例,但這是不同的。

我的taskdef應該類似於:

ant.taskdef(
    name: 'generator',
    classname: 'MyGenerator', 
    classpath: ???
)

classpath中應包括一切bin/ (其中我的代碼被編譯到),並在列出的所有罐子dependencies構建腳本的部分。 如何填空?

我嘗試了一些不同的東西,導致像The <taskdef> type doesn't support nested text data或典型的NoClassDefFoundError這樣The <taskdef> type doesn't support nested text data模糊消息。

我認為您要執行的操作在“在構建中使用自定義Ant任務”下的用戶指南中進行了描述

基本上你想聲明一個configuration ,在dependencies部分中添加依賴項,然后在taskdef classpath使用asPath

正如Perryn Fowler所寫,您應該聲明一個configurationdependencies部分。 這是我發現的一個例子: https//github.com/openbakery/gradle-common-plugins/blob/master/webdav.gradle

暫無
暫無

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

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