Spring Maven项目-java.lang.IllegalArgumentException:源不能为空
我正在尝试启动一个Spring启动应用程序,但它无法启动。这是我的堆栈跟踪:Spring Maven项目-java.lang.IllegalArgumentException:源不能为空,spring,maven,spring-boot,Spring,Maven,Spring Boot,我正在尝试启动一个Spring启动应用程序,但它无法启动。这是我的堆栈跟踪: 11:27:59.772 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : [] 11:27:59.775 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings
11:27:59.772 [main] DEBUG
org.springframework.boot.devtools.settings.DevToolsSettings - Included
patterns for restart : []
11:27:59.775 [main] DEBUG
org.springframework.boot.devtools.settings.DevToolsSettings - Excluded
patterns for restart : [/spring-boot-starter/target/classes/, /spring-
boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/,
/spring-boot/target/classes/, /spring-boot-actuator/target/classes/,
/spring-boot-devtools/target/classes/]
11:27:59.776 [main] DEBUG
org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs
for reloading : [file:/C:/Users/Bobi/Documents/workspace-sts-
3.9.2.RELEASE/springproject/target/classes/]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.M7)
2018-03-18 11:28:00.308 INFO 5048 --- [ restartedMain]
o.s.boot.SpringApplication : Starting SpringApplication
v2.0.0.M7 on DESKTOP-MFS6ORP with PID 5048
(C:\Users\Bobi\.m2\repository\org\springframework\boot\spring-
boot\2.0.0.M7\spring-boot-2.0.0.M7.jar started by Bobi in
C:\Users\Bobi\Documents\workspace-sts-3.9.2.RELEASE\springproject)
2018-03-18 11:28:00.313 INFO 5048 --- [ restartedMain]
o.s.boot.SpringApplication : No active profile set, falling
back to default profiles: default
2018-03-18 11:28:01.410 ERROR 5048 --- [ restartedMain]
o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalArgumentException: Sources must not be empty
at org.springframework.util.Assert.notEmpty(Assert.java:450) ~[spring-
core-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:381) [spring-boot-2.0.0.M7.jar:2.0.0.M7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.0.0.M7.jar:2.0.0.M7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M7.jar:2.0.0.M7]
at org.springframework.boot.SpringApplication.main(SpringApplication.java:1261) [spring-boot-2.0.0.M7.jar:2.0.0.M7]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher
.java:49) [spring-boot-devtools-2.0.0.M7.jar:2.0.0.M7]
这是我的主要课程:
package com.example.a;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class App
{
public static void main( String[] args )
{
SpringApplication.run(App.class, args);
}
}
这是我的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>com.example</groupId>
<artifactId>a</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>a</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</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>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
4.0.0
com.example
A.
0.0.1-快照
罐子
A.
http://maven.apache.org
UTF-8
org.springframework.boot
spring启动程序父级
2.0.0.1版本
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧启动装置
org.springframework.boot
弹簧靴开发工具
真的
org.springframework.boot
springbootmaven插件
我使用的是Spring工具套件,我通过文件->新建->Maven项目创建了项目。我添加了一些依赖项并添加了SpringApplication.run(App.class,args)代码>主类中的行,仅此而已。
我在StackOverflow上尝试了其他类似的建议,但没有任何效果。为了让应用程序正确启动,我必须做什么或做什么更改?我解决了这个问题。我不知道我以前是如何运行该项目的,但我只是右键单击->运行方式->Spring Boot应用程序,它工作正常。给定的pom文件和输出不匹配,因为在输出中,您在pom中引用了M7中的cloud,这一点都没有?