Simply GWT 2.3 and Maven2(3) project in Eclipse Indigo - eclipse

When I try to create Maven project with this parameters:
Archetype Group Id - org.codehaus.mojo;
Archetype Artifact Id - gwt-maven-plugin;
Archetype Version - 2.3.0-1.
I get some strange errors:
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:gwt-maven-plugin:2.3.0-1:generateAsync (execution: default, phase: generate-sources)
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:gwt-maven-plugin:2.3.0-1:i18n (execution: default, phase: generate-sources)
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-war-plugin:2.1.1:exploded (execution: default, phase: compile)
And some warnings as:
Implementation of project facet jst.web could not be found. Functionality will be limited.
Implementation of project facet wst.jsdt.web could not be found. Functionality will be limited.
This is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>net.test1</groupId>
<artifactId>TestWebApp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.3.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0-1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see
gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<runTarget>TestWebApp.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>net.test1.TestWebApp.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And so on. What is this? I have tried all possible manuals on the Internet, and everywhere the same. I tried to create project manualy without eclipse and the same. I think, the problem is that manuals in the Internet was writing for old version of Eclipse, Maven, GWT. How can I beat it? How can I just create simple project with GWT 2.3, Maven2 plugin and Eclipse Indigo without errors end warnings?

This is known behavior, discussed on the eclipse wiki. See here: http://wiki.eclipse.org/M2E_plugin_execution_not_covered.
Don't just comment out the problematic sections of your pom, you really do need them. For instance The generated comment for that maven-war-plugin in the pom is "Copy static web files before executing gwt:run" This turns out to be true. If you comment out that plugin and "mvn clean gwt:run", static files will not be copied to the target folder and be unavailable to hosted mode.
Fortunately the workaround is easy. If you open up the pom in Eclipse, look in the Overview section, and click the error message at the top, it will give you some quick fix options. Such as "Permanently mark goal exploded in pom.xml as ignored." This will add some m2e configuration to your pom so it is no longer flagged as an error, and everything will work as before. The newly generated section in your pom is what is described in the link above as the "ignore" option.
Hope this helps.

Related

The POM for jar is invalid, transitive dependencies will not be available

I want to provide external dependency to my maven project in eclipse. Therefore, I ave copied the jar file and its POM.xml directly in the local Maven Repository. But somehow Eclipse is complaining that the POM for the jar is invalid.
My pom.xml for jar file in local Repository looks like below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.b.t</groupId>
<artifactId>v-parent</artifactId>
<version>3.9.0</version>
</parent>
<scm>
<developerConnection>scm:svn:url/</developerConnection>
</scm>
<artifactId>v-p</artifactId>
<version>1.1.0</version>
<name>p</name>
<build>
<plugins>
<!-- Plugin required to build java classes from XSD using XJC -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<arguments>-npa</arguments>
<schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
<packageName>com.b.t.v.fusion.p.generated</packageName>
<schemaFiles>pConfig.xsd</schemaFiles>
<outputDirectory>${basedir}/target/generated-sources</outputDirectory>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!-- Plugin required to add the generated sources to the classpath -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.b.t</groupId>
<artifactId>v-fusioninterface</artifactId>
</dependency>
<dependency>
<!-- FFT -->
<groupId>com.github.wendykierp</groupId>
<artifactId>JTransforms</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<!-- Reading and writing of MATLAB files -->
<groupId>net.sourceforge.jmatio</groupId>
<artifactId>jmatio</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>doclint-java8-disable</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I have already checked similar posts and have done necessary changes in eclipse.ini (specifying JDK's JRE as vmargs n all). My dependency in MAven Project looks like below:
<dependency>
<groupId>com.b.t</groupId>
<artifactId>v-p</artifactId>
<version>1.1.0</version>
</dependency>
Please note that the same jar file with corresponding POM.xml is working well for my colleague in Intellij.
I am using Eclipse Luna just for info. I also have checked in my Eclipse that the Installed JRE is jdk1.8.0_144.
Also I am getting the same error when I use mvn clean install on command prompt.
Could someone please suggest what can I check more ?
You cannot just copy the files into your local repo, you need to install them. There are instructions here: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
In your case is would be something like:
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

NoClassDefFoundError While using Eclipse Cloud Foundry Plugin

So I have a maven project that I eventually build into a jar that looks like:
C:\Users\myTest\TESTJAR-1.0-jar-with-dependencies.jar
If I push to cloud foundry using command line it deploys fine:
cf push newProject -p C:\Users\myTest\TESTJAR-1.0-jar-with-dependencies.jar
However, when I trying deploying from Eclipse using the plugin, I get the following
'java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory'
Any help would be appreciated
POM.xml
` <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test.myTest</groupId>
<artifactId>TESTJAR</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- http://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>com.github.lalyos</groupId>
<artifactId>jfiglet</artifactId>
<version>0.0.7</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.8</version>
</dependency>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.3</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.myTest.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>'
Jar-packaged applications can be pushed to Cloud Foundry using Eclipse Cloud Foundry Tools (CFT) in two ways:
Specifying a manifest YAML file at top level in your Eclipse Maven project that points to jar in the file system that you want to push, using the “path" attribute. For example, in a workspace project, MyTestMavenProject, you’d have something like:
MyTestMavenProject/manifest.yml
with the contents of the manifest file
---
applications:
- name: testjarapp
path: C:\Users\myTest\TESTJAR-1.0-jar-with-dependencies.jar
Drag and drop the project containing this manifest file to a Cloud Foundry target in the Eclipse Servers view.
Drag/drop the Maven project without a manifest file, and CFT will automatically package the application prior to pushing to Cloud Foundry. However, this mechanism has some known issues for jar-packaged apps. In some cases, the project needs to be refreshed manually prior to drag/drop:
Refresh the project (typically F5)
Right-click on project: Maven -> Update Project
Drag/drop the Maven project onto the CF target in Servers view again to see if it deploys correctly
There is a bug that is tracking the issue here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=495814
CFT milestones are released roughly every 6 weeks, so the next milestone after Eclipse Neon (4.6) will have various bug fixes and improvements for the deployment of jar-packaged applications.

GWT maven project with server side dependencies

I have a maven GWT project under eclipse and since I added some server side dependencies the maven plugin doesn't compile anymore. Here follows more info about the context:
maven 3.0.3;
GWT 1.5.3;
GWT maven plugin org.codehaus.mojo:gwt-maven-plugin:1.2 (the latest compatible with GWT 1.5.3, http://mojo.codehaus.org/gwt-maven-plugin-1.2/).
The goal gwt:compile of the GWT maven plugin completes successfully if I don't add dependencies other than the GWT ones:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
When I add any other dependency, the goal gwt:compile fails:
[INFO] establishing classpath list (scope = compile)
[ERROR] Exception in thread "main" java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.Compiler.<init>(Lorg/eclipse/jdt/internal/compiler/env/INameEnvironment;Lorg/eclipse/jdt/internal/compiler/IErrorHandlingPolicy;Lorg/eclipse/jdt/internal/compiler/impl/CompilerOptions;Lorg/eclipse/jdt/internal/compiler/ICompilerRequestor;Lorg/eclipse/jdt/internal/compiler/IProblemFactory;)V
[ERROR] at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.<init>(JdtCompiler.java:93)
[ERROR] at com.google.gwt.dev.javac.JdtCompiler.<init>(JdtCompiler.java:231)
[ERROR] at com.google.gwt.dev.javac.JdtCompiler.compile(JdtCompiler.java:193)
[ERROR] at com.google.gwt.dev.javac.CompilationState.compile(CompilationState.java:115)
[ERROR] at com.google.gwt.dev.GWTCompiler.distill(GWTCompiler.java:327)
[ERROR] at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:564)
[ERROR] at com.google.gwt.dev.GWTCompiler.run(GWTCompiler.java:554)
[ERROR] at com.google.gwt.dev.GWTCompiler.main(GWTCompiler.java:214)
I did search a configuration parameter about classpath/dependencies in the gwt:compile (http://mojo.codehaus.org/gwt-maven-plugin-1.2/compile-mojo.html) with no success.
I would like to use server side dependencies alongside GWT ones telling the GWT plugin to not consider the non-GWT dependencies.
working pom (gwt:compile completes successfully):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>projectname</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>project name</name>
<organization>
<name>My company</name>
<url>my company url</url>
</organization>
<properties>
<gwt.version>1.5.3</gwt.version>
</properties>
<build>
<finalName>final name</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<ajdtVersion>none</ajdtVersion>
</configuration>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>org.mycompany.myproject.Main/welcomeGWT.html</runTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
not working pom (gwt:compile throws exception):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>projectname</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>project name</name>
<organization>
<name>My company</name>
<url>my company url</url>
</organization>
<properties>
<gwt.version>1.5.3</gwt.version>
</properties>
<build>
<finalName>final name</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<ajdtVersion>none</ajdtVersion>
</configuration>
<version>2.9</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>org.mycompany.myproject.Main/welcomeGWT.html</runTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.6.0</version>
</dependency>
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Are you using JasperReport in our project? I remember having a problem using JasperReport and GWT. JasperReport includes a different version of the org.eclipse.jdt.internal.compiler.Compiler than what GWT is expecting.
I think you can fix this by simply changing the order of the class path (was already suggested in the comments). If that does not help, try to update your GWT version. Or try to find a version of JasperReport which includes a version of the org.eclipse.jdt.internal.compiler.Compile class that works with GWT.
I faced a similar error in our QA Linux environment during deployment of our web application and we managed to fix it. This problem wasn't even there when I deployed into my local Windows 10 and Linux Ubuntu virtual machine. My environment configuration is as follows
Ubuntu 16.04 LTS
Apache Maven 3.3.3
Apache Tomcat/8.0.32 (Ubuntu)
JVM 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14
The problem was because there were two eclipse Compiler classes that were found in two different jar files, and this creates conflicts in the classpath during tomcat deployment. The culprits are files ecj.jar and jdtcore.jar
My original pom.xml snipet is as below
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.3.0.Final</version>
</dependency>
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>3.1.3</version>
</dependency>
The Maven dependency tree for drools-compiler introduces ecj.jar file.
The Maven dependency for dynamicreports-core.jar file that has jasperreports.jar that in turn introduces jdtcore.jar file.
Solution:
We upgraded the version of dynamicreports-core that introduces jasperreports.jar file.
Note:
I was able to fix this issue after reading http://www.cnblogs.com/xiaoMzjm/p/4566672.html. Credits to this blogger.
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>4.1.0</version>
</dependency>

How to compile a widgetSet in vaadin?

I am trying to use the visualizationsForVaadin add-on. The problem is, that I have to compile a custom widgetSet. I've been dealing with this the whole day, and still cannot compile it. First of all, here is my configuration:
Vaadin 6.7.1
gwt 2.3.0
following dependencies are in my pom file:
gwt-ajaxloader 1.1.0
validation-api 1.0.0.GA
gwt-visualization 1.0.2
gwt-user 2.3.0
visualizationsforvaadin 1.1.2.
When I try to compile the widgetSet with maven gwt plugin I get an exception:
Loading inherited module 'com.google.gwt.core.XSLinker'
[ERROR] Line 22: Unexpected element 'when-linker-added'
[ERROR] Failure while parsing XML
An interesting thing is, that the gwt-dev library, that is automatically loaded (as far as I know) is of version 2.0.3
I have tried everything possible (even impossible) and still nothing. At some point I had other exceptions complaining that the import of validation classes could not be resolved. I think, that has been resolved by some other dependencies. Please help. Thank you.
POM configuration:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- Version 2.1.0-1 works at least with Vaadin 6.5 -->
<version>2.3.0</version>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!--modules>
..
</modules-->
<webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets</webappDirectory>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<runTarget>clean</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
<noServer>true</noServer>
<port>8080</port>
<soyc>false</soyc>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
And here are the GWT dependencies
<dependency>
<groupId>com.google.gwt.google-apis</groupId>
<artifactId>gwt-visualization</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>com.google.gwt.google-apis</groupId>
<artifactId>gwt-ajaxloader</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>visualizationsforvaadin</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
I struggled with this over the past 2 days.
For future reference:
What you'll need:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${versions.vaadin}</version>
</dependency>
Configure gwt-maven-plugin as follows (you may not need all configs that I used, of course):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${versions.gwt}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets
</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets
</hostedWebapp>
<noServer>true</noServer>
<draftCompile>true</draftCompile>
<compileReport>false</compileReport>
<style>DETAILED</style>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
The vaadin-maven-plugin:
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${versions.vaadin}</version>
<executions>
<execution>
<configuration>
<!--<modules>
<module>org.vaadin.aceeditor.AceEditorWidgetSet</module>
</modules>-->
</configuration>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
You may also want to configure your maven-clean-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>
${basedir}/src/main/webapp/VAADIN/widgetsets
</directory>
</fileset>
</filesets>
</configuration>
</plugin>
In web.xml for your servlet (Ace Editor as an example):
<init-param>
<param-name>widgetset</param-name>
<param-value>org.vaadin.aceeditor.AceEditorWidgetSet</param-value>
</init-param>
Note that I did NOT include gwt as a dependency in my pom.xml.
I have a fully functional Vaadin project with custom widgets in Eclipse and I can't find any references to gwt-dev anywhere in the project. Go to Project properties -> Java Build Path -> Libraries and delete all references to gwt-dev. Also remove it from your pom.xml and try to recompile the widgetset.
edit: It could also be your gwt-user dependency. Try setting the version of gwt-user to 2.3.0 (if it already isn't) and set the scope to provided.

Create a GWT Maven Project

I'm trying to create a new project with Eclipse in order to create GWT application under maven 2 system.
I have create the project with the follow mvn command
mvn archetype:generate -DarchetypeRepository=repo1.maven.org -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.3.0
I have installed the follow eclipse plugins:
* m2eclipse
* egit
* gwt plugin
Here my POM file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.mobc3.paperquid</groupId>
<artifactId>Backoffice</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.3.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>Backoffice.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.mobc3.paperquid.backoffice.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
I can compile and deploy my application using the linux shell but I have many problems to build and run the application inside eclipse.
I haven't found any tutorial that explain how to create step by step a GWT application under maven inside eclipse.
Can someone help me?
One more option:
Make a gwt project by using the gwt plugin in Eclipse. Now you have an Eclipse gwt project.
Select the project in Project Explorer, right-click it, then choose Configure. Then select Convert to Maven Project. Now you get a gwt-maven project.
Now add necessary dependencies to pom.xml.
Here is the relevant (I think) section from my pom setup when I was running my GWT app with the gwt:run goal:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0</version>
<configuration>
<runTarget>/ModuleName.html</runTarget>
<modules>
<module>${project.groupId}.package.ModuleName</module>
</modules>
<copyWebapp>true</copyWebapp>
</configuration>
<executions>
<execution>
<configuration>
<extraParam>true</extraParam>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I should say, though, that I now use the GWT Eclipse Plugin to run my app within Eclipse, so it's been a while since I used this configuration. From what I remember reading, the "copyWebapp" "true" is one of the key pieces of configuration. It also helped me to specify the module name directly, because the gwt-maven-plugin sometimes had problems locating it.