对于Maven管理的项目制定虚拟目录

mac2022-06-30  29

基于Maven管理的web项目结构:

target目录是用来存放项目打包之后生成的文件的目录,此目录中的文件必须调用mvn clean package后才能生成,

如果把虚拟目录设置在此目录中,则每次修改项目后都需要调用mvn,很不方便

正确方法:

  1.设置虚拟目录为:src/main/webapp

  2.在pom.xml中更改maven打包的目录位置

<!-- 更改maven默认的打包目录 --> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <webappDirectory>${basedir}/src/main/webapp</webappDirectory> <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory> </configuration> </plugin>

 

 

转载于:https://www.cnblogs.com/DajiangDev/p/3548467.html

最新回复(0)