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

基于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>   

 

 

posted @ 2014-02-13 17:37  _流年  阅读(1092)  评论(0编辑  收藏  举报