setting source root to point inside of package hierarchy

I am sure this has been brought up already, but I looked in the archives and could not find an answer.

I am working with a huge code base, most of the code in which I do not want to load into Idea, just the package sub tree that I am currently working with. So in v 3.0.5 I was able to set the source root folder to point inside of pacakge tree (e.g. c:\src\com\mycompany\foo\bar).

However, when I try doing a similar thing in build 915 (and previous builds), Idea cannot resolve references to other classes, not even the ones in the same package. I've tried:
1. content folder = c:\src
source folder = com\mycompany\foo\bar

2. content folder = c:\src\com\mycompany\foo\bar
source folder = .

neither of which worked.

Can anyone suggest a workaround (or am I just misusing the feature)?

- Alex

9 comments
Comment actions Permalink

I also miss that feature A LOT.

And suggestions like "you can easily copy the files
you need somewhere else" don't help.
I need the files where they are (to be updated by VCS,
check them out, add or remove various different packages).

Is there a chance to get it back? With the new modules
implementation, perhaps?

r.


Alex Khesin wrote:

I am sure this has been brought up already, but I looked in the archives and could not find an answer.

I am working with a huge code base, most of the code in which I do not want to load into Idea, just the package sub tree that I am currently working with. So in v 3.0.5 I was able to set the source root folder to point inside of pacakge tree (e.g. c:\src\com\mycompany\foo\bar).

However, when I try doing a similar thing in build 915 (and previous builds), Idea cannot resolve references to other classes, not even the ones in the same package. I've tried:
1. content folder = c:\src
source folder = com\mycompany\foo\bar

2. content folder = c:\src\com\mycompany\foo\bar
source folder = .

neither of which worked.

Can anyone suggest a workaround (or am I just misusing the feature)?

- Alex


0
Comment actions Permalink

By definition a "source root" in IDEA is a directory that has your top-level
packages (such as "com") as immediate parents. In a new structure a source
root should be under a content root or the same as its content root. So for
your configuration correct setup would be
Content root: C:\src
Source root C:\src
If you don't want IDEA to look into some directories under the content root,
you can exclude them from the content (just mark them as 'excluded').

--

Best regards,
Eugene Zhuravlev
JetBrains Inc., http://www.intellij.com
"Develop with pleasure!"



"Alex Khesin" <no_mail@jetbrains.com> wrote in message
news:1318355.1062704154941.JavaMail.itn@is.intellij.net...

I am sure this has been brought up already, but I looked in the archives

and could not find an answer.
>

I am working with a huge code base, most of the code in which I do not

want to load into Idea, just the package sub tree that I am currently
working with. So in v 3.0.5 I was able to set the source root folder to
point inside of pacakge tree (e.g. c:\src\com\mycompany\foo\bar).
>

However, when I try doing a similar thing in build 915 (and previous

builds), Idea cannot resolve references to other classes, not even the ones
in the same package. I've tried:

1. content folder = c:\src
source folder = com\mycompany\foo\bar

>

2. content folder = c:\src\com\mycompany\foo\bar
source folder = .

>

neither of which worked.

>

Can anyone suggest a workaround (or am I just misusing the feature)?

>

- Alex



0
Comment actions Permalink

Eugene, is there a design (not implementation) reason for not allowing
to have a content root (which files to consider) UNDER a top root
(just a pointer where the top package starts).
Or equivalently, if source root would have to be under content root,
I strongly suggest to be able this not to be the "top package" directory
(for example specifying a package that this directory corresponds to).

If you have a complex package tree, and have to do some heavy experimenting with
just one package at level 4-5 it is extremely inconvenient to exclude
all parallel packages along the used one.

Richard Nemec


Eugene Zhuravlev wrote:

By definition a "source root" in IDEA is a directory that has your top-level
packages (such as "com") as immediate parents. In a new structure a source
root should be under a content root or the same as its content root. So for
your configuration correct setup would be
Content root: C:\src
Source root C:\src
If you don't want IDEA to look into some directories under the content root,
you can exclude them from the content (just mark them as 'excluded').


0
Comment actions Permalink

> Can anyone suggest a workaround (or am I just misusing the feature)?

Restructure your project (I'm serious). This will solve more problems
than this one.

Tom

0
Comment actions Permalink

Tom, if it were my project - no problem.
But some of us don't have that luxury.
Well - another "real world" situation.

r.

Thomas Singer wrote:

> Can anyone suggest a workaround (or am I just misusing the feature)?

Restructure your project (I'm serious). This will solve more problems
than this one.

Tom


0
Comment actions Permalink

I certainly agree that projects should be structured that way, but unfortunately, some aren't. I'm working on a java project with a ~7 year history, so it's structure (among other things) is a little antique. For example, they don't have a source directory. They just put com in the project's root, along side lot of other stuff. So I have to set the source root to the project root, which ends up including lots of other non-java folders into the java source path.

This seems to slow things down a bit. It's not an option to exclude everything else, because those other directories have text files, xml files, and other stuff that I want to access and edit in idea. I know we need to clean up the project, but we're not at a place where we can do that right now (fixing this will be a bit of a political battle).

Anyway, I'm trying to say there are situations where specifying a "source location" which isn't necessarily the "source root" would be great.

0
Comment actions Permalink

> Tom, if it were my project - no problem.
> But some of us don't have that luxury.
> Well - another "real world" situation.

Well, our project (a geodetical desktop application) was really crappy
when my coworker and I got full control over it. Now, one year ago, it
is much better structured, has cool new features the customers like -
but there is still a long way to go. If we would not have started to
refactor/restructure the project, the project would be dead now.

Try to convince the project leaders to refactor/restructure your project
if something is wrong. I know, it's a very stony way, but it's worth the
trouble and often the only solution to preserve it from dying.

Tom

0
Comment actions Permalink

Eugene, is there a design (not implementation) reason for not allowing
to have a content root (which files to consider) UNDER a top root
(just a pointer where the top package starts).


Yes, there were some reasons. We wished to make the project configuration
clearer to the users. That's the stuff which often caused misunderstanding.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"


"Richard Nemec" <rndzank@attbi.com> wrote in message
news:bj8dk5$ali$1@is.intellij.net...

Eugene, is there a design (not implementation) reason for not allowing
to have a content root (which files to consider) UNDER a top root
(just a pointer where the top package starts).
Or equivalently, if source root would have to be under content root,
I strongly suggest to be able this not to be the "top package" directory
(for example specifying a package that this directory corresponds to).

>

If you have a complex package tree, and have to do some heavy

experimenting with

just one package at level 4-5 it is extremely inconvenient to exclude
all parallel packages along the used one.

>

Richard Nemec

>
>

Eugene Zhuravlev wrote:

>

By definition a "source root" in IDEA is a directory that has your

top-level

packages (such as "com") as immediate parents. In a new structure a

source

root should be under a content root or the same as its content root. So

for

your configuration correct setup would be
Content root: C:\src
Source root C:\src
If you don't want IDEA to look into some directories under the content

root,

you can exclude them from the content (just mark them as 'excluded').

>

>


0
Comment actions Permalink

Request filed as:
http://www.intellij.net/tracker/idea/viewSCR?publicId=15907

Please, comment and vote.

r.


Valentin Kipiatkov (JetBrains) wrote:
>>Eugene, is there a design (not implementation) reason for not allowing
>>to have a content root (which files to consider) UNDER a top root
>>(just a pointer where the top package starts).


Yes, there were some reasons. We wished to make the project configuration
clearer to the users. That's the stuff which often caused misunderstanding.


0

Please sign in to leave a comment.