eaRobust
eaRobust

Reputation: 87

Build not finishing due to maven exec plugin

I have this multi module maven project, with one parent pom and many child poms.

when running maven install, my last module uses a maven exec plugin and runs a main method of some class. The thing is, it seems like the build is stopped once the main method finishes running.

This is my setup:

from my parent pom:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>3.0.0</version>
  <configuration>
    <skip>true</skip>
    <executable>java</executable>
  </configuration>
</plugin>

from my child pom:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>java</goal>
            </goals>
            <configuration>
                <mainClass>com.example.MainClass</mainClass>
                <async>true</async>
                <keepAlive>true</keepAlive>
            </configuration>
        </execution>
    </executions>
</plugin>

I tried incorporating

<async>true</async>
<keepAlive>true</keepAlive>

but it still stops after the main method is executed. I do not see BUILD SUCCESS in the end...

Upvotes: 1

Views: 1134

Answers (1)

eaRobust
eaRobust

Reputation: 87

The solution was to use exec:exec and not exec:java, because exec:java and maven build run on the same process while exec:exec runs on a different process.

Upvotes: 1

Related Questions