Error generating war file - Java Spring 5

1

I have my working environment in Ubuntu 16.04 and I am working with spring 5, I have tried to generate my war file but it generates the following error messages:

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-war-plugin:2.6:war (default-war) @ spring-boot-web-jsp ---
[INFO] Packaging webapp
[INFO] Assembling webapp [spring-boot-web-jsp] in [/home/henry/Documents/workspace/spring-boot-web-jsp/target/spring-boot-web-jsp-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/henry/Documents/workspace/spring-boot-web-jsp/src/main/webapp]
[INFO] Webapp assembled in [57 msecs]
[INFO] Building war: /home/henry/Documents/workspace/spring-boot-web-jsp/target/spring-boot-web-jsp-0.0.1-SNAPSHOT.war
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ spring-boot-web-jsp ---
[INFO]    ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.451 s
[INFO] Finished at: 2018-02-01T23:49:07-05:00
[INFO] Final Memory: 24M/269M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-   plugin:1.5.9.RELEASE:repackage (default) on project spring-boot-web-jsp: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed: Unable to find main class -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] link

SpringBootWebJspApplication.java

package com.bolsadeideas.springboot.app;

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

@SpringBootApplication
public class SpringBootWebJspApplication {

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

pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd">     4.0.0

<groupId>com.bolsadeideas.springboot.app</groupId>
<artifactId>spring-boot-web-jsp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>spring-boot-web-jsp</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-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
            <!--  JSTL para JSP -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
            <!-- Para compilar JSP -->
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

    
asked by García Henry 02.02.2018 в 06:06
source

1 answer

2

Because of the error, it seems that Spring does not know where your main class is. You can indicate it in the pom.xml of the following form:

<properties>
    <start-class>com.bolsadeideas.springboot.app.SpringBootWebJspApplication</start-class>
</properties>
    
answered by 02.02.2018 в 10:20