Package a WAR inside an .esb folder
rpelisse Sep 13, 2012 8:39 AMHi all,
I've been trying for most of the day to have maven add a WAR at the root of my .esb project, without any succes. A quick googling lead me to use the maven-dependency-plugin, and had me half way there. I'm indeed able to add the WAR to the exploded package built in my tagert, but not in my .esb archive.
Let's first do a quick configuration overview of my pom.xml:
...
<packaging>jboss-esb</packaging>
...
<dependencies>
...
<dependency>
<groupId>com.systematic.kombit</groupId>
<artifactId>ws-to-esb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
...
<!-- Packaging plugin for creating .esb artifacts -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-packaging-maven-plugin</artifactId>
<version>2.2</version>
<extensions>true</extensions>
<executions>
<execution>
<id>build-esb</id>
<goals>
<goal>esb</goal>
</goals>
</execution>
</executions>
</plugin>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.systematic.kombit</groupId>
<artifactId>ws-to-esb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
<outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
Important note: As I'm using a newer version of the maven-dependency-plugin than the one used in the example provided in the link below, I cannot use the "prepare-package" phase (otherwise the build failed screaming that I must use the package phase). I think this the root core of my issue, as, when mvn reach 'package' phase, it is already "too late", the .esb archive has been created.
Here is the result of the mvn package execution:
$ ls -1 target/
classes
com.systematic.kombit.ws-to-esb.1.0-SNAPSHOT
com.systematic.kombit.ws-to-esb.1.0-SNAPSHOT.esb
generated-sources
maven-archiver
$ ls -1 target/com.systematic.kombit.ws-to-esb.1.0-SNAPSHOT/
com
META-INF
ws-to-esb-1.0-SNAPSHOT.war
$ unzip -t target/com.systematic.kombit.ws-to-esb.1.0-SNAPSHOT.esb
Archive: target/com.systematic.kombit.ws-to-esb.1.0-SNAPSHOT.esb
testing: META-INF/ OK
testing: META-INF/MANIFEST.MF OK
testing: com/ OK
testing: com/systematic/ OK
testing: com/systematic/kombit/ OK
testing: META-INF/jboss-esb.xml OK
testing: com/systematic/kombit/MyAction.class OK
testing: META-INF/maven/ OK
testing: META-INF/maven/com.systematic.kombit/ OK
testing: META-INF/maven/com.systematic.kombit/ws-to-esb/ OK
testing: META-INF/maven/com.systematic.kombit/ws-to-esb/pom.xml OK
testing: META-INF/maven/com.systematic.kombit/ws-to-esb/pom.properties OK
No errors detected in compressed data of target/com.systematic.kombit.ws-to-esb.1.0-SNAPSHOT.esb
Any clue on how I could fix this ?