How can I prevent Eclipse from auto-rebuilding when I edit certain files?

限于喜欢 提交于 2019-12-13 02:49:45

问题


I'm developing a Java application using Eclipse Luna. I began looking into Ant scripts earlier today to develop a way of producing version numbers for the software as it changes. I'm pretty happy with it so far but the one remaining issue I seem to have is that I have an Ant script build.xml which modifies the build number of a property file build_info.properties whenever Eclipse recompiles the source code.

However, I've set Eclipse to rebuild automatically which means that any changes made to what it considers as the project's source files invokes this recompilation process, and so when build_info.properties is modified, it causes everything to be recompiled again in a feedback loop.

What I'm wondering is if there's a way I can prevent this from happening while still having auto-rebuild enabled such that Eclipse won't recompile everything every time that build_info.properties changes?

I've looked at this similar question but Robert's answer is not applicable to my situation and Javi's answer doesn't appear to work for me (I tried putting build_info.properties in its own source folder and setting the folder's exclusion pattern to **).

The relevant parts of build.xml are given below:

<target name="compile" depends="updateRevision">
    <echo>Compiling...</echo>
    <antcall target="build">
    </antcall>
</target>

<target name="updateRevision" if="git.present">
    <exec executable="git" outputproperty="git.hash" failifexecutionfails="true" errorproperty="">
        <arg value="rev-parse" />
        <arg value="HEAD" />
    </exec>
    <propertyfile file="${propertyfile.name}">
        <entry key="build.revision.number" type="string" operation="=" value="${git.hash}" />
    </propertyfile>
</target>

<target name="build" depends="updateRevision">
    <propertyfile file="${propertyfile.name}">
        <entry key="build.build.number" type="int" operation="+" value="1" />
    </propertyfile>
</target>

来源:https://stackoverflow.com/questions/26633627/how-can-i-prevent-eclipse-from-auto-rebuilding-when-i-edit-certain-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!