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 241471 - Smarter "Attach Source" in Maven
Summary: Smarter "Attach Source" in Maven
Status: NEW
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0
Hardware: PC Linux
: P2 normal with 2 votes (vote)
Assignee: Tomas Stupka
: 241998 (view as bug list)
Depends on:
Reported: 2014-02-06 06:40 UTC by Geertjan Wielenga
Modified: 2015-05-09 15:22 UTC (History)
3 users (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2014-02-06 06:40:28 UTC
"Attach Source" on a Java file in a Maven project should not force you to look for sources -- but should simply find the sources via Maven repo.
Comment 1 Milos Kleint 2014-02-17 11:14:35 UTC
*** Bug 241998 has been marked as a duplicate of this bug. ***
Comment 2 Milos Kleint 2014-02-17 12:49:33 UTC
The UI for attach sources is generic (works both for maven and non-maven projects alike). The maven UI includes the download sources action on Dependencies nodes and optional automatic source download on project opened.

the problems with previous implementation that basically did what you suggest were:

if the automatic download failed or got stuck, there was no way to manually set the source jars. Since the various services were called in a row, it was either the first one satisfying the the request or passing on to the next one.
a. if the standard UI was first, there was never a way to attempt the download
b. if the download was first, one actually had to wait for the download to finish (or fail) before passing on to the next service - the UI, effectively causing the UI to show up to minutes after the user gesture

the attach sources action caused the initial repository scan, causing unavoidable major performance regressions for people who didn't even care. For that reason we limited the feature for local repository jars even though the repository index can work out any jar based on SHA1, so now it works for maven and apisupport projects alike.
Comment 3 tomzi 2014-02-18 07:48:10 UTC
I remember not being able to 'unattach' some source, since I sometime attached wrong versions of the source and then I couldn't revert that again...

From a user point of view, the only thing you can do is 
-) Press 'Attach source'
-) Press 'Download'
-) Press 'OK' (or sth like that)

There is nothing magic going on here...

I'd think it would make sense to 
- Have some option checkbox, which says that autoattach will be done if possible
  - This checkbox could be a global option or next to the 'Attach source' box
- Auto download will only be done if 
  - only ONE download is available when pressing the 'Download' button manually
  - if more than one source can be found (I don't know if that is possible) then
    autodownload is skipped.

I'd think that for 95% of all cases for maven that should work... And if you don't like it you can deactivate it...

- Sure it would be nice if it still would be possible to 'unattach' a source if sth went wrong, but this is another feature request I guess, since attaching the wrong source by a human is still possible
Comment 4 Jesse Glick 2014-10-07 14:53:52 UTC
This used to work well, and then this important feature was apparently pulled out. Seems like it could be restored with just some minor API/UI changes to allow it to be optional.