简体   繁体   English

从 Spring Guides 在 STS 中导入 Maven 项目的问题

[英]Issue with importing Maven project in STS from Spring Guides

Spec: jdk1.8 , Spring Tool Suit Editor-3.8.2 , Maven 3.3.3 , Windows10 O/s规格: jdk1.8 , Spring Tool Suit Editor-3.8.2 , Maven 3.3.3 , Windows10 O/s

Downloaded the ZIP from url : https://spring.io/guides/gs/validating-form-inputurl下载ZIPhttps : //spring.io/guides/gs/validating-form-input

Error on MAVEN as follows MAVEN上的错误如下

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building gs-validating-form-input 0.1.0
[INFO] ------------------------------------------------------------------------
[DEBUG] The POM for org.springframework.boot:spring-boot-starter-thymeleaf-1.4.3.RELEASE:jar:1.4.3.RELEASE is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Question : Why is this Error shown ?问题为什么会显示此错误?

Just follow these steps (in Eclipse or in Spring Tool Suite) after you download and unzip this project Validating Form Input :下载并解压缩此项目Validating Form Input后,只需按照以下步骤(在 Eclipse 或 Spring Tool Suite 中):

  1. In your Eclipse or STS IDE File → Import... .在您的 Eclipse 或 STS IDE File → Import... In the Import window choose Maven → Existing Maven Projects .在导入窗口中选择Maven → Existing Maven Projects
  2. Select the root directory as path to your unzipped project, eg, C:\\gs-validating-form-input\\complete .选择根目录作为解压缩项目的路径,例如, C:\\gs-validating-form-input\\complete Click OK and Finish .单击“ OK和“ Finish
    Note: select complete folder if you want to see the final result or initial if you want to follow this guide step-by-step .注意:如果要查看最终结果,请选择complete文件夹,如果要按照本指南逐步操作,请选择initial文件夹
  3. When your project successfully imported expand src/main/java/hello package in Project Explorer or Navigator.当您的项目成功导入后,在 Project Explorer 或 Navigator 中展开src/main/java/hello包。 Right click on the Application.java class Run as → then either Java Application or Spring Boot App (or just press Alt + Shift + x and then press j or b correspondingly).右键单击Application.javaRun as →然后选择Java ApplicationSpring Boot App (或者只需按Alt + Shift + x ,然后相应地按jb )。
  4. That's all.就这样。 Go to your browser, and type http://localhost:8080/ in the address bar.转到您的浏览器,然后在地址栏中键入http://localhost:8080/

The project is OK, i downloaded, imported as Maven project in eclipse and i run it as a Spring boot app .项目没问题,我下载了,在 Eclipse 中作为Maven 项目导入,我将它作为Spring Boot 应用程序运行

I am using M2Eclipse 1.7我正在使用 M2Eclipse 1.7

Try cleaning your project.尝试清理您的项目。

Try to Right click -> Maven -> Update project.尝试右键单击 -> Maven -> 更新项目。

Try right click -> Run us -> Spring Boot app.尝试右键单击 -> 运行我们 -> Spring Boot 应用程序。

I download this project and right click complete open command line then mvn install , everything is ok.我下载这个项目并右键单击complete打开命令行然后mvn install ,一切正常。

The POM for org.springframework.boot:spring-boot-starter-thymeleaf-1.4.3.RELEASE:jar:1.4.3.RELEASE is missing, no dependency information available缺少 org.springframework.boot:spring-boot-starter-thymeleaf-1.4.3.RELEASE:jar:1.4.3.RELEASE 的 POM,没有可用的依赖信息

it seemd you cant download this jar from maven repository so Check your setting.xml and repository path.您似乎无法从Maven 存储库下载此 jar,因此请检查您的 setting.xml 和存储库路径。
And if you use eclipse Check your windows > preferences > maven > setting.如果您使用 eclipse 检查您的 windows > 首选项 > maven > 设置。

Unzip recently imported folder from https://start.spring.io/ Use Import option pointing at unzipped folder, you could see project got selected.https://start.spring.io/解压最近导入的文件夹 使用指向解压文件夹的导入选项,您可以看到项目被选中。 This way you can import Maven project in to STS IDE这样您就可以将 Maven 项目导入到 STS IDE

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

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