开发者

Replace Maven Site Plugin with GWT Compile Plugin

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 rep开发者_如何学JAVAository. 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?


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜