尝试使用maven在本地存储库中安装jar时

时间:2015-06-23 06:10:59

标签: eclipse maven repository m2e

我的Nexus Repo& amp;中没有这个SFTP罐子。我已将它的依赖项添加到POM文件中,但现在我想在我的本地存储库中安装此JAR,以便我可以在我的项目中使用它。但即使我使用管理员权限打开命令提示符,也会拒绝访问。

 C:\Windows\system32>mvn install:install-file -DgroupId=org.springframework.integration -DartifactId=spring-integration-sftp -Dversion=4.1.5 -Dpackaging=jar -Dfile=C:\Repo
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom
---
[INFO] Installing C:\Repo to C:\Users\t868396\.m2\repository\org\springframework
\integration\spring-integration-sftp\4.1.5\spring-integration-sftp-4.1.5.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.827 s
[INFO] Finished at: 2015-06-23T11:02:52+05:00
[INFO] Final Memory: 15M/64M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4
:install-file (default-cli) on project standalone-pom: Error installing artifact
 'org.springframework.integration:spring-integration-sftp:jar': Failed to instal
l artifact org.springframework.integration:spring-integration-sftp:jar:4.1.5: C:
\Repo (Access is denied) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

1 个答案:

答案 0 :(得分:1)

-Dfile=your.jar很可能不正确,请检查您的参数(仅供参考,因为您的帖子中省略了它)。

以下是一个例子:

mvn install:install-file -DlocalRepositoryPath=repo -DcreateChecksum=true 
 -Dfile=[your-jar] -Dpackaging=jar 
 -DgroupId=[...] -DartifactId=[...] -Dversion=[...]

请参阅:Can I add jars to maven 2 build classpath without installing them?

并且:https://maven.apache.org/general.html#importing-jars