So, I had a project in SVN that looks kinda like this:
- projectname
- src/
- conf/
- lib/
- logs/
- build.xml
I was having trouble in Eclipse because I kept hitting one of these two situations:
- I'd create a new project from SVN checkout, but my project wasn't a Java Project which means I didn't have things like code completion and build path settings. It was normal NOT to have these things when I was a developer in the early 2000s but these days I am more demanding about my dev basic needs!
- I'd create a new Java Project but this would create clone folders for like "src" and "lib". Then when I did my SVN checkout these would clash and I'd get ugly things happening like trying to edit my build path, but it would deliberately hide my "lib" folder from me, because it thought it was something else. Eww!
So here's what I did that worked. Or, How to set up a new Eclipse project when an existing codebase and ANT build file exist in subversion already:
- Open the SVN Perspective. (Window -> Open Perspective -> Other ... -> SVN Repository Exploring).
- If you don't have this option, you probably don't have Subclipse or something similar set up yet. That's another blog entry!
- Right click on the trunk of the project and choose Checkout, then "Check out as a project configured using the New Project Wizard"
- Choose Java Project and type in your project name (mine is the same as the root bullet point above)
- On the Create Java Project screen, pick "Create separate folders for sources and class files"
- Next it should show you your project name with a "src" folder underneath. Click that "src", then at the bottom there will be a hyperlink (you might have to scroll) that reads "Remove source folder 'src'". Pick that.
- OK Finish and let the SVN checkout do its thing.
- Now, in the Eclipse project tree, right click on "src" (which is currently a naked checkout folder simply called "src") and choose "Use as Source Folder"
- Now right click on "lib" (which is currently a naked checkout folder simply called "lib"), then choose Build Path -> Configure Build Path.
- Now click "Add Jars" and manually add all the jars in your "lib" folder that you have checked out from your svn repo
As a finishing touch, you'll want to make sure it can still Clean, Dist, Deploy in ANT. So go to Window --> Show View --> Ant, then add build.xml, then double click "clean" and "dist" to make sure it runs OK. Any problems from here are probably in the code files and not in the Eclipse setup.
No comments:
Post a Comment