IDEA does not pick up Gradle errors when "delegate IDE build / run action to gradle" is checked

Answered

Hi All:

In Gradle->Runner, I selected "delegate IDE build / run action to gradle".

Then, when I recompile invalid code, I get error messages in the "Run" tab but not in the "Messages" tab.

How can I make IDEA pick up the errors like it does when I don't select "delegate IDE build / run action to gradle"?

Thank you,

E


Code:

public class Main
{
    static public void main(String[] args)
    {
        System.out.println1();
    }
}



Output in the "Run" Tab:

7:47:41 AM: Executing external task 'run Main'...
D:\temp\P1\src\main\java\Main.java:6: error: cannot find symbol
        System.out.println1();
                  ^
  symbol:   method println1()
  location: variable out of type PrintStream
1 error
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.444 secs
Compilation failed; see the compiler error output for details.
7:47:44 AM: External task execution finished 'run Main'.

0
9 comments

It's not possible when the build is performed by Gradle.

0
Avatar
Permanently deleted user

Hi Serge:

Thank you for replying.

The builds are much faster when I select "delegate IDE build / run action to gradle".

Is there any way to configure IDEA so that I can get the higher build speed and still get errors in Messages?

I am mainly interested in Kotlin and Java on the desktop (i.e. not Android, etc.)

Thanks,

E

0

Hard to say, it may depend on the specific project. Higher compiler heap size may help is some cases.

0
Avatar
Permanently deleted user

Thanks Serge:

The speed up seems to be incremental compilation in the external gradle side.

How can I make sure (and check) that in Kotlin, I am definitely using incremental compilation?

Also, if I using incremental compilation, anything that I can do to maximize the compilation speed? (besides increasing heap size).

Again, thank you for your time.

E

 

0

As far as I know, compilation is always incremental in IntelliJ IDEA.

0
Avatar
Permanently deleted user

Maybe I'm not configuring correctly.

My normal builds are 2-3 times longer than  those with the external gradle.

What can I do to figure out why and / or resolve the difference?

 Perhaps replace IDEA's current internal gradle with the latest official release (I believe the latest version has significanly faster compilation time).

Thank you,

E

 

0

Report a performance problem at https://youtrack.jetbrains.com/issues/IDEA. If you provide a sample project to illustrate the problem, it would be great.

Otherwise you will need to perform build profiling somehow. We have the steps for IntelliJ IDEA builds profiling, but not sure how to profile Gradle builds to compare.

0
Avatar
Permanently deleted user

Si Serge:

Perhaps Jetbrains can replace IDEA's current internal gradle with the latest official release (I believe the latest version has significanly faster compilation time)?

Thank you,

E

 

0
Avatar
Permanently deleted user

I'm wondering why IntelliJ is not wrapping the gradle tasks and then process the gradle output to be synced with a similar output if the project were to be compiled by IntelliJ. Definitely there are some shortcomings of compiling and running the gradle projects with IntelliJ. Of course, this works for simple gradle projects, but when you have a more complex project, this approach fails.

I have already filled one bug report about IntelliJ making assumptions about gradle tasks (e.g. processResources) and running its own interpretation instead of what is written in the build.gradle script. I spent days already dealing with this kind of issues.

https://youtrack.jetbrains.com/issue/IDEA-173367

0

Please sign in to leave a comment.