Maven repository summary, maven Repository

Source: Internet
Author: User
Tags maven central sonatype

Maven repository summary, maven Repository
Maven repository Summary 1. maven repository address:

Common warehouses
Http://repo1.maven.org/maven2/
Http://repository.jboss.com/maven2/
Http://repository.sonatype.org/content/groups/public/
Http://mirrors.ibiblio.org/pub/mirrors/maven2/org/acegisecurity/

Private Repository
Http://repository.codehaus.org/
Http://snapshots.repository.codehaus.org/
Http://people.apache.org/repo/m2-snapshot-repository
Http://people.apache.org/repo/m2-incubating-repository/

At the same time, you can build your own maven Repository: private server. The method for building the repository is as follows: attachment: Access http://nexus.sonatype.org/downloads/download nexus.
Starting Nexus means starting a web server. Its default address is localhost: 8081. Nexus runs in a servlet container named Jetty. It starts with a local Service package named Tanuki Java Service Wrapper. This service package can be configured to run Nexus in the form of a Windows service or a Unix daemon thread. To start Nexus, you need to find a suitable startup script for your platform. To view the list of available platforms, view the contents of the $ {NEXUS_HOME}/bin/jsw directory.
The executable file is under the % nexus installation directory % \ nexus-webapp-1.0.0 \ binjsw \ windows-x86-32:
InstallNexus. bat/UninstallNexus. bat is used to install/uninstall nexus as a windows service.
Nexus. bat starts Nexus directly in the command line. If you do not want to install Nexus as a windows service, you can use this file to manually control the start and exit of Nexus.
1. Configure nexus
First, log on to the default address http: // localhost: 8081/nexus/. The default user name and password are admin/admin123.
By default, nexus disables the remote index download function. Enabling method:
Click Repositories under the Administration menu, and set the three Repositories Apache Snapshots, Codehaus Snapshots, and Maven Central
Modify Download Remote Indexes to true. Right-click the three repositories and select Re-index to download the remote index file.
2. manage warehouses
Log on as an administrator and click Repositories under Administration in the left navigation menu. Nexus provides three different warehouses.
(1) Agent warehouse
A proxy repository is a proxy for a remote repository. By default, Nexus comes with the following Agent Repository:
Apache Snapshots
This repository contains the snapshot version from the Apache Software Foundation. Http://people.apache.org/repo/m2-snapshot-repository
Codehaus Snapshots
This repository contains the snapshot version from Codehaus. Http://snapshots.repository.codehaus.org/
Central Maven Repository
This is the central Maven repository (released version ). Http://repo1.maven.org/maven2/
(2) host Repository
A host repository is a Nexus-hosted repository. Maven comes with the following host repository.
3rd Party
This host repository should be used to store third-party dependencies that cannot be found in the public Maven repository. Examples of such dependencies include: the commercial and private class libraries you use, such as the Oracle JDBC driver.
Releases
This host repository is where your organization publishes internal releases.
Snapshots
This host repository is where your organization releases the internal snapshot version.
(3) virtual warehouse
A virtual repository exists as the Maven 1 adapter. Nexus comes with a virtual central-m1 Repository
3. Manage groups
A group is a powerful feature of Nexus. It allows you to combine multiple repositories in a single URL. Nexus comes with two groups: public and public-snapshots. The public group combines three master repositories: 3rd Party, Releases, Snapshots, and central Maven repository. The public-snapshots group combines Apache Snapshots and Codehaus Snapshots repositories.
4. Configure maven
To make maven use Nexus as the repository, modify ~ /. M2/settings. xml.
Xml Code
<Profiles>
<Profile>
<Id> nexus </id>
<Repositories>
<Repository>
<Id> nexus </id>
<Name> local private nexus </name>
<Url> http: // localhost: 8081/nexus/content/groups/public </url>
</Repository>
</Repositories>
</Profile>
<Profile>
<Id> nexus-snapshots </id>
<Repositories>
<Repository>
<Id> nexus-snapshots </id>
<Name> local private nexus snapshots </name>
<Url> http: // localhost: 8081/nexus/content/groups/public-snapshots </url>
</Repository>
</Repositories>
</Profile>
</Profiles> <activeProfiles>
<ActiveProfile> nexus </activeProfile>
<ActiveProfile> nexus-snapshots </activeProfile>
</ActiveProfiles> 5. Deploy components to Nexus
To deploy components to Nexus, provide repository URLs in distributionManagement, and then run mvn deploy. Maven will push the project POM and components to your Nexus installation through a simple http put. You need to configure the repository of distributionManagement in your project POM.
Xml Code
<DistributionManagement>
<Repository>
<Id> releases </id>
<Name> Internal Releases </name>
<Url> http: // localhost: 8081/nexus/content/repositories/releases </url>
</Repository>
<SnapshotRepository>
<Id> Snapshots </id>
<Name> Internal Snapshots </name>
<Url> http: // localhost: 8081/nexus/content/repositories/snapshots </url>
</SnapshotRepository>
</DistributionManagement> if this problem persists, an error is reported during the deployment ~ Add the following server logon information to/. m2/settings. xml:
Xml Code
<Server>
<Id> releases </id>
<Username> admin </username>
<Password> admin123 </password>
</Server>
<Server>
<Id> Snapshots </id>
<Username> admin </username>
<Password> admin123 </password>
</Server> deploy third-party components:
The component may be a JDBC driver of a private database such as Oracle, or you may depend on another JAR, which is neither open source nor free to obtain. In this case, you need to manually bring these components and release them to your own repository. Nexus provides the "third-party" repository of the host for this purpose.
Run the following command to publish the file to Nexus:
Java code
Mvn deploy: deploy-file-DgroupId = com. oracle-DartifactId = ojdbc14
-Dversion = 10.2.0.3.0-Dpackaging = jar-Dfile = ojdbc. jar
-Durl = http: // localhost: 8081/nexus/content/repositories/thirdparty
-DrepositoryId = thirdparty6.Nexus listening port
By default, Nexus listens to port 8081. You can change this port by changing the value of $ {NEXUS_HOME}/conf/plexus. properties. To do this, stop Nexus, change the applicationPort value in the file, and then restart Nexus.
7. Maven Profiles
Profile in Maven is a set of optional configurations that can be set or override the default configuration values. With profile, you can customize the building for different environments. Profile can be configured in pom. xml and an id is given. Then you can use the command line mark when running Maven to tell Maven to run the target in a specific profile. The following pom. xml uses the production profile to overwrite the default Compiler plug-in settings.
Xml Code
<Profiles>
<Profile>
<Id> production </id>
<Build>
<Plugins>
<Plugin>
<GroupId> org. apache. maven. plugins </groupId>
<ArtifactId> maven-compiler-plugin </artifactId>
<Configuration>
<Debug> false </debug>
<Optimize> true </optimize>
</Configuration>
</Plugin>
</Plugins>
</Build>
</Profile>
</Profiles>
To run mvn install using the production profile, you need to input the-Pproduction parameter in the command line. To verify that the production profile overwrites the default Compiler plug-in configuration, you can run Maven in this way by enabling debug output (-X.
If you start to use Maven profile in large quantities, you will want to separate profile from POM and use a separate file, such as profiles. xml. You can use profiles in both pom. xml and external profiles. xml files. You only need to put the profiles element in the profiles. xml file under the $ {basedir} directory, and then run Maven as usual. The contents of the profiles. xml file are as follows:
Xml Code
<Profiles>
<Profile>
<Id> development </id>
<Build>
<Plugins>
<Plugin>
<GroupId> org. apache. maven. plugins </groupId>
<ArtifactId> maven-compiler-plugin </artifactId>
<Configuration>
<Debug> true </debug>
<Optimize> false </optimize>
</Configuration>
</Plugin>
</Plugins>
</Build>
</Profile>
<Profile>
<Id> production </id>
<Build>
<Plugins>
<Plugin>
<GroupId> org. apache. maven. plugins </groupId>
<ArtifactId> maven-compiler-plugin </artifactId>
<Configuration>
<Debug> false </debug>
<Optimize> true </optimize>
</Configuration>
</Plugin>
</Plugins>
</Build>
</Profile>
</Profiles> the settings profile can be applied to all projects built using Maven. You can define the settings profile in two places: defined in ~ The user-specific settings profile in/. m2/settings. xml, or the global settings profile defined in $ {M2_HOME}/conf/settings. xml. Original article: http://tianya23.blog.51cto.com/1081650/386908/
How to Set Up A maven remote Repository

By default, maven configures the central repository of apache. If the repository is not downloaded, the network speed may be caused or the configuration is incorrect.
Central Repository search.maven.org/shortsearch
 
How does eclipse relate to maven repository?

After installing the maven plug-in correctly in eclipse, click Window --> Preferences --> Maven --> User Settings --> Find your setting in the first input box. xml file (where your maven repsoitory location is configured), click Update Settings -- click Apply -- OK
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.