Maven: Where to put generated resources for tomcat-maven-plugin?

前端 未结 3 1363
遥遥无期
遥遥无期 2021-02-13 10:30

I have CSS and JavaScript files in src/main/webapp directory of my project. I want to join add joined and minified version of these resources to my WAR file and to

3条回答
  •  故里飘歌
    2021-02-13 11:14

    Use warSourceDirectory:

    ${project.build.directory}/${project.build.finalName}
    

    Instead of this configuration property (warDirectory) for the tomcat-maven-plugin:

    ${project.build.directory}/${project.build.finalName}
    

    According to the tomcat-maven-plugin documentation, warSourceDirectory is where the web resources get picked up, and its default value is ${basedir}/src/main/webapp. This means that if you don’t set that property, you need to generate your unified/minified JavaScript file under ${basedir}/src/main/webapp.

    If you set warSourceDirectory to the output folder, this means you need to generate this file before starting Tomcat.

提交回复
热议问题