zoukankan      html  css  js  c++  java
  • 从reps下载jar,然后unzip test jar,再执行junit测试

    gradle脚本如下:

    dependencies {
        compile 'com.test.attachment:attachment:1.0-SNAPSHOT'
        compile group:'org.eclipse.emf.commonj', name:'sdo', version:'2.3+', ext:'jar'
        compile group:'org.eclipse.emf.ecore', name:'sdo', version:'2.3+', ext:'jar'
        
    }

    task unzip(type: Copy) {
        def zipPath = project.configurations.compile.find {it.name.startsWith("attachment")}
        println zipPath
        def zipFile = file(zipPath)
        def outputDir = file("${buildDir}/unpacked/dist")
        
        from zipTree(zipFile)
        into outputDir

        doLast {
            copy {
                from "${buildDir}/unpacked/dist/config.properties"
                into "."
            }
        }
    }

    sourceSets {
        test {
            java {
                srcDirs = ["${buildDir}/unpacked/dist"]
            }
        }
    }

    执行gradle unzip 从reps下载测试包attachment.jar以及依赖的包,然后unzip attachment.jar到build/unpackaged/dist目录,最后把执行junit时需要用到的config.properties拷贝到根目录。

    执行gradle test 会执行unzip后的目录下的junit test,在build目录下生成junit report。

    参考:https://stackoverflow.com/questions/23023069/gradle-download-and-unzip-file-from-url?newreg=3ae627393e9b47e09b97ddbd99785e8d

  • 相关阅读:
    九度-题目1197:奇偶校验
    九度-题目1073:杨辉三角形
    九度-题目1072:有多少不同的面值组合?
    同步异步,阻塞非阻塞
    注解方式配置bean
    监听器
    自定义系统初始化器
    构建流
    数值流
    流的使用
  • 原文地址:https://www.cnblogs.com/qdlk/p/7505119.html
Copyright © 2011-2022 走看看