【问题标题】:Is it possible to Install file to local cache in gradle similar to Maven install:install-file?是否可以将文件安装到类似于 Maven install:install-file 的 gradle 中的本地缓存?
【发布时间】:2022-03-03 16:27:06
【问题描述】:

目前我正在使用 maven 将此文件安装到 maven 本地存储库,然后在我的应用程序 gradle 构建中,我拥有此工件的依赖项。

    mvn install:install-file -Dfile=locallib/wlthint3client.jar -DgeneratePom=true -DgroupId=com.oracle.weblogic -DartifactId=wlthint3client -Dversion=10.3 -Dpackaging=jar

build.gradle 中的依赖

    compile("com.oracle.weblogic:wlthint3client:10.3")

有没有办法使用 gradle 将文件安装到 gradle 本地缓存中?

提前致谢。

-维迪亚

【问题讨论】:

  • 你试过gradle build install这基本上是把jar推到本地maven repo。

标签: maven gradle build.gradle maven-install


【解决方案1】:

我有一个解决方法。我正在使用 gradle 本身将其推送到 maven 本地仓库。

来自 build.gradle 的片段:

configurations {
    resultArchives
}

uploadResultArchives {
    repositories {
        mavenDeployer {
            repository(url: mavenLocal().url)
            pom.version = '10.3'
            pom.artifactId = 'wlthint3client'
            pom.groupId = 'com.oracle.weblogic'
        }
    }
}

artifacts {
    resultArchives file: file('locallib/wlthint3client.jar')
}

将工件推送到 maven 本地仓库:

gradle uploadResultArchives

【讨论】:

    猜你喜欢
    • 2012-09-21
    • 2016-07-26
    • 2017-02-09
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-27
    相关资源
    最近更新 更多