My EAR project structure is like this:
+- MyEar
| +- Earcontent
| +- lib
+-
+-
+- pom.xml
I want to get all the jars in Earcontent/lib folder in my built MyEar.ear. I gave defaultLibBundleDir as 'lib' in my pom.xml. So I want to get all the jars in Earcontent/lib in MyEar.ear/lib folder.
<defaultLibBundleDir>lib/</defaultLibBundleDir>
My pom.xml looks like :
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
UPDATE: I tried
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
<packagingIncludes>${basedir}\EarContent\lib\*.jar</packagingIncludes>
</configuration>
</plugin>
But now when I build ear, The lib folder inside the ear as a whole is missing.
I tried same scenario in gradle build.gradle. There we are using fileTree.
compile fileTree(dir: "../MyEar/EarContent/lib", includes: ['*.jar']);
Since I am using maven, I want an equivalent for this in maven
The <defaultLibBundleDir>
and <bundleDir>
both seem work with maven artifacts.
However you seem to want to include jars which are not declared as dependencies or listed as <modules>
.
Therefore you might be better off trying to build the .ear file by configuring an assembly.
Otherwise you should remove the lib directory containing the jar files and declare all of the dependencies in your POM.