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 224681 - Source is taken from wrong Maven package (other version) from local Maven repo
Summary: Source is taken from wrong Maven package (other version) from local Maven repo
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3
Hardware: PC Linux
: P2 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-10 07:36 UTC by pekarna
Modified: 2013-02-01 20:02 UTC (History)
1 user (show)

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 pekarna 2013-01-10 07:36:10 UTC
In a Maven project, NetBeans opens wrong source jar for given class.
It happened to me several times. Two cases:

1) The project has other dep version, e.g. Wicket 1.5.9.
   But NetBeans opens 
  /home/ondra/.m2/repository/org/apache/wicket/wicket-core/6.3.0/wicket-core-6.3.0-sources.jar:org/apache/wicket/Component.java

2) Even the source of other project opened in the IDE is ignored and instead, old SNAPSHOT from Maven repo is opened. (Note that if not running Maven up to the `install` stage, it doesn't replace the jar in local repo; so the right -source.jar is the one in <project>/target/ .)
Comment 1 pekarna 2013-01-10 07:36:34 UTC
7.3.beta2
Comment 2 pekarna 2013-01-10 07:38:57 UTC
Annoying workaround: Delete all newer versions than the required from local repo.
Comment 3 Milos Kleint 2013-01-10 08:09:39 UTC
can you check your <Nb_user_dir>/Preferences/org/netbeans/modules/maven/attachedSource.properties file of occurences of your wicket-core artifact?
Comment 4 Milos Kleint 2013-01-10 08:43:43 UTC
I'm not able to reproduce.
1. created a project depending on wicket-core:6.3.0, downloaded sources.
2. Component.java from 6.3.0 source jar. Ok.
3. change dependency to 1.5.9
4. check Component.java. Is from generated source file. ok.
5. download sources for 1.5.9, Component.java comes from correct source jar again.


Looking at the code, the only part that could mix up/randomize the results is the SourceJavadocByHash related code that gets triggered when you click "Attach sources" button in the generated source file. The maven repository index is then checked for SHA1 match of the binary file and the resulting GAV's source jar is associated with the binary's url.
Comment 5 Milos Kleint 2013-01-10 08:44:53 UTC
also could you try with the latest dev build? some changes were done in this area since beta2. The dev build should be more stable than beta2, we've just reached code freeze, RC1 will be out soon.
Comment 6 Milos Kleint 2013-01-18 18:51:33 UTC
maybe issue 216448 is related?
Comment 7 Milos Kleint 2013-01-29 13:06:50 UTC
closing as worksforme, please reopen with more details
Comment 8 pekarna 2013-02-01 20:02:01 UTC
(In reply to comment #3)
> can you check your
> <Nb_user_dir>/Preferences/org/netbeans/modules/maven/attachedSource.properties
> file of occurences of your wicket-core artifact?

There's no such file in /home/ondra/.netbeans/7.3beta/config/Preferences/org/netbeans/modules/maven
Comment 9 pekarna 2013-02-01 20:02:48 UTC
Related to 225650