用 GWT 编译插件替换 Maven 站点插件

发布于 2024-10-31 01:27:26 字数 360 浏览 5 评论 0原文

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

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

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

I have successfully set up a few projects which use Maven to automatically deploy the Maven-generated site to the gh-pages branch of their git repository. GitHub then serves these files at a public URL on a personal subdomain. I'm looking to utilize this functionality to serve a rich client-side only GWT application.

I have modified my pom.xml to compile the GWT application to the target/site/ directory. The two main goals I am still attempting to achieve are:

  • How do I prevent the standard Maven site plugin from running during the site phase?
  • What is required so gwt:compile executes during the site phase?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云朵有点甜 2024-11-07 01:27:26

可以通过为插件指定新的执行来将目标绑定到阶段。我假设您已经拥有一些使大部分工作正常工作所需的自定义内容,因此我将重点关注如何将插件目标绑定到特定阶段。

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

A goal can be bound to a phase by specifying a new execution for the plugin. I'm assuming you've got some custom stuff you need to make most of this work correctly, so I'm just going to focus on what should work to bind a plugin goal to a particular phase.

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

Preventing the default maven site from being run is more interesting, as it is a phase, with a variety of goals bound to it. The standard site:site goal can be prevented from running in the site phase by explicitly specifying an execution with no goals. This may vary slightly from maven 2 to 3, so I'm going to be a little general here. Take a look at your build logs to see what is currently specified in terms of execution id, group/artifact id to correct possible oversights in my example:

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文