[Maven] remote Maven repository of configuration

   In many cases, the default central repository can not meet the needs of the project, the project may require additional components present in a remote warehouse, as Company Maven repository. At this point, you can configure the warehouse or in the settings.xml in maven project POM
<repositories>
    <repository>
        <id>company</id>
        <name>Company Repository</name>
        <url>http://repository.company.com/maven2/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <layout>default</layout>
    </repository>
</repositories>

  In repositories element, you can use the repository child element specifies one or more remote repository. In this example declares an id for the company, the name of the Company Repository warehouse. Any declaration of a warehouse id must be unique, in particular, should be noted that, id Maven comes with central warehouse is central, if other warehouses statement also use the id, the configuration will cover the central warehouse. url point values ​​from the configuration repository address, in general, are based on the address http protocol, Maven user can open the browser address repository browser member.
    The embodiment configuration snapshots and releases more important elements, which are used to control the release member Maven download and snapshots member.
    It should be noted that enabled child element, this example releases of enabled is true, expressed open support Company warehouse version download release, and snapshots are enabled is false, meaning shut down Company warehouse snapshot version of the download support. Thus, according to this configuration, Maven will download the release from Company warehouse components, rather than downloading a snapshot version of the component. layout element default value in this example shows a layout of the warehouse is the default layout Maven Maven 3 and 2, rather than the layout Maven 1.
  For snapshots and releases, in addition to Enabled, which further comprises two additional sub-elements and updatePolicy checksumPolicy: 
<snapshots>
    <enabled>true</enabled>
    <updatePolicy>daily</updatePolicy>
    <checksumPolicy>ignore</checksumPolicy>
</snapshots>

  Maven updatePolicy elements used to configure the frequency of update check from a remote repository, the default value is daily, express check Maven once a day. Other useful values ​​include: never-- Never check for updates; always-- every build check for updates; in-terval: X-- update check every X minutes (X is an arbitrary integer).
    ChecksumPolicy elements used to configure Maven inspection and examination and documentation of policies. When the member is deployed to Maven repository, it will deploy the corresponding checksum file. When downloading components, Maven will verify the checksum file, if the checksum verification fails, how do? When checksumPolicy default value warn, Maven will output a warning message when performing building, other available values: fail - Maven encounters a checksum error let the build to fail; ignore-- check the Maven completely ignored and error. 
 

Guess you like

Origin www.cnblogs.com/756623607-zhang/p/12182353.html