weixin_42919342
Outman Chen
2019-04-21 22:13

用IDEA新建的Maven项目,无法运行

  • spring
  • java
  • intellij-idea

按照网上的教程,新建了一个Maven项目,并在pom.xml添加了依赖和插件,
<?xml version="1.0" encoding="UTF-8"?>
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">
4.0.0

<groupId>outman</groupId>
<artifactId>chen</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
</parent>

<!-- Add typical dependencies for a web application -->
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<!-- Package as an executable jar -->
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

之后编写了一个简单的java程序,
package outman;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HelloWorldMainApplication {
public static void main(String[] args) {
SpringBootApplication.run(HelloWorldMainApplication.class,args);
}
}
图片说明
发现run是红色的,无法运行,请各位大佬解决一下。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐