1. Create a local image from the maven Repository
Http://blog.csdn.net/teamlet/archive/2007/04/22/1574642.aspx
2. Create a maven2 local code library server, which is often referred to as "private server"
The official Maven repository server is very slow. Do you still remember the last submarine cable Accident? The official server could not be accessed at all, and it was crazy during that time. In addition, the official server class library version is usually not the latest, and sometimes you have to do it yourself if you want to use the latest version. (The following describes how to manually create a local code server.
The Maven server is simple, just a common HTTP server, such as Apache.
Copy the folder of your local code library to the htpdocs/maven2 directory under the Apache installation directory. The Windows user is C:/Documents and Settings/Jeffrey /. m2/repository, which is/home/Jeffrey/in Linux /. m2/Repository (note. m2 is a hidden folder in Linux)
Start the Apache server and enter http: // localhost/maven2/repository in the browser. You can view the repository file directory.
Edit the project POM to specify the local code library Server
Add:
XML Code
- <Repositories>
- <Repository>
- <ID> mylibs <! -- </Span --> ID>
- <URL> http: // localhost/maven2/Repository <! -- </Span --> URL>
- <! -- </Span --> repository>
- <! -- </Span --> repositories>
Multiple repository records can be added. MVN searches in sequence. If none of them are found, MVN searches for the official server.
3. Add a new class library to the local code server.
Many class libraries on the maven official website cannot be found. You can only do it yourself.
Please first confirm that the official website does not exist and then do it yourself. After all, it is quite troublesome.
See the http://mvnrepository.com/,http://repo1.maven.org/maven2/ on two websites:
The preceding section describes how to organize the file directory of the maven code library. The same jar has an independent folder for each version to store. In addition to jar, the jar description file is also available. POM and their verification files. sh1
The. Pom file defines the name and version of the jar and other jar files that the jar depends on (that is why a jar is introduced but a lot of jar files are generated)
The simplest Pom is as follows:
Generate a verification file for jar and POM
You can use an ant task to do the following:
XML Code
- <! -- Generate checksum file for jar and pom -->
- <Target
Copy the generated sh1 files, Jar files, and pom files to the Apache code library according to the structure layout described above. Of course, you can copy them directly to the local code library.
XML Code
- XML version = "1.0" encoding = "UTF-8"?>
- <Project>
- <Modelversion> 4.0.0 <! -- </Span --> modelversion>
- <Groupid> net. Jeffrey <! -- </Span --> groupid>
- <Artifactid> XXX <! -- </Span --> artifactid>
- <Versions> 1.0 <! -- </Span --> version>
- <Dependencies>
- <! -- </Span --> dependencies>
- <! -- </Span --> Project>
From: http://hi.baidu.com/huang_max/blog/item/e204a2516ba9b82642a75bce.html