简体   繁体   English

摇篮+战争=错误的战争内容

[英]Gradle + war = Wrong war content

I am using Gradle, but the output war file (on /build/libs/project-version.war) has only the WebContent information. 我正在使用Gradle,但输出的war文件(在/build/libs/project-version.war上)仅具有WebContent信息。

Here's how I´ve set up my build.gradle file: 这是我设置build.gradle文件的方式:

//others
apply plugin: "war"


//repos and dependencies

webAppDirName = 'WebContent'

sourceSets {
    main {
        java {
            srcDir 'src'
        }

        resources {
            srcDir 'src'
        }
    }
}

And when I run gradle build command the WAR content is: 当我运行gradle build命令时,WAR内容为:

在此处输入图片说明

Can you guys help me out setting up the correct WAR ? 你们可以帮我设置正确的WAR吗? Thanks 谢谢

Actually, the WAR Content is correct. 实际上,WAR内容是正确的。

If you are going to build a WAR you need to specify this for it to build correctly: 如果要构建WAR,则需要指定此名称以使其正确构建:

webAppDirName = 'WebContent'

sourceSets {
    main {
        java {
            srcDir 'src'
        }

        resources {
            srcDir 'src'
        }
    }
}

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM