我正在尝试使用visualizationsForVaadin插件。问题是,我必须编译自定义widgetSet。我整天都在处理这个问题,但仍然无法编译它。首先,这是我的配置:
以下依赖项在我的pom文件中:
当我尝试使用maven gwt插件编译widgetSet时,我得到一个异常:
Loading inherited module 'com.google.gwt.core.XSLinker'
[ERROR] Line 22: Unexpected element 'when-linker-added'
[ERROR] Failure while parsing XML
有趣的是,自动加载的gwt-dev库(据我所知)是版本2.0.3 我尽一切可能(甚至不可能),但仍然没有。在某些时候,我有其他例外抱怨无法解决验证类的导入。我认为,这已被其他一些依赖项解决了。请帮忙。谢谢。
POM配置:
<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>
以下是GWT依赖项
<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>
答案 0 :(得分:3)
你需要什么:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${versions.vaadin}</version>
</dependency>
按如下方式配置gwt-maven-plugin(当然,您可能不需要我使用的所有配置):
<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>
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>
您可能还想配置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>
在servlet的web.xml中(以Ace Editor为例):
<init-param>
<param-name>widgetset</param-name>
<param-value>org.vaadin.aceeditor.AceEditorWidgetSet</param-value>
</init-param>
请注意,我没有在我的pom.xml中包含gwt作为依赖项。
答案 1 :(得分:1)
我在Eclipse中有一个功能齐全的Vaadin项目和自定义小部件,我在项目的任何地方都找不到对gwt-dev的任何引用。转到项目属性 - &gt; Java构建路径 - &gt;库并删除对gwt-dev的所有引用。还要从pom.xml中删除它并尝试重新编译widgetset。
编辑:它也可能是您的gwt-user
依赖项。尝试将gwt-user
的版本设置为2.3.0(如果已经不是),并将范围设置为provided
。