如何在eclipse中避免三次点击进入src / main / webapp?

时间:2012-10-23 23:42:04

标签: eclipse maven m2eclipse m2e eclipse-wtp

我在eclipse中设置了一个maven web app项目,maven喜欢将webapp资源放在src/main/webapp中,这很难导航,因为我必须单击三次才能获得webapp内容。

  • 点击1展开src
  • 点击2展开主要
  • 点击3展开webapp

Example of three levels of clicks needed to navigate to webapp

在典型的WTP eclipse项目中,只有WebContent并且是一个顶级文件夹,所以只需要点击一下即可进入。

是否有eclipse或m2e技巧使webapp显示为项目下的顶级元素。

2 个答案:

答案 0 :(得分:5)

如果它让您的生活更轻松,您可以覆盖webapp目录位置,直接挂起${basedir}

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <warSourceDirectory>${basedir}/webapp</warSourceDirectory>
    </configuration>
  </plugin>

答案 1 :(得分:4)

右键单击webapp文件夹,然后选择Build Path -> Use as Source Folder。该文件夹将显示在顶部(在分层包装演示文稿中)。它应该对最后的战争没有任何副作用。

enter image description here