我尝试使用Maven 2手动安装工件时遇到了一些错误.我想用命令从本地目录安装jar
mvn install:install-file -Dfile=jta-1.0.1B.jar
Run Code Online (Sandbox Code Playgroud)
但是Maven给出了一个构建错误,其内容如下:
Invalid task '.01B.jar': you must
specify a valid lifecycle phase, or a
goal in the format plugin:goal or
pluginGroupId:pluginArtifactId:pluginVersion:goal
Run Code Online (Sandbox Code Playgroud)
我的命令有错吗?
Rom*_*las 144
您需要指明groupId,artifactId和工件的版本:
mvn install:install-file \
-DgroupId=javax.transaction \
-DartifactId=jta \
-Dpackaging=jar \
-Dversion=1.0.1B \
-Dfile=jta-1.0.1B.jar \
-DgeneratePom=true
Run Code Online (Sandbox Code Playgroud)
Pas*_*ent 38
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Run Code Online (Sandbox Code Playgroud)
你确实需要包装选项.这回答了原始问题.
现在,在您的背景下,您正在与Sun提供的jar战斗.您也应该阅读" 应对Sun JAR"页面.在这里,您将学习如何帮助行家为您提供有关Sun罐的位置,以及如何添加Java.net更好的信息maven2仓库它包含 jta-1.0.1B.jar.在您的settings.xml(非便携式)或pom.xml(便携式)中添加:
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
小智 13
我不得不添加包装,所以:
mvn install:install-file \
-DgroupId=javax.transaction \
-DartifactId=jta \
-Dversion=1.0.1B \
-Dfile=jta-1.0.1B.jar \
-DgeneratePom=true \
-Dpackaging=jar
Run Code Online (Sandbox Code Playgroud)