From: Rhino on
Is there a way to determine the class dependencies in my code within
Eclipse?

For example, one of my projects makes use of various classes within a
"Common" project along the way. What is the simplest way to determine the
specific classes from "Common" (and any other projects outside my own) that
my project depends on?

At the moment, I'm actually opening each Java source file, looking at the
imports for each class where the first qualifier isn't java, and then
writing it down on a piece of paper. There's got to be a quicker way in an
IDE as slick as Eclipse but I'm not seeing it. (I tried searching on "class
dependencies" in the Eclipse help and got lots of hits but none of them
seem on point.)

I'm using Eclipse 3.5.2.

--
Rhino
From: Lew on
On 05/20/2010 02:12 PM, Rhino wrote:
> Is there a way to determine the class dependencies in my code within
> Eclipse?
>
> For example, one of my projects makes use of various classes within a
> "Common" project along the way. What is the simplest way to determine the
> specific classes from "Common" (and any other projects outside my own) that
> my project depends on?
>
> At the moment, I'm actually opening each Java source file, looking at the
> imports for each class where the first qualifier isn't java, and then
> writing it down on a piece of paper. There's got to be a quicker way in an
> IDE as slick as Eclipse but I'm not seeing it. (I tried searching on "class
> dependencies" in the Eclipse help and got lots of hits but none of them
> seem on point.)
>
> I'm using Eclipse 3.5.2.

While I can see how there might be occasional times when that information is
marginally useful, it's usually enough to know what JARs your code depends on,
since you don't get to pick and choose partial JAR pieces in your deployment.

A UML diagramming tool will give you what you want. If there isn't one built
in to Eclipse, there are plugins for that.

--
Lew
From: Tom Anderson on
On Thu, 20 May 2010, Rhino wrote:

> For example, one of my projects makes use of various classes within a
> "Common" project along the way. What is the simplest way to determine
> the specific classes from "Common" (and any other projects outside my
> own) that my project depends on?

Edit your project's build path to take Common off it. Look at the Problems
view and see what classes now can't be found.

Don't know how you'd get that as a file, though.

tom

--
The revolution is here. Get against the wall, sunshine. -- Mike Froggatt
From: Rhino on
Lew <noone(a)lewscanon.com> wrote in news:ht3v3u$h2e$2(a)news.albasani.net:

> On 05/20/2010 02:12 PM, Rhino wrote:
>> Is there a way to determine the class dependencies in my code within
>> Eclipse?
>>
>> For example, one of my projects makes use of various classes within a
>> "Common" project along the way. What is the simplest way to determine
>> the specific classes from "Common" (and any other projects outside my
>> own) that my project depends on?
>>
>> At the moment, I'm actually opening each Java source file, looking at
>> the imports for each class where the first qualifier isn't java, and
>> then writing it down on a piece of paper. There's got to be a quicker
>> way in an IDE as slick as Eclipse but I'm not seeing it. (I tried
>> searching on "class dependencies" in the Eclipse help and got lots of
>> hits but none of them seem on point.)
>>
>> I'm using Eclipse 3.5.2.
>
> While I can see how there might be occasional times when that
> information is marginally useful, it's usually enough to know what
> JARs your code depends on, since you don't get to pick and choose
> partial JAR pieces in your deployment.
>
Fair enough. This is certainly information I don't need terribly often
but I find myself wishing I had a quick way to get it today....

I'm really just trying to ascertain precisely which classes from outside
of my project would be necessary if the project were to be re-created on
another computer. It seemed like something that Eclipse might provide
built-in support but apparently not....

> A UML diagramming tool will give you what you want. If there isn't
> one built in to Eclipse, there are plugins for that.
>

I've been meaning to get into some UML diagramming anyway so I'll start
looking in that direction....

Thanks for your reply.
--
Rhino
From: Rhino on
Tom Anderson <twic(a)urchin.earth.li> wrote in
news:alpine.DEB.1.10.1005202003440.3936(a)urchin.earth.li:

> On Thu, 20 May 2010, Rhino wrote:
>
>> For example, one of my projects makes use of various classes within a
>> "Common" project along the way. What is the simplest way to determine
>> the specific classes from "Common" (and any other projects outside my
>> own) that my project depends on?
>
> Edit your project's build path to take Common off it. Look at the
> Problems view and see what classes now can't be found.
>
That's a pretty quick and effective way to get the actual information.

> Don't know how you'd get that as a file, though.
>
Since Eclipse apparently doesn't give you a built-in way to figure this out
- and write it to a file - I may just knock together a quick class to do
this for me. Shouldn't be too hard to get a class to just open all the java
source files in a project in turn, grab the import statements and then sort
the accumulated imports and remove duplicates....

Thanks for your suggestion!


--
Rhino