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

Reply via email to