You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Eric Kolotyluk <er...@gmail.com> on 2014/04/06 19:14:47 UTC

GitHub Site Deployment

I have my automated site deployment working with GitHub finally, but 
there are some inelegant aspects of it, and I am wondering if there are 
some more elegant solutions.

In order to get the maven-release-plugin to work properly I had to add 
the following to my pom.xml

<distributionManagement>
<site>
<!--
         Fake site used to trick maven-release-plugin into doing 
site-distribution.
         Real site-distribution is done via com.github.github 
site-maven-plugin.
         Even if you specify <goals>deploy site-deploy</goals> to the 
release
         plugin, it still needs to see <distributionManagement>.
       -->
<id>fake</id>
<url>file:///fake-site</url>
</site>
</distributionManagement>

I would rather not have to use such a hack, but I have found no other 
way. The actual site deployment is handled by

<profiles>
<profile>
<id>github-site</id>
<!--
         We do not want to deploy our site to GitHub until we release it,
         otherwise, snap-shot releases get published. For example:
           mvn release:clean
           mvn release:prepare
           mvn release:perform
         should just work. Add the following to the maven-release-plugin
           <plugin>
             <artifactId>maven-release-plugin</artifactId>
             <configuration>
                 <releaseProfiles>github-site</releaseProfiles>
           </configuration>
         </plugin>
       -->
<build>
<plugins>
<plugin>
<!--
                 deploy the site to github pages
                 https://github.com/github/maven-plugins
             -->
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<configuration>
<!-- the id of the server with the passwords in settings.xml -->
<server>github</server>
<!-- sometimes the plugin cannot figure out the owner and name  -->
<!-- from the scm info, so it is best to define it explicitly   -->
<!--               <repositoryOwner>kolotyluk</repositoryOwner> -->
<!--               <repositoryName>java-file-utilities</repositoryName> -->
<message>Creating GitHub Pages site for ${project.version}</message>
</configuration>
<executions>
<execution>
<phase>site-deploy</phase>
<goals>
<goal>site</goal> <!-- the site goal uploads to gh_pages -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

I would have rather done something like

<distributionManagement>
<site>
<id>github</id>
<url>/some magic URL that specifies the gh_pages branch of my project/</url>
</site>
</distributionManagement>

but GitHub chose another solution.

Cheers, Eric