gpt4 book ai didi

maven-2 - Maven : unable to install 3rd party jar

转载 作者:行者123 更新时间:2023-12-02 12:45:33 27 4
gpt4 key购买 nike

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

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 用于获取更多信息):

[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)

最佳答案

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

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

...应该是...

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

...还有...

-Dversion=3.1

...应该是...

-Dversion="3.1"

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

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

我承认并不是所有人都需要这样做,但这是一个好习惯。

关于maven-2 - Maven : unable to install 3rd party jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2470611/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com