有没有办法安装jar本地gradle存储库,因为它在mave中(maven install:install-file [英] Is there a way to install jar local gradle repository, as it in mave (maven install:install-file

查看:401
本文介绍了有没有办法安装jar本地gradle存储库,因为它在mave中(maven install:install-file的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前只和maven一起工作,当项目需要一些在任何仓库中都不可用的jar时,我可以使用

  mvn install:install-file -Dfile =< path-to-file> -DgroupId = LT;组ID> \ 
-DartifactId =< artifact-id> -Dversion = LT;版本> -Dpackaging = LT;包装和GT;

现在很简单。



现在我与gradle争斗,我的项目依赖于任何存储库中不再存在的jar。我的磁盘上有jar文件。在项目依赖关系中更改jar版本不适用于我的问题。



有没有办法从命令行将jar文件安装到gradle缓存中,而不更改任何项目依赖关系?

解决方案

@DaveNewton发布了一个问题链接,讨论如何将本地Maven存储库添加到Gradle的工件搜索路径。如果你仍然有你的本地Maven仓库,并且已经部署了该文件,那么这个工作就可以实现。



Gradle还允许你引用对你的本地文件系统。但是,如果你的计算机崩溃了,你就麻烦了。

我认为一个更好的方法是使用库管理器,比如Nexus Artifactory 。它应该在定期备份的单独机器上运行,并/或为其存储库使用RAID磁盘。


I used to work only with maven, and when project requires some jar which is not available in any repository, I was able to install it with

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

It was quite easy.

Now I struggle with gradle, my project depends on a jar which no longer exists in any repository. I have the jar file on my disk. Changing the jar version in project dependencies does not apply to my problem.

Is there any way to install jar file into the gradle cache from command line without changing any project dependencies?

解决方案

@DaveNewton posted a link to a question that talks about adding your local Maven repository to Gradle's artifact search path. If you still have your local Maven repository, and the file has been deployed there, this will work.

Gradle also lets you reference dependencies on your local filesystem. However, if your computer crashes, you're in trouble.

I think a far better approach is to use a repository manager, like Nexus or Artifactory. It should be running on a separate machine that is regularly backed-up and/or uses RAID disks for its repository.

这篇关于有没有办法安装jar本地gradle存储库,因为它在mave中(maven install:install-file的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆