Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share code in eclipse projects

Tags:

java

eclipse

I have two applications, one for android and one for blackberry and I want to share some common code between the two apps.

I have a folder structure as follows...

project
    android
        .metadata (eclipse workspace)
        project
            (android specific project folder layout)
    blackberry
        .metadata (eclipse workspace)
        project
            (blackberry specific project folder layout)
    project.core
        src
            (just source files common to each project above)

I just want to reference an external source folder (using relative paths) from the two internal projects. It seems eclipse doesn't like this kind of setup as it prefers source folders to be children of the workspace folder. Due to other reasons I cannot share a common workspace between blackberry and android.

Is there a way to do this?

like image 661
Russell Zornes Avatar asked Jun 09 '11 13:06

Russell Zornes


People also ask

How do I share project on Eclipse?

Right-click the project and click Team > Share Project. In the Share Project wizard, select Jazz Source Control as the repository type and click Next. If you are not already connected to the repository in which you want to share the project, select a repository to use and click Login.

How do I Export a Java project from Eclipse to github?

Step 1: Open Eclipse IDE and right-click on the project you want to push and go to Team->share project. Step 2: It will add the project to the given repository as shown below: Step 3: Again right-click on the project and go to Team->commit.


1 Answers

I would encourage putting your common code into a separate self contained project. You can then package this into a jar and import it in any of your projects.

like image 92
mark-cs Avatar answered Oct 07 '22 01:10

mark-cs