GWT Debug mode with MYSQL
eggp May 23, 2014 4:01 PMHello!
Sorry, I little speak english
I use GWT 3 years ago... find erraiframework, this is super framework, has solved all my problems are difficult to use...
I read the tutorial and docs... following maven import tutorial (errai-tutorial, GITHUB)...
Now I'm learning Maven. I would like to add the MYSQL driver and datasource with maven... I tried following the documentation... but it didn't work :((
Please help me settings maven file...
my persistence file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="localDSunit"> <!-- <provider>org.hibernate.ejb.HibernatePersistence</provider> --> <jta-data-source>java:jboss/datasources/localDS</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> </properties> </persistence-unit> </persistence>
and my pom.xml
<?xml version="1.0" encoding="UTF-8"?> <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>test.errai</groupId> <artifactId>test-errai</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>test</name> <properties> <errai.version>3.0-SNAPSHOT</errai.version> <gwt.version>2.5.1</gwt.version> <slf4j.version>1.5.11</slf4j.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <javaee.version>3.0.2.Final</javaee.version> <errai.dev.context>${project.artifactId}</errai.dev.context> <as.version>7.1.1.Final</as.version> <!-- Add the absolute path for $JBOSS_HOME below to manage another instance --> <errai.jboss.home>${project.build.directory}/jboss-as-${as.version}</errai.jboss.home> <mysql.version>5.1.30</mysql.version> <datasource.name>java:jboss/datasources/localDS</datasource.name> <database.name>databasename</database.name> <server.name>localhost</server.name> <username>root</username> <password></password> <pool.name>myPool</pool.name> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.errai.bom</groupId> <artifactId>errai-version-master</artifactId> <version>${errai.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-parent</artifactId> <version>${errai.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>${javaee.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-core</artifactId> <version>1.1.5.Final</version> </dependency> <dependency> <groupId>org.jboss.weld.servlet</groupId> <artifactId>weld-servlet-core</artifactId> <version>1.1.5.Final</version> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-cdi-jboss</artifactId> <version>${errai.version}</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-javaee-all</artifactId> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-cordova</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>${javaee.version}</version> <type>pom</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-cdi-jboss</artifactId> </dependency> </dependencies> <repositories> <repository> <id>JBOSS_NEXUS</id> <url>http://repository.jboss.org/nexus/content/groups/public</url> </repository> </repositories> <build> <finalName>${project.artifactId}</finalName> <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory> <pluginManagement> <plugins> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <versionRange>[2.4.0,)</versionRange> <goals> <goal>resources</goal> </goals> </pluginExecutionFilter> <action> <skip /> </action> </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <versionRange>[2.1,)</versionRange> <goals> <goal>unpack</goal> </goals> </pluginExecutionFilter> <action> <ignore></ignore> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>${gwt.version}</version> <executions> <execution> <goals> <goal>compile</goal> </goals> </execution> </executions> <configuration> <extraJvmArgs>-Xmx712m -XX:CompileThreshold=7000 -XX:MaxPermSize=1280M -Derrai.jboss.home=${errai.jboss.home} -Derrai.dev.context=${errai.dev.context} -Derrai.jboss.javaagent.path=${settings.localRepository}/org/jboss/errai/errai-client-local-class-hider/${errai.version}/errai-client-local-class-hider-${errai.version}.jar</extraJvmArgs> <logLevel>INFO</logLevel> <noServer>false</noServer> <server>org.jboss.errai.cdi.server.gwt.JBossLauncher</server> <disableCastChecking>true</disableCastChecking> <runTarget>${errai.dev.context}/index.html</runTarget> <soyc>false</soyc> <hostedWebapp>src/main/webapp</hostedWebapp> </configuration> </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>2.4.1</version> <configuration> <filesets> <fileset> <directory>${basedir}</directory> <includes> <include>src/main/webapp/app/</include> <include>src/main/webapp/WEB-INF/deploy/</include> <include>src/main/webapp/WEB-INF/lib/</include> <include>**/gwt-unitCache/**</include> <include>.errai/</include> </includes> </fileset> </filesets> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <!-- Unpack jboss-as from maven. Remove this if you wish to use your own jboss/wildfly instance. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>process-resources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-dist</artifactId> <version>${as.version}</version> <type>zip</type> <overWrite>false</overWrite> <outputDirectory>${project.build.directory}</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> <profiles> <profile> <id>jboss7</id> <activation> <activeByDefault>true</activeByDefault> </activation> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <packagingExcludes>**/javax/**/*.*,**/client/local/**/*.class</packagingExcludes> <outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping> </configuration> </plugin> <plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> <version>${as.version}</version> <!-- <extensions>false</extensions> --> <executions> <execution> <id>deploy-mysql</id> <phase>package</phase> <goals> <goal>deploy-artifact</goal> </goals> <configuration> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <name>mysql.jar</name> </configuration> </execution> <execution> <id>add-datasource</id> <phase>install</phase> <goals> <goal>add-resource</goal> </goals> <configuration> <address>subsystem=datasources</address> <resources> <resource> <address>xa-data-source=${datasource.name}</address> <enable-resource>true</enable-resource> <properties> <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> <jndi-name>${datasource.name}</jndi-name> <enabled>true</enabled> <pool-name>${pool.name}</pool-name> <driver-name>mysql.jar</driver-name> </properties> </resource> <resource> <address>xa-data-source=${datasource.name}S,xa-datasource-properties=DatabaseName</address> <properties> <value>${database.name}</value> </properties> </resource> <resource> <address>xa-data-source=${datasource.name},xa-datasource-properties=ServerName</address> <properties> <value>${server.name}</value> </properties> </resource> <resource> <address>xa-data-source=${datasource.name},xa-datasource-properties=User</address> <properties> <value>${username}</value> </properties> </resource> <resource> <address>xa-data-source=${datasource.name},xa-datasource-properties=Password</address> <properties> <value>${password}</value> </properties> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-jboss-as-support</artifactId> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava-gwt</artifactId> <scope>provided</scope> </dependency> <!-- <dependency> --> <!-- <groupId>hsqldb</groupId> --> <!-- <artifactId>hsqldb</artifactId> --> <!-- <scope>provided</scope> --> <!-- </dependency> --> <dependency> <groupId>javax.annotation</groupId> <artifactId>jsr250-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>javax.inject</groupId> <artifactId>javax.inject</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <classifier>sources</classifier> <scope>provided</scope> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate.common</groupId> <artifactId>hibernate-commons-annotations</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <classifier>sources</classifier> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-cdi-jboss</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-codegen-gwt</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-data-binding</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-javax-enterprise</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-jaxrs-client</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-jpa-client</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-navigation</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-tools</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-ui</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.errai</groupId> <artifactId>errai-html5</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>jaxrs-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.spec.javax.interceptor</groupId> <artifactId>jboss-interceptors-api_1.1_spec</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.spec.javax.transaction</groupId> <artifactId>jboss-transaction-api_1.1_spec</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.weld.servlet</groupId> <artifactId>weld-servlet-core</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-core</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-codec-http</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-naming</artifactId> <scope>provided</scope> </dependency> </dependencies> </profile> <profile> <id>mobile</id> <build> <plugins> <plugin> <groupId>org.jboss.errai</groupId> <artifactId>cordova-maven-plugin</artifactId> <version>${errai.version}</version> <executions> <execution> <id>build</id> <phase>package</phase> <goals> <goal>build-project</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <pluginRepositories> <pluginRepository> <id>snapshots.jboss.org</id> <name>JBoss Snapshot Repository</name> <url>http://snapshots.jboss.org/maven2</url> <layout>default</layout> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> </project>
Thanks!
Egg!