[英]Different behavior of gwt-maven-plugin in IDE and commandline
I am using the gwt-maven-plugin and since recently I got strange errors in my IDE (eclipse oxygen). 我正在使用gwt-maven-plugin,因为最近我在IDE中遇到了奇怪的错误(日食氧气)。 After researching it I realize that the gwt-maven-plugin is behaving differently when run in eclipse or on commandline.
经过研究后,我意识到gwt-maven-plugin在eclipse或命令行中运行时的行为有所不同。 On commandline everything is ok and the gwt:css creates an interface with the correct visisbility (public).
在命令行上,一切正常,并且gwt:css创建一个具有正确可见性的接口(公共)。 But when I run it in eclipse the
public
is missing and thus I get all the errors in eclipse since the classes can not access the interface anymore. 但是当我在eclipse中运行它时,
public
却不见了,因此我遇到了eclipse中的所有错误,因为这些类不再可以访问该接口了。 I am using gwt 2.6.1, JDK 1.8.0 (but build itself is with 1.6) and maven 3.5.2. 我正在使用gwt 2.6.1,JDK 1.8.0(但构建本身是1.6)和maven 3.5.2。
Any ideas what is causing this? 任何想法是什么原因造成的?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>css</goal>
<goal>generateAsync</goal>
<goals>
</execution>
</executions>
<configuration>
<skip>${gwt.skipcompile.config}</skip>
<inplace>true</inplace>
<module>${gwt.module.config}</module>
<runTarget>Config.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
<compileReport>true</compileReport>
<cssFiles>
<cssFile>MyCss.css</cssFile>
</cssFiles>
//And the code is generated like this (eclipse):
interface MyCss extends CssResource ...
//in command line
public interface MyCss extends CssResource ...
The gwt-maven-plugin
delegates to GWT InterfaceGenerator and it doesn't add the public
modifier. gwt-maven-plugin
委托给GWT InterfaceGenerator ,并且不添加public
修饰符。 You can see the git-log and confirm that this has been always the case (already reported sometimes ). 您可以查看git-log并确认情况一直如此( 有时已经报告过)。 So, you cannot be executing the plugin goal from the command line, you should be using something different.
因此,您不能从命令行执行插件目标,而应使用其他方法。 For example, you might have a script that adds the
public
modifier using awk
(or something similar), and this is not executed from eclipse. 例如,您可能有一个脚本,该脚本使用
awk
(或类似方法)添加public
修饰符,而这不是从eclipse执行的。
Side note: You really should upgrade GWT and gwt-maven-plugin
. 旁注:您确实应该升级GWT和
gwt-maven-plugin
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.