在同一个Gradle项目中生成WAR和EAR构件 [英] Generating WAR and EAR artifacts inside the same Gradle project
问题描述
src / main / webapp
。 Project myproject-web
, build.gradle
:
apply plugin:'java'
apply plugin:'eclipse-wtp'
apply plugin:'war'
我知道我可以包装由 myproject生成的
文件如果我定义了一个二级项目(比如 myproject-ear
),那么在 .ear
>),它将 ear
插件和引用 myproject-web
作为依赖关系:
项目 myproject-ear
, build.gradle
:
deploy project(':myproject-web')
我知道,只有一个 .war
内部创建 .ear
文件是没有意义的但这就是我需要在我目前的工作中提供工件的方式)。因此,可以完全跳过项目 myproject-ear
的定义,直接在内部直接使用 ear
插件 myproject-web
的构建文件?
谢谢!
将耳塞添加到战争项目中,然后使用以下配置将战争添加到耳中:
ear {
from war.outputs.files
}
Suppose that I have a Gradle web project with a standard web project layout src/main/webapp
.
Project myproject-web
, build.gradle
:
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'war'
I know that I can wrap the resulting .war
file generated by myproject-web
inside an .ear
if I define a secondary project (say, myproject-ear
) which applies the ear
plugin and references myproject-web
as a dependency:
Project myproject-ear
, build.gradle
:
deploy project(':myproject-web')
I know it's a bit pointless to create an .ear
file with only one .war
inside (but that's how I'm required to deliver artifacts at my current job). So would it be possible to entirely skip the definition of the project myproject-ear
and just use the ear
plugin directly inside myproject-web
's build file?
Thanks!
Add the ear plugin to your war project, then add the war into the ear using the following configuration:
ear {
from war.outputs.files
}
这篇关于在同一个Gradle项目中生成WAR和EAR构件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!