Importing artifacts inside EAP during Galleon provisioning
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 8.x
- Red hat OpenShift Container Platform (OCP)
- 4.x
Issue
- How to add an resource inside EAP provisioned via Galleon?
- How to add a jar/war inside EAP provisioned via Galleon?
- How to add a jar/war inside EAP provisioned via Galleon?
Resolution
Following the build of EAP proviosionaled via JBoss EAP 7 Galleon provisioning via provisioning.xml or pom.xml in eap-maven-plugin, an user has the following options for injecting a certain dependency inside the EAP (provisioned by Galleon's via eap-maven-plugin):
extra-server-content-dirsfeature from the EAP maven plugin:
<packaging-scripts>
<execution>
<scripts>
<script>${project.build.scriptSourceDirectory}/config.cli</script>
</scripts>
</execution>
</packaging-scripts>
<extra-server-content-dirs>
<extra-content>extra-content</extra-content>
</extra-server-content-dirs>
- dependency maven plugin
<!-- Maven Dependency Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/server/standalone/deployments</outputDirectory>
<artifactItems>
<artifactItem>
<!-- artifact details ->
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
- assembly maven plugin
In this alternative, the pom.xml reference a assembly.xml file, which then adds the context for dependency addition:
<!-- Maven Assembly Plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptors>
<descriptor>./assembly.xml</descriptor>
</descriptors>
</configuration>
<dependencies>
<dependency>
<!-- dependency details -->
</dependency>
</dependencies>
<executions>
<execution>
<id>assembly-id</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Root Cause
The eap-maven-plugin works together with other plugins such as the assembly maven plugin and the dependency plugin, however, the latter two plugins can conflict/misbehavior independently from the eap-maven-plugin. Any problem should be investigate as any maven plugin process.
Diagnostic Steps
- Enable debug logs from Maven: -X
- For Galleon one can use
MAVEN_OPTSandMAVEN_OPTS_APPEND.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.