I have a multi-module Maven project from which I would like to create executable jar. Below you can see the expansion of my project:
main-module
|___basis-service
| |___src/main/java
| |
| |___src/main/resources
| |
| |___src/test/java
| |
| |___src/test/resources
|
|___controller-service
|___src/main/java
| |___de.app2
| |___App2BasisServiceApplication
|
|___src/main/resources
|
|___src/test/java
| |___de.app2
| |___App2BasisServiceApplicationTest
|
|___src/test/resources
The path of the main de.app2.App2BasisServiceApplication. And here is my Parent.pom
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>de.app2.App2BasisServiceApplication</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven.assembly.plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>de.app2.App2BasisServiceApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
From this stackoverflow question I got my information how to create an executable jar: How to build an executable jar from multi module maven project?
When I build my application then I get a jar, but this jar doesn't seem to have any of my classes. When I look at the jar in a decompiler then I don't see my classes there either.
Also when I try to run my jar in the console with java -jar appname.jar then I get the error: Could not find or load main class .
Does anyone know what I am doing wrong and how I can solve the problem?
Thanks in advance