maven-archetype-webapp eclipse problem

后端 未结 17 1643
囚心锁ツ
囚心锁ツ 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:20

    Just add a new folder "java" under src/main. will solve the problem. Because the classpath with java folder is already available in .classpath file of created project, so adding java folder will not cause any error. see below entry in .classpath file, which allows to add java folder.

    <attributes>
    <attribute name="optional" value="true"/>
    <attribute name="maven.pomderived" value="true"/>
    

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

    Here is my solution. It works without any issue.

    There could be questions regarding why all this steps are required and i believe they are pretty genuine. But this is one of the ways to make your web application or any other component working on eclipse using Maven from command line.

    1) Open a command window

    2) mvn archetype:generate -DgroupId=your package -DartifactId=your Project -DarchetypeArtifactId= your archetype. In my case "maven-archetype-webapp" -DinteractiveMode=false

    3) cd your Project

    4) mvn eclipse:eclipse -Dwtpversion=2.0

    5) Go to file system. Go to your newly created project. create folders, a) java under main
    b) test under src c) java and resources under test

    6) mvn eclipse:clean

    7) mvn eclipse:eclipse -Dwtpversion=2.0

    8) import your Project project in eclipse

    Thanks, Sid

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

    Right click the Maven Project -> Build Path -> Configure Build Path In Order & Export tab, you can see the message like select 'JRE System Library' and 'Maven Dependencies' checkbox Click OK Now you can them

    0 讨论(0)
  • 2020-11-29 21:30
    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.
    0 讨论(0)
  • 2020-11-29 21:30

    Simply create new folder named java under src/main/

    Then right click on project and select maven->update project

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

    error occurs when the JRE System Library is wrongly pointed. Now go to Libraries tab and change the JRE System Library to the correct version.

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