Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using eclipse with an existing (complex) project
Using eclipse with an existing (complex) project [message #60157] Wed, 18 June 2003 06:27 Go to next message
Eclipse UserFriend
Originally posted by: james.dontspamme.mosaicsoftware.com

Hi,

I\'ve browsed this group and there have been a number of posts that focus
on similar problems to those I\'ve run into. Some of them have helped a
little in my understanding of how Eclipse manages project directory
structures, and I\'m starting to despair that what I want to do is not
possible (or is going to be just plain painful).

But before I give up I thought I\'d pose this to the group:

We have an existing project consisting of about 1,800 Java files. The
existing directory structure is pretty awful but we inherited it. I\'d
prefer not to change it since we throw away a lot of history for much of
the source code (again, an inherited source control system) and it means
moving a large group of developers over to a new directory structure.

What it boils down to is, a. is it possible, and b. if so what\'s the best
way to point eclipse at the following directory structure (given the
constraints below) and create a new project?

all classes live in sub-packages of foo (so foo.*, foo.bar.*,
foo.bar.blue.*)

base
+--- src
| +--- foo
| +--- other1
|
+--- build
| +--- classes
| +--- other3
|
+--- other4

I want the eclipse project to either live in the src directory, or live in
the base directory but ignore pretty much everything under it except the
contents of base\\src\\foo.
I want to build class files into base\\build\\classes\\foo\\... (as per
the packaging).

This is complicated by the fact that I need eclipse to pick up classes in
a separate directory in a completely unrelated location on the file system
and use a completely different compiler and JVM (initially). In this case
c:\\winnt\\java\\classes, we\'re still on Microsoft\'s compiler/JVM.
We\'re in the process of migrating but we inherited a large amount of
legacy code tied to Microsoft\'s J/Direct technology. Part of that process
involves moving off Visual J++ onto a new IDE. Eclipse gets my vote, _if_
we can get this step right.

I\'ve fought with eclipse a number of times to try to get this right. In
most cases I\'ve lost on the following fronts:
1. It won\'t let me reference class directories below the project folder
(C:\\winnt\\java\\classes)
2. It seems to include everything in the directories under the project
folder (we have a lot of extraneous files that aren\'t related directly to
the Java portion of the project).
3. When I create the projects initially eclipse takes a hell of a long
time to startup before it comes back to me. On one occasion I forcibly
terminated the process when I noticed it was replicating the entire
base\\build directory\'s contents under base\\build\\classes\\build\\...
(I\'d set the build directory to build\\classes and the project files were
in base).

Any help suggestions (pointers to articles, I\'ve read the various FAQS
which were moderately helpful) would be most welcome.

Thanks in advance.
James Greenfield
Re: Using eclipse with an existing (complex) project [message #60302 is a reply to message #60157] Wed, 18 June 2003 08:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: faust.acm.org

> all classes live in sub-packages of foo (so foo.*, foo.bar.*,
> foo.bar.blue.*)
>
> base
> +--- src
> | +--- foo
> | +--- other1
> |
> +--- build
> | +--- classes
> | +--- other3
> |
> +--- other4

Create a project named base. Create a Java source folder named "src" inside
base. Move foo and all subdirectories into base. Copy the remaining non
source directories into base. In the project properties, go to Java Build
Path, Source tab and set the exclusion filter for your "src" source folder
to contain everything that isn't foo.

To build class files into base\build\classes click on "allow output folders
for source folders" in the Source tab of Project->properties->java build
path. Then choose the base\build\classes folder for the output of the foo
project.

>
> I\'ve fought with eclipse a number of times to try to get this right.

Don't fight with Eclipse, play nice!

> 1. It won\'t let me reference class directories below the project folder
> (C:\\winnt\\java\\classes)

Some thoughts... you can add a class folder under project->properties->java
build path libraries tab if you have a project containing these classes. Or
you can add it to the classpath properties of your launch. Or maybe you can
make a container and use that.

> 2. It seems to include everything in the directories under the project
> folder (we have a lot of extraneous files that aren\'t related directly to
> the Java portion of the project).

From the package explorer view, choose the drop down choice "Filters". Does
this give you what you're looking for?

> 3. When I create the projects initially eclipse takes a hell of a long
> time to startup before it comes back to me.

That's probably b/c it's compiling everything. If you have incremental
compile on, you don't normally pay this price unless you force a total
rebuild.

Hope this helps.


Randy
Re: Using eclipse with an existing (complex) project [message #60499 is a reply to message #60157] Wed, 18 June 2003 09:54 Go to previous messageGo to next message
Eclipse UserFriend
I've also sent you a document about projects. Hope your email is
james@mosblablah..

Best regards.
Re: Using eclipse with an existing (complex) project [message #60518 is a reply to message #60302] Wed, 18 June 2003 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Randy Faust wrote:

> > all classes live in sub-packages of foo (so foo.*, foo.bar.*,
> > foo.bar.blue.*)
> >
> > base
> > +--- src
> > | +--- foo
> > | +--- other1
> > |
> > +--- build
> > | +--- classes
> > | +--- other3
> > |
> > +--- other4

> Create a project named base. Create a Java source folder named "src" inside
> base. Move foo and all subdirectories into base.

I believe that he means copy foo and all subdirectories into src.

> Copy the remaining non
> source directories into base. In the project properties, go to Java Build
> Path, Source tab and set the exclusion filter for your "src" source folder
> to contain everything that isn't foo.

As an alternative to coping the entire directory hierarchy, you can
uncheck the Use default location item when creating the project and then
point at base. You want to define src as a source folder when creating
the project. Click on the Add Folder button when on the New Java Project
Source tab. You can use the build/classes directory for output by using
the Browse button for the Default Output Folder field on the same tab.


> To build class files into base\build\classes click on "allow output folders
> for source folders" in the Source tab of Project->properties->java build
> path. Then choose the base\build\classes folder for the output of the foo
> project.

> >
> > I\'ve fought with eclipse a number of times to try to get this right.

> Don't fight with Eclipse, play nice!

> > 1. It won\'t let me reference class directories below the project folder
> > (C:\\winnt\\java\\classes)

> Some thoughts... you can add a class folder under project->properties->java
> build path libraries tab if you have a project containing these classes. Or
> you can add it to the classpath properties of your launch. Or maybe you can
> make a container and use that.

I would suggest jaring up the classes in java/classes and adding as an
External Jar. You probably want to create a Variable to point to the jars
directory location to allow for easy changing of the location in the
future.

> > 2. It seems to include everything in the directories under the project
> > folder (we have a lot of extraneous files that aren\'t related directly to
> > the Java portion of the project).

> From the package explorer view, choose the drop down choice "Filters". Does
> this give you what you're looking for?

> > 3. When I create the projects initially eclipse takes a hell of a long
> > time to startup before it comes back to me.

> That's probably b/c it's compiling everything. If you have incremental
> compile on, you don't normally pay this price unless you force a total
> rebuild.

> Hope this helps.


> Randy
Re: Using eclipse with an existing (complex) project [message #61149 is a reply to message #60518] Wed, 18 June 2003 12:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: james.dontspamme.mosaicsoftware.com

Dave Wegener wrote:

> Randy Faust wrote:

> > Create a project named base. Create a Java source folder named \\\"src\\\"
inside
> > base. Move foo and all subdirectories into base.

> I believe that he means copy foo and all subdirectories into src.

> > Copy the remaining non
> > source directories into base. In the project properties, go to Java Build
> > Path, Source tab and set the exclusion filter for your \\\"src\\\" source
folder
> > to contain everything that isn\\\'t foo.

These both seem to imply that I\\\'m _required_ to match my directory
structure to that expected by Eclipse, which is exactly what I\\\'m trying
to avoid. We can\\\'t really afford to remodel our directory structure
(much as I\\\'d like to).

> As an alternative to coping the entire directory hierarchy, you can
> uncheck the Use default location item when creating the project and then
> point at base. You want to define src as a source folder when creating
> the project. Click on the Add Folder button when on the New Java Project
> Source tab. You can use the build/classes directory for output by using
> the Browse button for the Default Output Folder field on the same tab.

This I\\\'ve managed, but once I go this route I can\\\'t seem to include
the classes in c:\\\\winnt\\\\java\\\\classes (the idea of an external jar
file has occurred to me but I\\\'d like to avoid it if possible since
patches to the MS JVM include patches to these classes which means
managing updates across our entire group of dev teams, in four countries
:-P).

But thanks for the info, I\\\'ll go play (nice :-)) some more and see what
I can get done.

James
Re: Using eclipse with an existing (complex) project [message #61314 is a reply to message #61149] Wed, 18 June 2003 16:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

James Greenfield wrote:

> Dave Wegener wrote:

> > Randy Faust wrote:

> > > Create a project named base. Create a Java source folder named
\\\"src\\\"
> inside
> > > base. Move foo and all subdirectories into base.

> > I believe that he means copy foo and all subdirectories into src.

> > > Copy the remaining non
> > > source directories into base. In the project properties, go to Java Build
> > > Path, Source tab and set the exclusion filter for your \\\"src\\\" source
> folder
> > > to contain everything that isn\\\'t foo.

> These both seem to imply that I\\\'m _required_ to match my directory
> structure to that expected by Eclipse, which is exactly what I\\\'m trying
> to avoid. We can\\\'t really afford to remodel our directory structure
> (much as I\\\'d like to).

> > As an alternative to coping the entire directory hierarchy, you can
> > uncheck the Use default location item when creating the project and then
> > point at base. You want to define src as a source folder when creating
> > the project. Click on the Add Folder button when on the New Java Project
> > Source tab. You can use the build/classes directory for output by using
> > the Browse button for the Default Output Folder field on the same tab.

> This I\\\'ve managed, but once I go this route I can\\\'t seem to include
> the classes in c:\\\\winnt\\\\java\\\\classes (the idea of an external jar
> file has occurred to me but I\\\'d like to avoid it if possible since
> patches to the MS JVM include patches to these classes which means
> managing updates across our entire group of dev teams, in four countries
> :-P).

In that case, You should be able to use a linked folder to accomplish
this. Set the project up with src defined as a source folder. Go to the
Project Properties and select Java Build Path. Select Libraries tab and
Add Class Folder. Select Create Folder and then click on the Advanced
button. Give the folder a name and select Link to folder in filesystem
and browse to winnt\java\. Select classes. This will create a link to
the folder in base. The classes in the directory will now be in your
classpath.


> But thanks for the info, I\\\'ll go play (nice :-)) some more and see what
> I can get done.

> James
Re: Using eclipse with an existing (complex) project [message #61601 is a reply to message #61149] Thu, 19 June 2003 05:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: faust.acm.org

> > I believe that he means copy foo and all subdirectories into src.
>
Right o. Point being that you don't have to change your structure to make it
work within Eclipse. you just have to massage the project setup a little to
tell it what to compile, where to compile it to, and what you want on your
project classpath.


Randy
Re: Using eclipse with an existing (complex) project [message #61701 is a reply to message #60157] Thu, 19 June 2003 08:17 Go to previous messageGo to next message
Eclipse UserFriend
It would be interesting to hear if you could accomplish to squeeze
your project into an eclipse project.

martin
Re: Using eclipse with an existing (complex) project [message #66564 is a reply to message #61314] Wed, 25 June 2003 00:54 Go to previous message
Eclipse UserFriend
Originally posted by: radzloco.yahoo.com

Dave,

The solution that you provided almost works for me. I have to add a
module to an existing project. I do not want to include anything else in
my build path but the new module will use existing modules so I want them
in my classpath.

The structure I have :

java
allModules
existingModule1
existingModule2
myNewModule

Whenever I add myNewModule folder all files inside it are assumed to fall
into "default" package, whereas they are in allModules.myNewModule. I
tried unchecking the default directory while creating the project and
browsing to the "java" folder and then adding allModules/myNewModule as
Source folder, but did not work. I also tried creating with default folder
and then adding the folder by Add Folder->Advanced and Link Folder.

Anywhere I am going wrong ?

Thanks.
Radz
Dave Wegener wrote:

> James Greenfield wrote:

> > Dave Wegener wrote:

> > > Randy Faust wrote:

> > > > Create a project named base. Create a Java source folder named
> \\\"src\\\"
> > inside
> > > > base. Move foo and all subdirectories into base.

> > > I believe that he means copy foo and all subdirectories into src.

> > > > Copy the remaining non
> > > > source directories into base. In the project properties, go to Java
Build
> > > > Path, Source tab and set the exclusion filter for your \\\"src\\\"
source
> > folder
> > > > to contain everything that isn\\\'t foo.

> > These both seem to imply that I\\\'m _required_ to match my directory
> > structure to that expected by Eclipse, which is exactly what I\\\'m trying
> > to avoid. We can\\\'t really afford to remodel our directory structure
> > (much as I\\\'d like to).

> > > As an alternative to coping the entire directory hierarchy, you can
> > > uncheck the Use default location item when creating the project and then
> > > point at base. You want to define src as a source folder when creating
> > > the project. Click on the Add Folder button when on the New Java Project
> > > Source tab. You can use the build/classes directory for output by using
> > > the Browse button for the Default Output Folder field on the same tab.

> > This I\\\'ve managed, but once I go this route I can\\\'t seem to include
> > the classes in c:\\\\winnt\\\\java\\\\classes (the idea of an external jar
> > file has occurred to me but I\\\'d like to avoid it if possible since
> > patches to the MS JVM include patches to these classes which means
> > managing updates across our entire group of dev teams, in four countries
> > :-P).

> In that case, You should be able to use a linked folder to accomplish
> this. Set the project up with src defined as a source folder. Go to the
> Project Properties and select Java Build Path. Select Libraries tab and
> Add Class Folder. Select Create Folder and then click on the Advanced
> button. Give the folder a name and select Link to folder in filesystem
> and browse to winnt\java\. Select classes. This will create a link to
> the folder in base. The classes in the directory will now be in your
> classpath.


> > But thanks for the info, I\\\'ll go play (nice :-)) some more and see what
> > I can get done.

> > James
Previous Topic:[JDT_UI]Custom IMarkers visible in CompilationUnitEditor
Next Topic:override properties view
Goto Forum:
  


Current Time: Sun Jun 08 00:11:31 EDT 2025

Powered by FUDForum. Page generated in 0.02769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top