I'm trying to use maven-jar-plugin to produce both a war file and a jar file doing ./mvnw clean install
.
My pom.xml contains:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>jar-services-provided</id>
<phase>test</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<packaging>jar</packaging>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>${project.build.directory}\${project.artifactId}-${project.version}.jar</file>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
I also tried with <phase>compile</phase>
.
The jar-file is being created but is very small and does not even contain the application main class.
How can I achieve the same result as <packaging>jar</packaging>
? The war-file looks good it is bigger.
I did read Maven JAR Plugin 3.0.2 Error ...