在 maven install:install-file 中使用 Windows 驱动器盘符

发布于 2024-09-26 22:43:16 字数 694 浏览 1 评论 0原文

当我尝试使用以下 maven 命令安装自定义 jar 时,它将失败:

mvn -X install:install-file -Dfile=D:\Work\...

然而,以下命令确实有效:

mvn -X install:install-file -Dfile=\Work\...

您现在可能会问: 那么问题出在哪里?好吧,我想从脚本文件导入,那里有带有驱动器号和所有其他修饰的路径。

那么我该怎么办呢?

PS:错误信息是:

[错误] 找不到前缀“D”的插件 在当前项目和>中插件组 [org.apache.maven.plugins,org.code haus.mojo] 可从 存储库 [本地(D:\Repository), 中央 (http://repo1.maven.org/maven2)] -> [帮助1] org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: 未找到前缀“D”的插件 当前项目和插件中 组 [org.apache.maven.plugins, org.codehaus.mojo] 可从 存储库

PPS:该公司的该死的 IE 中没有拼写检查器:-(

When I try to install a custom jar with the following maven command then it will fail misirably:

mvn -X install:install-file -Dfile=D:\Work\...

Howerver the following does work:

mvn -X install:install-file -Dfile=\Work\...

You might now ask: So where is the problem? Well, I want to import from a script file and there I have the path with drive letter and all other trimmings.

So how would I go about this?

PS: The error message is:

[ERROR] No plugin found for prefix 'D'
in the current project and in the> plugin groups
[org.apache.maven.plugins, org.code
haus.mojo] available from the
repositories [local (D:\Repository),
central
(http://repo1.maven.org/maven2)] ->
[Help 1]
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException:
No plugin found for prefix 'D' in the
current project and in the plugin
groups [org.apache.maven.plugins,
org.codehaus.mojo] available from the
repositories

PPS: No spell checker in the companies bloody IE :-(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

蓝眼睛不忧郁 2024-10-03 22:43:17

最后我选择:

PUSHD %[PROJECT_HOME]
    CALL mvn    ^
     install:install-file  ^
     `-Dfile=lib/ojdbc14.jar` ^
     `-DgroupId=com.oracle`  ^
     `-DartifactId=ojdbc14`  ^
     `-Dversion=9.0.2.0.0`  ^
     `-Dpackaging=jar`
POPD

我使用:

  • PUSHD,这样我就可以使用相对路径名。
  • CALL 以便脚本不会提前结束。
  • 正斜杠而不是反斜杠。
  • Windows下所有-D参数都需要加反引号。

我希望这有帮助。

In the end I opted for:

PUSHD %[PROJECT_HOME]
    CALL mvn    ^
     install:install-file  ^
     `-Dfile=lib/ojdbc14.jar` ^
     `-DgroupId=com.oracle`  ^
     `-DartifactId=ojdbc14`  ^
     `-Dversion=9.0.2.0.0`  ^
     `-Dpackaging=jar`
POPD

I used:

  • PUSHD so I can use relative path names .
  • CALL so the script won't prematurly end.
  • forward slashes instead of backslashes.
  • all -D parameters need to be backticked under Windows.

I hope that helps.

李不 2024-10-03 22:43:17

我遇到了一个非常类似的错误,除了我的前缀是“C”...

阅读此线程后,我在 jar 文件名中添加了单引号 -Dfile='C:\work\perforce\trunk\Lib\ ftp4j\ftp4j-1.7.2.jar' 并且您需要确保 =' 之间没有空格。

添加单引号修复了它,并且我能够在安装后将 "BUILD SUCCESS" 作为我的输出。

但猜猜我在存储库文件夹中看到了什么? ftp4j-1.7.2.jar.lastUpdatedftp4j-1.7.2.pomftp4j-1.7.2.pom.lastUpdated 文件都是通过安装在文件夹中创建的,但实际的 ftp4j-1.7.2.jar 没有/无法复制...所以此时,我只需手动复制 ftp4j-1.7.2.jar 通过我自己到存储库,这似乎终于起作用了。

I got a very similar error except my was prefix 'C'...

After reading this thread, I added single quotation mark to my jar file name as -Dfile=‘C:\work\perforce\trunk\Lib\ftp4j\ftp4j-1.7.2.jar’ and you need to make sure there is no space between the = and the '.

Adding the single quotes fixed it and I was able to have "BUILD SUCCESS" as my output after the install.

But guess what I see in my repository folder? The ftp4j-1.7.2.jar.lastUpdated, ftp4j-1.7.2.pom, ftp4j-1.7.2.pom.lastUpdated files were all created in the folder by the installation, but the actual ftp4j-1.7.2.jar was NOT/failed to copy over...So at this point, I just manually copy the ftp4j-1.7.2.jar over myself to the repository and that seems to finally work.

潇烟暮雨 2024-10-03 22:43:17

我在使用 PowerShell 时遇到了这个问题,但不知怎的,当我使用命令提示符时它就解决了......

I had this problem using PowerShell, but somehow, it was resolved when I used Command Prompt...

窗影残 2024-10-03 22:43:17

您可以尝试使用有效的 Java 路径字符串吗?

  • 将 '\' 替换为 '/'
  • 或将每个 '\' 加倍

Could you try by using a valid Java path string ?

  • replacing '\' with '/'
  • or doubling each '\'
哎呦我呸! 2024-10-03 22:43:17

ojdbc6.jar 安装示例(在 Windows 上)。

甲骨文。接下来在“Command Shell”中发出命令

mvn install:install-file -Dfile="C:\Users\yourusername\Downloads\ojdbc6-11.2.0.3.jar" -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar

Example for ojdbc6.jar install (on Windows).

Download ojdbc drivers from Oracle. Next in "Command Shell" issue command

mvn install:install-file -Dfile="C:\Users\yourusername\Downloads\ojdbc6-11.2.0.3.jar" -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文