Hustle Play
Syd's blog.
Using SVN Externals in Eclipse/Subclipse to Reuse Common Code
Posted by on March 11, 2011
These are instructions on how to create a common project which can share common code amongst several UI projects.
In my case, I wanted to share common J2ME code between BlackBerry and J2ME UI’s. However, this technique can be used in other situations where common code is to be shared amongst separate builds which require different build environments.
- First, separate your common code and put the source code into a General Project.
- Remove the src directory if it exists. That is, move everything up one directory and remove the empty src directory.
- Commit the General Project to SVN
- Lets start by creating the J2ME Project
- Create a new MIDlet Project (Eclipse MTJ)
- Commit the MIDlet Project to SVN
- Copy the URL of the General Project to your clipboard
- Set the SVN Externals for the MIDlet Project to the URL that you just copied
- Synchronize the MIDlet Project with the Repository. You should see a conflict.
- Update
- Commit
- Delete the MIDlet Project
- Check out the MIDlet Project from SVN. Your MIDlet Project should have pulled the common code also.
- From inside the MIDlet Project, set the Common Code directory to a Source Folder
Advertisement