Skip Eclipse validation of build.xml

后端 未结 5 667
暖寄归人
暖寄归人 2021-02-06 07:42

I\'ve followed the steps given in the Android Developer Blog to generate a build.xml for building releases for an Android Application. I need to do a custom compiling so I have

相关标签:
5条回答
  • 2021-02-06 08:02

    I do not know if you can do this for a single file but i think you can disable the validation within the eclipse preferences under Validation.

    0 讨论(0)
  • 2021-02-06 08:03

    Kukudas's solution to "Ignore all buildfile problems" does solve the root problem.

    However, Eclipse will still detect the buidl.xml as broken and will not allow Ant Builders to call the file. In fact, Eclipse will silently ignore such build steps in your project as if weren't there.

    0 讨论(0)
  • 2021-02-06 08:04

    I have figured out a much better solution to the problem of eclipse not finding build targets from the imported/included projects. First of all, upgrade to the r14 sdk. Revision 14 uses only a build.xml file from the ${sdk.dir}/tools/ant directory

    At the bottom of the build.xml file within your own project, you'll see an import statement that looks like this:

    <import file="${sdk.dir}/tools/ant/build.xml"/>
    

    Change this statement to

    <import file="${sdk.dir}/tools/ant/build.xml" as="androidbuild" />
    

    Then from your project, you can reference those target with

    <target name="compile" depends="androidbuild.-resource-src, androidbuild.-aidl, androidbuild.-pre-compile" />
    

    Also note that now they have pre-compile/pre-build tasks that will be called before compiling. (checkout the full build.xml to see exactly when they are called). You can use these as hooks to do some work before compiling without overriding the original tasks.

    0 讨论(0)
  • 2021-02-06 08:20

    Another workaround (less drastic than disable all validation/problem reporting): Go to Window->preferences->Ant->Problems tab. Add "build.xml" to the ignore list...

    0 讨论(0)
  • 2021-02-06 08:22

    I found 2 solutions that work for me :

    1 - The solution from kukudas above :

    How about this: under preferences ant -> editor in the tab Problems "Ignore all buildfile problems" ? You can set there a specific file too if i'm not mistaken. – kukudas Oct 15 '10 at 10:28

    While it works, this solution is workspace specific and can be quite tedious if a user wants to keep Ant validation for a few files but ignore a large number of files.

    2 - Eclipse seems to validate ant files only when they are opened in an editor. Therefore, another solution involves never opening ant files that shouldn't be validated using eclipse. I managed to get rid of warnings by doing a file backup-delete-restore.

    Ideally, ant validation should be done like all other XML validation so it may be configured at project level.

    0 讨论(0)
提交回复
热议问题