我已经成功设置了一些使用 Maven 将 Maven 生成的站点自动部署到gh-pages
其 git 存储库的分支的项目。然后 GitHub 在个人子域的公共 URL 上提供这些文件。我希望利用此功能为富客户端仅 GWT 应用程序提供服务。
我已经修改了我pom.xml
的将 GWT 应用程序编译到target/site/
目录中。我仍在努力实现的两个主要目标是:
- 如何防止标准 Maven 站点插件在该
site
阶段运行? - 在该阶段
gwt:compile
执行什么要求?site
我已经成功设置了一些使用 Maven 将 Maven 生成的站点自动部署到gh-pages
其 git 存储库的分支的项目。然后 GitHub 在个人子域的公共 URL 上提供这些文件。我希望利用此功能为富客户端仅 GWT 应用程序提供服务。
我已经修改了我pom.xml
的将 GWT 应用程序编译到target/site/
目录中。我仍在努力实现的两个主要目标是:
site
阶段运行?gwt:compile
执行什么要求?site
通过为插件指定新的执行,可以将目标绑定到阶段。我假设你有一些你需要的自定义东西来使大部分工作正常工作,所以我只关注将插件目标绑定到特定阶段的工作。
<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>