PW maven_ upload, and download from PW

Since the company did not maven, themselves want to use, and thus be on their own to take a nexus

1, hard to force more than that, to upload files to the local maven jar

   Setting.xml need to add in the machine (the client windows) in a maven of this:

  

   <server>
         <id>releases</id>
         <username>admin</username>
         <password>admin123</password>
    </server>
    <server>
        <id>snapshots</id>
        <username>admin</username>
        <password>admin123</password>
    </server>
    <server>
        <id>thirdparty</id>
        <username>admin</username>
        <password>admin123</password>
    </server>

  Then the project pom.xml file, add:

  

 <distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://localhost:9081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://localhost:9081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

  It should be noted at this time distributionManagement-> repository-> id to the server and setting.xml mvn of the id the same.

  The last execution lifecycle to get the last deploy. You can upload PW

  

2. Besides downloaded from the PW:

  You need to find at profiles add tags setting.xml in the file mvn:

<! - Download jar package configuration -> 
    < Profile >  
        <! - Profile of ID -> 
        < ID > dev </ ID > 
        < Repositories > 
            < Repository >  <! - warehouse id, repositories can configure warehouse to ensure no repeat id -> 
                < id > nexus </ id >  <-! warehouse address, that address nexus warehouse group -> 
                < url > HTTP: // localhost: 9081 / nexus / Content / groups / public / </ URL >  <-! whether to download member releases ->
                <Releases > 
                    < Enabled > to true </ Enabled > 
                </ Releases >  <-! whether to download snapshots member -> 
                < snapshots > 
                    < Enabled > to true </ Enabled > 
                </ snapshots > 
            </ Repository > 
        </ Repositories > 
        < pluginRepositories >  <! - plug-warehouse, maven plug-ins rely on the run, also you need to download the plugin from private servers -> 
            < pluginRepository >  <!- the above mentioned id plugin repository not allowed to repeat, if repeated back configuration will overwrite the front ->
                <id>public</id>
                <name>Public Repositories</name>
                <url>http://localhost:9081/nexus/content/groups/public/</url>
            </pluginRepository>
        </pluginRepositories>
    </profile>

  Add mvn of the setting.xml

    <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>    

  Note activeProfiles-> activeProfile and profiles-> profile-> id consistent

 Then you can download.

Guess you like

Origin www.cnblogs.com/lxl-six/p/11247419.html