Multiple Source directories? [message #244602] |
Wed, 02 January 2008 20:13  |
Eclipse User |
|
|
|
Originally posted by: siegfried.heintze.com
I just discovered
http://maven.apache.org/guides/introduction/introduction-to- the-standard-directory-layout.html
and I want to change my directories.
Presently I'm using the "src" directory for my java source code and I want
to rename it to "src/main/java".
Normally I would just go ahead and try it but I don't want to mess up my
development directory. Should I
(1) create a new directory called src/main/java and copy the files from src
into it? Will this be a problem having two source code directories?
(2) rename the existing directory (how do I do that when the old name is src
and the new name is src/main/java?)
What about the fact that I created a src/test/java and had to tell eclipse
that this was not part of "src/" directory. If I create a new directory
called "src/main/java" while "src/" still exists, is this going to cause a
problem?
Thanks,
siegfried
|
|
|
Re: Multiple Source directories? [message #244603 is a reply to message #244602] |
Thu, 03 January 2008 04:30  |
Eclipse User |
|
|
|
Originally posted by: pcdavid.pcdavid.net
Siegfried Heintze a écrit :
> I just discovered
> http://maven.apache.org/guides/introduction/introduction-to- the-standard-directory-layout.html
> and I want to change my directories.
>
> Presently I'm using the "src" directory for my java source code and I want
> to rename it to "src/main/java".
A safe way to do this would be:
1. Remove the 'src' directory from you build path: right-click on the
project, and select "Build Path > Configure build path". In the 'Source'
tab, select the 'src' folder, and remove it. The folder will not be
deleted, but Eclipse will not consider its content for compilation.
2. Close the project properties dialog and go to the "Navigator" view
(not the "Package Explorer").
3. Inside 'src', create the folders main/java (and main/test if you
want), and move your source files in them.
4. Go back to the "Package Explorer". Select the 'src/main/java' folder,
right-click and select "Build Path > Use as source folder". Repeat for
src/main/test if you have it.
> Normally I would just go ahead and try it but I don't want to mess up
> my development directory.
If you're not using an SCM like Subversion, you should be. It's very
liberating to know that you can experiment and always come back to a
safe state if you things get messed up.
> (1) create a new directory called src/main/java and copy the files from src
> into it? Will this be a problem having two source code directories?
There is normally no problem having several source directories, but it
can be confusing if they are contained in one another (it *is* possible
to support this with filters, but in general the complexity is not worth
it).
If you are using Maven (instead of just following their recommended
source layout), you might consider installing the "Maven Integration for
Eclipse" plugin from Codehaus (http://m2eclipse.codehaus.org/update/).
|
|
|
Powered by
FUDForum. Page generated in 0.08480 seconds