简体   繁体   中英

Gradle hides files on building war

My project tree:

 /project
|
|--> /src
|    |-->/main
|        |-->/webapp
|            |--> a lot of folders here including /files with doc file inside
|--> build.gradle

when i put in my build.gradle file only apply plugin 'war' it puts everything in war file on build except doc file from /files directory

I read Gradle docs so I'm adding

war{
    from 'src/main/webapp/files'
}

to my build.gradle file, after it my war file became bigger in size but needed file is not there.

How can I add file from /files directory to war /files directory?

UPDATE

After adding this project to multi-project build the problem has gone. Don't know really what was wrong.

I believe the syntax you're looking for is:

war {
  from 'src/main/webapp/files' into 'files'
}

This will copy everything from src/main/webapp/files into a subdirectory called files at the root of your WAR file (eg. my-app.war/files )

I had a lot of interesting issues with Gradle's war task and copying, so if this doesn't work, I can look up what other methods I've used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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