gpt4 book ai didi

jar - Gradle:如何将资源(而非lib)jar添加到 war 根源?

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

试图从疯狂复杂的ant构建迁移到gradle的持续传奇中-我们有一些我正在生成的“javahelp”资源jar文件。它们不包含任何类。我需要将创建这些资源 jar 的项目的输出添加到 war 的根源(而不是WEB-INF/lib)。

我尝试的解决方案:

apply plugin: 'war'

//Move files into position for the mmplEar project
task stage(overwrite: true, dependsOn: war) << {
}

war {
from project(':help:schedwincli').buildDir.absolutePath + '/libs'
include '*.jar'
}

dependencies {
//Ensure the jar is generated, but we don't want it in the lib dir
providedCompile project(':help:schedwincli')
}

这将编译并运行,并且 :help:schedwincli会运行并生成所需的jar,但是,当我打开war文件时, war 中的任何地方都不会出现预期的jar。有什么建议吗?

编辑

我在下面的Peter的建议下进行了更改,但是现在出现此错误:

Could not find property 'resources' on configuration container.



这是它说失败的地方:
from '../../runtime', /*Fails on this line*/
'../../runtime/html',
'../../runtime/html/Jboss',
'../../runtime/props',
'../../runtime/props/Jboss',
'../../scripts',
'../../../proj/runtime',
'../../../proj/runtime/html',
'../../../proj/runtime/html/Jboss',
'../../../proj/runtime/props',
'../../../proj/runtime/props/Jboss',
configurations.resources
include '*.css'
include '*.gif'
include '*.html'
include '*.jpg'
include '*.jnlp'
include '*.props'
include '*.properties'
include 'jsps/**'
include '*.jar'
include 'log4j/**'
include 'setupLdap.cmd'
include 'spreadsheets/*.xlsx'

最佳答案

您想要类似的东西:

configurations {
resources
}

dependencies {
resources project(':help:schedwincli')
}

war {
from configurations.resources
}

关于jar - Gradle:如何将资源(而非lib)jar添加到 war 根源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19687050/

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