Gradle任务不执行其依赖项

时间:2015-12-22 01:32:47

标签: gradle launch4j

我尝试通过此Gradle插件http://launch4j.sourceforge.net/使用https://github.com/TheBoegl/gradle-launch4j

当我Private Sub frm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load, MyBase.ResizeEnd DataGridView1.SuspendLayout() DataGridView1.DataSource = ... DataGridView1.PerformLayout() End Sub 时,我得到以下输出。

gradle clean launch4j

我不明白为什么copyResources没有运行。显然:执行copyL4jLib。难道Gra Gra不会发现copyResources在它之前出现并先执行它吗?

这是我的gradle -version信息。

:clean
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:copyL4jLib
:generateXmlConfig
:createExeWithBin SKIPPED
:unzipL4jBin
:copyL4jBinLib
:createExeWithJar FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':createExeWithJar'.
> meta-tagger.exe not created:
        launch4j: Icon doesn't exist.

这是我的构建脚本。

Gradle 2.10
Build time:   2015-12-21 21:15:04 UTC
Build number: none
Revision:     276bdcded730f53aa8c11b479986aafa58e124a6

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_66 (Oracle Corporation 25.66-b18)
OS:           Windows 7 6.1 amd64

1 个答案:

答案 0 :(得分:3)

看来这个插件正在做一些我喜欢的事情。首先,它创建任务(请参阅https://github.com/TheBoegl/gradle-launch4j/blob/develop/src/main/groovy/edu/sc/seis/launch4j/Launch4jPlugin.groovy#L50),然后替换afterEvaluate块中的任务(请参阅https://github.com/TheBoegl/gradle-launch4j/blob/develop/src/main/groovy/edu/sc/seis/launch4j/Launch4jPlugin.groovy#L122

要解决此问题,您应该能够将任务依赖项设置放在afterEvaluate块中,以确保您配置replaced任务:

afterEvaluate {
    copyL4jLib.dependsOn copyResources    
}