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

  • 相关阅读:
    Theme.AppCompat.Light报错
    在Eclipse添加Android兼容包( v4、v7 appcompat )
    如何从Eclipse导入github上的项目源码
    一个C#多线程的工作队列
    是否需要手动执行DataContext的Dispose方法?
    Unity3d 销毁
    Unity3d 碰撞检测
    unity3d 鼠标事件
    Unity3d 刚体
    unity3d 让物体移动到点击位置
  • 原文地址:https://www.cnblogs.com/qdlk/p/7505119.html
Copyright © 2011-2022 走看看