[ http://jira.codehaus.org/browse/WAGON-64?page=comments#action_82775 ]
Caleb Lyness commented on WAGON-64:
-----------------------------------
I believe the problem is a low level problem - i.e. os related, because windows
passes back the problem (seen in the File Monitor report above). I did come up
with the following hack/quick fix, which is serving me well.
--- AbstractWagon.java-revBASE.svn000.tmp.java 16.12.2006 10:56:16 AM
+++
extern-lib\wagon\wagon-provider-api\src\main\java\org\apache\maven\wagon\AbstractWagon.java
02.11.2006 01:39:47 PM
@@ -161,174 +161,188 @@
protected void createParentDirectories( File destination )
throws TransferFailedException
{
+ System.out.println("Destination file: "+destination);
File destinationDirectory = destination.getParentFile();
+ System.out.println("Destination directory: "+destinationDirectory);
if ( destinationDirectory != null && !destinationDirectory.exists() )
{
+ System.out.println("Destination does not exist... create it...");
if ( !destinationDirectory.mkdirs() )
{
- throw new TransferFailedException(
+ if (destinationDirectory.exists()) {
- "Specified destination directory cannot be created: " +
destinationDirectory );
+ System.out.println("mkdirs failed. But directory
exists...");
- }
+ } else {
+ System.out.println("Failed to create
file:"+destinationDirectory);
+
+ throw new TransferFailedException(
+ "Specified destination directory cannot be created: " +
destinationDirectory );
+ }
+ } else {
+ System.out.println("Directory created");
+ }
+ } else {
+ System.out.println("Directory exists (or not specified)");
}
}
Feel free to remove the printlns :-)
You might not like this "solution" though. Basically it if does not find the
directory, I try to create, if that fails I try to see if it exists. Usually
that last double check works around the problem. If you clean it up and test it
more thoroughly would you post back your changes. Maybe
one of the wagon devs will do something with it.
PS: I patched: version 1.0-beta-1
But I think this should be applicable to earlier version too...
Hope that helps.
Cheers
> File cannot be created error...
> -------------------------------
>
> Key: WAGON-64
> URL: http://jira.codehaus.org/browse/WAGON-64
> Project: wagon
> Issue Type: Bug
> Components: wagon-file
> Affects Versions: 1.0-alpha-2, 1.0-alpha-3, 1.0-alpha-4, 1.0-alpha-5,
> 1.0-alpha-6, 1.0-alpha-7
> Reporter: Caleb Lyness
>
> I am using maven 1.0 to build and deploy. As of a couple of days back I
> started getting deploy problems.
> I am completely lost as to explain the error and desperately would like some
> one to shed some light
> I am deploying to maven repository which lives in a windows share.
> The repository is defined as follows in the project.properties file:
> maven.repo.list=internal
> maven.repo.internal=file://
> maven.repo.internal.directory=\\\\192.168.150.7\\Maven.Internal.Repo
> This has been working for nearly a year now. (An aside any other arrangment
> of URL sepecification always results
> in the deployment to the local host... yes I have tried all combinations and
> read the stuff out there. Makes no difference)
> It now fails with the following error:
> Will deploy to 1 repository(ies): internal
> Deploying to repository: internal
> Uploading to System/poms/Service-1.4.0.pom:
> .................... (6K)
> Failed to deploy to: internal Reason:
> org.apache.maven.wagon.TransferFailedException: Specified destination
> directory cannot be created: \\192.168.150.7\Maven.Internal.Repo\System\poms
> org.apache.maven.wagon.TransferFailedException: Specified destination
> directory cannot be created: \\192.168.150.7\Maven.Internal.Repo\System\poms
> at
> org.apache.maven.wagon.AbstractWagon.createParentDirectories(AbstractWagon.java:169)
> at
> org.apache.maven.wagon.providers.file.FileWagon.fillOutputData(FileWagon.java:82)
> at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:133)
> at
> org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deployFiles(DefaultArtifactDeployer.java:407)
> at
> org.apache.maven.artifact.deployer.DefaultArtifactDeployer.doDeploy(DefaultArtifactDeployer.java:324)
> at
> org.apache.maven.artifact.deployer.DefaultArtifactDeployer.handleDeploy(DefaultArtifactDeployer.java:131)
> at
> org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:102)
> at
> org.apache.maven.artifact.deployer.DeployBean.deploy(DeployBean.java:142)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> Notice how the first upload worked. While the second one dies while trying to
> create the parent directly (which does exist).
> The first upload must have executed exactly the same code!
> I have updated wagon jars the plugin is using and this does not modify the
> error.
> in AbstractWagon.java the failing code is:
> protected void createParentDirectories(File destination)
> throws TransferFailedException
> {
> File destinationDirectory = destination.getParentFile();
> if(destinationDirectory != null && !destinationDirectory.exists() &&
> !destinationDirectory.mkdirs())
> throw new TransferFailedException("Specified destination
> directory cannot be created: " + destinationDirectory);
> else
> return;
> }
> I wrote a quick test which runs on the same machine:
> System.out.println("Test: ");
> File destination = new
> File("\\\\192.168.150.7\\Maven.Internal.Repo\\System\\poms\\test-file");
> File destinationDirectory = destination.getParentFile();
> if (destinationDirectory != null
> && !destinationDirectory.exists()
> && !destinationDirectory.mkdirs())
> System.out.println("Failed!");
> else
> System.out.println("Ok!");
>
> destination.createNewFile();
>
> if (destinationDirectory != null
> && !destinationDirectory.exists()
> && !destinationDirectory.mkdirs())
> System.out.println("Failed!");
> else
> System.out.println("Ok!");
> This works fine. I get an empty file on the share.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira