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.