If there is a xml file in a Eclipse java project, and with "build Automatically" enabled, every time I change the xml file, and save, it will trigger Eclipse to build the project, and sometimes it cause much time to finish.
I just thought that xml 开发者_运维技巧files are just resource files, or at least it is not code change and should not trigger project build. What's the reason for this, and is there anyway to disable it?
You are right there xml files are resource files. If the project code depends on the xml listed resource and there is some change in the xml file, auto build gets triggered to verify if the valid resource is available to the project, if not it shows warnings, or errors as the case may be.
To stop auto build in Eclipse: Window > Preferences > General > Workspace > Uncheck the checkbox 'Build automatically'
I finally find out a workaround to this problem:
go to project properties > Java Build Path > Source > add an exclude rule: **/*.xml
by excluding all xml files from Java Build Path, now edit xml files will not trigger build with 'build Automatically' on.
From Eclipse documentation,
A build is a process that derives new resources from existing ones, updates existing
resources, or both
It is not just compilation of source code
精彩评论