Search code examples
javaandroideclipseantsharing

Eclipse: create two projects sharing files


I need to create an application that will be deployed on Desktop and Android. I'll use the MVC pattern; the Desktop and Android versions will share the Controller and the Model.

I thus want to create my two projects in a way that allows me to share the code related to the controller and the model, each project having its own version of the view.

What is the best way to do that in Eclipse? I don't want to use the code as a library because it must be possible to modify it directly from any of the two projects, with the modifications visible immediately in both.

Moreover, when the applications will be done, I must be able to generate an "ant build file", so I want a file structure that allows to build the two versions separately with no redundancy.

Thanks in advance!


Solution

  • You can share class files and jar files between projects as a library, so what you would need would be three projects: two with the interface code and one with the common files. The common files would be your library.