I want to be able to use a single set of source files between an sbt android-plugin project, that I'll build from the command line. I'd like to be able share the same AndroidManifest.xml
file as well as the res
directory.
Is there a way I can get Eclipse to create/import the Android project from the sbt project's src/main directory?
Here's the kludge I used to get it to work.
First, create a temporary Eclipse Android project in your workspace with the relevant source code, manifest, resources, etc. I'll refer to this project as EclipseProj
.
Next, create an sbt android-plugin project from a shell in the same directory as your Eclipse Workspace. I'll refer to this project as SbtProj
.
Then, move the src
folder contents of EclipseProj
to SbtProj/src/main/java
, as well as the AndroidManifest.xml
file and the res
folder. Optionally, make sure you can build SbtProj
.
Next, move the .classpath
, .project
, and project.properties
files to SbtProj/src/main
.
Now you are ready to import the sbt project into Eclipse. Delete EclipseProj
from within Eclipse (don't delete the files on disk yet, in case you missed something.)
From Eclipse choose the import menu, "Existing Projects into Workspace", and click browse to select root directory. Choose the path to SbtProj/src/main
, then click the checkbox to import the project. I'll refer to this new project again as EclipseProj
since we removed the old temporary version from Eclipse.
Now your project is imported, but the source is missing. Right click EclipseProj
in Eclipse and select project properties. Click the Java Build Path, then the source tab, and the "add folder" button. Select the java checkbox.
Now do a clean build in Eclipse and verify that EclipseProj
builds. If it does, and the SbtProj
does as well, you're done and you can delete the original EclipseProj
temporary project's files.