我想在我的 .m2 存储库中替换一个 Jar。我的存储库中有旧版本的 Jar。我想将其更新为较新的。
目前我jtidy-4aug2000r7-dev.jar
在C:\.m2\repository\jtidy\jtidy\4aug2000r7-dev
.
我想将其更新为 jtidy-r938。我的本地文件夹中有这个 jar。
有人可以告诉我该怎么做。
Since it's on central, the easiest way is to declare it as a dependency to your project and run mvn dependency:get
.
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>r938</version>
</dependency>
This will put the r398
version in (another) subdirectory beside the 4aug2000r7-dev
version.
To manually install an artifact refer to this answer.
Cheers,
If you have the updated jar locally, you use the following command
mvn install:install-file -Dfile=path-to-your-artifact-jar \
-DgroupId=your.groupId \
-DartifactId=your-artifactId \
-Dversion=version \
-Dpackaging=jar \
-DlocalRepositoryPath=path-to-specific-local-repo
which install your updated jar file locally.
update your pom.xml
purticularly the one similar to this
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>**4.0**</version>
<type>jar</type>
<scope>test</scope>
<optional>true</optional>
</dependency>
update Version as per your need
更新 pom.xml 中依赖标记中的版本。它将自动从中央 maven repo 下载新版本。
Delete it, update the version-number in your pom.xml and update your dependencies. If the version is not available in the maven repository, build your own artifact with the specified version use it for your purpose.