Steps to include a jar in the EAR package while building:
Scenario 1. If the jar project is part of same EAR project heirarchy and need to build before packaging
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
<configuration>
<modules>
<javaModule>
<groupId>myProjectGroup</groupId>
<artifactId>myArtifact</artifactId>
<bundleFileName>myArtifact-x.0.jar</bundleFileName>
<bundleDir>[Destination-Path]</bundleDir>
</javaModule>
</modules>
</configuration>
Step3: Add the dependency as follows:
<dependency>
<groupId>myProjectGroup</groupId>
<artifactId>myArtifact</artifactId>
<version>x.0</version>
<type>jar</type>
</dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.
Scenario 2. If the jar is external and not part of EAR project heirarchy
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
<configuration>
<modules>
<javaModule>
<groupId>externalGroup</groupId>
<artifactId>externalJarArtifact</artifactId>
<bundleFileName>externalJarArtifact-x.0.jar</bundleFileName>
<bundleDir>[Destination-Path]</bundleDir>
</javaModule>
</modules>
</configuration>
Step3: Add the dependency as follows:
<dependency>
<groupId>externalGroup</groupId>
<artifactId>externalJarArtifact</artifactId>
<version>x.0</version>
<scope>system</scope>
<systemPath>[external-jar-local-path]/externalJarArtifact-x.0.jar</systemPath>
</dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.
Scenario 1. If the jar project is part of same EAR project heirarchy and need to build before packaging
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
<configuration>
<modules>
<javaModule>
<groupId>myProjectGroup</groupId>
<artifactId>myArtifact</artifactId>
<bundleFileName>myArtifact-x.0.jar</bundleFileName>
<bundleDir>[Destination-Path]</bundleDir>
</javaModule>
</modules>
</configuration>
Step3: Add the dependency as follows:
<dependency>
<groupId>myProjectGroup</groupId>
<artifactId>myArtifact</artifactId>
<version>x.0</version>
<type>jar</type>
</dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.
Scenario 2. If the jar is external and not part of EAR project heirarchy
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
<configuration>
<modules>
<javaModule>
<groupId>externalGroup</groupId>
<artifactId>externalJarArtifact</artifactId>
<bundleFileName>externalJarArtifact-x.0.jar</bundleFileName>
<bundleDir>[Destination-Path]</bundleDir>
</javaModule>
</modules>
</configuration>
Step3: Add the dependency as follows:
<dependency>
<groupId>externalGroup</groupId>
<artifactId>externalJarArtifact</artifactId>
<version>x.0</version>
<scope>system</scope>
<systemPath>[external-jar-local-path]/externalJarArtifact-x.0.jar</systemPath>
</dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.
No comments:
Post a Comment