Experience using Maven PW

I was using nexus2.11.2 on centos6.5 built PW, the following is a summary of my experience these days.

 

1. When you modify pom.xml time, eclipse check your local warehouse jar package, if they have, pom.xml file is not an error, otherwise an error.

 

2. Use PW several benefits are more convenient, not everyone is a lot of things from the Internet, and with PW, other people do not need the Internet, as long as the PW that server can access on the line.

Therefore, you should first ensure your PW is access to the Internet. If the company requires a proxy, then the nexus management page where the proxy settings, the specific location is

Administration in point server and then inside I was following settings, fill in your own proxy server IP port with the account password

 

 

3. Create a Repository group, this is a warehouse group, you can choose to add those specific configuration in the warehouse in his.

There is certainly a need most Central, his image is http://repo1.maven.org/maven2/ address is the primary address of maven2.

Download Remote Indexes all warehouse, I have set to true up.

4. Create yourself a proxy Repository, the aim is to create, for example, my group was added only a Central, but found not enough, I also need other packages

For example, I used the CDH this project, but this maven Central warehouse did not, so I need to build a warehouse in cdh, CDH can know by the maven pom.xml file, his warehouse address

https://repository.cloudera.com/artifactory/cloudera-repos/

So I added the following configuration

 

5. I finished adding proxy 4 inside, put it in the 3 years in the group, so you have 3 in this directory, unified group with 3 in the warehouse created.

6. how to let other people do not go, but download it from PW warehouse

1) Configure your pom.xml to add the following configuration

Copy the code
<! - set the main warehouse, to find according to the set order. -> 
    <Repositories> 
         <Repository>   
            <the above mentioned id> Kora </ the above mentioned id> <- The group ID needs to set consistent with your new ID ->! 
            <Name> Kora Repository </ name>    
            <url> HTTP: / /10.10.92.244:8081/nexus/content/groups/kora / </ URL>    
        </ Repository>   
    </ Repositories>
Copy the code

2) Add the following arranged in settings.xml maven client, the label on the lower side mirrors

 <mirror>   
      <id>kora</id>   
      <mirrorOf>*</mirrorOf>   
      <url>http://10.10.92.244:8081/nexus/content/groups/kora/</url>   
    </mirror>

 

7. Some private jar package, how you do not find a warehouse in maven? Use this 3rd party, 3rd party jar package, he is a hosted Repository

Here the point Artifact Upload, you can upload 3rd party jar package, every time I choose GAV Parameters, after upload, the 3rd this also added to the group created in step 3, the first three on this also.

 

8. Establish the proxy does not download the corresponding jar package, this time, you select the group, group where there will not be, but when you visit, sometimes, it does not automatically download.

My approach is that the pom.xml with settings.xml in the address of the warehouse, are replaced by proxy, and then add a jar you want to download the dependency label, then, let proxy download. This way you will have a group where, after another exchange group.

 

9. I found a jar package on my server, but maven install time or tips

[ERROR] Failed to execute goal on project kora-monitor: Could not resolve dependencies for project com.kora:kora-monitor:war:1.2.6: Failure to find bitwalker:UserAgentUtils:jar:1.13 in http://10.10.92.244:8081/nexus/content/groups/kora/ was cached in the local repository, resolution will not be reattempted until the update interval of kora has elapsed or updates are forced -> [Help 1]

This is because I have bitwalker local directory, but not inside things, but because of the catalog, but not up and down from the PW, so that if you delete a local path, and then install it.

 

10. The problem with almost 9, suggesting no jar on the server, such as oracle driver, but I found that I had uploaded to the 3rd, and 3rd is under the jar, and the group also has

But they could not find life and death, so I put the 3rd of this com.oracle contracted deleted, and then open the group even has com.oracle this directory, but not inside the jar package which is very strange,

Because I was the 3rd in the com.oracle directory completely deleted. Why group in there, I ended up in the group one by one to find the collection of each warehouse, and finally found com.oracle in this directory Central

Like with the group in the directory, the directory is no light jar package, but then I deleted this directory, and from the new directory in the 3rd uploaded in with a jar package to solve the problem.

 

11. If the directory structure is particularly large, do not want to upload one by one, can be directly uploaded to the directory server, my 3rd directory is / usr / local / sonatype-work / nexus / storage / thirdparty

I put my private warehouse jar package directly into them, enough to make a. 3rd group where you can see with the

12.Maven compiled tips GBK garbled, and your class is UTF-8, then you need to add code format in your project's pom.xml years, as follows:

 <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

 

Guess you like

Origin www.cnblogs.com/zhuyeshen/p/11754053.html