java and class files in same directory

I am using an ant build which spits out the class files in the same directory as the source (.java) files. Hence, the project tab always shows these class files, parses them and shows them as duplicate when I am editing the java file in the editor.

Is there any way through which I can disable the parsing of these generated class files? I tried adding *.class in the Ignore files and folders field in the General Options dialog, but it also hides the java library class files.

Thanks.

13 comments
Comment actions Permalink

Anil

>I am using an ant build which spits out the class files in the same directory as the source (.java) files.
>

Why don't you simply change the Ant build?

Alain

0
Comment actions Permalink

>I am using an ant build which spits out the class files in the same directory as the source (.java) files.

Then fix your Ant file. Building into your source tree is a classic build newbie mistake, and is just asking for headaches.

--Dave Griffith

0
Comment actions Permalink

Alain

Thanks for the input. But I really cannot change the ant build scripts which have many dependencies and strewn across multiple src directories. And the main reason being that's how it's being used at my workplace by those who are not using IDEA.

Anil.

0
Comment actions Permalink

Just make IDEA project match your build. I mean make output path (in Settings|Path)
equal to source folder. Don't forget to uncheck exclude output checkbox.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

I am using an ant build which spits out the class files in the same
directory as the source (.java) files. Hence, the project tab always
shows these class files, parses them and shows them as duplicate when
I am editing the java file in the editor.

Is there any way through which I can disable the parsing of these
generated class files? I tried adding *.class in the Ignore files and
folders field in the General Options dialog, but it also hides the
java library class files.

Thanks.




0
Comment actions Permalink

Maxim

The source files are across many directories.
1/src, 2/src, etc. I can't possibly make the output path equal to all of those src directories, right?

Anil.

0
Comment actions Permalink

On Wed, 09 Mar 2005 18:36:05 +0000, Maxim Shafirov wrote:

Just make IDEA project match your build. I mean make output path (in
Settings|Path) equal to source folder. Don't forget to uncheck exclude
output checkbox.


And look out for any "clear output path on rebuild"...

I can see this just heading towards disaster..

0
Comment actions Permalink

And look out for any "clear output path on rebuild"...


That should not happen (hopefully!), as I am using the ant scripts to clean and compile.

Anil.

0
Comment actions Permalink

>And look out for any "clear output path on rebuild".

That's usually the point people realize that this sort of thing might have been a bad idea.

--Dave "You are using source control, right" Griffith

0
Comment actions Permalink

Anil wrote:
>>And look out for any "clear output path on rebuild"...

That should not happen (hopefully!), as I am using the ant scripts to clean and compile.


You said should.

0
Comment actions Permalink

Anil wrote:

Maxim

The source files are across many directories.
1/src, 2/src, etc. I can't possibly make the output path equal to all of those src directories, right?

Anil.


If each src folder represents a logical module, then you could set up
multiple modules, each with src and output pointing to the same dir:
module1
- module1.iml (the IDEA module file)
- src/out
module2
- module2.iml
- src/out

Use Settings -> Paths to add modules to your project.

If there are many modules, you can possibly generate the module files
automatically using some script. (They are XML files)

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Rob

I had tried that, but there are cyclic dependencies between those modules (I guess that would indicate those folders are not separate logical modules).

Anil.

0
Comment actions Permalink

Anil wrote:

Rob

I had tried that, but there are cyclic dependencies between those modules (I guess that would indicate those folders are not separate logical modules).

Anil.


Irida, the EAP version of IDEA, supports cyclical module dependencies,
if you are comfortable using an EAP version for development.

Oftentimes, cyclical dependencies can be corrected with refactoring.
Google for Acyclic Dependencies Principle and Dependency Inversion
Principle. The book Agile Software Development, Principles, Patterns,
and Practices by Robert C. Martin
(http://www.amazon.com/exec/obidos/ASIN/0135974445/) discusses this very
well.

IDEA has the Extract Interface (and also Extract Superclass if you make
the superclass abstract), which is quite useful to introduce a
dependency inversion. Simply extract the classes' interfaces into a
separate package (in a separate module), and have both concrete modules
depend on the abstract module with the interfaces. Takes some practice,
but it's a great tool for your toolbox.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Change your ant file itself maybe


_____________
agile software development

0

Please sign in to leave a comment.