我在spring工具套件中創建了maven項目。我創建了具有所需依賴性的pom.xml,但由於「SpringBootApplication無法解析爲類型」而面臨錯誤。 我嘗試了幾個解決方案,如Maven - >更新項目...,清潔項目,刪除Maven(.m2)的本地存儲庫目錄等...我也嘗試創建另一個Maven項目,但仍然是相同的錯誤。SpringBootApplication無法解析爲Spring工具套件和maven中的類型錯誤
我覺得這是eclipse的spring工具套件與maven的問題。 是否有任何解決方案像通過日食或其他任何補丁? 在此先感謝!
的pom.xml如下
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.javabrains.springbootquickstart</groupId>
<artifactId>cource.api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Java Brains Cource API</name>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<properties>
<java.version>1.8</java.version>
</properties>
</project>
你是否已經嘗試命令mvn乾淨安裝從命令行下你的項目? –
'......不能解析爲類型「表示導入缺失或無法解析。在後一種情況下,「導入...無法解決」是您應該查看的錯誤。你有這樣的錯誤嗎? – howlger