usage search not working in IDEA 9 when adding e.g. project dir to the classpath

Hi,

we used to add some subdirs of our project (and the project dir itself) to the modules classpath. When doing this with IDEA 9 (I imported older projects) the usage search is not working any more. No errors occur and no usage is found.

I tried to add the dirs as module dependency or as library, both the same effect. Everything worked fine with older versions of IDEA (e.g. 8.1.4), even with the IDEA 9 Beta release(!) I used before.

Is this a bug or how can I obtain the old behaviour?

Greetings,

Bernd

16 comments
Comment actions Permalink

Hello Bernd,

Could you please explain more clearly what your project structure is? I don't
undersytand what do you mean by "adding the project dir to the modules classpath".

we used to add some subdirs of our project (and the project dir
itself) to the modules classpath. When doing this with IDEA 9 (I
imported older projects) the usage search is not working any more. No
errors occur and no usage is found.

I tried to add the dirs as module dependency or as library, both the
same effect. Everything worked fine with older versions of IDEA (e.g.
8.1.4), even with the IDEA 9 Beta release(!) I used before.

Is this a bug or how can I obtain the old behaviour?

Greetings,

Bernd

---
Original message URL:
http://www.jetbrains.net/devnet/message/5252827#5252827

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Imagine an old fashioned structure like this: ;-)

project dir
|
+- classes
|
+- resources
|
+- src
|
+- temp
|
+- test
  |
  +- src
  |
  +- classes


Adding resources to the classpath is ok.
Adding src, test/src or the project dir itself to the classpath breaks the usage search.

0
Comment actions Permalink

Hello Bernd,

In such a project structure, you should mark "src" as a source root, and
"test/src" as a test source root, and not add anything under project dir
to libraries (which is, I guess, what you mean by "adding to the classpath").
Then everything will work correctly.

Imagine an old fashioned structure like this: ;)

project dir
|
+- classes
|
+- resources
|
+- src
|
+- temp
|
+- test
|
+- src
|
+- classes
Adding resources to the classpath is ok.
Adding src, test/src or the project dir itself to the classpath breaks
the usage search.
---
Original message URL:
http://www.jetbrains.net/devnet/message/5252835#5252835

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

yole schrieb:

Hello Bernd,

In such a project structure, you should mark "src" as a source root, and
"test/src" as a test source root, and not add anything under project dir
to libraries (which is, I guess, what you mean by "adding to the classpath").
Then everything will work correctly.

Imagine an old fashioned structure like this: ;)

project dir
|
+- classes
|
+- resources
|
+- src
|
+- temp
|
+- test
|
+- src
|
+- classes
Adding resources to the classpath is ok.
Adding src, test/src or the project dir itself to the classpath breaks
the usage search.
---
Original message URL:
http://www.jetbrains.net/devnet/message/5252835#5252835

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


Well, that is what I did, that is what worked before and that is what we both excpected.

Try this:
create a new project within a directory with the structure above (just the project dir and a src dir). The src dir is marked as source folder.
Create a new class which implements a new interface. Press ctrl+alt+f7 on the interface, which shows the implementing class. Ok.
Add the project dir to the module classpath (no matter if this is added using ProjectStructure->Libraries->Attach Classes or Project Structure->Modules->Dependencies). Press ctlr+alt+F7... the message is "no usages found in project files".

When using e.g. the Serializable interface, searching for implementing classes (in project files and libraries), the usages in the libraries are found.

0
Comment actions Permalink

Hello Bernd,

Why do you add the project dir as a library? Such a configuration was never
meant to mean anything useful, and if its behavior changed, we do not consider
it as a bug that needs fixing.

yole schrieb:
>
> Hello Bernd,
>
> In such a project structure, you should mark "src" as a source root,
> and "test/src" as a test source root, and not add anything under
> project dir to libraries (which is, I guess, what you mean by "adding
> to the classpath"). Then everything will work correctly.
>
>> Imagine an old fashioned structure like this: ;)
>>
>> project dir
>> |
>> +- classes
>> |
>> +- resources
>> |
>> +- src
>> |
>> +- temp
>> |
>> +- test
>> |
>> +- src
>> |
>> +- classes
>> Adding resources to the classpath is ok.
>> Adding src, test/src or the project dir itself to the classpath
>> breaks
>> the usage search.
>> ---
>> Original message URL:
>> /message/5252835#5252835
>

Well, that is what I did, that is what worked before and that is what
we both excpected.
Try this:

create a new project within a directory with the structure above (just
the project dir and a src dir). The src dir is marked as source
folder.

Create a new class which implements a new interface. Press ctrlaltf7
on the interface, which shows the implementing class. Ok.

Add the project dir to the module classpath (no matter if this is
added using ProjectStructure->Libraries->Attach Classes or Project
Structure->Modules->Dependencies). Press ctlraltF7... the message is
"no usages found in project files".

When using e.g. the Serializable interface, searching for implementing
classes (in project files and libraries), the usages in the libraries
are found.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5252841#5252841

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Well, the run/debug configuration uses the classpath defined by the module. Our testcases are sometimes loading resources (properties, spring configurations, ...) out of the test/src directory. Adding the test/src directory as dependency to the module breaks the usage search, too.
Sure you can say: "Why don't you put these files somewhere else?". Well, this is historical and even very convenient, but I don't think it is bad practice and I even think it is useful.

I saw Eclipse users which could not add these folders as module dependency (I think you can't select them or a dialog appears, don't know any more). But with eclipse, you can configure the run-configurations and add folders to the classpath e.g. for your junit-runs. Configuring the run configuration with IntelliJ only allows to set the classpath (and JDK) of a module, therefore I have to add the directories to the modules classpath, right?

So I should ask another question now: how can I add arbitrary folders (this means, even folders with a special meaning for the IDE as a src folder or the project folder) to the classpath of my run-configurations without configuring them as "library" or "module dependency", since this will break the usage search?

0
Comment actions Permalink

Hello Bernd,

You don't need to put the files anywhere else or add any arbitrary folders.
You need to make sure that the extensions of those files are listed in Settings
| Compiler | Resource patterns. Then IDEA's make will copy the files to the
output directory, and the output directory is automatically added to the
runtime classpath without the need to configure anything.

Well, the run/debug configuration uses the classpath defined by the
module. Our testcases are sometimes loading resources (properties,
spring configurations, ...) out of the test/src directory. Adding the
test/src directory as dependency to the module breaks the usage
search, too.

Sure you can say: "Why don't you put these files somewhere else?".
Well, this is historical and even very convenient, but I don't think
it is bad practice and I even think it is useful.

I saw Eclipse users which could not add these folders as module
dependency (I think you can't select them or a dialog appears, don't
know any more). But with eclipse, you can configure the
run-configurations and add folders to the classpath e.g. for your
junit-runs. Configuring the run configuration with IntelliJ only
allows to set the classpath (and JDK) of a module, therefore I have to
add the directories to the modules classpath, right?

So I should ask another question now: how can I add arbitrary folders
(this means, even folders with a special meaning for the IDE as a src
folder or the project folder) to the classpath of my
run-configurations without configuring them as "library" or "module
dependency", since this will break the usage search?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Well, this might not suit every need.

Adding these directories to the runtime classpath was a kind of workaround in IntelliJ (these projects started with very early versions of IntelliJ, there is an underliying ant build system with some other needs regarding the file structure) and doing it like this fitted best for what we wanted to do.

The best way would be to introduce the possibility to add arbitrary classpath entries in the runtime configuration. What about a change request for the next version?

0
Comment actions Permalink

I support this request.. and was lucky to come across this post which pin pointed the problem .. I think [http://jetbrains.net/devnet/thread/285942] refers to this same issue

0
Comment actions Permalink

Hi,

We have the same problem for our project. The problem is that we don't use GWT plugin provided by IDEA - so we add it as Application to Run/Debug configuration. But GWT needs java classes to be added to the classpath. So when we add src root to the classpath - Find Usages functionality is broken. Is there any possible way to do it in another way?

0
Comment actions Permalink

Hello Sergey,

We have the same problem for our project. The problem is that we don't
use GWT plugin provided by IDEA - so we add it as Application to
Run/Debug configuration. But GWT needs java classes to be added to the
classpath. So when we add src root to the classpath - Find Usages
functionality is broken. Is there any possible way to do it in another
way?


IDEA 9.0.1 will handle such configurations in the same way as IDEA 8 and
previous versions did, so you'll be able to keep using the same configuration.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

IDEA 9.0.1 will handle such configurations in the same way as IDEA 8 and
previous versions did, so you'll be able to keep using the same configuration.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


Great, I will wait for IntelliJ 9.0.1 then...

Greetings,

Bernd

0
Comment actions Permalink

Thanks! Looking forward for 9.0.1

0
Comment actions Permalink

EAP version IU-93.32 fixed a similar problem for me.

0
Comment actions Permalink

In the cold weather, the UGG boots are considered as the best shoes.More and more people like wearing the UGG boots such as the UGG Classic Metallic 5812]]>.With its development ,the UGG boots have lauched different kinds of boots into the fashion market,including the UGG Classic Short Boots]]> and the UGG Women's Highkoo]]>.However,in the fashion world,if you want to be more attractive and elegant,the beautiful shoes are not enough.You have to choose the best stylish handbag to match your shoes.Therefor,the designer replica handbags are very necessary.If you want to buy the best designer cheap handbags,i would like to introduce two famous brand handbags to you.I think there must be one handbag is your favorite.One is the famous brand Versace Handbags ,the other is the Ferragamo Handbags.Both of them are the famous brand in the world.Their quality are very good.

---
Original message URL: http://www.jetbrains.net/devnet/message/5254909#5254909

0
Comment actions Permalink

In the cold weather, the UGG boots are considered as the best shoes.More and more people like wearing the UGG boots such as the http://sell-ugg.com/UGG-Classic-Metallic-5812/c9/index.html.With its development ,the UGG boots have lauched different kinds of boots into the fashion market,including the http://uggboots-euro.com/UGG-Classic-Short-Boots/c3/index.html and the http://uggboots-euro.com/UGG-Women%27s-ighkoo/c23/index.html.However,in the fashion world,if you want to be more attractive and elegant,the beautiful shoes are not enough.You have to choose the best stylish handbag to match your shoes.Therefor,the designer replica handbags are very necessary.If you want to buy the best designer cheap handbags,i would like to introduce two famous brand handbags to you.I think there must be one handbag is your favorite.One is the famous brand http://www.famousbrandbag.com/Versace/c40/index.html,the other is the Ferragamo Handbags.Both of them are the famous brand in the world.Their quality are very good.

---
Original message URL: http://www.jetbrains.net/devnet/message/5254922#5254922

0

Please sign in to leave a comment.