Uploaded image for project: 'Maven Site Plugin'
  1. Maven Site Plugin
  2. MSITE-654

Appending a slash to the repository URL makes deploying to GitHub impossible

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.6
    • Component/s: Maven 3, site:deploy
    • Labels:
      None
    • Environment:
      Maven 3.0.4

      Description

      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:

        <distributionManagement>
          <site>
            <id>gh-pages</id>
            <url>scm:git:ssh://git@github.com/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>
      

      It fails because it tries to run the following command:

      git clone ssh://git@github.com/Mahoney/sandbox.git/
      

      Note the trailing slash - it shouldn't be there. Remove it and the clone works fine.

      I have tracked this down to the following:

      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 + "/";
              }
          }
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael-o Michael Osipov
                Reporter:
                mahoney Robert Elliot
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: