Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-archetype-webapp eclipse problem

I'm trying to create a very simple webapp with maven and eclipse, but I'm having no joy at all, in fact the reverse of joy.

I go to File -> New Project, select Maven Project, and select the maven-archetype-webapp. When I finish the wizard, a webapp structure gets generated but with no 'java' directory under main, just resources and webapp.

So I right click on main and select new Class. The class gets created under resources (?!), and furthermore, there seems to be no compilation of it by java. I can make stupid errors and no syntax highlighting comes up. It's like java isn't recognizing it.

Alternatively I have tried creating a new 'java' directory under main where it should be, but still with the same non-existent java symptoms.

What gives? This is driving me insane..

Thanks all!

like image 850
Jeremy Avatar asked Jun 15 '10 04:06

Jeremy


People also ask

What should be the archetype for Maven project in Eclipse?

If you want a web application, use maven-archetype-webapp, or if you want a simple application use maven-archetype-quickstart. They are useful because you will be able to expand them with no problem. Note that this is in the Eclipse plugin by default (at least it is today).


2 Answers

Simply create a java directory under main (i.e. src/main/java) and right-click on your project and select Maven > Update Project Configuration.

like image 57
Pascal Thivent Avatar answered Sep 18 '22 16:09

Pascal Thivent


  1. By default, When you create a project with maven archetype "maven-archetype-webapp", it doesn't create any java and test folders.
  2. You can manually add those folders as src/main/java and src/test/java.
  3. After adding these folders, right click on your project in project explorer, go to maven>update project conf.
like image 36
Udayan Avatar answered Sep 18 '22 16:09

Udayan