Ich habe versucht, eine Startfeder Bootprojekt von https://start.spring.io/Fehler: Kann keine Hauptklasse finden oder laden ... im Frühjahr Boot-1.5.9-Version, aber nicht in 1.4.7
zu erzeugen, wenn ich Frühlings-Boot verwenden 1.5.9 Version das Projekt ich erhalte die folgende
Error: Could not find or load main class com.example.demo120417.Demo120417Application
jedoch zu erzeugen; Ändern der Version zu Spring Boot 1.4.7 lädt und führt die Hauptklasse ohne Fehler aus.
Ich habe Aktuator, Sicherheit, Thymoleaf, Devtools, h2 in der Abhängigkeit.
<?xml version="1.0" encoding="UTF-8"?>
<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>com.example</groupId>
<artifactId>demo120417</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo120417</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Was könnte die Ursache dafür sein? Ich verbrachte fast einen Tag damit, herauszufinden, ob ich Probleme mit dem Build-Pfad hatte. Gewöhnlich weist ein rotes Ausrufezeichen auf das Projekt mich auf das Bibliotheksproblem hin.
Wie hast du es in Eclipse importiert und wie laufen Sie es? – Oleg
Klicken Sie mit der rechten Maustaste und importieren Sie es. Ich starte es mit nur einem Rechtsklick und starte als> Java-Anwendung – tadtab
Das rote Ausrufezeichen sagt mir, dass Eclipse dein Projekt nicht erstellen konnte. Welche Probleme sind für das Projekt in der Problemsicht aufgelistet? –