maven-archetype-webapp eclipse problem

后端 未结 17 1607
囚心锁ツ
囚心锁ツ 2020-11-29 20:49

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 Mav

相关标签:
17条回答
  • 2020-11-29 21:14

    This is a great article that I read when I was having trouble understanding how to build multiple projects into one using Maven. Specifically, this article explains how to set up a WEB project (war file) to consume an inner standard java project (jar file).

    If you have a basic understanding of Maven, skip to the sections at the end: How do I build other types of projects? How do I build more than one project at once?

    http://maven.apache.org/guides/getting-started/index.html#How_do_I_build_other_types_of_projects

    If you aren't familiar with Maven yet, check out:

    http://www.mkyong.com/spring/quick-start-maven-spring-example/

    Trust me, mkyong knows what is up!

    0 讨论(0)
  • 2020-11-29 21:14

    Do it the other way around. First make a webapp project, then add the Maven framework (in Intellij - right click project and select Add framework support). It will create the right folders for you.

    0 讨论(0)
  • 2020-11-29 21:15
    • Read the m2eclipse WTP mini-howto.
    • Check the online Developing with Eclipse and Maven.
    • Ensure your settings.xml is configured in the Eclipse preferences.
    • Check the m2eclipse FAQ.

    Anything else is likely to be down to the archetype and how you've configured your pom.xml. The directory structure you describe is identical to the one maven-archetype-webapp creates on the command line.

    0 讨论(0)
  • 2020-11-29 21:16

    a webapp structure gets generated but with no 'java' directory under main

    Create src/main/java on your own.

    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.

    after creating appropriate dir structure execute the maven command

    mvn eclipse:eclipse 
    

    then refresh the project in eclipse.

    -SE

    0 讨论(0)
  • 2020-11-29 21:18

    I had the same problem even when i added JRE system library to my current java version but still had same problem then i just deleted JRE system library and added once again it worked for me

    • To delete JRE System Library right click on project ->properties ->java build path -> select JRE system library -> remove

    • To add JRE go to properties->java build path -> add library ->JRE system library -> choose JRE -> finish

    0 讨论(0)
  • 2020-11-29 21:20

    Simply create a java directory under main (i.e. src/main/java) and right-click -> Build Path -> Use a Source Folder

    0 讨论(0)
提交回复
热议问题