Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to setup Linked Resources relative to the .project file?

We have a Flash Builder (which is based on Eclipse) project that pulls source from different locations, included in the source control in which the project is. As per our organization requirements, the source code is present in directories not directly under the project directory. Initially we had the problem that all paths to the linked resources were absolute and did not work on other machines with different paths.

Right now, the solution we have for this is to set up a Linked Resource Path Variable that points to the root of the working folder. All other locations are based on that, so we can include source from folders like

${WORKING_BASE}/library1 ${WORKING_BASE}/library2 

The problem with this solution is that everyone that pulls the project has to set the WORKING_BASE variable correctly before opening the project for it to work. My question is, is there a way to make the Linked Resources relative to the location of the .project file? That would be ideal.

like image 457
JohnWithoutArms Avatar asked Oct 22 '10 18:10

JohnWithoutArms


People also ask

How to add linked resources in Eclipse?

To add a linked folder to your project, click File > New > Folder to display the New Folder dialog box. Click Advanced, select Link to alternate location (Linked Folder), and then navigate to the folder that you want to link to.

How do I change linked resources in eclipse?

"The linked resource target path can be changed by selecting the Edit... button in the File > Properties > Resource property page of the linked resource. "

How do I link a File in eclipse?

Under the Source tab you can click on the Link Source... button and then input the location of your common source directory - that will allow you to put all "shared" files in the one spot and link them into the projects you want.

What are linked resources?

Linked resources are files and folders that are stored in locations in the file system outside of the project's location. These special resources can be used to add files and folders to your project that for some reason must be stored in a certain place outside of your project.


2 Answers

It is possible since Eclipse 3.6 (Helios)

Open the project properties and goto Resources > Linked Resources > Path Variables.

There you can create a new variable relative to an existing one. For instance:
Name: MY_SOURCE_FOLDER
Location: ${PROJECT_LOC}\..\src

This will add a new Path variable to your .project file with a value like:

$%7BPARENT-1-PROJECT_LOC%7D/src 

meaning ${PARENT-1-PROJECT_LOC}/src, where the 1 means the parent directory 1 times above PROJECT_LOC.

like image 72
Matthias Avatar answered Sep 20 '22 21:09

Matthias


With eclipse 3.7, giving this path :

C:\projects\workspace\project1 C:\projects\workspace\project2 

Within project1 you can do :

PROJECT_LOC => C:\projects\workspace\project1 PARENT-1-PROJECT_LOC => C:\projects\workspace PARENT-2-PROJECT_LOC => C:\projects\ PARENT-1-PROJECT_LOC\project2 => C:\projects\workspace\project2 
like image 34
Sébastien Avatar answered Sep 18 '22 21:09

Sébastien