Programming Notes

Deploying JDBC Driver in JBoss Maven Plugin

| Comments

With release of jboss-as maven plugin version 7.0.1.Final the new goal deploy-artifact is added. It allows to deploy additional artifacts to JBoss server, like JDBC DB driver JAR. After trying do deploy JDBC driver with jboss-as maven plugin using following code in pom.xml I received the NullPointerException in Maven build. Here is part of maven pom.xml used to deploy the driver to jboss:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<plugin>
  <groupId>org.jboss.as.plugins</groupId>
  <artifactId>jboss-as-maven-plugin</artifactId>
  <version>7.0.1.Final</version>
  <executions>
      <execution>
          <id>deploy-driver-AS400</id>
          <phase>package</phase>
          <goals>
              <goal>deploy-artifact</goal>
          </goals>
          <configuration>
              <hostname>${jboss-hostname}</hostname>
              <groupId>com.ibm</groupId>
              <artifactId>as400</artifactId>
              <fileName>jt400.jar</fileName>
              <name>jt400.jar</name>
          </configuration>
      </execution>
  </executions>
</plugin>


In the plugin’s manual at http://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html it said

The artifact must be already listed as a dependency in the projects pom.xml

but it do not tells in which scope the driver’s JAR have to be: it have to be in compile or runtime scope in order to work. I had it in provided scope. After changing the scope of dependency it works fine.