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 201446 - Add version to <dependencyManagement> when available
Summary: Add version to <dependencyManagement> when available
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-30 15:14 UTC by fabriziogiudici
Modified: 2016-07-07 08:38 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fabriziogiudici 2011-08-30 15:14:40 UTC
Currently, when you add a dependency to a project by using the wizard, the POM of the project gets updated with groupId-artifactId-version-artifactType.

Best practices for Maven predicate that all version numbers are consolidated in a single dependencyManagement section. So, NetBeans should search for such a section in the current POM, then in the parent POM and all ancestors. If no groupId-artifactId entry is found, one is created with the version. If it's found and version is the same, nothing should be done. If it's different, a notification to the user should be shown, allowing him to decide whether he wants to update the previously entered version or use that one in place of the one picked by the wizard.

As a minor remark, artifactType should be omitted if it's 'jar', the default, to reduce cluttering.
Comment 1 Jesse Glick 2011-08-30 21:53:49 UTC
(In reply to comment #0)
> NetBeans should search for such a
> section in the current POM, then in the parent POM and all ancestors.

...but behave as now if there is no such section in the effective POM, since the user may just not care about dM in this case.

> If no groupId-artifactId entry is found, one is created with the version.

Potentially tricky, since it is not obvious which ancestor you wanted this defined in, if several define dM.

> allowing him to decide whether he
> wants to update the previously entered version or use that one in place of the
> one picked by the wizard.

...or to behave as now, overriding the managed version.

> artifactType should be omitted if it's 'jar', the default

That is already true, at least in 7.1 (but I think in earlier releases too). But please keep unrelated remarks in their own issues.
Comment 2 fabriziogiudici 2012-01-20 22:26:38 UTC
"Potentially tricky, since it is not obvious which ancestor you wanted this
defined in, if several define dM."

It makes sense, IMHO, to use the first dM section found crawling up the parent hierarchy.

"That is already true, at least in 7.1 (but I think in earlier releases too)."

I still see <type>jar</type> being added by 7.1.
Comment 3 Milos Kleint 2012-02-16 12:05:36 UTC
which wizard are we talking about here?
Comment 4 Jesse Glick 2012-02-20 19:07:10 UTC
I think reporter was referring to the Add Dependency dialog (not actually a wizard).
Comment 5 fabriziogiudici 2012-02-20 19:27:08 UTC
Confirmed.
Comment 6 Milos Kleint 2013-03-13 15:26:02 UTC
*if* non-current file is to be modified, then it has to be explicitly shown to the user or chosen by the user that something like that will happen. We cannot do that behind the scenes.
Comment 7 Martin Balin 2016-07-07 08:38:42 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss