Running and building in IntelliJ ?

Hello all

I've just installed IntelliJ 9 and then imported all my Eclipse projects...everything went fine. I'm pretty impressed with IDEA so far, works very fast and smooth.

Problem is when I want to run something, IDEA will not let me as long as there are errors in some of the classes.

The projects imported are around 2000 classes..and many of the errors I never bothered to correct since Eclipse didn't care.
Even classes with errors it would run as long as the methods being used didnt have errors.

They are not being used anyway or I didn't have time to figure out what to do with them. Deleting them is not an option before careful consideration
and that would take time. Fixing each and every error would take time.


So my question is: is it possible to let IDEA compile what it CAN compile, then run what's there ?

I foresee some problems even if I have totally error free code..someone commits code with error, and because of that others can no longer run
their tests (or whatever). Even the slightest little error in the smallest insignificant class breaks a 2000 classes project..is there really no way around this ?

Thanks

19 comments

Surely you have to fix the errors at some point, else how do you run the application outside the IDE?

People should certainly not be committing uncompilable code, and unit tests should ensure that at least the normal use-cases for the changes are working before they're committed.

TeamCity is a nice way of saving a lot of time with this, as you can commit the changes conditional on them passing all the unit tests, which will be run on the TeamCity build agents.

0

Thanks for your reply...What you're saying is "fix your errors"..I thought I made it clear why this is not always a (good) option.
So I guess the IDE just can't do it
My current application runs fine outside the IDE(Eclipse) since the code with errors are not being run.
Consider this case: you have a fully functional application that must be deployed in 50 min.
But because of errors in classes NOT EVEN BEING USED, it is not possible.

You're of course reluctant to simply delete these classes..and fixing each error will take time.
Sorry but this is a real weakness..and it's probably why Eclipse still rules.

I tried IntelliJ because of superior scala support..but I cannot work with an IDE who has a build system similar to VS 1999.

0

That's no problem with IDEA. You have to exclude the offending classes
from compile, and then everything works fine. The most convenient way is
to run make, get some errors in the message pane, and then you can right
click on the error message and select 'Exclude from Compile'.

On 3/8/2010 5:46 PM, Mikkel Petersen wrote:

Thanks for you're reply...So I guess the IDE just can't do it.
My current application runs fine outside the IDE(Eclipse) since the code with errors are not being run.
Consider this case: you have a fully functional application that must be deployed in 50 min.
But because of errors in classes NOT EVEN BEING USED, it is not possible.
Sorry but this is a real weakness..and it probably why Eclipse still rules.

>

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


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0

OK thank you, still dont like it..excluding all these classes..what when you want to include them again ?
There should just be an option "exlude classes with errors from build"..

I hope intellij will support this in the future. For now I'll try to fix all the errors anyway though im looking at 2 days work or so.
But might be overall good to clean everything up.

Thanks for the responses all.

0

You can also exclude whole directories, which simplifies things in many
situations. And when you want to include them again, just go to Settings
-> Compiler -> Excludes and include whatever you want.

On 3/8/2010 6:43 PM, Mikkel Petersen wrote:

OK thank you, still dont like it..excluding all these classes..what when you want to include them again ?
There should just be an option "exlude classes with errors from build"..

>

I hope intellij will support this in the future. For now I'll try to fix all the errors anyway though im looking at 2 days work or so.
But might be overall good to clean everything up.

>

Thanks for the responses all.

>

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


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0

You seem to be blaming IntelliJ for the state of your project. The fact that Eclipse let you do that is a weakness of Eclipse IMHO. Eclipse has obviously allowed you to create a project in a horrendous state.

Code that cannot compile should not be committed and there are tools out there that can help prevent this from happening (Team City, Hudson, CruiseControl, etc).

If you need to make some code unstable for R&D, testing, etc then I would recommend you use source control branching to your advantage.

How do you build and deploy your code if it can't compile without errors?

0

I can see that you have never used Eclipse. I'm nto here to advertise Eclipse at all..but
it seems to me that people here cannot grasp the concept of a project being build and deployed even if there are errors in it.
That is Visual Studio 1999 or JBuilder  kind of thinking. If the "build" fails, even one method out of 5000 classes, you have to fix that one first.


Why ? if class a,b,c,d are ok but class e not, should class E then break the entire build ? Give me a reason for that really.-
I did not talk about committing code..that is not the problem so why are you even talking about that ?

This is not the way it should work. And so far that is the only thing that annoys me in IntelliJ.
I'm not blaming Intellij for the "state" of my project because the state of my project is perfect. Except when loaded into IntelliJ.
I dont know why some people do not understand what I'm saying.


However I want to use my project is my choice. IntelliJ should NOT dictate
how I want to develop. It should simply do as I tell it too.

So if I tell it to compile whatever is there and run what it can, please do it. I'm the man, intellij is the machine, so obey !

If you to read my post again you would see that the classes being deployed are WORKING
code..the ones with errors are classes to either be fixed or deleted in the future, something I dont have time for now.

Of course there shouldnt be ANY errors, but since Eclipse permits, it happens..especially over 4-5 years.

That doesnt mean the project is in a bad state.

0

Besides everything else in IntelliJ is OK and this thing I can live with (though I dont understand why it is like this)..but there's always room for improvement isn't there ?

0

In idea you can run targets when there are uncompilable classes: in the Run/Debug configuration uncheck the "Before launch->Make" checkbox. Note that with this change you have to call "Build->Make project" manually for Idea to compile your classes. And when manually making Idea still tries to compile your non working code, so it's only a minor advance: you still have to exclude the "permanently" uncompilable classes.

I can see that you have never used Eclipse. I'm nto here to advertise Eclipse at all..but
it seems to me that people here cannot grasp the concept of a project being build and deployed even if there are errors in it.

That is Visual Studio 1999 or JBuilder  kind of thinking. If the "build" fails, even one method out of 5000 classes, you have to fix that one first.

I've used Eclipse and this was one of the things I've never liked in it.

One of my clients used this development concept: Compile + make war in Eclipse. Many times war's where deployed in production with non working code.

Sometimes just because after all the tests where done a key was pressed by mistake, a random letter was inserted into the code and Eclipse made and deployed the war without any warning that an error existed.

Or sometimes a developer was interrupted, and when he returned to coding forgot that he was in the middle of changing some class and the uncompilable code went into production.

Or ...

Very dumb Eclipse behaviour imo.

0

This is not about what is "dumb" or not..I just want to compile my code that I imported from Eclipse.
Now there are some errors in Java3D that I included in my code. I have no idea what the error are about since it's not my code.. ? I do knot know what is going on there at all.
All I know is that it doesnt break my code at all but I cannot run ANYTHING before this is fixed.
I agree with you that production code should be compile error free..but development code ?
It would be nice if anyone here could help me instead of turning defensive of their favorite IDE..and trying to blame it on me.
I ask a simple question really, a "No you cant do that"..would have been enough..instead of "You cant do that because you SHOULDNT do that and Eclipse is WRONG" etc.

0

I don't really want to get into the principal argument whether uncompilable code in VCS is a Bad Thing.
(Though I strongly would argue that point if that particular discussion would be called for.)

Excluding classes is what I usually (before fixing the error prior to commit.)
However that has the disadvantage that the complete class is excluded rather than the single offending
method/execution path.

Yet I faintly remember a previous discussion of this issue.
IIRC you can make it work exactly like in eclipse: In Compiler settings select the Eclipse compiler.
Probably you then need to configure it to continue on compilation errors (using "additional command line parameters").
Unfortunately I also remember some discussion that the Eclipse compiler included with IDEA is terribly out of date.

You probably need to do some searching in the forum archive's...


On 06.03.2010 09:57, Mikkel Petersen wrote:

Hello all

>

I've just installed IntelliJ 9 and then imported all my Eclipse projects...everything went fine. I'm pretty impressed with IDEA so far, works very fast and smooth.

>

Problem is when I want to run something, IDEA will not let me as long as there are errors in some of the classes.

>

The projects imported are around 2000 classes..and many of the errors I never bothered to correct since Eclipse didn't care.
Even classes with errors it would run as long as the methods being used didnt have errors.

>

They are not being used anyway or I didn't have time to figure out what to do with them. Deleting them is not an option before careful consideration
and that would take time. Fixing each and every error would take time.

>
>

So my question is: is it possible to let IDEA compile what it CAN compile, then run what's there ?

>

I foresee some problems even if I have totally error free code..someone commits code with error, and because of that others can no longer run
their tests (or whatever). Even the slightest little error in the smallest insignificant class breaks a 2000 classes project..is there really no way around this ?

>

Thanks

>

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


0

Hello Mikkel,

IntelliJ is strongly focused on keeping your codebase clean and maintainable.
Having unused and uncompilable code in your source tree is, in our opinion,
exactly the opposite of "clean and maintainable". Because of that, we do
not plan to change IntelliJ's default behavior in this regard any time soon.

(If you go to Settings | Compiler, switch from javac to the Eclipse compiler
and enable its option to skip uncompilable code, you will get the same behavior
as in Eclipse.)

Thanks for you're reply...So I guess the IDE just can't do it.

My current application runs fine outside the IDE(Eclipse) since the
code with errors are not being run.

Consider this case: you have a fully functional application that must
be deployed in 50 min.

But because of errors in classes NOT EVEN BEING USED, it is not
possible.

Sorry but this is a real weakness..and it probably why Eclipse still
rules.


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


0

Thanks that sounds like what I'm looking for..I already
But how do you do this ?

"enable its option to skip uncompilable code, you will get the same behavior
as in Eclipse".

0

Personally I wouldn't do it but I have to admit you got me curious.  It appears to be the "-proceedOnError" flag that you set in "Additional command line parameters"

http://dev.eclipse.org/viewcvs/index.cgi/jdt-core-home/howto/batch%20compile/batchCompile.html?view=co

0

In principle I agree that its far, far better to have clean code that always compiles.

However, in a world where >90% of the people around you use Eclipse, which will continue to work with a few broken classes its hard to argue the point.

0

Well, instead of wasting your time maintaining this thread, you could have started fixing your compilation errors. If you didn't find a simple solution for doing that, here a tip. Just comment the non compilable code out, and put a TODO on top of it so you can always come back to it. If you tell me this takes you more than two hours, than the people working on this project really did a hell of a job!


And JBs position is not "you can not do that" but "we don't want you to do that". Using this permissive approach is why you ended up having this mess in the first place. I wouldn't vote for importing this crappy behavior in IntelliJ. Try looking at this from the perspective of a "clean" project. We do not need/want that. If committing non-compilable code in VCS is a common practice in your project, you should consider escalating that to your managers, because this not how teamwork should look like. It is the first time I hear of someone tolerating this fact... and even more, asking for a "feature" to work it around. Outrageous...


0

"you can not do that" but "we don't want you to do that".

Is that not the same ? Result is the same for me at least.
I do not see why every line of code should be error free. If the code being USED is error free is what count.
Having some little class preventing you to run a giga-application, now that is silly to me really.

Also, imagine some code that is not yours  and that you dont understand becomes broken  and the author is not there to help you ? What will you do with it ? Wait for the owner  to return from vacation to fix it ?

And I'm not ASKING for this feature, I was hoping it was there.
If you could switch it on and off would be good enough.

For big projects running for years and years with thousands and thousands of classes there would be no no way
anyone would migrate to IntelliJ under these circumstances.

Takes too much time and would be too expensive.

I tried to do what you said, but soon it was complaining about errors in third party code as well.
It only showed me 2-3 at a time, when those were fixed, showed me another 2.-3. Always 100 warnings or so
to clutter up my view, even if I selected "no warnings".
I couldnt see the end of it..So I simply gave up and returned back to Eclipse.

To bad a simple thing like this should stop it when everything else worked well.

Besides, if a project is errorneous or not is not decided by little red lines in an IDE..but by 1) your unit tests
compile and pass.
And 2) application runs, testers cant make it crash.  and 3) your customer keeps paying you to develop it.

0

Mikkel Petersen schrieb:

I'm not ASKING for this feature, I was hoping it was there.
If you could switch it on and off would be good enough.

For big projects running for years and years with thousands and thousands of classes there would be no no way
anyone would migrate to IntelliJ under these circumstances.

Takes too much time and would be too expensive.

I tried to do what you said, but soon it was complaining about errors in third party code as well.
I couldnt see the end of it..So I simply gave up and returned back to Eclipse.


Yes! Return to Eclipse! ... If you cannot understand that uncompilable
code is useless code.

If you and your team starts coding you should simply avoid writing
erronous code! Then you will never reach that stage.

If you are in the situation that you cannot write compilable code then
put a TODO right there and go ahead. But never leave errors in your code.

What kind of errors are there? Uncaught exceptions, incompatible types?

Best regards,
Matthias

0

There's all kind of errors. It's fixable, just don't have time right now.
Year you're probably right, one should not make code with errors.
Problem in this case is when you want to port your code from eclipse.
If IntelliJ would permit this, then you would "catch" more eclipse users.

0

Please sign in to leave a comment.