Add a jar package not available in the Central Library to the maven-proxy code library of maven2 proxy

Source: Internet
Author: User

Some third-party libraries are not in the central code library of maven2, but the project team needs them. What should I do?
Assume that the maven-proxy system has been installed and corresponding files are added to the local repository directory of Maven-proxy,
Suppose we want to add the ibatis-2.3.0.667.jar to mavne-proxy, the specific operation is as follows:
Groupid = com. ibatis, artifactid = ibatis, version = 2.3.0.667 for the agreed ibatis-2.3.0.667.jar
Assume that the localrepository path of Maven-proxy is/var/Maven-proxy/target/repo.
(1) copy the jar package to the maven-proxy local code library.
$ CD/var/Maven-proxy/target/Repo
$ Mkdir com
$ Mkdir COM/ibatis
$ Mkdir COM/ibatis
$ Mkdir COM/ibatis/2.3.0.667
$ CP ibatis-2.3.0.667.jar/var/Maven-proxy/target/repo/COM/ibatis/2.3.0.667
(2) Compile the POM file:
$ VI ibatis-2.3.0.667.pom
The file content is as follows:

<Project>
<Modelversion> 4.0.0 </modelversion>
<Groupid> com. ibatis </groupid>
<Artifactid> ibatis </artifactid>
<Version> 2.3.0.667 </version>
</Project>

If there is a dependency, you can describe the dependency in the POM file.
(3) make the checksum file:
Use ant to generate the checksum file of the jar package and pom file, and create build. XML as follows:

<Project default = "checksum">
<Target name = "checksum">
<Checksum file = "ibatis-2.3.0.667.jar" algorithm = "Sha" fileext = ". sha1"/>
<Checksum file = "ibatis-2.3.0.667.pom" algorithm = "Sha" fileext = ". sha1"/>
</Target>
</Project>

Execute this ant task
$ Ant build. xml
The ibatis-2.3.0.667.jar.sha1 and ibatis-2.3.0.667.pom.sha1 files are generated, and the Library can be added in the Pom. xml file of the project, adding the following dependency:

<Dependency>
<Groupid> com. ibatis </groupid>
<Artifactid> ibatis </artifactid>
<Version> 2.3.0.667 </version>
</Dependency>

In this way, MVN will download this library from Maven-proxy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.