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 197561 - parent resolution on RELEASE parent broken until locally installed
Summary: parent resolution on RELEASE parent broken until locally installed
Status: RESOLVED DUPLICATE of bug 167208
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: 192257
Blocks:
  Show dependency tree
 
Reported: 2011-04-08 11:08 UTC by onmomo
Modified: 2012-03-22 11:23 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sample projects to reproduce (22.64 KB, application/x-zip)
2011-04-08 11:08 UTC, onmomo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description onmomo 2011-04-08 11:08:09 UTC
Created attachment 107602 [details]
sample projects to reproduce

This is a blocker to me.

It's simular to Bug 192257, I would recommend to look at Bug 192257 again with Release versions.

Issue reproducable with NB 7.0 RC1 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 deploy MainProject and delete it afterwards in the local repository.

Then call "dependencies:sources -U" on "ChildOneMainProject" and "ChildTwoMainProject", Maven will download MainProject 1.0.0 and succeed the build but NB still shows "misconfigured Maven project". A quick look into the "show and resolve problems" dialog will show:

"[FATAL] Non-resolvable parent POM: The repository system is offline but the artifact re.produce:MainProject:pom:1.0.0 is not available in the local repository. and 'parent.relativePath' points at wrong local POM @ line 6, column 13
 for project re.produce:ChildTwoMainProject:1.0.0 at C:\Users\cmo\Documents\NetBeansProjects\reproduce\ChildTwoMainProject\pom.xml"

A workaround would be to install "MainProject" RELEASE version in the localRepo which creates the file "maven-metadata-local.xml". It seems like NB 7.0 RC1 only
recognises projects which are locally installed which is quite unhandy when you
only check out the actual SNAPSHOT version of the parent for developing.

NB would work probably if you change the version of MainProject to 1.0.0-SNAPSHOT. It looks like NB has problems with RELEASE version resolution.
Comment 1 Jesse Glick 2011-04-08 22:21:50 UTC
Created a hosted release repo in Nexus. Set up a corresponding <server> section in settings.xml. Set distributionManagement/repository in MainProject/pom.xml to the same id/url.

mvn -f MainProject/pom.xml deploy
mvn -f ChildOneMainProject/pom.xml deploy
mvn -f ChildTwoMainProject/pom.xml deploy
rm -rfv ~/.m2/repository/re
netbeans --open *

Now MainProject is OK, child projects misconfigured as expected - Maven has no way of finding MainProject, since relativePath is wrong and MainProject is not in Central (as 'mvn validate' confirms).

So, I make a <repositories> section in each child POM and copy the <repository> definition from MainProject into them and reload the project; now they look OK in the IDE and can be built.

I think your problem is that you are simply neglecting to tell Maven where your custom repository is. (Trying to inherit the repo definition from the parent, without relativePath, will not suffice since it cannot find the parent without the repo definition.) As I mentioned in your earlier issue, as of M3 presence of an artifact in the local repo also does not suffice unless the repo ID used to obtain that artifact earlier matches the repo ID you are now specifying - this keeps you honest.

Also works to define in settings.xml rather than child POMs:

        <profile>
            <id>...</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>...</id>
                    <url>...</url>
                </repository>
            </repositories>
        </profile>

You need to download the parent POM once somehow, but a simple 'mvn validate' accomplishes this.
Comment 2 onmomo 2011-04-09 06:02:15 UTC
Thxs for your patience. It still wont work for me.. i defined the repos in global settings.xml which works with nb 6.9 and m3. Its really strange that it works with the exact same config when i use snapshot versions instead of release versions.

(In reply to comment #1)
> Created a hosted release repo in Nexus. Set up a corresponding <server> section
> in settings.xml. Set distributionManagement/repository in MainProject/pom.xml
> to the same id/url.
> 
> mvn -f MainProject/pom.xml deploy
> mvn -f ChildOneMainProject/pom.xml deploy
> mvn -f ChildTwoMainProject/pom.xml deploy
> rm -rfv ~/.m2/repository/re
> netbeans --open *
> 
> Now MainProject is OK, child projects misconfigured as expected - Maven has no
> way of finding MainProject, since relativePath is wrong and MainProject is not
> in Central (as 'mvn validate' confirms).
> 
> So, I make a <repositories> section in each child POM and copy the <repository>
> definition from MainProject into them and reload the project; now they look OK
> in the IDE and can be built.
> 
> I think your problem is that you are simply neglecting to tell Maven where your
> custom repository is. (Trying to inherit the repo definition from the parent,
> without relativePath, will not suffice since it cannot find the parent without
> the repo definition.) As I mentioned in your earlier issue, as of M3 presence
> of an artifact in the local repo also does not suffice unless the repo ID used
> to obtain that artifact earlier matches the repo ID you are now specifying -
> this keeps you honest.
> 
> Also works to define in settings.xml rather than child POMs:
> 
>         <profile>
>             <id>...</id>
>             <activation>
>                 <activeByDefault>true</activeByDefault>
>             </activation>
>             <repositories>
>                 <repository>
>                     <id>...</id>
>                     <url>...</url>
>                 </repository>
>             </repositories>
>         </profile>
> 
> You need to download the parent POM once somehow, but a simple 'mvn validate'
> accomplishes this.
Comment 3 onmomo 2011-04-11 06:16:24 UTC
Even a validate executed through nb project error dialog will download the parent pom. So the repos are correctly configured.

(In reply to comment #2)
> Thxs for your patience. It still wont work for me.. i defined the repos in
> global settings.xml which works with nb 6.9 and m3. Its really strange that it
> works with the exact same config when i use snapshot versions instead of
> release versions.
> 
> (In reply to comment #1)
> > Created a hosted release repo in Nexus. Set up a corresponding <server> section
> > in settings.xml. Set distributionManagement/repository in MainProject/pom.xml
> > to the same id/url.
> > 
> > mvn -f MainProject/pom.xml deploy
> > mvn -f ChildOneMainProject/pom.xml deploy
> > mvn -f ChildTwoMainProject/pom.xml deploy
> > rm -rfv ~/.m2/repository/re
> > netbeans --open *
> > 
> > Now MainProject is OK, child projects misconfigured as expected - Maven has no
> > way of finding MainProject, since relativePath is wrong and MainProject is not
> > in Central (as 'mvn validate' confirms).
> > 
> > So, I make a <repositories> section in each child POM and copy the <repository>
> > definition from MainProject into them and reload the project; now they look OK
> > in the IDE and can be built.
> > 
> > I think your problem is that you are simply neglecting to tell Maven where your
> > custom repository is. (Trying to inherit the repo definition from the parent,
> > without relativePath, will not suffice since it cannot find the parent without
> > the repo definition.) As I mentioned in your earlier issue, as of M3 presence
> > of an artifact in the local repo also does not suffice unless the repo ID used
> > to obtain that artifact earlier matches the repo ID you are now specifying -
> > this keeps you honest.
> > 
> > Also works to define in settings.xml rather than child POMs:
> > 
> >         <profile>
> >             <id>...</id>
> >             <activation>
> >                 <activeByDefault>true</activeByDefault>
> >             </activation>
> >             <repositories>
> >                 <repository>
> >                     <id>...</id>
> >                     <url>...</url>
> >                 </repository>
> >             </repositories>
> >         </profile>
> > 
> > You need to download the parent POM once somehow, but a simple 'mvn validate'
> > accomplishes this.
Comment 4 Jesse Glick 2011-04-11 15:33:06 UTC
I have no further idea how to reproduce your problem or diagnose it. If you want to delve into the Maven internals and find the real problem, please do so.
Comment 5 onmomo 2011-04-20 09:26:33 UTC
(In reply to comment #4)
> I have no further idea how to reproduce your problem or diagnose it. If you
> want to delve into the Maven internals and find the real problem, please do so.

Ok, I'll have a look.
Comment 6 onmomo 2011-04-20 13:02:31 UTC
I might have found the issue. I retried to reproduce your steps and found out that defining the repositories in the USER settings.xml will also work for me.

> Also works to define in settings.xml rather than child POMs:
> 
>         <profile>
>             <id>...</id>
>             <activation>
>                 <activeByDefault>true</activeByDefault>
>             </activation>
>             <repositories>
>                 <repository>
>                     <id>...</id>
>                     <url>...</url>
>                 </repository>
>             </repositories>
>         </profile>
> 

But in my case, the repos are only defined in the GLOBAL settings.xml (MAVEN_HOME/conf) which will cause this issue! If I copy my repo settings from the global to the local settings.xml it will work as expected. Why does it even build with SNAPSHOT versions but not with RELEASE versions? It seems like NB does not probably recognise the global settings.xml definitions.

Could you try to confirm my findings, please?


(In reply to comment #1)
> Created a hosted release repo in Nexus. Set up a corresponding <server> section
> in settings.xml. Set distributionManagement/repository in MainProject/pom.xml
> to the same id/url.
> 
> mvn -f MainProject/pom.xml deploy
> mvn -f ChildOneMainProject/pom.xml deploy
> mvn -f ChildTwoMainProject/pom.xml deploy
> rm -rfv ~/.m2/repository/re
> netbeans --open *
> 
> Now MainProject is OK, child projects misconfigured as expected - Maven has no
> way of finding MainProject, since relativePath is wrong and MainProject is not
> in Central (as 'mvn validate' confirms).
> 
> So, I make a <repositories> section in each child POM and copy the <repository>
> definition from MainProject into them and reload the project; now they look OK
> in the IDE and can be built.
> 
> I think your problem is that you are simply neglecting to tell Maven where your
> custom repository is. (Trying to inherit the repo definition from the parent,
> without relativePath, will not suffice since it cannot find the parent without
> the repo definition.) As I mentioned in your earlier issue, as of M3 presence
> of an artifact in the local repo also does not suffice unless the repo ID used
> to obtain that artifact earlier matches the repo ID you are now specifying -
> this keeps you honest.
> 
> Also works to define in settings.xml rather than child POMs:
> 
>         <profile>
>             <id>...</id>
>             <activation>
>                 <activeByDefault>true</activeByDefault>
>             </activation>
>             <repositories>
>                 <repository>
>                     <id>...</id>
>                     <url>...</url>
>                 </repository>
>             </repositories>
>         </profile>
> 
> You need to download the parent POM once somehow, but a simple 'mvn validate'
> accomplishes this.
Comment 7 gohu 2011-04-21 13:30:02 UTC
Exact same bug, copying $MAVEN_HOME/conf/settings.xml to ~/.m2/settings.xml fixed it too.
Comment 8 Jesse Glick 2011-04-21 13:37:20 UTC

*** This bug has been marked as a duplicate of bug 167208 ***
Comment 9 gilbertoca 2012-03-22 11:23:46 UTC
(In reply to comment #1)
> I think your problem is that you are simply neglecting to tell Maven where your
> custom repository is.

Bingo! Thanks, that was the problem with us as well.

> 
> Also works to define in settings.xml rather than child POMs:
> 
>         <profile>
>             <id>...</id>
>             <activation>
>                 <activeByDefault>true</activeByDefault>
>             </activation>
>             <repositories>
>                 <repository>
>                     <id>...</id>
>                     <url>...</url>
>                 </repository>
>             </repositories>
>         </profile>
> 

Editing the /$USER/.m2/settings.xml and including the repository fixes it.
Thanks, again.

Sonatype Nexus™ Open Source Edition, Version: 2.0.1 
Product Version: NetBeans IDE Dev (Build 201203150400)
Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
System: Linux version 3.1.9-1.4-desktop running on i386; UTF-8; en_US (nb)