jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2 & 3
  • MNG-1245

Reactor projects sometimes used even with version mismatch

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 3.0-alpha-1
  • Component/s: Plugins and Lifecycle
  • Labels:
    None
  • Complexity:
    Expert
  • Testcase included:
    yes

Description

See attached sample project structure.

In short: project A depends on project B version 1.1-SNAPSHOT,
but only 1.0-SNAPSHOT is available (both in the reactor, so on disk), as well
as in the local repository.

Still, m2 install runs fine. Excerpt from building Project A:

[DEBUG] Artifact not found - using stub model: Unable to download the artifact from any repository
test:sub-b:1.1-SNAPSHOT:pom

......configuring compiler plugin.....

[DEBUG] (f) classpathElements = [/mnt/a/home/forge/work/sandbox/m2test/deptest/sub-a/target/classes, /mnt/a/home/forge/work/sandbox/m2test/deptest/sub-b/target/classes]

Now, when running m2 eclipse:eclipse, m2 reacts as it should. Still the pom stub-model is used,
but the .jar cannot be resolved.
(weird enough m2 eclipse:eclipse doesn't accept reactor dependencies during resolve,
although the generated projects do have internal links - but this is a different bug; this is a convenient bug for now.. )

Proposed fix: Reactor projects can only be used when the pom versions match too. I thought
this code was in months ago and working properly.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. File
    deptest.tgz
    20/Oct/05 4:49 AM
    1 kB
    Kenney Westerhof
  2. Hide
    Java Archive File
    maven-project-2.0.5-SNAPSHOT.jar
    09/Jun/06 11:17 AM
    107 kB
    Mike Perham
    1. File
      META-INF/MANIFEST.MF 0.5 kB
    2. XML File
      META-INF/plexus/components.xml 6 kB
    3. File
      org/.../AlwaysOnProfileActivator.class 0.8 kB
    4. File
      org/.../DetectedProfileActivator.class 0.7 kB
    5. File
      org/apache/.../FileProfileActivator.class 1 kB
    6. File
      org/.../JdkPrefixProfileActivator.class 1 kB
    7. File
      org/.../OperatingSystemProfileActivator.class 3 kB
    8. File
      org/.../ProfileActivationException.class 0.6 kB
    9. File
      org/apache/.../ProfileActivator$1.class 0.8 kB
    10. File
      org/apache/.../ProfileActivator.class 0.7 kB
    11. File
      org/.../SystemPropertyProfileActivator.class 2 kB
    12. File
      org/apache/.../DefaultProfileManager.class 7 kB
    13. File
      org/apache/.../profiles/ProfileManager.class 0.7 kB
    14. File
      org/apache/.../ActiveProjectArtifact.class 7 kB
    15. File
      org/apache/.../AttachedArtifact.class 5 kB
    16. File
      org/.../InvalidDependencyVersionException.class 0.6 kB
    17. File
      org/apache/.../MavenMetadataSource.class 12 kB
    18. File
      org/apache/.../ProjectArtifactMetadata.class 6 kB
    19. File
      org/.../DefaultMavenProjectBuilder.class 36 kB
    20. File
      org/.../DefaultMavenProjectHelper.class 3 kB
    21. File
      org/.../DuplicateProjectException.class 0.6 kB
    22. File
      org/.../DefaultModelInheritanceAssembler.class 12 kB
    23. File
      org/.../ModelInheritanceAssembler$1.class 0.9 kB
    24. File
      org/.../ModelInheritanceAssembler.class 0.9 kB
    25. File
      org/.../DefaultModelDefaultsInjector.class 4 kB
    26. File
      org/apache/.../DefaultProfileInjector.class 12 kB
    27. File
      org/apache/.../ModelDefaultsInjector$1.class 0.8 kB
    28. File
      org/apache/.../ModelDefaultsInjector.class 0.8 kB
    29. File
      org/apache/.../ProfileInjector$1.class 0.8 kB
    30. File
      org/apache/.../ProfileInjector.class 0.7 kB
    Showing 30 of 56 items Download Zip
    Show
    Java Archive File
    maven-project-2.0.5-SNAPSHOT.jar
    09/Jun/06 11:17 AM
    107 kB
    Mike Perham
  3. Text File
    MNG-1245.patch
    09/Jun/06 11:15 AM
    1 kB
    Mike Perham

Issue Links

is depended upon by

Bug - A problem which impairs or prevents the functions of the product. MECLIPSE-123 Transitive deps with wrong version partly resolved to reactor resulting in 2 absolute paths being concatenated

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Bug - A problem which impairs or prevents the functions of the product. MNG-2787 Multi Project Aggregator ignoring dependency version in the POM

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
is duplicated by

Bug - A problem which impairs or prevents the functions of the product. MEJB-18 Manifest classpath contains wrong entries in multi-module build

  • Blocker - Blocks development and/or testing work, production could not run
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Bug - A problem which impairs or prevents the functions of the product. MNG-2424 Classpath in reactor builds differ from dependency resolution

  • Blocker - Blocks development and/or testing work, production could not run
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Bug - A problem which impairs or prevents the functions of the product. MNG-1975 EAR project depends on WAR that doesn't exist, but it builds succesfully

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
John Casey added a comment - 31/Oct/05 8:02 PM

will investigate.

Show
John Casey added a comment - 31/Oct/05 8:02 PM will investigate.
Hide
Permalink
Mike Perham added a comment - 09/Jun/06 10:31 AM

The code in question appears to be in MavenProject.replaceWithActiveArtifact: Note it should probably be doing some version checking also.

public Artifact replaceWithActiveArtifact( Artifact pluginArtifact )
    {
        if ( getProjectReferences() != null && !getProjectReferences().isEmpty() )
        {
            // TODO: use MavenProject getProjectReferenceId
            String refId = ArtifactUtils.versionlessKey( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId() );
            MavenProject ref = (MavenProject) getProjectReferences().get( refId );
            if ( ref != null && ref.getArtifact() != null )
            {
                // TODO: if not matching, we should get the correct artifact from that project (attached)
                if ( ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) )
                {
                    // if the project artifact doesn't exist, don't use it. We haven't built that far.
                    if ( ref.getArtifact().getFile() != null && ref.getArtifact().getFile().exists() )
                    {
                        pluginArtifact = new ActiveProjectArtifact( ref, pluginArtifact );
                    }
...SNIP...
                }
            }
        }
        return pluginArtifact;
    }
Show
Mike Perham added a comment - 09/Jun/06 10:31 AM The code in question appears to be in MavenProject.replaceWithActiveArtifact: Note it should probably be doing some version checking also.
public Artifact replaceWithActiveArtifact( Artifact pluginArtifact )
    {
        if ( getProjectReferences() != null && !getProjectReferences().isEmpty() )
        {
            // TODO: use MavenProject getProjectReferenceId
            String refId = ArtifactUtils.versionlessKey( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId() );
            MavenProject ref = (MavenProject) getProjectReferences().get( refId );
            if ( ref != null && ref.getArtifact() != null )
            {
                // TODO: if not matching, we should get the correct artifact from that project (attached)
                if ( ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) )
                {
                    // if the project artifact doesn't exist, don't use it. We haven't built that far.
                    if ( ref.getArtifact().getFile() != null && ref.getArtifact().getFile().exists() )
                    {
                        pluginArtifact = new ActiveProjectArtifact( ref, pluginArtifact );
                    }
...SNIP...
                }
            }
        }
        return pluginArtifact;
    }
Hide
Permalink
Mike Perham added a comment - 09/Jun/06 11:15 AM

2.0.x patch which adds version checking so the project reference is only used if the versions are the same. The full build of components passes with this patch.

Show
Mike Perham added a comment - 09/Jun/06 11:15 AM 2.0.x patch which adds version checking so the project reference is only used if the versions are the same. The full build of components passes with this patch.
Hide
Permalink
Mike Perham added a comment - 09/Jun/06 11:17 AM

Patched binary. No warranties.

Show
Mike Perham added a comment - 09/Jun/06 11:17 AM Patched binary. No warranties.
Hide
Permalink
Olivier Lamy added a comment - 12/Jun/06 11:09 AM

The question is : is it a bug or a feature ? ( )

Show
Olivier Lamy added a comment - 12/Jun/06 11:09 AM The question is : is it a bug or a feature ? ( )
Hide
Permalink
Kenney Westerhof added a comment - 06/Jul/06 12:56 PM

Fixed in svn trunk revision 413054.
Applied to the maven-2.0.x branch in revision 419630.

Show
Kenney Westerhof added a comment - 06/Jul/06 12:56 PM Fixed in svn trunk revision 413054. Applied to the maven-2.0.x branch in revision 419630.

People

  • Assignee:
    Kenney Westerhof
    Reporter:
    Kenney Westerhof
Vote (1)
Watch (3)

Dates

  • Created:
    20/Oct/05 4:49 AM
    Updated:
    08/Apr/07 6:26 PM
    Resolved:
    06/Jul/06 12:56 PM

Time Tracking

Estimated:
2h
Original Estimate - 2 hours
Remaining:
2h
Remaining Estimate - 2 hours
Logged:
Not Specified
Time Spent - Not Specified
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.