|Eclipse with Subclipse behavior against Maven file structure is strange [message #989398]
||Wed, 05 December 2012 23:52
| David Luu
Registered: December 2012
Was wondering if anybody encountered this or have insight into the observed behavior.|
We are setting up Selenium test framework, developing with Eclipse and compiling and running the tests through maven with our CI server.
As such, rather than muck with Maven integration with Eclipse or modifying Maven's default file structure to be Eclipse friendly, we decided to just adapt Eclipse for Maven, keeping the default Maven file structure so our test code is under
Don't ask why or suggest to use Maven integration with Eclipse or modify Maven settings, this post is just to talk about Eclipse behavior I observed.
So what we do is use Subclipse to checkout project to our local machines to work on.
So with our current setup, to get Eclipse to recognize Java packages correctly to start from src/test/java and rather than src (so it doesn't think packages are named test.java.yourpackagenamingfromhereon)
Our project lead designated that we checkout project from SVN as new Java project (via wizard) and specify SVN path that leads up to src/test/java and select "Use project folder as root for sources and class file" instead of "Create separate folders for sources and class files". It would appear that if you don't make this selection or specify SVN path to be root of project (e.g. parent of src) instead, then Eclipse fails to recognize the proper Java package hieararchy.
But what's interesting is if I use an external SVN client to checkout first to have a local repo, then use Subclipse and checkout from SVN as new Java project (via wizard), then instead of create new project in workspace as one typically does, select create project from existing source and select the local repo (at this point, project layout defaults to "Create separate folders for sources and class files", can't modify). Then finish the wizard, accepting prompts about any overwrites of the local repo, etc. The project imports successfully, and you get both Subclipse functionality to manage the codebase there (rather than use external SVN client anymore) and you get desired package referencing w/o having to resort to the workarounds my lead specified.
I also get the desired functionality not using Subclipse, using external SVN client, and importing/creating Java project with existing source, but this way, don't get the Subclipse functionality to manage SVN code inside Eclipse. Besides what I state above, I haven't yet found alternate way to checkout SVN code with Subclipse w/o having existing source to make it reference package correctly.
So I was wondering why does Eclipse w/ (or w/o Subclpse) behave this way? Why does creating project from existing source reference package starting at src/test/java while creating in workspace, etc. as new will make it reference from src?
Shouldn't it behave same either way? Maybe I'm missing some insight on the Eclipse Java project architecture.