Maven install:install-file:指定的文件不存在 [英] Maven install:install-file : specified file not exists

查看:1733
本文介绍了Maven install:install-file:指定的文件不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将自定义jar添加到我的项目中(到pom.xml).进行操作

I tried to add custom jar into my project (to pom.xml). When I made an operation

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<myGroup> -DartifactId=<myArtifactId> -Dversion=<myVersion> -Dpackaging=<myPackaging> -DlocalRepositoryPath=<path>

我实际上收到一个错误:指定的文件不存在.但是文件在文件夹中-这就是问题所在.我该如何解决?还是我可以在没有此步骤的情况下添加自定义jar?我知道scope,但是它不能正常工作-Maven变量$ {basedir}不能在systemPath中使用.

I actually received an error: the specified file not exists. But the file is in the folder - that's the problem. How I can resolve this? Or how I can add custom jar without this step? I know about scope , but it's not working properly - maven variable ${basedir} cannot be used in systemPath.

Maven 3.3.9

Maven 3.3.9

更新1:实际上,现在我发现了一些新内容:Maven不喜欢groupId和version中的点.经过一番尝试后,我安装了文件,但这是错误的路径,因为我收到的不是Maven存储库中org_my_local_file文件夹中的文件,而不是org.my.local.file树.

UPDATE 1: Actually, now I find smth new: Maven doesn't like dots in groupId and version. After some tries I installed file, but it's wrong path, because instead of (e.g) org.my.local.file tree I received file in org_my_local_file folder in maven repo.

推荐答案

我做了很多次,并且按预期工作. 你到底是什么意思:

I did this many times and it worked as expected. What do you exactly mean with :

Maven不喜欢groupId和版本中的点.

Maven doesn't like dots in groupId and version.

您会得到什么例外? 您会收到org_my_local_file,因为我认为您交换了.".在groupId中针对"_"吗?

What exception do you get ? You get org_my_local_file because I think you exachanged '.' in the groupId against '_' ?

您可以在此处找到一个不错的教程,在其中可以看到如何正确完成:

You find a good tutorial here where you can see how it is done correctly :

如何包含自定义图书馆到Maven本地存储库中?

看来您正在使用Windows.尤其是Powershell会引起问题.在这里看看,也许您必须转义一些字符,有一些可能的解决方法:

EDIT : It looks like you are using windows. Especially powershell is known to cause problems. Have a look here, may be you have to escape some characters, there are some possible solutions :

安装Maven工件

这篇关于Maven install:install-file:指定的文件不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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