How to create Spring MVC application with Maven structure in Intellij IDEA 13.1?

后端 未结 3 1679
借酒劲吻你
借酒劲吻你 2021-02-01 03:50

I want to to create new Spring MVC project in Maven structure using Intellij IDEA but can\'t do that. actually i want to creat

相关标签:
3条回答
  • 2021-02-01 04:26

    Update as per comment for IntelliJ 15:

    Same instructions apply and here's a view from it:

    Also note that Spring Initializr has been added in the same New Project screen that is becoming the de-facto way of initialising Spring Boot applications.


    (initial post)

    In IntelliJ 13 Ultimate Edition it's very simple since the template is built-in:

    File > New Project > Spring > Create project from template > Spring MVC

    enter image description here enter image description here

    0 讨论(0)
  • 2021-02-01 04:33

    The above suggestions didn't work for me. What I did is Creating MVC project straight up with Maven, based on the archtype:

    http://kolorobot.github.io/spring-mvc-quickstart-archetype

    The command is:

    mvn archetype:generate \
        -DarchetypeGroupId=pl.codeleak \
        -DarchetypeArtifactId=spring-mvc-quickstart \
        -DarchetypeVersion=1.0.0 \
        -DgroupId=my.groupid \
        -DartifactId=my-artifactId \
        -Dversion=version \
        -DarchetypeRepository=http://kolorobot.github.io/spring-mvc-quickstart-archetype
    

    Or, if you want to just Copy-Paste it to shell or cmd in one line:

    mvn archetype:generate -DarchetypeGroupId=pl.codeleak -DarchetypeArtifactId=spring-mvc-quickstart -DarchetypeVersion=1.0.0 -DgroupId=my.groupid -DartifactId=my-artifactId -Dversion=version -DarchetypeRepository=http://kolorobot.github.io/spring-mvc-quickstart-archetype
    

    When DgroupId, DartifactId & Dversion are the groupId, artifactId and version of your project.

    It will generate a full working maven project.

    The next step is just to import the maven project to IntellijIDEA.

    As for Version 14.1.4:

    1. File -> New -> Project from Existing Sources... and choose the Project you generated.
    2. Check the Import project from external model and choose Maven.
    3. At this point there will be more configurations, but you can just click Next & Finish.

    To run the project in your browser you would need to install and configure Apache Tomcat.

    IntelliJ and Tomcat.. Howto..?

    0 讨论(0)
  • 2021-02-01 04:37

    All you need to do is the following.

    Click File -> New Project and then:

    First add this Maven archetype (from the button on top right)

    enter image description here

    That archetype will help you bootstrap the project by providing some Spring configuration code and must be present in your local Maven repository (directions are provided on how to do that in the link I sent - it's very easy).

    After adding the archetype just do like in the following screenshot:

    enter image description here

    The next screen just asks you for the the GroupId, ArtifactId and Version of your project. The following screens are trivial.

    That's it!

    Note that you can use any archetype you like (although the one I supplied seems to be very much up to date). If you find a better one than the one I supplied, feel free to use it. You can also write your own without too much trouble.

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