Bug 66177 - [workspace] PDE can't build plugin jar from linked sources
Summary: [workspace] PDE can't build plugin jar from linked sources
Status: RESOLVED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: Build (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal with 13 votes (vote)
Target Milestone: ---   Edit
Assignee: pde-build-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 68965 76413 82412 99350 99743 101020 161434 (view as bug list)
Depends on:
Blocks: 181380
  Show dependency tree
 
Reported: 2004-06-08 12:54 EDT by David Pickens CLA
Modified: 2018-12-03 09:11 EST (History)
21 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Pickens CLA 2004-06-08 12:54:32 EDT
Create a plugin project with the source directory as a link to a directory 
outside of the workspace. Create a "build.properties" file in which the linked 
directory is the source from which the jar file is to be built. The sources 
will not be found when you export the plugin as a "Deployable Plug-ins and 
Fragments".

If you create an "Ant" script, build.xml, you'll see that it is referencing 
the linked directory, instead of the directory that is the target of the link.

Note: this problem exists in 3.0RC1
Comment 1 Pascal Rapicault CLA 2004-06-09 09:52:59 EDT
Was it working in 2.1.3 or in 3.0 M8?

If I'm correct this has never been supported because PDE Build does use the 
workspace to find resources. This allows it to work outside of eclipse.
Comment 2 David Pickens CLA 2004-06-09 11:44:06 EDT
I don't know if it worked in earlier versions. I didn't try it until 3.0M9. It
should not be a difficult problem to fix. When generating the "build.xml" take
not of a source "directory" that is actually a link, and replace the reference
to the target directory. Then it should work fine.
Comment 3 Pascal Rapicault CLA 2004-06-09 16:17:21 EDT
If you really think what you wrote in the previous comment, feel free to 
provide a patch :-).
Comment 4 David Pickens CLA 2004-06-09 16:23:03 EDT
Of course, what I meant is "it shouldn't be a difficult problem to fix for one 
who is familiar with the PDE code that creates the 'build.xml' file".  I don't 
qualify. :-) 
Comment 5 Pascal Rapicault CLA 2004-06-09 16:33:50 EDT
The point I made in comment #1 was actually to say that it is not trivial since 
PDE Build does not know about your workspace as a workspace, nor does it 
compile the java files directly.
The compilation is done by the javac ant task which does not know about eclipse 
workspaces and just compile folders that it is being told to. 
This design choice has been one since day one and changing that is far from 
trivial. However this decoupling as the advantage to allow you to be able in a 
releng-style mode, build eclipse without eclipse, etc.

To be honest it is unlikely to be fixed in a near future.

The only workaround that could possibly work in your case would be to put the 
target of the link in the build.properties.
Comment 6 Mike Lischke CLA 2004-07-05 16:10:06 EDT
*** Bug 68965 has been marked as a duplicate of this bug. ***
Comment 7 Mike Lischke CLA 2004-07-05 16:19:01 EDT
I wonder how this bug can be deferred. For me it is a show stopper and in that 
a very serious problem, because we have all our source folders linked to our 
version control system folders. Currently I have to fully duplicate the whole 
source structure in a local folder tree to be able to export a plug-in. This 
is not just a little problem.

I also agree that putting the resolved folders into the Ant script should do 
the job. I assume there is a temporary Ant script generated for the export, 
right? I tried to manually adjust the folders in the build.xml file but this 
produced other problems in Eclipse.

To sum up: linked folders are a great concept, also for merging different 
libraries in one Eclipse project, but its implementation seems to have stopped 
half on the way.
Comment 8 Pascal Rapicault CLA 2004-10-18 08:51:11 EDT
*** Bug 76413 has been marked as a duplicate of this bug. ***
Comment 9 Pascal Rapicault CLA 2005-01-10 08:50:32 EST
*** Bug 82412 has been marked as a duplicate of this bug. ***
Comment 10 Pascal Rapicault CLA 2005-06-11 12:38:08 EDT
*** Bug 99350 has been marked as a duplicate of this bug. ***
Comment 11 Pascal Rapicault CLA 2005-06-13 20:48:06 EDT
*** Bug 99743 has been marked as a duplicate of this bug. ***
Comment 12 Mike Lischke CLA 2005-06-14 02:51:02 EDT
Here is a workaround for this problem:

On Windows 2k and XP with NTFS you can use socalled junction points, which allow
a mapping of one folder into another folder. This works very much like symbolic
links in Unix and is transparent to the OS, so it really looks like the mapped
folder is physically located in the target folder, while it is actually only a
phantom. You need a special tool to create a junction point, either from the Win
resource kit or from Sysinternals:
http://www.sysinternals.com/Utilities/Junction.html. Another good point of these
junction points is that it is a set-and-forget feature. Once set it stays until
you delete the mapping, no need to modify the registry or set an auto start
entry etc.

The biggest advantage (it's absolute transparency to the OS) is also the biggest
disadvantage: using the command line or Explorer you cannot tell which folder is
true and which is a mapping. You need the junction point tools to find the
mapped folders. So it is easily possible that you delete files in the mapped
folder without realizing that the files in the physical folder will also be
deleted. So one should not overuse junction points.

Apart from that I have used junction points for several months now and they work
great for me.
Comment 13 Bob Foster CLA 2005-06-14 03:16:13 EDT
Apart from the fact that the workaround is platform-dependent and the main
source of the problem is the way Import sets up projects with linked content.

Somebody just tell me how I can import these projects without causing this
problem - will copying the source do it? - and I'll go away. Otherwise, the
response to this bug so far is to say the least unproductive.
Comment 14 Mike Lischke CLA 2005-06-14 11:21:35 EDT
Bob, the bug is clearly marked as for Windows XP, so my workaround might indeed
help people with this particular problem. For copying the sources: have you read
all comments here? I wrote in my comment from last year that the only solution I
found is to copy the source code and use existing instead linked folders.

However I agree that the entire handling of this particular bug is a bit
disappointing, particularly when you see how many times it was reported (see the
duplicates) and how easy a solution seems to be.
Comment 15 Pascal Rapicault CLA 2005-06-22 17:44:14 EDT
*** Bug 101020 has been marked as a duplicate of this bug. ***
Comment 16 Pascal Rapicault CLA 2005-11-10 14:55:44 EST
*** Bug 113704 has been marked as a duplicate of this bug. ***
Comment 17 Christian Schaefer CLA 2005-12-14 08:20:57 EST
for our rich client application we are using a lot of jar files built on the server and binary included in some plugins in the client. therefore this bug is very boring for us, because we have to copy the jar files into the plugin projekts   otherwise we would be able to link to the one central file and version.

but maybe we can fix it in an releng build script manually.


Comment 18 Karl Kuhlmann CLA 2006-01-12 18:56:59 EST
See comment #5 in bug 99743.
This has effects that are more annoying than the build problems. When you link your source code to plug-in projects and try to connect them by exporting a package from one and importing classes int that package in a dependent project you get compile errors of the type:

import com.foo.bar.example.trial.Try;
       ^^^^^^^^^^^^^^^^^^^
(package com.foo.bar.example cannot be resolved. 
This is a bogus error. In fact the class is compiled. However, it is clearly not helpful, and vastly reduces productivity as well as any down-stream problems it will cause. It doesn't happen if you put the source code for a plug-in in the project directory.
Comment 19 Pascal Rapicault CLA 2006-01-12 22:06:13 EST
Karl, I suspec that you are adding the libraries directly on the classpath or something like that which would likely create problems.
Comment 20 maarten meijer CLA 2006-09-05 15:09:54 EDT
(In reply to comment #14)
> Bob, the bug is clearly marked as for Windows XP, 
This very same bug also occurs under Mac OSX 10.4.7 using Eclipse 3.2
Please offer a workaround!
Comment 21 maarten meijer CLA 2006-09-06 17:48:17 EDT
> Please offer a workaround!
1) Create a normal source folder /src

2) Add a special ant builder that copies the required files into /src on clean, build, etc
You can set your preference. Ant skips if no changes are detected
Have Ant mark the copied files as read-only and derived so they don't go into CVS and you don't edit them

DON'T NAME YOUR ANT FILE build.xml !! Then the feature build will wipe it out!

3) Go back to developing, all happens automagic...
Comment 22 Pascal Rapicault CLA 2006-12-14 12:46:52 EST
*** Bug 161434 has been marked as a duplicate of this bug. ***
Comment 23 Guillaume WALLET CLA 2007-03-07 05:34:50 EST
Hello,

I'm using maven 2 to build some project together with a eclipse plugin project.
The maven-eclipse-plugin produce the .project and .classpath and include dependencies as linked resources in .project in place of duplicate the library in the project, so I think it's a good way to do.

The plugin run without problem inside eclipse PDE, in debug to.

But the export wizard don't use the real location of dependency so it's impossible to build plugin.

I agree with the idea that it should be fixed.
Comment 24 Markus Keller CLA 2007-03-07 05:44:31 EST
A fix for bug 101241 would also solve this problem.
Comment 25 Miles Parker CLA 2007-04-20 13:45:05 EDT
My two cents are that the fix Andrew proposes in bug 168365 would be the best, e.g. making marteen's work around part of the generated ant build, or perhaps as a helper build. I would argue against simply using the linked resource directly as this then makes a build dependent on access to that non-workspace resource. Or as I suggest half-seriously in bug 101241, simply dissallow linked resources in PDE builds. <ducking/>
Comment 26 Paul Wagland CLA 2009-01-04 16:30:00 EST
(In reply to comment #24)
> A fix for bug 101241 would also solve this problem.
> 

Well, bug 101241 is now fixed, but I still cannot export a plugin that I have that has a linked directory. I am trying to convert an older project over, and the linked directory is to the build tree of native build.
Comment 27 Lars Vogel CLA 2018-12-03 09:11:31 EST
Currently we are not actively enhancing PDE build anymore. Therefore, I close this bug as WONTFIX. 

Please reopen, if you plan to provide a fix.
Comment 28 Lars Vogel CLA 2018-12-03 09:11:43 EST
Currently we are not actively enhancing PDE build anymore. Therefore, I close this bug as WONTFIX. 

Please reopen, if you plan to provide a fix.