1

I searched the same problem, but the answers did not resolve my problem. I developed the spring boot application with IntelliJ IDEA, here is my MainClass:

package me.yummykang.configserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;

@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}

And my pom.xml is:

<?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>me.yummykang</groupId>
    <artifactId>config-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>config-server</name>
    <description>config server</description>

    <parent>
        <groupId>me.yummykang</groupId>
        <artifactId>eagle-eye</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </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.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
            <version>1.2.3.RELEASE</version>
        </dependency>
    </dependencies>

</project>

The project is a multiple modules maven project, another sub module can run using IDEA's DEBUG button, but this sub module can not run with IDEA's DEBUG button and cause ***ERROR:Could not find or load main class Could not find or load main class me.yummykang.configserver.ConfigServerApplication***

But I could run it using the spring boot plugin execute the run command and other command like start would did not work as well. And after shuting down the application that started with **run** command, the IDEA's DEBUG button worked because of the target that was compiled by **run** command.

utengr
  • 3,225
  • 3
  • 29
  • 68
Demon Coldmist
  • 2,560
  • 2
  • 13
  • 21

1 Answers1

0
  • Please configure/update appropriate JRE into Build path and compiler in the IDE.

  • Run javac and java in command, check if both are same Java versions.

  • Update Java version in pom.xml.


<properties>        
        <java.version>1.8</java.version>
        <spring-cloud.version></spring-cloud.version>
</properties>