【问题标题】:Replace Maven Site Plugin with GWT Compile Plugin用 GWT 编译插件替换 Maven 站点插件
【发布时间】:2011-07-31 07:05:29
【问题描述】:

我已经成功设置了一些使用 Maven 将 Maven 生成的站点自动部署到其 git 存储库的 gh-pages 分支的项目。然后 GitHub 在个人子域的公共 URL 上提供这些文件。我希望利用此功能为富客户端仅 GWT 应用程序提供服务。

我已修改我的pom.xml 以将GWT 应用程序编译到target/site/ 目录。我仍在努力实现的两个主要目标是:

  • 如何防止标准 Maven 站点插件在 site 阶段运行?
  • gwt:compilesite 阶段执行需要什么?

【问题讨论】:

  • 你成功地让它工作了吗?

标签: gwt maven-2 maven maven-plugin maven-site-plugin


【解决方案1】:

可以通过为插件指定新的执行来将目标绑定到阶段。我假设你有一些自定义的东西可以让大部分工作正常工作,所以我只关注将插件目标绑定到特定阶段的工作。

<plugin>
  <artifactId>gwt-maven-plugin</artifactId>
  ...
  <executions>
    <execution>
      <id>gwt-site</id>
      <phase>site</phase><!-- phase to bind to -->
      <goals>
        <goal>compile</goal><!-- goal to run in that phase -->
      </goals>
      <configuration>
        <!-- Your magic configuration stuff goes here -->
      </configuration>
    </execution>
    <!-- Possible other executions might be defined here -->
  </executions>
</plugin>

阻止默认的 maven 站点运行更有趣,因为它是一个阶段,绑定了各种目标。通过显式指定没有目标的执行,可以防止标准站点:站点目标在站点阶段运行。这可能从 maven 2 到 3 略有不同,所以我将在这里稍微概括一下。查看您的构建日志以查看当前在执行 ID、组/工件 ID 方面指定的内容,以纠正我的示例中可能出现的疏忽:

<plugin>
  <artifactId>maven-site-plugin</artifactId>
  ...
  <executions>
    <execution>
      <phase>site</phase>
      <goals></goals><!-- This is empty to indicate that no goals should be run in this phase -->
    </execution>
  </executions>
</plugin>

【讨论】:

    猜你喜欢
    • 2014-06-23
    • 1970-01-01
    • 1970-01-01
    • 2011-04-16
    • 2018-05-29
    • 1970-01-01
    • 1970-01-01
    • 2012-03-14
    • 2014-05-03
    相关资源
    最近更新 更多