Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6991

settings-defined local repository is not honored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-alpha-2
    • 4.0.0-alpha-2, 4.0.0
    • None
    • None

    Description

      We have functional tests using the latest Maven snapshots and they started polluting the global ~/.m2/repository.

      This commit introduced a bug in the handling of the local repository definition.

      The local repository is taken from settings here.

      but then, before, Maven was doing (in MavenCli)

              String localRepoProperty = request.getUserProperties().getProperty( MavenCli.LOCAL_REPO_PROPERTY );
      
              if ( localRepoProperty == null )
              {
                  localRepoProperty = request.getSystemProperties().getProperty( MavenCli.LOCAL_REPO_PROPERTY );
              }
      
              if ( localRepoProperty != null )
              {
                  request.setLocalRepositoryPath( localRepoProperty );
              }
      

      effectively replacing the local repository definition only if `maven.repo.local` was defined in user or system properties.
       
      After the commit mentioned above, the code does

              request.setLocalRepositoryPath( determineLocalRepositoryPath( request ) );
              ...
              private String determineLocalRepositoryPath( final MavenExecutionRequest request )
              {
                  return request.getUserProperties().getProperty(
                          MavenCli.LOCAL_REPO_PROPERTY,
                          request.getSystemProperties().getProperty( MavenCli.LOCAL_REPO_PROPERTY ) // null if not found
                  );
              }
      

      effectively always replacing the local repository definition, potentially nulling it.

      Attachments

        Issue Links

          Activity

            People

              mthmulders Maarten Mulders
              facewindu François Guillot
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: