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 198997 - Running Maven follows symlinks in project path
Summary: Running Maven follows symlinks in project path
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 178420 201400
Blocks:
  Show dependency tree
 
Reported: 2011-05-30 10:52 UTC by fillumina
Modified: 2011-09-26 13:34 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The test output panel with the partial classpath evidenced (35.73 KB, image/gif)
2011-05-30 10:52 UTC, fillumina
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fillumina 2011-05-30 10:52:14 UTC
Created attachment 108594 [details]
The test output panel with the partial classpath evidenced

Hi there,
this is a little bug that annoys me since several NB versions. I'm wondering if it may be finally solved.

1) Executing a failing JUnit 4.7 test through the IDE a stack trace error is shown in the Output panel.
2) clicking the link of one of the classes (part of the same project of the JUnit test) it opens in the IDE

Now the problem:
3) the class is opened in the editor but it isn't evidenced in the Projects panel
4) requiring to do so by using the "Select in project" right-mouse-click menu will cause a popup request to open the owning project (the one we are working with which is obviously already opened).

The other (maybe related) problem is that the link doesn't cover the entire classpath but starts right after the first part of the domain name (see attached picture).

Thank you and keep up with the good job!
Francesco
Comment 1 fillumina 2011-05-30 12:22:42 UTC
I should add that this problem doesn't appear all the time but only once in a while.
Comment 2 fillumina 2011-06-01 07:18:36 UTC
It seems related to having a debugging session opened.
Comment 3 Jan Becicka 2011-06-01 08:42:27 UTC
Re 4)
and what happens if you agree on opening project?
Comment 4 Tomas Zezula 2011-06-01 13:28:56 UTC
>3) the class is opened in the editor but it isn't evidenced in the Projects
>panel
>4) requiring to do so by using the "Select in project" right-mouse-click menu
>will cause a popup request to open the owning project (the one we are working
>with which is obviously already opened).
If the project is not in the Projects panel it's not opened. It's only a dependence of
a opened project.
For example:
You have project B which depends on project A.
Only B is opened. You can navigate into project A source as it's a dependence of B,
but it's not opened. If you invoke Select in project" the IDE asks if the project should be opened.
Did I misunderstand something in your comments?
Comment 5 fillumina 2011-06-01 14:41:52 UTC
(In reply to comment #3)

If I agree I found two instances of the same project opened in the Projects panel.

(In reply to comment #4)

What you say is what it should be, but instead I have that project already opened and present in my Projects panel, thus the problem.

--

As soon as possible I will try to found a procedure to replicate the problem, in the meantime I leave the status (resolved) unchanged.
Comment 6 Tomas Zezula 2011-06-01 15:17:22 UTC
Can you attach screenshots of this projects with tooltip (containing the absolute path)?
You will need to create 2 screenshots 1 for each of these projects.
Thanks
Comment 7 fillumina 2011-07-01 12:38:44 UTC
Sorry to be so late guys,
I have stumbled over this problem again and I had the sense of recording it, so now I have a procedure that can reproduce the problem and a video as well ;).

That's the procedure:
1) just "clean and build" a maven module with a bug in a test
2) having get the stack trace click on a class which is part of the module
3) the class will open in the editor with the cursor on the proper line
4) if you ask to "select in project" you will be asked to open the module again

Thanks and keep on the good job!
Francesco

ps. I haven't found any way to actually upload my video (2.6 Mb), the attachment form is way too slow (starts with 2 kb/s, and then dies few seconds after). Do you have other means to get it (i.e. an email or something)?
Comment 8 Jesse Glick 2011-07-01 14:42:23 UTC
(In reply to comment #7)
> I haven't found any way to actually upload my video (2.6 Mb)

There are various sites for uploading large files for temporary sharing, though precise steps to reproduce are more valuable than any video.

(In reply to comment #5)
> If I agree I found two instances of the same project opened in the Projects
> panel.

Normally this does not happen. I did however find that there is a symlink bug. Create a Maven quickstart app, then close it and create a symlink to it. Open the project via the symlink, and edit AppTest.java to fail(). Alt-F6 and click on the AppTest.java link in the resulting failure log. AppTest.java is opened via the canonical path, rather than the symlink path as expected.
Comment 9 Jesse Glick 2011-07-01 14:49:06 UTC
More relevant summary. Note that jumping to source from the Test Results window works correctly; it is the separate Output Window tab for the test failure that is broken.

(In reply to comment #0)
> The other (maybe related) problem is that the link doesn't cover the entire
> classpath but starts right after the first part of the domain name

Unrelated; see bug #197915.
Comment 10 fillumina 2011-07-01 15:14:36 UTC
The link to the video (xvid-AVI, 2.6 Mb):

http://uploading.com/files/92bf4693/defect.avi/

It shows clearly how the duplicated project (module) gets opened.
Comment 11 Jesse Glick 2011-07-01 15:29:51 UTC
The problem is not in NetBeans as such but the output line "Surefire report directory: ..." which prints the canonicalized path. This does not look like a bug in the Surefire plugin either; Maven itself configures

    /**
     * Base directory where all reports are written to.
     *
     * @parameter default-value="${project.build.directory}/surefire-reports"
     */
    private File reportsDirectory;

to the canonicalized path.

Relates to bug #178420, but even a fix of that would not help much since you would still be opening an individual file using the wrong path; you would be prevented from opening a duplicate copy of the whole project, but there would still be issues.
Comment 12 Jesse Glick 2011-07-01 15:52:10 UTC
The plot thickens. Maven does not seem to be canonicalizing anything; rather, the Java launcher itself does!

  jrunscript -e 'println(java.lang.System.getProperty("user.dir"))'

prints the physical path when you cd to the symlink.

Also, mvn -f /full/path/to/symlink/pom.xml works even when (cd /full/path/to/symlink; mvn) does not. NB does not normally invoke Maven this way, since there can be some problematic mojos or POMs which assume a particular CWD, but perhaps it has to do do when the project path contains symlinks.
Comment 13 Jesse Glick 2011-07-01 15:55:47 UTC
(In reply to comment #10)
> http://uploading.com/files/92bf4693/defect.avi/

/home/frm/Development -> /home/data/Development? Try opening the project from the latter path.
Comment 14 fillumina 2011-07-01 16:06:21 UTC
(In reply to comment #13)

> /home/frm/Development -> /home/data/Development? Try opening the project from
> the latter path.

You are right! I had a symlink in the path of the module. Opening the same module in a path without symlinks solved the problem.
Comment 15 Jesse Glick 2011-07-01 16:52:16 UTC
I filed #7061568 for the JVM since I think this should be fixed upstream. In the meantime I will consider a workaround in NB.

(The NB Ant integration is not affected. While Ant itself is affected, NB does not fork Ant and so does not rely on the CWD; it embeds Ant in-VM and passes an absolute file name to the script.)
Comment 16 Jesse Glick 2011-07-01 18:06:41 UTC
core-main #3a7357cccfd2
Comment 17 Quality Engineering 2011-07-02 14:08:12 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/3a7357cccfd2
User: Jesse Glick <jglick@netbeans.org>
Log: #198997: Running Maven follows symlinks in project path
Comment 18 Tomas Danek 2011-08-25 11:54:04 UTC
verified in trunk according to steps in comment #7

Product Version: NetBeans IDE Dev (Build 201108220601)
Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02-384
System: Mac OS X version 10.6.8 running on x86_64; MacRoman; en_US (nb)
User directory: /Users/tomas/.netbeans/dev
Cache directory: /Users/tomas/.netbeans/dev/var/cache
Comment 19 Jesse Glick 2011-08-25 16:10:05 UTC
(In reply to comment #18)
> verified in trunk according to steps in comment #7

Did you check comment #8 too?

releases #514e73d4d2f9
Comment 20 Quality Engineering 2011-08-26 04:28:19 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/514e73d4d2f9
User: Jesse Glick <jglick@netbeans.org>
Log: #198997: Running Maven follows symlinks in project path
(transplanted from 3a7357cccfd28fc363cc04a250b1ff8418e4229a)
Comment 21 Tomas Danek 2011-08-31 09:51:46 UTC
verified in patch (yes, i followed also comment #8)
Comment 22 Quality Engineering 2011-09-26 13:34:07 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/84f4bd5bcd9c
User: Jesse Glick <jglick@netbeans.org>
Log: #198997: Running Maven follows symlinks in project path
(transplanted from 3a7357cccfd28fc363cc04a250b1ff8418e4229a)