Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

src/main/webapp directory not recognized by Eclipse

I use m2eclipse to import Maven Java projects in Eclipse.

It fails to recognize src/main/webapp as a source directory.

Graphically in the package explorer (or when I look into Java-Build-Path in the project's properties),
this directory isn't in the list of sources folder (while src/main/java or src/main/resources do).

To access it, I have to look directly into the src/ directory, and start unfolding... Not very convenient!

However, if I run maven install, the resources are copied to the correct directory.
(example : src/main/webapp/index.jsp to target/mywar/index.jsp)

Questions

  1. Is this a correct behavior ? (I was thinking it could be treated as other resources ...)
  2. Could I fix it?
  3. I wonder if there are other drawbacks for this situation, that I would not be aware of right now?
like image 618
KLE Avatar asked Nov 02 '09 15:11

KLE


1 Answers

  1. Is this a correct behavior ? (I was thinking it could be treated as other resources ...)
  2. Could I fix it?
  3. I wonder if there are other drawbacks for this situation, that I would not be aware of right now?
  1. Yes, to me this is the correct behavior.
  2. It doesn't really make sense for src/main/webapp to be a source folder, it doesn't contain compilable source files.
  3. I don't know. I guess it depends on your expectations :)

That said, m2eclipse made a contribution that allows to make src/main/webapp available at the top level with a specific "Web Resources" label, something like this:

alt text

This could be a solution for your concern (the not convenient folding).

like image 93
Pascal Thivent Avatar answered Sep 29 '22 12:09

Pascal Thivent