[ 
https://jira.codehaus.org/browse/MSITE-654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=308794#comment-308794
 ] 

Rob Elliot commented on MSITE-654:
----------------------------------

On the extra slash - note this from the URI spec 
http://tools.ietf.org/html/rfc3986#section-6.2.4:

{quote}
[Web spiders] implement even
   more aggressive techniques in URI comparison.  For example, if they
   observe that a URI such as

      http://example.com/data

   redirects to a URI differing only in the trailing slash

      http://example.com/data/

   they will likely regard the two as equivalent in the future.  This
   kind of technique is only appropriate when equivalence is clearly
   indicated by both the result of accessing the resources and the
   common conventions of their scheme's dereference algorithm (in this
   case, use of redirection by HTTP origin servers to avoid problems
   with relative references).
{quote}

So appending a slash to every URI does not necessarily result in an equivalent 
URI, so doing so in the Site plugin is highly likely to break URIs in certain 
circumstances, including Github URIs.

                
> 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://g...@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>
> {code}
> It fails because it tries to run the following command:
> {noformat}
> git clone ssh://g...@github.com/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