Test Classes are not being compiled

My Test Classes are no longer being automatically recompiled when clicking on either Run or Debug. The "Make" on debug/run checkbox is checked.

I have to manually compile every Test class each time. What's even worse, there does not appear to be any way to get Inner Classes to be compiled.

How do I get that back to normal, in which doing a Make will build all the sources including test ones?

The Source Settings dialog is shown in the attachment.

Edited by: Stephen Boesch on Oct 23, 2008 2:44 PM

Edited by: Stephen Boesch on Oct 23, 2008 2:46 PM



Attachment(s):
ijSources.jpg
14 comments
Comment actions Permalink

Any ideas on this? Test classes are still not being compiled except when I do it explicitly.

0
Comment actions Permalink

What happens if you right-click on the source folder in project view and select "Compile ]]>"?

0
Comment actions Permalink

Hi Michael, thanks for getting involved here. Right clicking on the Src folder comes up with "Compile Src" but does not have "Compile ]]>".

When I run Compile Src, it recompiles all of my source code and resynchronizes the output folder. Takes 60 to 90 seconds. That's nice to do once in a while, but not usable in normal work when a few lines of code are changing each time.

In any case I uploaded screenshot of doing what you said, right clicking on Src



Attachment(s):
rightClickSrc.JPG
0
Comment actions Permalink

Sorry, my suggestion was ambiguous. I should have specified to right-click on the test source folder and see what happens.

I have my project setup like this:

-src
--java
---package structure hierarchy
-test
--java
---package structure hierarchy

The "java" directory under "src" is a source directory and the "java" directory under "test" is a test sources directory. If I right-click the "java" directory under "test" I have a "Compile ]]>" menu option.

Just out of curiosity why do you want test sources to compile when you do a Make? You really only need them when you are running your unit tests.

0
Comment actions Permalink

To help understand my pain, let's discuss what happens when I either Run or Debug a Junit Test Class, or Java application that is defined within the Project. Even that specific class does not get compiled !

I mean that makes no sense at all. Why would Intellij not go and compile that class I am asking it to run? Also, it does not do any dependency checking; i.e. after I manually compile that specific class, then I get another error due to another test class that is its direct dependency also needs to be compiled (and was not done so by IJ).

I definitely do want all classes, both test and src, to be compiled whenver a Make or Build is done. They are intricately tied together: I don't want the app to bulid if the test classes are in sync.

And that was the behavior until a few days ago. I don't know what changed to make this stop working.

The Test folder structure screenshot is attached.



Attachment(s):
testCompile.JPG
0
Comment actions Permalink

In the Run dialog window there is a section labeled "Before Launch" (a panel with a titled border), in this section make sure "Make" is checked, you may have inadvertently unchecked that.

If you uncheck this you will have to compile each file individually as you describe.

0
Comment actions Permalink

Yes I am aware of that flag. It is checked. screenshot attached



Attachment(s):
makeBeforeRun.JPG
0
Comment actions Permalink

I have exhausted my ideas. :)

I would make a guess you have inadvertently checked/unchecked some setting somewhere.

Maybe recreate the project in some temp directory to see if the problem goes away.

Last grasp at straws here... I see you have the Make check in the JUnit run configurations, do you also have it checked up in the Application section (referring to your screenshot)

0
Comment actions Permalink

Yes I had re-verified all are checked.

I am an experienced IJ user: have used it on large corporate projects as well as a number of my own side ones over the past year. And I have put a lot of my own time to understand how to optimize it for my own productivity. The point being that, although I do (really!) appreciate the input, the root of the issue is likely to be a non-trivial item.

There is likely a lurking bug in IJ: but I am hoping someone might know what to do, since getting a bug fixed takes a long long time.

Recreating the project from scratch is a potential but painful option, and does not shed light on the underlying issue that could recur.

0
Comment actions Permalink

Anyone from JetBrains want to comment (as to whether or not this were a known bug ) ?

0
Comment actions Permalink

Hello Stephen,

Do you, by any chance, have the test directory (or some path within it) excluded
from compile? See Settings/Compiler for a list of excluded directories.

What you describe sounds like the result one would get if that were the case.
Explicit compilation invoked on the file would work, but project wide make/compile
would not pick up those files.

HTH,
Andrei


0
Comment actions Permalink

no that would have been a real basic mistake if that were the case. screenshot attached. btw None of the classes underneath "test" folder are excluded. I can't expand them because of condidentiality (not open source project)

Edited by: Stephen Boesch on Oct 24, 2008 6:02 PM



Attachment(s):
moduleSettings.JPG
0
Comment actions Permalink

Hello Stephen,

That's not what I meant. I was talking about Settings/Compiler. See attached screenshot.

HTH,
Andrei

SB> no that would have been a real basic mistake if that were the case.
SB> screenshot attached.
SB>



Attachment(s):
compilerSettings.png
0
Comment actions Permalink

Hi Andrei,
Yes that's it. Thanks a lot! The reason I did not make the connection is that I had marked those classes as "do not compile" in a moment of haste more than a week earlier, and I had totally forgotten about having done so.

0

Please sign in to leave a comment.