File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes How can I control the organization of my code and still use Eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How can I control the organization of my code and still use Eclipse?" Watch "How can I control the organization of my code and still use Eclipse?" New topic
Author

How can I control the organization of my code and still use Eclipse?

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

I have several apps that I have in Eclipse.

1. If I put the apps into the same project, I can re-use code from the application framework that I have developed, but this seems un-organized. For example, when I look at "Problems" I see all problems from the whole workspace which is not what I want when I'm focusing on one project-at-a-time.

2. If I put the code into different projects in the same workspace, then I can't reuse my reusable code since each project has it's own "src" directory and each project even has its own "com" folder.

3. There is a problem in seeing problems in other projects, other than the one I'm developing. I've tried using a workspace for each project. This succeeds in separating the errors so that I only see the errors from the project that I'm working on, but then I'm even farther away from being able to reuse my reusable code.

4. Another problem: to deploy a .jar file is not easy for me in Eclipse. It seems that I get it working once and have to figure it out again the next time because my choices from the previous time that I created a .jar don't "stick".

At the "Trail Ride" and in the "SCJP" forum, they suggest not using any IDE and instead use Java. They say that we should learn to use Java and that if you use an IDE, you're leanring the IDE and not learning Java.

Kaydell
[ June 29, 2007: Message edited by: Kaydell Leavitt ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30753
    
156

1) Why would you want everything in the same project? You could use the filter approach in #3 to see the errors for each folder/app, but as you point out it is unorganized. You would have to create multiple source folders for each app for this to work.

2) Why can't you put the code into different projects? You can add the reused code project to the build path of the reuser's project.

3) On the problems pane, there is an arrow icon for filters. If you set your filter to the active item and it's children, you limit what you see in the problems tab. By clicking on a project, you only see the errors for one project at a time.

4) You could use Ant to create the jar (with your settings) and run it whenever you want to create a jar.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Thanks for your help again Jeanne,

I remember that you've helped me before.

I'm going to try to ease-up.

Kaydell
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Kaydell Leavitt:
4. Another problem: to deploy a .jar file is not easy for me in Eclipse. It seems that I get it working once and have to figure it out again the next time because my choices from the previous time that I created a .jar don't "stick".


Somewhere in the wizard - if I remember correctly, on the bottom of the last page - there is an option to save the setting in a jardesc file. Use that, and next time just right click that file and choose the option to directly create the jar file again.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16140
    
  21

It's true - if you're just learning Java, learning an IDE is just making your work twice as hard. However, if you're required to use Eclipse by an employer or are proficient with Java and want the convenience features that an IDE provides, that's another matter.

If multiple projects are sharing code, you can make a project out of the shared code, have it build a jar, then have the other projects reference that jar. If everything's in the same workspace, you can define the other projects as dependent projects, so that they will be updated if you modify the jar. Also, the jar location will be made relative.

A jar defined this way is attached to the other projects for reference purposes, but presumably - OK, commonly, though not always - when those projects are deployed, they'll want their own copy of the jar. If that's the case, you have to ensure that the dependent project's build process includes a step to insert a copy of the jar into the dependent project build. I normally have Ant do that, but there are other ways as well.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I control the organization of my code and still use Eclipse?