XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.0-beta-2
    • None
    • wagon-ftp
    • None

    Description

      I use the following command

      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
      

      and get the error

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

      and stacktrace

      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Required directory: '/maven2' is missing
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:224)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.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(DelegatingMethodAccessorImpl.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 artifact: Required directory: '/maven2' is missing
              at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:243)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.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(DefaultArtifactDeployer.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(DefaultWagonManager.java:237)
              at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:153)
              at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:80)
              ... 19 more
      

      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

      if(!ftp.changeWorkingDirectory(getRepository().getBasedir()))
                      throw new TransferFailedException("Required directory: '" + getRepository().getBasedir() + "' " + "is missing");
      

      Then i write 2 tests with FTPClient:
      First test run ok

          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();
                  }
              }
          }
      

      The next test fails

          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();
                  }
              }
          }
      

      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            artem Artem Pasko
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: