This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 192257 - Import-scope dependency on sister project broken until locally installed
Summary: Import-scope dependency on sister project broken until locally installed
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 197561
  Show dependency tree
 
Reported: 2010-11-22 07:05 UTC by onmomo
Modified: 2011-04-08 11:08 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
three projects to reproduce this issue (15.77 KB, application/x-zip-compressed)
2010-11-22 07:05 UTC, onmomo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description onmomo 2010-11-22 07:05:21 UTC
Created attachment 103174 [details]
three projects to reproduce this issue

Issue reproducable with NB 7.0 Beta and attached sample projects.
You have to change distributionManagement to your repository manager. (was tested with artifactory 2.3.1 and 2.2.3) and afterwards install --> deploy the projects, then go to localRepo and delete everything under folder "re".

After this load those attached projects into NB, they are shown as "misconfigured Maven project". In the next step you should call "dependencies:sources -U" on "MainProject" and "ChildMainProject", Maven will download the desired dependency "depmgmt-project:1.0.0-SNAPSHOT" but NB still complains "misconfigured Maven project" for "MainProject" and "ChildMainProject". A quick look into the "show and resolve problems" dialog tells:

"2 problems were encountered while building the effective model for re.produce:ChildMainProject:1.0.0-SNAPSHOT
[ERROR] Non-resolvable import POM: The repository system is offline but the artifact re.produce:depmgmt-project:pom:1.0.0-SNAPSHOT is not available in the local repository. @ re.produce:MainProject:1.0.0-SNAPSHOT, C:\Users\cmo\Documents\NetBeansProjects\MainProject\pom.xml, line 28, column 25
[ERROR] 'dependencies.dependency.version' for jdom:jdom:jar is missing. @ line 26, column 21
 for project re.produce:ChildMainProject:1.0.0-SNAPSHOT at C:\Users\cmo\Documents\NetBeansProjects\ChildMainProject\pom.xml" 

which is WRONG because the "depmgmt-project", which also contains the dependency jdom:1.1 in it's depedencyManagement tag, is properly located in the localRepo. If you hit "revalidate", the build was also succesful.

A workaround would be to install "depmgmt-project" in the localRepo which creates the file "maven-metadata-local.xml". It seems like NB 7.0 beta only recognises projects which are locally installed which is quite unhandy when you work with hundreds of projects.
Comment 1 Jesse Glick 2010-11-23 00:37:25 UTC
(In reply to comment #0)
> A workaround would be to install "depmgmt-project" in the localRepo

That is what you need to do. Otherwise the import-scope dependencies from the other projects cannot be resolved. After doing so, a Reload Project on the others makes them loadable without errors. If your bug is about something else, I don't follow what.

Normally ArtifactFixer allows the POM dependency to be resolved from the source project rather than the local repo, which would be more convenient - it would suffice to open depmgmt-project. Not sure why that is not working in this case. Seems NbLocalArtifactRepository is not being queried.
Comment 2 onmomo 2010-11-23 07:25:12 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > A workaround would be to install "depmgmt-project" in the localRepo
> 
> That is what you need to do. Otherwise the import-scope dependencies from the
> other projects cannot be resolved. After doing so, a Reload Project on the
> others makes them loadable without errors. If your bug is about something else,
> I don't follow what.

I'm not sure if I got you right. My Bug is: 
Why am I required to install "depmgmt-project" if it was probably downloaded from the remote repository manager and located in the local repository to load "MainProject" and "ChildMainProject" correctly in NB?
Comment 3 Jesse Glick 2010-11-23 18:55:36 UTC
(In reply to comment #2)
> Why am I required to install "depmgmt-project" if it was probably downloaded
> from the remote repository manager and located in the local repository

If, and only if, this artifact is in the local repository (*), then the other projects should be loadable.

(*) https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-ResolutionfromLocalRepository may be of interest.
Comment 4 onmomo 2010-11-23 21:45:11 UTC
> If, and only if, this artifact is in the local repository (*), then the other
> projects should be loadable.
> 
> (*)
> https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-ResolutionfromLocalRepository
> may be of interest.

That's all right with me.
Comment 5 onmomo 2011-01-25 06:36:17 UTC
I've experienced a simular issue with NB Dev Build 201101170000.

My projects reference to a parent pom which was released. The parent was resolved from the remote repository and stored in the local repository correctly. Unfortunately, it seems that NB won't recognise this project neither and states following message:

"misconfigured maven project" (parent pom not resolvable)

"1 problem was encountered while building the effective model for mnet:magic-workplace:2.3.0-SNAPSHOT
[FATAL] Non-resolvable parent POM for mnet:magic:2.3.0-SNAPSHOT: The repository system is offline but the artifact mnet:mnet-parent:pom:10.1.0 is not available in the local repository. and 'parent.relativePath' points at wrong local POM @ mnet:magic:2.3.0-SNAPSHOT, D:\MNet\MagIC\trunk\pom.xml, line 9, column 13
 for project mnet:magic-workplace:2.3.0-SNAPSHOT at D:\MNet\MagIC\trunk\modules\Workplace\pom.xml  "

It looks like the problem occours not only with scope import.
Comment 6 Jesse Glick 2011-03-07 22:43:59 UTC
I set up your projects using a local Nexus instance and NB 7.0 and it all worked. Specifically I:

1. Created a hosted repo in Nexus.

2. Added a <server> authentication section to ~/.m2/settings.xml matching that repo ID.

3. Edited the POMs of depmgmt-project and MainProject to refer to this repo:

    <distributionManagement>
        <snapshotRepository>
            <id>test192257</id>
            <url>.../nexus/content/repositories/test192257/</url>
        </snapshotRepository>
    </distributionManagement>
    <repositories>
        <repository>
            <id>test192257</id>
            <url>.../nexus/content/repositories/test192257/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

Then I ran 'mvn deploy' on each project in turn; deleted ~/.m2/repository/re/; and restarted the IDE with the three projects open. MainProject and ChildMainProject very briefly showed themselves as misconfigured, then quickly reloaded and showed no warnings. The local repo had the downloaded depmgmt-project as expected.
Comment 7 onmomo 2011-03-08 06:04:02 UTC
(In reply to comment #6)
> I set up your projects using a local Nexus instance and NB 7.0 and it all
> worked. Specifically I:
> 
> 1. Created a hosted repo in Nexus.
> 
> 2. Added a <server> authentication section to ~/.m2/settings.xml matching that
> repo ID.
> 
> 3. Edited the POMs of depmgmt-project and MainProject to refer to this repo:
> 
>     <distributionManagement>
>         <snapshotRepository>
>             <id>test192257</id>
>             <url>.../nexus/content/repositories/test192257/</url>
>         </snapshotRepository>
>     </distributionManagement>
>     <repositories>
>         <repository>
>             <id>test192257</id>
>             <url>.../nexus/content/repositories/test192257/</url>
>             <snapshots>
>                 <enabled>true</enabled>
>             </snapshots>
>         </repository>
>     </repositories>
> 
> Then I ran 'mvn deploy' on each project in turn; deleted ~/.m2/repository/re/;
> and restarted the IDE with the three projects open. MainProject and
> ChildMainProject very briefly showed themselves as misconfigured, then quickly
> reloaded and showed no warnings. The local repo had the downloaded
> depmgmt-project as expected.



(In reply to comment #6)
> I set up your projects using a local Nexus instance and NB 7.0 and it all
> worked. Specifically I:
> 
> 1. Created a hosted repo in Nexus.
> 
> 2. Added a <server> authentication section to ~/.m2/settings.xml matching that
> repo ID.
> 
> 3. Edited the POMs of depmgmt-project and MainProject to refer to this repo:
> 
>     <distributionManagement>
>         <snapshotRepository>
>             <id>test192257</id>
>             <url>.../nexus/content/repositories/test192257/</url>
>         </snapshotRepository>
>     </distributionManagement>
>     <repositories>
>         <repository>
>             <id>test192257</id>
>             <url>.../nexus/content/repositories/test192257/</url>
>             <snapshots>
>                 <enabled>true</enabled>
>             </snapshots>
>         </repository>
>     </repositories>
> 
> Then I ran 'mvn deploy' on each project in turn; deleted ~/.m2/repository/re/;
> and restarted the IDE with the three projects open. MainProject and
> ChildMainProject very briefly showed themselves as misconfigured, then quickly
> reloaded and showed no warnings. The local repo had the downloaded
> depmgmt-project as expected.

Ok, which NetBeans 7.0 build did you use? Perhaps, the difference Artifactory / Nexus is the matter?
I'll try to reproduce it again and will report my findings.
Comment 8 Jesse Glick 2011-03-08 12:15:00 UTC
(In reply to comment #7)
> which NetBeans 7.0 build did you use?

Just a private dev build, no more than a day or two old.

> Perhaps, the difference Artifactory / Nexus is the matter?

Possible. I also saw that your POMs omitted a <repositories> section, though these could have been defined elsewhere such as in a profile in settings.xml.
Comment 9 onmomo 2011-03-09 22:10:41 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > which NetBeans 7.0 build did you use?
> 
> Just a private dev build, no more than a day or two old.
> 
> > Perhaps, the difference Artifactory / Nexus is the matter?
> 
> Possible. I also saw that your POMs omitted a <repositories> section, though
> these could have been defined elsewhere such as in a profile in settings.xml.

I was unable to reproduce it with NB Dev 201103090000 and NB 7.0 Beta 2 in combination with Artifactory 2.3.1 / 2.3.2 at home. I will try it at work if I'm back (approx 4 weeks).

The repositories section is set in the maven global settings.xml.