Hustle Play

Syd's blog.

Using SVN Externals in Eclipse/Subclipse to Reuse Common Code

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.

  1. First, separate your common code and put the source code into a General Project.
  2. Remove the src directory if it exists. That is, move everything up one directory and remove the empty src directory.
  3. Commit the General Project to SVN
  4. Lets start by creating the J2ME Project
  5. Create a new MIDlet Project (Eclipse MTJ)
  6. Commit the MIDlet Project to SVN
  7. Copy the URL of the General Project to your clipboard
  8. Set the SVN Externals for the MIDlet Project to the URL that you just copied
  9. Synchronize the MIDlet Project with the Repository. You should see a conflict.
  10. Update
  11. Commit
  12. Delete the MIDlet Project
  13. Check out the MIDlet Project from SVN. Your MIDlet Project should have pulled the common code also.
  14. From inside the MIDlet Project, set the Common Code directory to a Source Folder
  15. Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.