FTP deploy
----------

                 Key: MDEPLOY-72
                 URL: http://jira.codehaus.org/browse/MDEPLOY-72
             Project: Maven 2.x Deploy Plugin
          Issue Type: Bug
    Affects Versions: 2.3
            Reporter: Artem Pasko


I use the following command 
{code}
mvn deploy:deploy-file -DgroupId=my.product -DartifactId=myproduct 
-Dversion=1.1 
-Dpackaging=jar -Dfile=D:\myproduct.jar -Durl=ftp://ftp.mycompany.com/maven2 
-DrepositoryId=mycompanyftp
{code}
and get the error
{code}
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'deploy'.
[INFO] ------------------------------------------------------------------------
[INFO] Building downloader-web
[INFO]    task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [deploy:deploy-file]
Uploading: ftp://ftp.mycompany.com/maven2/my/product/myproduct/1.1/myproduct.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Required directory: '/maven2' is missing

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Jan 30 13:55:28 EET 2008
[INFO] Final Memory: 2M/6M
[INFO] ------------------------------------------------------------------------
{code}
and stacktrace
{code}
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact
: Required directory: '/maven2' is missing
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:564)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:224)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error deploying artif
act: Required directory: '/maven2' is missing
        at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.
java:243)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:447)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
        ... 16 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error
 deploying artifact: Required directory: '/maven2' is missing
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(Def
aultArtifactDeployer.java:94)
        at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.
java:239)
        ... 18 more
Caused by: org.apache.maven.wagon.TransferFailedException: Required directory: '
/maven2' is missing
        at org.apache.maven.wagon.providers.ftp.FtpWagon.fillOutputData(FtpWagon
.java:232)
        at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:133)
        at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(D
efaultWagonManager.java:237)
        at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(Def
aultWagonManager.java:153)
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(Def
aultArtifactDeployer.java:80)
        ... 19 more
{code}
The "maven2" directory is present on ftp and i can connect to it.
I look to the FtpWagon.fillOutputData() method and find the code which throw 
exception
{code}
if(!ftp.changeWorkingDirectory(getRepository().getBasedir()))
                throw new TransferFailedException("Required directory: '" + 
getRepository().getBasedir() + "' " + "is missing");
{code}
Then i write 2 tests with FTPClient:
First test run ok
{code}
    public void testFTP() throws IOException {
        FTPClient ftp = null;
        try{
            ftp = new FTPClient();
            ftp.connect("ftp.mycompany.com");
            int reply = ftp.getReplyCode();
            if(!FTPReply.isPositiveCompletion(reply)){
                throw new RuntimeException("Not positive");
            }
            assertTrue(ftp.login("login","password"));
            assertTrue(ftp.changeWorkingDirectory("maven2/"));   //Use maven2/ 
directory
        }finally {
            if (ftp != null) {
                ftp.disconnect();
            }
        }
    }
{code}
The next test fails
{code}
    public void testFTP() throws IOException {
        FTPClient ftp = null;
        try{
            ftp = new FTPClient();
            ftp.connect("ftp.mycompany.com");
            int reply = ftp.getReplyCode();
            if(!FTPReply.isPositiveCompletion(reply)){
                throw new RuntimeException("Not positive");
            }
            assertTrue(ftp.login("login","password"));
            assertTrue(ftp.changeWorkingDirectory("/maven2"));   //Use /maven2 
directory and fail with this assertion
        }finally {
            if (ftp != null) {
                ftp.disconnect();
            }
        }
    }
{code}
So i think that getRepository().getBasedir() returns "/maven2" string. And 
current FTPClient cannot change directory to the "/maven2".
I use maven 4.0.8,  wagon-ftp 1.0-beta-2, Maven Deploy Plugin 2.3
Is it bug. Or i do something wrong?

-- 
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

        

Reply via email to