简体   繁体   English

Maven -DlocalRepositoryPath未使用,而是使用默认的本地存储库位置

[英]Maven -DlocalRepositoryPath not used, instead uses default local repository location

I'm using the following command to create a local repository within my project (used on many systems so I was experimenting a bit with having a local maven repository inside my project folder for storing external jars that can't be found on any online repository): 我正在使用以下命令在我的项目中创建一个本地存储库(在许多系统上使用,所以我正在尝试在我的项目文件夹中有一个本地maven存储库,用于存储在任何在线存储库中找不到的外部jar ):

C:\Users\someone\workspace\someProject>mvn install:install-file
    -Dfile=somePackage-1.0.0.jar
    -DgroupId=foo.bar
    -DartifactId=somePackage
    -Dversion=1.0.0
    -Dpackaging=jar
    -DlocalRepositoryPath=libs
    -DcreateChecksum=true

This is run from Windows command line. 这是从Windows命令行运行的。 Somehow, even with -DlocalRepositoryPath, it's still installing the jar into the default local repository (C:\\Users\\someone\\.m2\\, etc.). 不知何故,即使使用-DlocalRepositoryPath,它仍然将jar安装到默认的本地存储库(C:\\ Users \\ someone \\ .m2 \\,等)。 What am I doing wrong here? 我在这做错了什么? I tried different variations of the libs path, like /libs, /libs/, full path, using "", but nothing worked. 我尝试了libs路径的不同变体,比如/ libs,/ libs /,完整路径,使用“”,但没有任何效果。 Why isn't the -DlocalRepositoryPath argument not working here? 为什么-DlocalRepositoryPath参数不能在这里工作? I'm using Maven 2.2.1. 我正在使用Maven 2.2.1。

The install:install-file option ignores the localRepositoryPath when using the version 2.2 of the plugin. 使用插件的2.2版时,install:install-file选项会忽略localRepositoryPath。 However, it works with version 2.3 and higher. 但是,它适用于2.3及更高版本。

Also, try using the fully qualified name of the plugin to specify the version: 另外,尝试使用插件的完全限定名称来指定版本:

mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \
                         -Dfile=<path-to-your-file> -DgroupId=<myGroup> \ 
                         -DartifactId=<myArtifactId> -Dversion=<myVersion> \
                         -Dpackaging=<myPackaging> -DlocalRepositoryPath=<path>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM