简体   繁体   English

在Eclipse中使用Maven创建一个Spring MVC项目

[英]creating a spring mvc project using maven in eclipse

I want to create a springMvc project using maven in eclipse. 我想在Eclipse中使用Maven创建springMvc项目。 I have installed eclipse plugin in eclipse by following the steps shown in this answer : Maven in Eclipse: step by step installation 我已按照此答案中所示的步骤在Eclipse中安装了eclipse插件: Eclipse中的Maven:逐步安装

I didn't have the spring-mvc archetype by default so I created a new archetype with the following details 默认情况下,我没有spring-mvc原型,所以我创建了一个具有以下详细信息的新原型

Archetype Group Id: co.ntier
Archetype Artifact Id: spring-mvc-archetype
Archetype Version: 1.0.2
Repository URL: http://maven-repository.com/artifact/co.ntier/spring-mvc-archetype/1.0.2

After doing all this, I tried creating a new maven project using the spring mvc archetype and i am getting the following error 完成所有这些操作后,我尝试使用spring mvc原型创建一个新的maven项目,但出现以下错误

在此处输入图片说明

As cam be seen from the Archetype Group ID you have specified - co.ntier - this is not an official Spring artifact and according to the following the last release was over 3 years ago. 从原型组ID中可以看到,您已经指定了-co.ntier-这不是Spring的官方产品,根据以下说明,最新版本是3年前。

https://repository.sonatype.org/index.html#nexus-search;quick~spring-mvc-archetype https://repository.sonatype.org/index.html#nexus-search;quick~spring-mvc-archetype

The post you are folowing is also over 4 years old. 您关注的帖子也已有4年以上的历史了。

On that basis you may want to consider an alternative. 在此基础上,您可能要考虑替代方法。 You can bootstrap a Spring MVC project easily by using the Spring Initialzr: 您可以使用Spring Initialzr轻松引导Spring MVC项目:

https://start.spring.io/ https://start.spring.io/

Enter name you want for group and artifact and select 'Web' in the dependencies. 输入要用于组和工件的名称,然后在依赖项中选择“ Web”。 Unzip the downloaded file. 解压缩下载的文件。 In Eclipse select File > Import > Existing Maven Project and point to the root of the unzipped folder. 在Eclipse中,选择File> Import> Existing Maven Project并指向解压缩文件夹的根目录。

If you were to install Spring Tools Suite (Eclipse with some Spring related bells and whistles) you also get some additional options: 如果要安装Spring Tools Suite(带有一些与Spring相关的功能的Eclipse),您还将获得一些附加选项:

https://spring.io/tools https://spring.io/tools

File > Import > Spring getting Started Content > 文件>导入> Spring入门内容>

I'm trying to create MVN project in eclipse and I faced the same problem still. 我正在尝试在Eclipse中创建MVN项目,但仍然遇到相同的问题。 So as an alternative, I create a Java Project/Dynamic Web Project in eclipse and then I convert the project into Maven and add the POM dependencies. 因此,作为替代方案,我在eclipse中创建了Java Project / Dynamic Web Project,然后将项目转换为Maven并添加了POM依赖项。 This way I'm happy now. 这样我现在很开心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM