Rob Elliot created MSITE-654:
--------------------------------

             Summary: Appending a Slash to the Repository URL Makes Deploying 
to Github impossible
                 Key: MSITE-654
                 URL: https://jira.codehaus.org/browse/MSITE-654
             Project: Maven 2.x and 3.x Site Plugin
          Issue Type: Bug
          Components: Maven 3, site:deploy
    Affects Versions: 3.1
         Environment: Maven 3.0.4
            Reporter: Rob Elliot


I am attempting to deploy my site to github as described here:
http://maven.apache.org/wagon/wagon-providers/wagon-scm/usage.html
using the following config:
{code:xml}
  <distributionManagement>
    <site>
      <id>gh-pages</id>
      <url>scm:git:ssh://[email protected]/Mahoney/sandbox.git</url>
    </site>
  </distributionManagement>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.1</version>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-scm</artifactId>
            <version>2.2</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-manager-plexus</artifactId>
            <version>1.8</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-gitexe</artifactId>
            <version>1.8</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-api</artifactId>
            <version>1.8</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
{code}

It fails because it tries to run the following command:
{noformat}
git clone ssh://[email protected]/Mahoney/sandbox.git/
{noformat}
Note the trailing slash - it shouldn't be there. Remove it and the clone works 
fine.

I have tracked this down to the following:

{code:title=AbstractDeployMojo.java}
    public void execute()
        throws MojoExecutionException
    {
        if ( skipDeploy )
        {
            getLog().info( "maven.site.deploy.skip = true: Skipping site 
deployment" );
            return;
        }

        deployTo( new 
org.apache.maven.plugins.site.wagon.repository.Repository( 
getDeployRepositoryID(), appendSlash(
            getDeployRepositoryURL() ) ) );
    }

    /**
     * Make sure the given url ends with a slash.
     *
     * @param url a String.
     * @return if url already ends with '/' it is returned unchanged,
     *         otherwise a '/' character is appended.
     */
    protected static String appendSlash( final String url )
    {
        if ( url.endsWith( "/" ) )
        {
            return url;
        }
        else
        {
            return url + "/";
        }
    }
{code}

The assumption that the URI to which a site is to be deployed *must* end in a 
slash renders this interaction impossible. It should surely be a matter for 
individual wagon providers to decide what processing needs to be done to the 
provided URI, rather than having the site plugin make a blanket decision with 
no knowledge of the URI formats expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to