使用sonarqube gradle插件配置带有子模块的Android项目的正确方法是什么?

What is the correct way to configure an Android project with submodules for use with the sonarqube gradle plugin?(使用sonarqube gradle插件配置带有子模块的Android项目的正确方法是什么?)
本文介绍了使用sonarqube gradle插件配置带有子模块的Android项目的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

配置带有子模块的 Android 项目以与 sonarqube gradle 插件一起使用的正确方法是什么?谷歌不是我的朋友,但我可能错过了一些基本的东西.(我搜索与 android 构建目录和子模块相关的 sonarqube 问题.没有有用的结果.)

What is the correct way to configure an Android project with submodules for use with the sonarqube gradle plugin? Google has not been my friend, but I may have missed something basic. (I search for sonarqube issues related to the android build directories and submodules. No useful results.)

在一个非常高的层次上,我正在处理一个具有以下结构的 Android 项目.

At a very high level, I am working with an Android project with the following structure.

git_repository
|----- android_project
  |--- app
  |--- SDK
    |- api

git_repository 包含 README.md 和其他顶级文件,包括 android_project.android_project 包含应用程序,以及 SDK 中的 git 子模块.这个 git 子模块包含应用程序需要运行的 api 代码.

The git_repository contains the README.md and other top level files including the android_project. The android_project contains the the app, as well as a git submodule in SDK. This git submodules contains the api code that app needs to run.

问题是当我尝试运行 sonarqube 时,它​​似乎在寻找不存在的文件/目录.对于一个更简单的最小项目,我没有这个问题.我计划在周一建立一个使用子模块的最小项目,但我想在周末离开之前解决这个问题.

The problem is that when I try to run sonarqube, it seems to be looking for files/directories that do not exist. I do not have this problem with a simpler minimal project. I plan to set up a minimal project that uses submodules on Monday, but I want to get this question out the door before I leave for the weekend.

$ ./gradlew clean sonarqube
* snip *
:sonarqube
Invalid value for sonar.java.test.libraries
:sonarqube FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> No files nor directories matching '/Users/my_username/git_repository/android_project/app/build/intermediates/dependency-cache/debug'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -- debug option to get more log output.

BUILD FAILED

Total time: 9.897 secs
$

此 gradle 任务在 MacOS/Android Studio 命令行设置中失败,但最终目标是拥有可与 Jenkins 一起使用的配置.我的 settings.gradle 和 build.gradle 文件如下.显然我做错了什么.

This gradle task is fail on a MacOS/Android Studio command line setup, but the ultimate goal is to have a configuration that works with Jenkins. My settings.gradle and build.gradle files follow. Clearly I am doing something wrong.

git_repository/android_project/settings.gradle完整列表

include ':app', ':api'
project(':api').projectDir = new File('SDK/api')

git_repository/android_project/build.gradle完整清单

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply plugin: 'org.sonarqube'

allprojects {
    repositories {
        jcenter()
    }
    tasks.withType(JavaCompile) {
        options.encoding = 'UTF-8'
    }
}

//subprojects {
//    sonarqube {
//        properties {
// //           property "sonar.sources", "src"
//        }
//    }
/
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)