Maven
  1. Maven
  2. MNG-3975

getArtifact(Artifact artifact, List remoteRepositories) should include Exception in debug log messages.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.9
    • Fix Version/s: 2.0.10, 2.1.0
    • Component/s: Logging
    • Labels:
      None
    • Environment:
      Any environment.

      Description

      We recently had an issue where the local repo could not be created due to permissions issues. Unfortunately the default output of mvn -X is not helpful in debugging this issue.

      In org.apache.maven.wagon.AbstractWagon:

      protected void createParentDirectories( File destination )
      throws TransferFailedException
      {
      File destinationDirectory = destination.getParentFile();
      if ( destinationDirectory != null && !destinationDirectory.exists() )
      {
      if ( !destinationDirectory.mkdirs() )

      { throw new TransferFailedException( "Specified destination directory cannot be created: " + destinationDirectory ); }

      }
      }

      if TransferFailedException("Specified destination directory cannot be created: " + destinationDirectory ); is thrown it eventually bubbles up to org.apache.maven.artifact.manager.DefaultWagonManager and is caught in the second catch block from this snippet of public void getArtifact( Artifact artifact, List remoteRepositories ):

      try

      { getArtifact( artifact, repository ); successful = artifact.isResolved(); }

      catch ( ResourceDoesNotExistException e )

      { // This one we will eat when looking through remote repositories // because we want to cycle through them all before squawking. getLogger().debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")" ); }

      catch ( TransferFailedException e )

      { getLogger().debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")" ); }

      Can we also include the exception in the debug log message? e.g. make this call:

      getLogger().debug( "Unable to get resource '" + artifact.getId() + "' from repository " +
      repository.getId() + " (" + repository.getUrl() + ")" , e);

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          6d 22h 10m 1 Benjamin Bentmann 14/Jan/09 14:29
          Mark Thomas made changes -
          Workflow jira [ 12950737 ] Default workflow, editable Closed status [ 12986991 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 21:45:26 UTC 2015 [ 1428270326204 ]
          Mark Thomas made changes -
          Workflow jira [ 12714346 ] Default workflow, editable Closed status [ 12753786 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 08:49:45 UTC 2015 [ 1428223785911 ]
          Benjamin Bentmann made changes -
          Link This issue relates to MNG-4065 [ MNG-4065 ]
          Benjamin Bentmann made changes -
          Link This issue relates to MNG-3794 [ MNG-3794 ]
          Benjamin Bentmann made changes -
          Fix Version/s 2.0.10 [ 14112 ]
          Fix Version/s 2.0.11 [ 14118 ]
          Hide
          Benjamin Bentmann added a comment -

          Also merged into 2.0.10 branch in r737502.

          Show
          Benjamin Bentmann added a comment - Also merged into 2.0.10 branch in r737502 .
          Benjamin Bentmann made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Benjamin Bentmann [ bentmann ]
          Fix Version/s 2.0.11 [ 14118 ]
          Fix Version/s 2.1.0-M2 [ 14587 ]
          Hide
          Benjamin Bentmann added a comment -

          Fixed in r734502 and r734503, respectively.

          I opted to only output the message of the inner exception instead of the entire stack trace. This should be sufficient to diagnose the problem ("Specified destination directory cannot be created: <path>") and doesn't cause excessive debug output which I doubt is useful for the normal user who is not going to jump into the sources.

          Show
          Benjamin Bentmann added a comment - Fixed in r734502 and r734503 , respectively. I opted to only output the message of the inner exception instead of the entire stack trace. This should be sufficient to diagnose the problem ("Specified destination directory cannot be created: <path>") and doesn't cause excessive debug output which I doubt is useful for the normal user who is not going to jump into the sources.
          Stoyan created issue -

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Stoyan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development