Monday, October 17th, 2011

darkoshi: (Default)
At work, we're using Eclipse for our Java development environment.

Something I don't understand, is why Eclipse thinks it needs to recompile my projects when a jar file on the Build Path has changed.

We have jar files which get updated fairly often. The jar files are built in a separate project, and then promoted into one of the projects that I work with. It takes about 20 minutes for Eclipse to rebuild my projects from scratch, so I don't want Eclipse doing a full rebuild whenever one of the jar files is updated. I only want Eclipse to build the Java files that have changed.

Eclipse indicates that it is doing a "scoped incremental build", but in reality, it first cleans the output folders, so that it ends up doing a full rebuild of all the code.

Originally, my build path included the jar files in my workspace. I tried to avoid the problem by copying the jar files to a folder outside of my workspace, and by updating my build path to point to the files in that other folder.

This partially fixed the problem. Eclipse no longer did a full rebuild when I manually selected to build the projects. It only built the changed Java files, as I'd expect. But when I clicked to start debugging the projects, *then* Eclipse did a full rebuild after all.

I found out that there is a setting in the Preferences - "Build (if required) before launching". Presumably unselecting that option would avoid the full rebuild when I start to debug.

But my question is, why does Eclipse think that a rebuild is required, when only a jar file has changed? Is it really necessary? Shouldn't the jar file changes be automatically picked up at run-time, without recompiling the calling code?

The only thing I can think that the rebuild may accomplish, is to flag any errors which may exist due to mismatches between the calling code and the jar files. It shouldn't actually result in any changes to the compiled class files, right? Or am I mistaken?

When I've updated my workspace from the repository, there shouldn't be any mismatches between the Java modules and the jar files, so I don't see any benefit to doing a full rebuild.

I may need to find an Eclipse forum to post my question.

January 2026

S M T W T F S
     123
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Saturday, January 3rd, 2026 09:25 pm
Powered by Dreamwidth Studios