Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid three clicks to get into src/main/webapp in eclipse?

I am setting up a maven web app project in eclipse, maven likes to put the webapp resources in src/main/webapp which is a pain to navigate to because I have to click three times to get to webapp contents.

  • click 1 expand src
  • click 2 expand main
  • click 3 expand webapp

Example of three levels of clicks needed to navigate to webapp

In a typical WTP eclipse project there is only WebContent and is a top level folder so only one click is needed to get into it.

Is there an eclipse or m2e trick to make the webapp show up as a top level element under the project.

like image 598
ams Avatar asked Oct 23 '12 23:10

ams


Video Answer


2 Answers

If it makes your life easier, you can override the webapp directory location to hang directly off ${basedir}

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
      <warSourceDirectory>${basedir}/webapp</warSourceDirectory>
    </configuration>
  </plugin>
like image 61
Alexander Pogrebnyak Avatar answered Oct 23 '22 09:10

Alexander Pogrebnyak


Right click the webapp folder and select Build Path -> Use as Source Folder. The folder will be presented on top (in a hierarchical package presentation). It should have no side effects to the final war.

enter image description here

like image 20
FrVaBe Avatar answered Oct 23 '22 11:10

FrVaBe