Arquillian: Wildfly embedded? - junit

Until now I had my integration tests running with Arquillian and an embedded Glassfish 4.x. As I suffer from bug ARQ-1458, I tried migrating to Wildfly 8.0.0.Beta1.
My deps in Maven are:
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.2.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>8.0.0.Beta1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-embedded</artifactId>
<version>8.0.0.Beta1</version>
<scope>test</scope>
</dependency>
When running my test, I get the error that jbossHome is null. I have NO arquillian.xml. When checking Github sources for wildfly-arquillian-container-embedded (POM), I wonder WHY an embedded container requires JBOSS_HOME? I understand to have it for the managed and remote variants, but why do I need it for an embedded one?
The Arquillian pages also only have examples for JBoss AS as managed servers, so I wonder it it is possible at all (but why is there wildfly-arquillian-container-embedded then?)?
Or should I stick to a managed container with using the maven-dependency-plugin to download the container (see http://arquillian.org/guides/getting_started/#add_more_containers - bottom)?
Thanks and best regards!
Exact error is:
org.jboss.arquillian.container.spi.ConfigurationException: jbossHome 'null' must exist
at org.jboss.arquillian.container.spi.client.deployment.Validate.configurationDirectoryExists(Validate.java:139)
at org.jboss.as.arquillian.container.embedded.EmbeddedContainerConfiguration.validate(EmbeddedContainerConfiguration.java:102)
at org.jboss.arquillian.container.impl.ContainerImpl.createDeployableConfiguration(ContainerImpl.java:115)
at org.jboss.arquillian.container.impl.ContainerImpl.setup(ContainerImpl.java:181)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:149)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$7.perform(ContainerLifecycleController.java:145)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainer(ContainerLifecycleController.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:62)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$1.perform(ContainerLifecycleController.java:55)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachContainer(ContainerLifecycleController.java:209)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.setupContainers(ContainerLifecycleController.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

One should set environment variable JBOSS_HOME to path to jBoss installation. Otherwise, a tag property should be added to arquillian.xml inside a container tag.
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="jboss" default="true">
<configuration>
<property name="jbossHome">/path/to/jboss/as</property>
</configuration>
</container>
from example application jboss-javaee6-webapp

use systemPropertyVariables
<profile>
<id>INTEGRATION_TESTS</id>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>8.2.0.Final</version>
</dependency>
<!-- this is the wildfly emb.container - BUT eventually it is not a fully blown emb.container-->
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-embedded</artifactId>
<version>8.2.0.Final</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>8.2.0.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>jdbc</id>
<phase>package</phase>
<goals>
<goal>deploy-artifact</goal>
</goals>
<configuration>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<name>ojdbc6.jar</name>
</configuration>
</execution>
<execution>
<id>datasource</id>
<phase>package</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<address>subsystem=datasources,data-source=tests</address>
<resources>
<resource>
<properties>
<connection-url>jdbc:oracle:thin:#***:1521:xe</connection-url>
<jndi-name>java:jboss/datasources/tests</jndi-name>
<enabled>true</enabled>
<enable>true</enable>
<user-name>***</user-name>
<password>***</password>
<driver-name>ojdbc6.jar</driver-name>
<use-ccm>false</use-ccm>
</properties>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
<module.path>${project.basedir}/target/wildfly-8.2.0.Final/modules</module.path>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Look at this nice article written by Dan Allen.
To be short: generally do not use an embedded container (glassfish with EclipseLink particularly). Standalone server gives us more accurate test results.
Also I prefer remote adapters due to speed of development (none server startup with every test launch, just start it manually once).
If you want the container to start automatically like with embedded, then switch to a managed container.
Hope it helps.

Well, I guess that it works differently w/ Wildfly than with Glassfish:
https://community.jboss.org/thread/236562
:(
Edit: Docker adds another perspective on this issue. I could easily manage the external container using Docker and Maven while still using Arquillian. Did not test it yet, but if someone stumbles upon this...

Related

fabric8 maven plugin configuration with image running Java > 8

I am using fabric8 maven plugin to deploy a vertx application into Openshift. My application is running with Java 11.
However, by default, the fabric8 maven plugin uses a Java 8 Docker image to create my vertx application image.
How is it possible to configure fabric8 maven plugin to use a Java 11 image ? Does it provide other images for Java > 8 ?
I fixed it for my Spring Boot application by adding from configuration to the generator. For vert.x the solution could look like this:
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>3.5.42</version>
<configuration>
<generator>
<config>
<vertx>
<from>fabric8/s2i-java:3.0-java11</from>
</vertx>
</config>
</generator>
</configuration>
</plugin>
Which tags are available for the s2i image can be looked up at the Docker Hub page: https://hub.docker.com/r/fabric8/s2i-java/tags
for me this solution from above didn't help but thanks of that! I've found out that I've to declare image in my profile definition. I'm running my openshift build like this: mvn clean fabric8:deploy -P openshift
What help me a lot was adding this to profile:
<properties>
<fabric8.generator.fromMode>docker</fabric8.generator.fromMode>
<fabric8.generator.from>fabric8/s2i-java:3.0-java11</fabric8.generator.from>
</properties>
Below part of my pom.xml have a look profile definition
<properties>
...
<java.version>11</java.version>
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
<fabric8-maven-plugin.version>4.4.1</fabric8-maven-plugin.version>
</properties>
<dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<release>${java.version}</release>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>openshift</id>
<properties>
<fabric8.generator.fromMode>docker</fabric8.generator.fromMode>
<fabric8.generator.from>fabric8/s2i-java:3.0-java11</fabric8.generator.from>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
<version>0.3.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>${fabric8-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>resource</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<enricher>
<config>
<f8-healthcheck-vertx>
<readiness>
<path>/actuator/health</path>
</readiness>
<liveness>
<path>/actuator/health</path>
</liveness>
</f8-healthcheck-vertx>
</config>
</enricher>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

Maven and mysql dependency

I currently have a project in which there is a build.xml. In this build, there is the command CreateDB, which calls something.jar. This jar run some sql script (mysql db). So, right now, I can run that command by executing
ant CreateDB
from the command line. But now, I need to do something more. When I am building my application (using Maven), I want to run that ant command. So, I create this pom.xml (see below), but it doesn't work, I got this error :
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'
According to this message, it seems that I don't have the connector for mySql, but I specified it in my dependency. So, what I did wrong ?
Pom.xml:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dl.test</groupId>
<artifactId>toto</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>toto</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.23</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>mysql</id>
<phase>integration-test</phase>
<configuration>
<tasks>
<!-- For MySql -->
<ant antfile="path\build.xml" target="createDB" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The ant task launched by the maven antrun plugin does not inherit the maven dependencies automatically.
You have to reference the maven test classpath explicitly in your build.xml code, which is available through the maven.test.classpath property.
So your execution might look similar to the following (test.classpath also needs to referenced in your build.xml):
<execution>
<id>mysql</id>
<phase>integration-test</phase>
<configuration>
<tasks>
<!-- For MySql -->
<property name="test_classpath" refid="maven.test.classpath"/>
<ant antfile="path\build.xml" target="createDB" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
See also: Maven AntRun Plugin - Referencing the Maven Classpaths

schema-codegen failed: A required class was missing while executing

I am getting the below error while trying to build an application. This is failing while running tests otherwise it is fine :
WARNING: Error injecting: org.jibx.maven.SchemaCodeGenMojo
java.lang.NoClassDefFoundError: org/jibx/runtime/JiBXException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
at java.lang.Class.getDeclaredConstructors(Class.java:1891)
[ERROR] Failed to execute goal org.jibx:maven-jibx-plugin:1.2.2:schema-codegen (generate-java-code-from-xml-schema) on project b2bservices-xml-api:
Execution generate-java-code-from-xml-schema of goal org.jibx:maven-jibx-plugin:1.2.2:schema-codegen failed: A required class was missing while executing org.jibx:maven-jibx-plugin:1.2.2:schema-codegen: org/jibx/runtime/JiBXException
My pom looks like :
<dependencies>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-bind</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<id>generate-java-code-from-xml-schema</id>
<phase>generate-sources</phase>
<goals>
<goal>schema-codegen</goal>
</goals>
<configuration>
<targetDirectory>${basedir}/src/main/java</targetDirectory>
<directory>${basedir}/src/main/resources/schemas</directory>
<includes>
<includes>xml_services.xsd</includes>
</includes>
<options>
<package>com.company.b2c.product.xml</package>
<prefer-inline>true</prefer-inline>
<show-schema>true</show-schema>
<binding-file-name>binding.xml</binding-file-name>
</options>
<verbose>true</verbose>
</configuration>
</execution>
</plugin>
</plugins>
</build>
Now this is getting failed during build process. Any assistance will be greatly appreciated.
You need to include the JiBX dependencies in your pom file:
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-run</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-extras</artifactId>
<version>1.2.5</version>
</dependency>
I would also recommend using a newer version of JiBX like 1.2.5.
Don Corley
JiBX contributor.

Scalatest html reports

I'm trying to get an html report of the scalatest and I've found a lot of configurations like this:
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0-M2</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<testFailureIgnore>true</testFailureIgnore>
<filereports>NCXEHLOWFD file/constrained.txt,file/full.txt</filereports>
<xmlreports>xml</xmlreports>
<htmlreports>html/report.html</htmlreports>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
But IntelliJ tells me that xmlreports and htmlreports are not allowed, and no xml or html reports are generated.
Can anyone suggest anything?
I'll be very thankful
You need to use the latest plugin version currently available 1.0-M4-SNAP1 instead of 1.0-M2 which doesn't have htmlreports property. Here are important part from my pom.xml:
<project>
<properties>
<scala.version>2.9.3</scala.version>
<scalatest.version>2.0.M5b</scalatest.version>
<scalatest.plugin.version>1.0-M4-SNAP1</scalatest.plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>${scalatest.plugin.version}</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
<htmlreporters>${project.build.directory}/html/scalatest</htmlreporters>
<testFailureIgnore>false</testFailureIgnore>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.version}</artifactId>
<version>${scalatest.version}</version>
<scope>test</scope>
</dependency>
<!-- required by scalatest-maven-plugin to generate HTML report -->
<dependency>
<groupId>org.pegdown</groupId>
<artifactId>pegdown</artifactId>
<version>1.2.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
With this setting I can run mvn clean install and it will produce nice HTML report under ${project.build.directory}/html/scalatest
#rozky's solution works for me but the css is awkward. It doesn't display the table correctly. It doesn't show me the suite name column in the table no matter what version of pegdown and scalatest-maven-plugin I use :/

Error with Maven GAE Plugin + Google Cloud SQL

Here's my plugin configuration:
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.7.3</version>
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<configuration>
<jvmFlags>
<jvmFlag>-Drdbms.server=local</jvmFlag>
<jvmFlag>-Drdbms.driver=com.mysql.jdbc.Driver</jvmFlag>
<jvmFlag>-Drdbms.url=jdbc:mysql://localhost:3306/prova?user=root&password=pass</jvmFlag>
</jvmFlags>
<serverId>appengine.google.com</serverId>
</configuration>
</plugin>
You can read more here: https://developers.google.com/cloud-sql/docs/developers_guide_java
First I had this trivial error, doing mvn gae:run
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
So I added the "real" driver to my pom.xml:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
with no results. The error remains the same.
Part of the stacktrace:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at com.google.appengine.tools.development.DevAppServerClassLoader.loadClass(DevAppServerClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:84)
at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.init(LocalRdbmsServiceLocalDriver.java:73)
at com.google.appengine.api.rdbms.dev.LocalRdbmsService.init(LocalRdbmsService.java:85)
edit:
My new plugin conf:
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.9.2</version>
<dependencies>
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
</dependencies>
<configuration>
<jvmFlags>
<jvmFlag>-Drdbms.server=local</jvmFlag>
<jvmFlag>-Drdbms.driver=com.mysql.jdbc.Driver</jvmFlag>
<jvmFlag>-Drdbms.url=jdbc:mysql://localhost:3306/prova?user=root&password=pass</jvmFlag>
</jvmFlags>
<serverId>appengine.google.com</serverId>
<!-- <sdkDir>${appengine.sdk.root}</sdkDir> -->
<!-- <appDir>${basedir}/war</appDir> -->
</configuration>
</plugin>
Ok I solved. I manually put mysql-connector-java-5.1.18-bin.jar in my sdk folder:
file:///opt/appengine-java-sdk-1.6.0/lib/impl/
Error changes in a more comfortable:
java.sql.SQLException: Access denied for user 'root'#'localhost' (using password: YES)
Thank you for suggestions however
Or you can use maven-antrun-plugin do it for you at build time. No more manual intervention for your project team (I use this with the offical appengine-maven-plugin, you need to adapt the path for use with maven-gae-plugin) :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<!-- Use 'package' instead of 'install' if you want the Driver to be available for 'integration-test' -->
<phase>package</phase>
<configuration>
<target>
<!-- delete existing mysql jar from appengine sdk lib/impl -->
<delete>
<fileset
dir="${settings.localRepository}/com/google/appengine/appengine-java-sdk/${appengine.target.version}/appengine-java-sdk/appengine-java-sdk-${appengine.target.version}/lib/impl"
includes="**/mysql-connector-java*" />
</delete>
<!-- copy mysql jar into appengine sdk lib/impl -->
<copy
file="${settings.localRepository}/mysql/mysql-connector-java/${mysql.version}/mysql-connector-java-${mysql.version}.jar"
todir="${settings.localRepository}/com/google/appengine/appengine-java-sdk/${appengine.target.version}/appengine-java-sdk/appengine-java-sdk-${appengine.target.version}/lib/impl"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Did you add this to the plugins' dependencies as well ?
If it is the plugin's classpath it should be picked up by GAE.