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

java.lang.UnsupportedOperationException on DefaultProjectBuilder.build

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.2.3
    • 3.2.5
    • Bootstrap & Build
    • None

    Description

      ProjectBuildingRequest request = ...
      ProjectBuilder builder = plexus.lookup(ProjectBuilder.class);
      builder.build(file, request);
      

      When the build method is called, the following exception is thrown:

      java.lang.UnsupportedOperationException
      	at java.util.AbstractMap.put(AbstractMap.java:209)
      	at org.apache.maven.project.DefaultProjectBuilder.initProject(DefaultProjectBuilder.java:815)
      	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:174)
      	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:118)
      

      The code should be reviewed. This is the offending code inside DefaultProjectBuilder:

                          Artifact artifact = repositorySystem.createDependencyArtifact( d );
      
                          if ( artifact == null )
                          {
                              map = Collections.emptyMap();
                          }
      
                          map.put( d.getManagementKey(), artifact );
      
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            schulte77 Christian Schulte
            gastaldi George Gastaldi
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment