在命令行上使用 Android lint 忽略库项目 [英] Ignoring library project with Android lint on the command line

查看:36
本文介绍了在命令行上使用 Android lint 忽略库项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Jenkins 中使用 Android lint,需要忽略我的团队未修改的库项目(特别是 Action Bar Sherlock),以便我们可以从 Android lint 获得有用的结果.目前我正在从命令行启动 lint 并将结果保存到一个 XML 文件中,然后 Jenkins 可以读取该文件.我似乎不能做的是忽略图书馆项目.在 Eclipse 中,您可以显式禁用对库项目的扫描,但我不知道是否有相应的命令行参数.

I am using Android lint with Jenkins and need to ignore library projects (specifically Action Bar Sherlock) that my team does not modify so that we can get useful results from Android lint. At the moment I am launching lint from the command line and saving the results to an XML file that can then be read by Jenkins. What I can't seem to do though is ignore library projects. In Eclipse you can explicitly disable scanning of library projects but I can't figure out if there is a corresponding command line argument for this.

我为这个问题想出了一些不同的解决方法,但没有一个是理想的.我正在使用 lint 22.0.5.谢谢.

I have come up with a few different work-arounds for this issue but none of them are ideal. I am using lint 22.0.5. Thanks.

推荐答案

这就是我使用 Jenkins 和 Gradle 的方式:

This is how I do it with Jenkins and Gradle:

  • 配置 Jenkins 构建后操作发布 Android Lint 结果"以仅获取主项目的 lint-results.xml.默认为 **/lint-results.xml,包括库项目的 lint 结果.
  • 在库项目的 build.gradle 文件中设置 abortOnError false 以忽略那里的 lint 错误.
  • Configure the Jenkins post-build action "Publish Android Lint Results" to pick up only the lint-results.xml of the main project. The default is **/lint-results.xml and includes lint results of library projects.
  • Set abortOnError false in the build.gradle file in library projects to ignore lint errors there.

这篇关于在命令行上使用 Android lint 忽略库项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆