简体   繁体   中英

Maven - Include external resource at the root of war file

I have a resource file at the root of my maven project. The directory structure is as follows.

src/
pom.xml
resource_file

Inside pom.xml, I've mentioned the resource as:

<build>
   <resources>
        <resource>
            <directory>.</directory>
            <includes>
                <include>resource_file</include>
            </includes>
        </resource>
    </resources>
</build>

Inside the war file, the resource_file is present at WEB-INF/classes/resource_file . I need the resource_file to be at the root of the war file. I can unzip the war file and move the resource_file to root and create the war file again. But, is there any way to accomplish this through maven itself?

The default is to put resources into src/main/webapp directory which will automatically put into the root of the resulting war file.

The docs has also an example of that.

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