Probleme beim Ausführen eines JAR, das über 'mvn-Paket' erstellt wurde. Versuche verschiedene Lösungen ohne Erfolg.Hauptklasse konnte nicht gefunden oder geladen werden, wenn Spring Boot jar ausgeführt wird
pom.xml
<groupId>org.springframework</groupId>
<artifactId>rest-service</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.4.RELEASE</version>
</parent>
...
<properties>
<java.version>1.8</java.version>
<start-class>ves.sfdc.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
projectroot \ src \ main \ java \ ves \ SFDC \ application.java
@SpringBootApplication
@Configuration
@ComponentScan
@EnableAsync
@EnableScheduling
@EnableAutoConfiguration
public class Application{
@Autowired
JdbcTemplate jdbcTemplate;
@Autowired
AccountService accountService;
@Autowired
static
SfdcUtil sfdcUtil= new SfdcUtil();
@Autowired
NamedParameterJdbcTemplate jdbcTemplate2;
public static void main(String[] args) throws SecurityException, IOException {
SpringApplication.run(Application.class, args);
}
}
Projekt arbeitet in Eclipse in Ordnung, und wenn Sie mvn Feder-boot : run
Frage mich, ob ich etwas offensichtliches hier vermisse?
Warum benutzen Sie das maven-shade-plugin? Außerdem sollten Sie ' ves.sfdc.Application start-class>' entfernen. Spring Boot und sein Maven Plugin kümmern sich darum. –
dunni
nicht sicher. hat es von einem Führer geliehen, als es haha war. Ich hatte Fehler mvn Verpackung Entfernen der obwohl vorher? Es konnte nicht das Haupt finden. –
Entfernen Sie auch das Maven-Schatten-Plugin. Es ist nicht erforderlich für Spring Boot – dunni