You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Deng Ching <oc...@apache.org> on 2010/01/07 04:37:43 UTC

[Proposal] Fix for SCM-511

Hi All,

I'm trying to fix http://jira.codehaus.org/browse/SCM-511, which occurs when
you try to publish a site to an SVN repository where the base directory does
not exist yet. An example scenario is when you have the following
configuration in your POM:

<distributionManagement>
   <site>
     <id>site.svn</id>
     <url>scm:svn:
https://mysvn.repo.com/svn/myproject/trunk/www/docs/${project.version}<https://mysvn.repo.com/svn/myproject/trunk/www/docs/$%7Bproject.version%7D>
</url>
   </site>
</distributionManagement>

where the ${project.version} path does not exist in the SVN repository. So
when you execute 'mvn site:deploy', you will get the following error:

"Embedded error: Error checking out: Unable to commit file. The svn command
failed. svn: URL  '
https://mysvn.repo.com/svn/myproject/trunk/www/docs/1.0-SNAPSHOT/' doesn't
exist"

In this case, the ${project.version} directory should have been created when
the site is deployed.

After looking through the code, I came up with two possible fixes for this:

1. Fix it in wagon-scm by automatically creating the missing directories
when an error is encountered during checkout when a deployment is performed.
Instead of changing the behavior of Wagon.put(File source, String
destination), a new Wagon.put(File source, String destination, boolean
createMissingDirs) method (take note of the additional boolean parameter)
will be added for this purpose to the Wagon API. The maven-site-plugin will
be updated to use this new method in Wagon instead.

2. Fix it in maven-site-plugin (in site:deploy) by copying the generated
site to a temporary directory named as the last directory path in the site
<url> (in this case 1.0-SNAPSHOT) and deploy the site starting at this
directory. This would only be done if the initial deployment failed with a
TransferFailedException as that is the one thrown by Wagon when a directory
path does not exist. The temporary directory will be deleted after the site
is deployed.

I'm leaning towards #1 but I'm wondering if this is the right way to go. Any
comments or thoughts on this?
Thanks in advance!

-Deng

Re: [Proposal] Fix for SCM-511

Posted by Deng Ching <oc...@apache.org>.
I submitted a patch for wagon-scm to auto-generate the missing directories
while SCM-487 is not yet in maven-scm trunk.
The patch is in http://jira.codehaus.org/browse/WAGON-297

Thanks,
Deng

On Thu, Jan 7, 2010 at 6:19 PM, Deng Ching <oc...@apache.org> wrote:

> Ok, thanks for all your inputs :) I'll look into these suggestions..
>
> -Deng
>
>
> On Thu, Jan 7, 2010 at 6:11 PM, Olivier Lamy <ol...@apache.org> wrote:
>
>> Hi,
>> I would prefer using the --parents option too.
>> The issue already exists [1].
>> I have reverted due to the svn 1.5 requirements.
>>
>> BTW, this change can be added in this project [2]. And you can use
>> this provider (svnjava) instead of the svnexe one.
>>
>> --
>> Olivier
>>
>> [1] http://jira.codehaus.org/browse/SCM-487
>> [2] http://code.google.com/p/maven-scm-provider-svnjava/
>>
>> 2010/1/7 Brett Porter <br...@apache.org>:
>> >
>> > On 07/01/2010, at 2:37 PM, Deng Ching wrote:
>> >
>> >> After looking through the code, I came up with two possible fixes for
>> this:
>> >>
>> >> 1. Fix it in wagon-scm by automatically creating the missing
>> directories
>> >> when an error is encountered during checkout when a deployment is
>> performed.
>> >> Instead of changing the behavior of Wagon.put(File source, String
>> >> destination), a new Wagon.put(File source, String destination, boolean
>> >> createMissingDirs) method (take note of the additional boolean
>> parameter)
>> >> will be added for this purpose to the Wagon API. The maven-site-plugin
>> will
>> >> be updated to use this new method in Wagon instead.
>> >
>> > This is the right way to go, but I don't think the public API of Wagon
>> needs to be changed. The same thing is already done in the webdav wagon (it
>> walks back up the tree to create it). The problem is, because of the
>> multiple requests, it is pretty slow. I don't know if you can do it faster
>> by interrogating the output of a local "svn st" on the temporary checkout.
>> >
>> > The other option is to require SVN 1.5 and add "--parents, and do an
>> initial mkdir command, ignoring a result that says it already existed. That
>> might require SCM changes though.
>> >
>> > - Brett
>> >
>> > --
>> > Brett Porter
>> > brett@apache.org
>> > http://brettporter.wordpress.com/
>> >
>> >
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: dev-help@maven.apache.org
>> >
>> >
>>
>>
>>
>> --
>> Olivier
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>

Re: [Proposal] Fix for SCM-511

Posted by Deng Ching <oc...@apache.org>.
Ok, thanks for all your inputs :) I'll look into these suggestions..

-Deng

On Thu, Jan 7, 2010 at 6:11 PM, Olivier Lamy <ol...@apache.org> wrote:

> Hi,
> I would prefer using the --parents option too.
> The issue already exists [1].
> I have reverted due to the svn 1.5 requirements.
>
> BTW, this change can be added in this project [2]. And you can use
> this provider (svnjava) instead of the svnexe one.
>
> --
> Olivier
>
> [1] http://jira.codehaus.org/browse/SCM-487
> [2] http://code.google.com/p/maven-scm-provider-svnjava/
>
> 2010/1/7 Brett Porter <br...@apache.org>:
> >
> > On 07/01/2010, at 2:37 PM, Deng Ching wrote:
> >
> >> After looking through the code, I came up with two possible fixes for
> this:
> >>
> >> 1. Fix it in wagon-scm by automatically creating the missing directories
> >> when an error is encountered during checkout when a deployment is
> performed.
> >> Instead of changing the behavior of Wagon.put(File source, String
> >> destination), a new Wagon.put(File source, String destination, boolean
> >> createMissingDirs) method (take note of the additional boolean
> parameter)
> >> will be added for this purpose to the Wagon API. The maven-site-plugin
> will
> >> be updated to use this new method in Wagon instead.
> >
> > This is the right way to go, but I don't think the public API of Wagon
> needs to be changed. The same thing is already done in the webdav wagon (it
> walks back up the tree to create it). The problem is, because of the
> multiple requests, it is pretty slow. I don't know if you can do it faster
> by interrogating the output of a local "svn st" on the temporary checkout.
> >
> > The other option is to require SVN 1.5 and add "--parents, and do an
> initial mkdir command, ignoring a result that says it already existed. That
> might require SCM changes though.
> >
> > - Brett
> >
> > --
> > Brett Porter
> > brett@apache.org
> > http://brettporter.wordpress.com/
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
>
>
> --
> Olivier
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: [Proposal] Fix for SCM-511

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
I would prefer using the --parents option too.
The issue already exists [1].
I have reverted due to the svn 1.5 requirements.

BTW, this change can be added in this project [2]. And you can use
this provider (svnjava) instead of the svnexe one.

--
Olivier

[1] http://jira.codehaus.org/browse/SCM-487
[2] http://code.google.com/p/maven-scm-provider-svnjava/

2010/1/7 Brett Porter <br...@apache.org>:
>
> On 07/01/2010, at 2:37 PM, Deng Ching wrote:
>
>> After looking through the code, I came up with two possible fixes for this:
>>
>> 1. Fix it in wagon-scm by automatically creating the missing directories
>> when an error is encountered during checkout when a deployment is performed.
>> Instead of changing the behavior of Wagon.put(File source, String
>> destination), a new Wagon.put(File source, String destination, boolean
>> createMissingDirs) method (take note of the additional boolean parameter)
>> will be added for this purpose to the Wagon API. The maven-site-plugin will
>> be updated to use this new method in Wagon instead.
>
> This is the right way to go, but I don't think the public API of Wagon needs to be changed. The same thing is already done in the webdav wagon (it walks back up the tree to create it). The problem is, because of the multiple requests, it is pretty slow. I don't know if you can do it faster by interrogating the output of a local "svn st" on the temporary checkout.
>
> The other option is to require SVN 1.5 and add "--parents, and do an initial mkdir command, ignoring a result that says it already existed. That might require SCM changes though.
>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>



-- 
Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [Proposal] Fix for SCM-511

Posted by Brett Porter <br...@apache.org>.
On 07/01/2010, at 2:37 PM, Deng Ching wrote:

> After looking through the code, I came up with two possible fixes for this:
> 
> 1. Fix it in wagon-scm by automatically creating the missing directories
> when an error is encountered during checkout when a deployment is performed.
> Instead of changing the behavior of Wagon.put(File source, String
> destination), a new Wagon.put(File source, String destination, boolean
> createMissingDirs) method (take note of the additional boolean parameter)
> will be added for this purpose to the Wagon API. The maven-site-plugin will
> be updated to use this new method in Wagon instead.

This is the right way to go, but I don't think the public API of Wagon needs to be changed. The same thing is already done in the webdav wagon (it walks back up the tree to create it). The problem is, because of the multiple requests, it is pretty slow. I don't know if you can do it faster by interrogating the output of a local "svn st" on the temporary checkout.

The other option is to require SVN 1.5 and add "--parents, and do an initial mkdir command, ignoring a result that says it already existed. That might require SCM changes though.

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org