gradle中调用ant.unzip对zip包解压缩

任务:拷贝第三方jar的zip包到lib,unzip到temp目录,把其中的jar拷贝到lib目录,把zip和产生的中间文件删掉。

apply plugin: 'java'
def root = file('..')
copy {
    from "${root}/3rdpartyinternal/selenium_java/selenium-java-2.47.1.zip"
    into "lib"
}
ant.unzip(src:"lib/selenium-java-2.47.1.zip", dest:"temp")
    copy {
    from "temp/selenium-2.47.1/selenium-java-2.47.1.jar"
    from "temp/selenium-2.47.1/libs/apache-mime4j-0.6.jar"
    from "temp/selenium-2.47.1/libs/bsh-1.3.0.jar"
    from "temp/selenium-2.47.1/libs/cglib-nodep-2.1_3.jar"
    from "temp/selenium-2.47.1/libs/commons-codec-1.10.jar"
    from "temp/selenium-2.47.1/libs/commons-collections-3.2.1.jar"
    from "temp/selenium-2.47.1/libs/commons-exec-1.3.jar"
    from "temp/selenium-2.47.1/libs/commons-io-2.4.jar"
    from "temp/selenium-2.47.1/libs/commons-lang3-3.4.jar"
    from "temp/selenium-2.47.1/libs/commons-logging-1.1.3.jar"
    from "temp/selenium-2.47.1/libs/cssparser-0.9.16.jar"
    from "temp/selenium-2.47.1/libs/gson-2.3.1.jar"
    from "temp/selenium-2.47.1/libs/guava-18.0.jar"
    from "temp/selenium-2.47.1/libs/hamcrest-core-1.3.jar"
    from "temp/selenium-2.47.1/libs/hamcrest-library-1.3.jar"
    from "temp/selenium-2.47.1/libs/htmlunit-2.17.jar"
    from "temp/selenium-2.47.1/libs/htmlunit-core-js-2.17.jar"
    from "temp/selenium-2.47.1/libs/httpclient-4.4.1.jar"
    from "temp/selenium-2.47.1/libs/httpcore-4.4.1.jar"
    from "temp/selenium-2.47.1/libs/httpmime-4.4.1.jar"
    from "temp/selenium-2.47.1/libs/jcommander-1.29.jar"
    from "temp/selenium-2.47.1/libs/jetty-io-9.2.11.v20150529.jar"
    from "temp/selenium-2.47.1/libs/jetty-util-9.2.11.v20150529.jar"
    from "temp/selenium-2.47.1/libs/jna-4.1.0.jar"
    from "temp/selenium-2.47.1/libs/jna-platform-4.1.0.jar"
    from "temp/selenium-2.47.1/libs/junit-4.12.jar"
    from "temp/selenium-2.47.1/libs/nekohtml-1.9.22.jar"
    from "temp/selenium-2.47.1/libs/netty-3.5.7.Final.jar"
    from "temp/selenium-2.47.1/libs/phantomjsdriver-1.2.1.jar"
    from "temp/selenium-2.47.1/libs/sac-1.3.jar"
    from "temp/selenium-2.47.1/libs/serializer-2.7.2.jar"
    from "temp/selenium-2.47.1/libs/testng-6.8.5.jar"
    from "temp/selenium-2.47.1/libs/websocket-api-9.2.11.v20150529.jar"
    from "temp/selenium-2.47.1/libs/websocket-client-9.2.11.v20150529.jar"
    from "temp/selenium-2.47.1/libs/websocket-common-9.2.11.v20150529.jar"
    from "temp/selenium-2.47.1/libs/xalan-2.7.2.jar"
    from "temp/selenium-2.47.1/libs/xercesImpl-2.11.0.jar"
    from "temp/selenium-2.47.1/libs/xml-apis-1.4.01.jar"
    into "lib"

if (file("lib/selenium-java-2.47.1.zip").exists()) {
    file("lib/selenium-java-2.47.1.zip").delete()
    file("temp").deleteDir()  
}
dependencies {
    compile fileTree('lib')
    compile project(':Automation_Fwk')
}
sourceSets {
    main {
        java {
            srcDir 'src'
        }
    }
}

jar {
    archiveName = "tests.jar"
}

posted on   熊gg  阅读(1044)  评论(0编辑  收藏  举报

< 2025年1月 >
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1
2 3 4 5 6 7 8

统计

点击右上角即可分享
微信分享提示