I am trying to build a cli application with java and maven which contains two profile profileName1
and profileName2
in maven.
I have run the below command and trying to package the jar with all dependencies :
mvn -P profileName1 clean package
I have tried the below to process:
Process 1
<profiles>
<profile>
<id>profileName1</id>
<properties>
<main.class>
com.sunkuet02.CommandLineInterface
</main.class>
<jar.name>profileName1</jar.name>
</properties>
</profile>
</profiles>
But above doesn't include dependencies to the jar file
Process 2
<profiles>
<profile>
<id>profileName1</id>
<properties>
<main.class>
com.sunkuet02.CommandLineInterface
</main.class>
<jar.name>profileName1</jar.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
This also doesn't include dependencies with jar file.
Is there any way to do this ?