Maven本地仓库地址的设置

默认情况下,mvn 的配置文件在 ~/.m2/settings.xml,默认仓库在 ~/.m2/repository,通过修改 settings.xml 的内容,实现仓库位置的变化。

<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:/software/repository</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->

使用Maven指令注册本地JAR包

<dependency>
   <groupId>com.alibaba.openplatform.shared</groupId>
   <artifactId>zwdd-sdk-java</artifactId>
   <version>1.2.0</version>
</dependency>
mvn install:install-file -Dfile=zwdd-sdk-java-1.2.0.jar -DgroupId=com.alibaba.openplatform.shared -DartifactId=zwdd-sdk-java -Dversion=1.2.0 -Dpackaging=jar
D:\FileStorage\File\2021-11>mvn install:install-file -Dfile=aspose-words-15.8.0.jar -DgroupId=com.alibaba.openplatform.shared -DartifactId=zwdd-sdk-java -Dversion=1.2.0 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing D:\FileStorage\File\2021-11\aspose-words-15.8.0.jar to D:\software\repository\com\alibaba\openplatform\shared\zwdd-sdk-java\1.2.0\zwdd-sdk-java-1.2.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.621 s
[INFO] Finished at: 2021-11-17T11:03:19+08:00
[INFO] ------------------------------------------------------------------------