如何使用 gradle 将另一个项目的构建工件添加到 .war 中?
与 如何添加 .使用 gradle 将属性文件添加到我的 WAR 中? 但不完全是:
我有一个项目,称之为“webclient”,它生成:
build/out/WEB-INF/deploy/foo
build/out/client/bar.js
build/out/clientDebug/baz.js
然后我有一个 war 项目,称之为“服务器”,我是尝试通过执行以下操作将上述内容包含到几个不同的目录中:
war {
from files(project(':webclient').file('build/out/WEB-INF')) {
into('xxx')
}
from files(project(':webclient').file('build/out/client')) {
into('yyy')
}
from files(project(':webclient').file('build/out/clientDebug')) {
into('zzz')
}
}
...但这不起作用。我最终得到了 zzz/ 下的所有内容!我做错了什么吗? gradle 中的错误(1.0-m6,顺便说一句)?
Related to How do I add a .properties file into my WAR using gradle? but not quite:
I've got one project, call it 'webclient' that produces:
build/out/WEB-INF/deploy/foo
build/out/client/bar.js
build/out/clientDebug/baz.js
and then I've got a war project, call it 'server' that I'm trying to include the above into the a few different directories by doing:
war {
from files(project(':webclient').file('build/out/WEB-INF')) {
into('xxx')
}
from files(project(':webclient').file('build/out/client')) {
into('yyy')
}
from files(project(':webclient').file('build/out/clientDebug')) {
into('zzz')
}
}
...but that doesn't work. I end up with all the contents under zzz/ ! Am I doing something wrong? bug in gradle (1.0-m6, btw)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有深入研究细节,但 files() 方法似乎导致了这里的问题。以下解决方法应该可以帮助您:
I didn't digged deeper in the details, but the files() method seems to cause the problems here. The following workaround should do the trick for you: