有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何为gradle构建使用lint4j插件,以及如何为Jenkins配置它?

以下插件配置适用于maven:

<dependency>
  <groupId>lint4j</groupId>
  <artifactId>jutils-lint4j-plugin</artifactId>
  <version>1.3.1</version>
  <type>plugin</type>
</dependency>

然后,我可以将以下代码片段添加到我的项目的reports部分。xml

<report>jutils-lint4j-plugin</report>

将以下行添加到项目的maven中。属性文件:

maven.repo.remote=http://www.ibiblio.org/maven,http://www.jutils.com/maven

但我也希望格拉德尔也一样。除了所需的构建之外。gradle change,我是否需要在项目中进行任何其他更改,以便在Jenkins的工作中看到lint报告


共 (2) 个答案

  1. # 1 楼答案

    添加以下代码来构建。gradle文件:

    buildscript {
      repositories { jcenter() }
      dependencies {
        classpath 'com.netflix.nebula:gradle-lint-plugin:latest.release'
      }
    }
    
    apply plugin: 'nebula.lint'
    
    gradleLint.rules = ['dependency-parentheses', 'dependency-tuple']
    

    添加自定义规则,忽略案例

  2. # 2 楼答案

    然后确保gradle plugin已安装并配置:

    <hudson.plugins.gradle.Gradle plugin="gradle@1.24">
            <description/>
            <switches> -Dtest.single=com/mycomp/test/trusted/**/*Tests
                -Dtest.scaleDefaultWaits=2.0</switches>
            <tasks>clean test</tasks>
            <rootBuildScriptDir/>
            <buildFile/>
            <gradleName>gradle-1.12</gradleName>
            <useWrapper>false</useWrapper>
            <makeExecutable>false</makeExecutable>
            <fromRootBuildScriptDir>true</fromRootBuildScriptDir>
            <useWorkspaceAsHome>false</useWorkspaceAsHome>
        </hudson.plugins.gradle.Gradle>
    

    我确实在网上找到了这本书,可以作为你的指南:https://github.com/codepath/android_guides/wiki/Building-Gradle-Projects-with-Jenkins-CI#create-the-build-job