java - gradle可以自动创建META-INF、WEB-INF文件夹和web.xml吗?

标签 java gradle gradlew

我是 gradle 新手。我想用 gradle 启动一个网络应用程序。我使用的版本是v3.1

目前,我只在 build.gradle 文件中添加 apply plugin: 'war' 。

我使用war插件,但运行./gradlew build后它不会创建META-INF、WEB-INF文件夹和web.xml。

我是否需要手动创建这些文件夹和文件,或者 gradle 有一种我不知道的自动创建它们的方法?

最佳答案

Gradle specification of War plugin回答你的问题:

The default behavior of the War task is to copy the content of src/main/webapp to the root of the archive. Your webapp directory may of course contain a WEB-INF sub-directory, which may contain a web.xml file. Your compiled classes are compiled to WEB-INF/classes. All the dependencies of the runtime configuration are copied to WEB-INF/lib.

关于java - gradle可以自动创建META-INF、WEB-INF文件夹和web.xml吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40232285/

相关文章:

java - 打印出 hashmap 冲突

java - 来自 Groovy 的带有参数的 invokeMethod

android - 为什么应用程序 :assembleDebug called twice?

java - Gradlew init - 没有这样的文件或目录

gradle - build Gradle项目的问题

java - 菜单工具栏显示在错误的 fragment 中

java - 使用 bean-discovery-mode ="annotated"的 CDI 注入(inject)

java - 不能使用具有不同Spring Boot版本的库

android - 来自Maven的ActionBarSherlock Gradle依赖项与androidsupportv4发生冲突

java - 无法定位平台 : 'Java SE 12' using tool chain: 'JDK 8 (1.8)'