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 153249 - Maven support allows incorrect .jar dependencies between multiple modules
Summary: Maven support allows incorrect .jar dependencies between multiple modules
Status: RESOLVED INVALID
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-14 22:13 UTC by _ wadechandler
Modified: 2009-03-19 10:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ wadechandler 2008-11-14 22:13:20 UTC
A user just wrote to dev@openide.netbeans.org how to make a .jar quit being deleted that was shared between two modules.
What is happening is that Maven support is apparently allowing his projects to depend on the same .jar file. This file
is being copied by the same name to the same place by both modules. When he uninstalls one it removes the .jar file
altogether. The same .jar file should not be used by different modules, this is a no no, and a unique directory under
ext by code name base should be created and all the modules jars placed there or possibly more correct a library wrapper
should automatically be generated or something and not allow this type dependency at all...not at the module
level...tell the user what the issue is with a dialog and suggest they setup this dependency through the suite project
and to create a library wrapper. I'll direct this person to comment here.
Comment 1 Milos Kleint 2008-11-17 17:59:19 UTC
most likely a misconfiguration on the user end. However more indepth description of the problem would help.

http://mojo.codehaus.org/nbm-maven-plugin/
Section Maven Dependency vs NetBeans runtime dependency describes the behaviour of the currently released
nbm-maven-plugin. Please note the upcoming 3.0 version redesigns this area a bit, but the described scenario can still
be probably done. Especially with the 2.6.x version one had to explicitly put the doubled jar as direct dependency to 2
different projects. 

As far as I can tell, there's not much the maven support in the IDE can do to prevent people from "shooting themselves
in the foot". The suggested workarounds/solutions don't seem achievable within the context of a maven based tooling.
eg. library wrapper as a concept is hardly enforceable, so is suite-scoping of features.
Comment 2 Lukas Hasik 2008-12-04 12:55:18 UTC
reporter didn't provided required information for more than 14 days. Wade could you be more specific in the problem
description to let mkleint to help you.

Please, feel free to reopen when you face the problem again but attach the additional info.

thank you for report
Comment 3 Lukas Hasik 2008-12-04 12:55:46 UTC
x
Comment 4 _ wadechandler 2008-12-04 17:06:42 UTC
There really isn't a lot to provide unless I start using Maven myself. The other person was on the
dev@openide.netbeans.org list. You can see the problem in more depth there to better help you guys solve the problem,
and it seems pretty clear. Apparently all he did was add a dependency to the same .jar file from multiple Maven module
projects. The problem is pretty obvious:

1) Suite A
2) Module A
3) Module B
4) JAR A

Module A and B are both depending on JAR A. Both of these modules are then for some reason taking these JAR files and
encompassing them into their modules. I assume the Maven support does this does it not? Then this JAR file gets written
to the same place in ext upon module install...unzip. Well, the JAR then gets loaded more than once by two different
modules, which is a bug in itself, and too, if a user removes 1 of these Modules from an installation the .jar file is
removed, and the other module is broken...see the issue there? 

Sure, maybe it points to some issues in NB RCP where by some better documented procedures such as all modules including
.jar files should really embed their files in their own directory under ext using their code name base...only way to
prevent two modules from trying to load the *exact* same .jar file which is a NO NO...talk to Jesse Glick, or perhaps
modules should have indexes built for them about the files which came from them, and only when a file has no links to it
it is deleted by the module installer/uninstaller features, but the fact the Maven support allowed the user to have two
modules pointing to the same JAR which gets copied to the same location is also an error at this point. That really
shouldn't happen.

Either way, a couple issues could be gleaned from this information, and one way or another there is an issue here
associated with this bug in that one of the above scenarios about file management needs to be addressed I believe.
Essentially it isn't much of a matter of Maven support trying to keep the user from shooting themselves in the foot as
much as it makes it very easy for them to do so, in a very common way which would allow the user to perceive they can
setup dependencies simply through the user interface. I see nothing in this issue which would really lay any blame at a
users foot as much as the issue relates to the IDE and Maven support letting the user simply choose the same JAR file
from multiple modules as a dependency and not having a correct way of dealing with that scenario.

Truly, there are different ways this can be resolved. But think about this. If those JARs must go with that module, be
packaged and stuck into ext only for that module supposedly, then does it not go to reason that someone else might use
the same .jar file, with the same exact name, in a completely unrelated module and project (from even different
companies...thinking commons logging and other 3rd party libraries) and cause a similar issue very easily provided and
caused by the Maven support? So, the best solution in that case is that Maven support place the users ext JARs in
ext/code.base.name instead of directly into ext. Too, this points to an issue with library wrapper modules as well and
where their .jars may be placed.
Comment 5 Milos Kleint 2009-03-19 10:50:50 UTC
primarily an issue with nbm-maven-plugin, not the IDE, 

please file under http://jira.codehaus.org/browse/MNBMODULE

closing here as invalid.