【问题标题】:Different behavior of gwt-maven-plugin in IDE and commandlineIDE 和命令行中 gwt-maven-plugin 的不同行为
【发布时间】:2019-07-22 22:56:27
【问题描述】:

我正在使用 gwt-maven-plugin,最近我的 IDE(日食氧气)中出现了奇怪的错误。经过研究,我意识到 gwt-maven-plugin 在 eclipse 或命令行中运行时的行为不同。 在命令行上一切正常,gwt:css 创建了一个具有正确可见性(公共)的界面。但是当我在 eclipse 中运行它时,public 丢失了,因此我在 eclipse 中得到了所有错误,因为类不能再访问接口了。我正在使用 gwt 2.6.1、JDK 1.8.0(但构建本身是 1.6)和 maven 3.5.2。

任何想法是什么原因造成的?

<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 ...

【问题讨论】:

    标签: java gwt gwt-maven-plugin


    【解决方案1】:

    gwt-maven-plugin 代表 GWT InterfaceGenerator,它不添加 public 修饰符。您可以查看 git-log 并确认情况一直如此(已报告 sometimes)。所以,你不能从命令行执行插件目标,你应该使用不同的东西。例如,您可能有一个使用awk(或类似的东西)添加public 修饰符的脚本,而这不是从eclipse 中执行的。

    旁注:您确实应该升级 GWT 和 gwt-maven-plugin

    【讨论】:

    • 感谢您的信息!但它似乎没有在较新的版本中修复,是吗?仍然很奇怪,因为如果我从命令行执行它,它就可以工作。但据我所知,它不应该......
    • 但是你在执行 mvn 目标吗?并且,是否有一些 Maven 配置文件?或者你能显示整个 pom.xml 配置吗?
    猜你喜欢
    • 2018-11-22
    • 2014-12-25
    • 1970-01-01
    • 2019-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多