【问题标题】:How to change GWT.xml with maven profile by a GWT project如何通过 GWT 项目使用 Maven 配置文件更改 GWT.xml
【发布时间】:2011-11-02 12:23:23
【问题描述】:

目前,我正在从事一个 gwt-maven 项目。与每个 GWT 项目一样,它具有以下 gwt.xml

<module rename-to='myProject'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
   .
   .    
   ...

我创建了另一个 gwt.xml 来设置持续集成的配置。 (定义为here。)

<module rename-to='myProject'>
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.myCompany.myProject' />
   .
   .    
   ...

这是我用来管理配置文件和更改 gwt.xml 的 pom。

<profile>
  <id>ci</id>
    <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
          <configuration>
                  <module>com.myCompany.myProject</module>
                  <style>OBF</style>
          </configuration>
      </plugin>
    </plugins>
 </build>

</profile>

如果我尝试使用配置文件 ci (mvn package -Pci) 打包项目,我会收到以下错误。

[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.3.0-1:compile (default) on project MyProject: GWT Module com.myCompany.myProject not found in project sources or resources. -> [Help 1]

我该如何解决?

【问题讨论】:

    标签: gwt maven profile


    【解决方案1】:

    如果您的模块文件位于 src/main/resources/com/myCompany/ 编译器应该会找到您的模块。你能确认一下吗?

    顺便说一下,按照惯例,GWT 模块名称以大写字母开头。

    【讨论】:

    • 我只有一个模块/一个项目。我的目标只是使用配置文件更改 Jenkins 上的一些 gwt 配置。
    • 我按照您发布的链接中描述的程序进行操作,对我来说效果很好。我的两个模块都位于同一个地方......我的开发模块继承自生产模块并覆盖了一些属性以加快编译速度。效果很好!!!我必须感谢您发布该链接!我厌倦了根据我想要的是开发版还是产品版来修改属性!我希望它也适用于您...确保您的文件中没有任何拼写错误...可能就是这样!
    • 确认链接中提供的解决方案在 2k20 中也适用于我 :)
    猜你喜欢
    • 2013-01-07
    • 2012-05-20
    • 2012-01-12
    • 2012-08-06
    • 2012-02-18
    • 2012-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多