【问题标题】:Unzip a tar.gz file from maven repository into build directory with gradle使用 gradle 将 tar.gz 文件从 maven 存储库解压缩到构建目录
【发布时间】:2011-11-20 19:54:42
【问题描述】:

我有一个 tar.gz 文件,其中包含 Web 服务的 WSDL 文件,我想将此文件解压缩到构建目录中。 tar.gz 文件位于 maven 存储库中。 例如文件名为 my-webservice-1.10.5-wsdl.tar.gz

我尝试了复制任务,然后尝试了 ant.unzip,但这不起作用。

在 maven 中,我为此使用了 maven-dependency-plugin。不幸的是,没有 gradle 等价物。

【问题讨论】:

    标签: copy tar unzip gradle gzip


    【解决方案1】:

    下面的 quick&dirty 脚本应该可以工作;我相信你会设法让它更漂亮。据我所知,没有一步解压tar.gz的方法。

    apply plugin: 'java'
    
    configurations {
      tar
    }
    
    repositories {
      mavenCentral()
    }
    
    dependencies {
      tar 'spice:spice-converter:1.0@tar.gz'
    }
    
    assemble << {
      // not very pretty, but fileCollection() will not work, since it performs
      // the evaluation lazily
      ant.gunzip(src: configurations.tar.files.iterator().next(), dest: 'build/tmp/ungziped.tar')
      copy {
        from tarTree('build/tmp/ungziped.tar')
        into 'build/target'
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-07
      • 1970-01-01
      • 1970-01-01
      • 2013-04-27
      • 2011-11-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-06
      相关资源
      最近更新 更多