Intellij ideal 新建web项目的web资源目录不能自动映射问题

来源:互联网 发布:网络公安报警电话 编辑:程序博客网 时间:2024/06/02 04:19

在用intelij ideal新建web项目时候,有时为了方便直接拷贝或者修改另外一个web项目,有时候会遇到一个问题,那就是在dispatch-servlet.xml配置文件中,无法自动适配到资源目录,细心的人会发现此时的web资源目录跟正常的不同,正常的web目录应该如下图样式



这里的webroot为我们的web资源目录,文件夹上面有个Internet标志的,如果你的项目配置不正常的话是不显示的。当不正常的情况下如何修改呢?其实只是在对应的项目的.iml文件下修改或者增加以下内容即可:

<module xxxxx>

 <component name="FacetManager">
    <facet type="web" name="Web">
      <configuration>
        <descriptors>
          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/
webroot/WEB-INF/web.xml" />
        </descriptors>
        <webroots>
          <root url="file://$MODULE_DIR$/
webroot" relative="/" />
        </webroots>
        <sourceRoots>
          <root url="file://$MODULE_DIR$/src/main/java" />
          <root url="file://$MODULE_DIR$/src/main/resources" />
        </sourceRoots>
      </configuration>
    </facet>
    <facet type="Spring" name="Spring">
      <configuration />
    </facet>
  </component>

0 0
原创粉丝点击