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

embedder returns stale maven project state

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0-alpha-2
    • 3.0-alpha-3
    • Embedding
    • None

    Description

      Embedder returns stale maven project state after project's pom.xml changed and re-read. This is extremely common scenario when using embedder in IDE like m2e. See attached sample project that demonstrates one of many possible ways to trigger this problem.

      The problem appears to be related to static MavenProject cache in DefaultMavenProjectBuilder, which means that even recreating embedder instance is not going to purge state cache entries.

      Also note that using artifact#getId does not provide enough context to uniquely identify cached MavenProject instances. This is particularly true for IDEs where the same embedder instance is likely to be used to process unrelated projects. Cached MavenProject instances should be identified at least by the following attributes

      • project artifact id
      • values of all properties
      • all active profiles
      • content of all pom.xml files directly and indirectly involved in construction of maven project instance
      • IDE specific state, like m2e "enable workspace dependency resolution"
      • likely more...

      Attachments

        1. staleproject.zip
          5 kB
          igorfie
        2. MNG-4041-e.diff
          14 kB
          igorfie
        3. MNG-4041-d.diff
          2 kB
          igorfie
        4. MNG-4041-c.diff
          6 kB
          igorfie
        5. MNG-4041-c.diff
          4 kB
          igorfie
        6. MNG-4041.diff
          76 kB
          igorfie

        Issue Links

          Activity

            People

              Unassigned Unassigned
              igorf Igor Fedorenko
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: