If my project does not use maven, I should make a choice, or change the project, or urge this project to use maven. Someone may ask why maven is used? Doesn't maven work well. Here, I will only talk about two things: The first is to manage the jar package. This contains many meanings, such as downloading the jar package. Through the repository, you only need to enter the package name and version number, and can download it to your local machine immediately without looking for it on the official website or google, if the download speed is slow, you can change the repository address at any time. In addition, jar version chaos is also common in projects. Some hidden problems are caused by the jar version and are difficult to find. In addition, there are n multiple jar packages in a project, but no one can tell the dependency between them, maven can, and so on. The second point is to make your technical habits less out of touch.
The first two articles respectively explain how to download, install, and start maven, as well as some precautions and error handling. This article mainly describes the configuration.
Open the nexus console:
In fact, the interfaces of maven1 and maven2 are similar in Version 2.5.1, and maven2 adds some options.
Select From POM and upload the pom file (my package has passed the mvn archetype: create-DgroupId = com. ainfo. bs-DartifactId = acctmanm-DpackageName = com. kage-Dversion = 1.0 is created, so there is a pom file. If not, enter the GAV parameter ). Then upload the jar package. After uploading the package, remember to click "add" and then "upload". I forgot a few of the packages and checked them for a long time. If you forget it, you can complete it. It is regarded as update when completing the data. update must ensure that the deployment policy option is allow redeploy.
After uploading, you can see these files on the host:
Update the index (sometimes not updated) to view the new package:
Next, modify the maven configuration file setting. xml to point to this nexus host:
<Server> <id> nexus-releases </id> <username> admin </username> <password> admin123 </password> </server> <id> nexus -snapshots </id> <username> admin </username> <password> admin123 </password> </server> </servers> <profile> <id> dev </id> <repositories> <repository> <id> local-nexus </id> <url> http: // 30.51.23.250: 8081/nexus/content/groups/public/</url> <releases> <enabled> true </enabled> </releases> <snapshots> <enabled> true </enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id> local-nexus </id> <url> http: // 30.51.23.250: 8081/nexus/content/groups/public/</url> <releases> <enabled> true </enabled> </releases> <snapshots> <enabled> true </enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> <activeProfiles> <activeProfile> dev </activeProfile> </activeProfiles>
You can also modify pom. xml. Because I want my project to be automatically directed to this host after being downloaded by team members (high mobility) on svn, I need to configure it in pom. xml.
Finally, the most important step (not mentioned in many online articles) is to modify the configuration in MyEclipse (the default path does not have the setting file ):
Change to the actual path:
Then, the update project will be updated:
After the update, your local maven repository will download this package. If there is not a jar package downloaded, there is only one update file, such as the tapestry-3.0.4.pom.lastUpdated, there are several reasons,
1. If the repository address you configured is incorrect, check your setting. xml (if you configured it in pom. Check pom. xml in xml)
2. The jar you uploaded is incorrect. Go to the nexus host and check whether the jar has been uploaded.
3. You uploaded the jar file but didn't have an update index. Follow the update instructions above.
4. You have just updated the package, so it will not be automatically updated. In this case, delete the folder of this package in your local repository (or just delete lastupdated)
It's okay to download the self-uploaded jar. What about downloading other jar files? You can also test it.
For example, if the jfree jar is downloaded and configured in pom, it will be automatically downloaded:
Check before and after the download on the nexus machine:
In fact, all the databases in the console are on the host. MyHostedRepo is built by myself, and the rest are available by default. As configured in setting, public is shown in the figure:
Version: nexus2.5.1 (tgz) maven3.2.3
2014.11.6
Build an enterprise maven repository using Nexus2 (3)