Search code examples
maven-2mercurialgoogle-code

Maven + Mercurial + Site Deploy issues


I'm trying to deploy my Maven generated site to a googlecode project using mercurial. When I do a

mvn site:deploy

I get Transfer error: org.apache.maven.scm.NoSuchCommandScmException: No such command 'list'.

Its like its trying to do a "svn list" even though I am using mercurial.

In my pom I have maven wagon and mercurial setup (I think correctly):

org.apache.maven.wagon wagon-scm 1.0-beta-6 org.apache.maven.scm maven-scm-provider-hg 1.4

Then for my site deploy I have a separate mercurial repository:

   <distributionManagement>
  <site>
   <id>googlecode</id>
   <name>googlecode site</name>
   <url>scm:hg:${project.site.scm}/</url>
  </site>
   </distributionManagement>

In my settings.xml I have:

  <servers>
  <server>
    <id>googlecode</id>
    <username>...</username>
    <password>...</password>
  </server>
  </servers>

Solution

  • Stumbled upon this question and thought I would provide an answer for anyone else as the documentation for how to do this is sparse:

    For quite some time now I've been successfully hosting my website in a Google Code repository that uses Mercurial. It works well and I've had very little issues

    First, you have to go to your project, tab "Administer", subtab "Source" and create a new repository called "site". Then, you have to commit and push at least one file, conveniently called "index.html" to that repository because "hg locate", which is called by the SCM plugin, fails on completely empty repositories.

    I have this in my POM to deploy to http://site.MYREPO.googlecode.com/hg

    <build>
        <plugins>
            ...
            <!--Deploy site with Mercurial (Hg)-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0-beta-3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-api</artifactId>
                        <version>1.5</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-hg</artifactId>
                        <version>1.5</version>
                    </dependency>
                </dependencies>
            </plugin>
            ...
        </plugins>
    </build>
    
    <!--
        Distribution
    -->
    <distributionManagement>
        <!--Site deploy repository-->
        <site>
            <id>MYREPO.googlecode.com</id>
            <url>scm:hg:https://site.MYREPO.googlecode.com/hg</url>
        </site>
    </distributionManagement>
    

    You then have to tell Maven your username and password, so add this to your Maven settings.xml file (note the @ character is HTML encoded as Mercurial will choke on it normally)

    <settings>
        <servers>
            <server>
                <id>MYREPO.googlecode.com</id>
                <username>MYEMAIL%40gmail.com</username>
                <password>MYPASSWORD</password>
            </server>
        </servers>
    </settings>
    

    Now you can mvn clean site site:deploy and visit http://site.MYREPO.googlecode.com/hg/index.html to get your complete maven site.