Maven:无法安装第3方罐 [英] Maven: unable to install 3rd party jar

查看:93
本文介绍了Maven:无法安装第3方罐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将第3方jar安装到我的存储库(alfresco-repository.jar)中.我正在使用以下命令:

trying to install a 3rd party jar into my repository (alfresco-repository.jar). I'm using the following command:

mvn install:install-file -DgroupId=alfresco -DartifactId=alfresco -Dversion=3.1 -Dpackaging=jar "-Dfile=C:/Users/xxx/Development/WIP/Alfresco/common/jars/alfresco/3.1/lib/alfresco-repository-3.1.jar" -DgeneratePom=true -e

,我得到以下异常(-e用于更多信息):

and I'm getting the following exception (-e used for more information):

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task '.1': you must specify a valid lifecycle phase, or a goal in
 the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Invalid task '.1': you must specify a va
lid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:plugin
ArtifactId:pluginVersion:goal
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor
(DefaultLifecycleExecutor.java:1830)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListBy
AggregationNeeds(DefaultLifecycleExecutor.java:462)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:175)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6
0)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

推荐答案

问题是您在错误的位置使用双引号(),有时甚至根本没有使用双引号.您应该在所有值周围使用双引号参数.例如...

The problem is that you are using double quotes (") in the wrong places and sometimes not at all. You should be using double quotes around all of your values of parameters. For instance...

"-Dfile=C:/Users/xxx/Development/WIP/Alfresco/common/jars/alfresco/3.1/lib/alfresco-repository-3.1.jar"

...应该是...

...should be...

-Dfile="C:/Users/xxx/Development/WIP/Alfresco/common/jars/alfresco/3.1/lib/alfresco-repository-3.1.jar"

...和...

-Dversion=3.1

...应该是...

...should be...

-Dversion="3.1"

不同操作系统的不同命令行将不一致地处理第一个版本,但是,如果仅将每个参数的 value 用双引号引起来,则每次都会得到所需的行为.您的整个命令应如下所示……

Different command lines of different OS's will handle the first versions inconsistently but if you surround only the value of each parameters with double quotes, you will get the desired behavior every time. Your entire command should look like this...

mvn install:install-file -DgroupId="alfresco" -DartifactId="alfresco" -Dversion="3.1" -Dpackaging="jar" -Dfile="C:/Users/xxx/Development/WIP/Alfresco/common/jars/alfresco/3.1/lib/alfresco-repository-3.1.jar" -DgeneratePom="true" -e

我承认所有这些都不是必须的,但这是一个好习惯.

I'll admit it is not necessary on all of them but it is a good habit to have.

这篇关于Maven:无法安装第3方罐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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