configure mojo maven to deploy app

2

Hello, I'm trying to run an app made in spring. My tree is next

./icova-webapp.
./services.
./etcetc.

login to webapps and execute mvn spring-boot:run

I clarify that these are the steps that they left me to be able to deploy the app, I also clarify that I do not know maven and they asked me as a favor to lift the application.

Doing the above I get the following error

[DEBUG] Configuring mojo 'org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:run' with basic configurator -->
[DEBUG]   (f) addResources = false
[DEBUG]   (f) agent = []
[DEBUG]   (f) arguments = []
[DEBUG]   (f) classesDirectory = /root/evolplus/backendEvol/evolplus/icova/icova-webapp/target/classes
[DEBUG]   (f) mainClass = SocialApplication
[DEBUG]   (f) profiles = []
[DEBUG]   (f) project = MavenProject: com.applying:icova-webapp:1.0-SNAPSHOT @ /root/evolplus/backendEvol/evolplus/icova/icova-webapp/pom.xml
[DEBUG]   (f) skip = false
[DEBUG]   (f) useTestClasspath = false
[DEBUG] -- end configuration --
[WARNING]
java.lang.ClassNotFoundException: SocialApplication
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
        at java.lang.Thread.run(Thread.java:745)

My archiv pom.xml within icova-webapp directory 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>
    <parent>
      <groupId>com.applying</groupId>
      <artifactId>icova</artifactId>
      <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.applying</groupId>
    <artifactId>icova-webapp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>portal</name>


    <dependencies>
        <dependency>
          <groupId>com.applying</groupId>
          <artifactId>icova-common</artifactId>       
          <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
          <groupId>com.applying</groupId>
          <artifactId>icova-model</artifactId>        
          <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
          <groupId>com.applying</groupId>
          <artifactId>icova-service</artifactId>          
          <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

    </dependencies>

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

</project>

Now the class you reference is in

./icova-webapp/src/main/java/com/applying/icova/config/SocialApplication

Which has these lines in its code

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

I read that it was necessary to be able to deploy the application, however I believe that I need some step which I have not been specified, any help would be useful for me.

    
asked by Kevin AB 15.03.2017 в 00:31
source

1 answer

0

In the label <build>...</build> of your file pom.xml add the label <archive>...</archive> that I indicate below (I have left a few spaces just for you to see where the modification is). I assume that your class main is called SocialApplication . If it is not that, you put the name of the class that makes the entry point in the application.

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

                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>main.SocialApplication</mainClass>
                    </manifest>
                </archive>

                <executable>true</executable>
            </configuration>
        </plugin>
    </plugins>
</build>

If you want to package a .jar executable, I suggest you see this: Maven: Set Up The Classpath

    
answered by 28.03.2017 в 12:01