Project Build and Artifacts Build clarification

Answered

If I build the required modules before buiding an artifact, shouldn't IntelliJ just copy the already compiled .class files to the artifact directory?
It seems it is building everything from scratch.

10 comments
Comment actions Permalink

How do you build them? IntelliJ IDEA cannot reuse classes compiled externally (by Gradle/Ant or Maven).

0
Comment actions Permalink

I'm doing a "Build project" from the IntelliJ menu. I'm on 2018.2, latest EAP

0
Comment actions Permalink

Building artifact using this menu doesn't recompile any unmodified classes, you can verify it by the timestamps of the .class files inside the artifact:

So, if you Build | Build Project, then wait a minute, then Build the artifact, it will contain the same classes produced during the Build Project, IntelliJ IDEA will not try to compile them again.

0
Comment actions Permalink

I'll give your timestamp suggestion a try and let you know.
Another thing is unclear to me. Does the "Build > Build project" action do a full build every time, or it build only the changed classes? Seems it redo eveything.

0
Comment actions Permalink

Build Project is incremental, Rebuild will do the full build.

Try with the release version. EAP builds are unsupported and if you have found a bug there, you should report directly at https://youtrack.jetbrains.com/issues/IDEA.

0
Comment actions Permalink

Hi Serge. I just tried to Build project and then Build alrtifact. I can see class files being deleted and rebuild live, so is there a problem to report?

What would make IntelliJ build eveything from scratch? I did not do any change.

0
Comment actions Permalink

 Same thing with 2018.1.3

0
Comment actions Permalink

Ok... Seems if the project contains errors (I think only with "Invalid characters" type. Update: no, with every type of error after "Build | Rebuild project") it will rebuild all everytime. I'm using the Eclipse compiler and the project has errors (it's not possibile to fix them). Do I file an issue? The project has 20 modules and take 3 minutes to build + 3 minutes to deploy. It's too much everytime

0
Comment actions Permalink

If the project has errors, IDE will try to rebuild every time, it's by design.

0
Comment actions Permalink

But if you think about it, it doesn't make sense. I mean, if there is an error, it's not by a full rebuild that it will go away.

Also, because I'm using the Eclipse compiler, I EXPECT there will be errors.

0

Please sign in to leave a comment.