gpt4 book ai didi

gradle - Gradle任务不执行其依赖关系

转载 作者:行者123 更新时间:2023-12-03 03:43:00 25 4
gpt4 key购买 nike

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

当我执行gradle clean launch4j时,我得到以下输出。

: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.

我不明白为什么copyResources没有运行。显然:copyL4jLib被执行。 Gradle是否应该弄清楚copyResources在它之前并先执行它?

这是我的gradle版本信息。
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

这是我的构建脚本。
plugins {
id 'edu.sc.seis.launch4j' version '1.6.1'
id 'java'
}

repositories {
mavenLocal()
mavenCentral()
jcenter()
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

task copyResources(type: Copy) {
from 'src/main/wrapper-resources/'
into 'build/launch4j'
}

copyL4jLib {
dependsOn copyResources
}

launch4j {
mainClassName = 'com.mpinnegar.Main'
icon = 'favicon.ico'
headerType = 'console'
errTitle = 'Image Tagger'
stayAlive = true
}

tasks.copyL4jLib.dependsOn copyResources

最佳答案

看来该插件正在做一些奇怪的事情。首先,它创建任务(请参阅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
}

关于gradle - Gradle任务不执行其依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34407151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com