I am using Maven in combination with Quarkus and Angular for my website.
In order to start and stop the Angular frontend I have the following plugin set up:
<plugin>
<groupId>org.ple</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>frontend</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sh</executable>
<arguments>
<argument>-c</argument>
<argument>npm run start && echo $! > ${project.build.directory}/frontend-server.pid</argument>
</arguments>
<workingDirectory>../../../../../../../frontend/foo/</workingDirectory>
</configuration>
</execution>
<execution>
<id>stop-frontend</id>
<phase>post-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sh</executable>
<arguments>
<argument>-c</argument>
<argument>if [ -f ${project.build.directory}/frontend-server.pid ]; then kill $(cat ${project.build.directory}/frontend-server.pid); fi</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
The frontend does start but when I close maven using ctrl+c the frontend keeps running until I externally kill the process.
How can I have the frontend be terminated when I terminate maven/quarkus
1