Windows + maven + Eclipse

Source: Internet
Author: User
Tags maven central sonatype

One tutorial: http://www.yiibai.com/maven/maven_overview.html

MAVEN Central Warehouse Information quick check: http://maven.outofmemory.cn/

 Windows installs Maven and configures the local maven jar repository: 01: Install JDK, and configure;02: Download MAVEN:HTTP://MAVEN.APACHE.ORG/DOWNLOAD.HTMLL unzip the directory file;(Apache-maven-3.2.5-bin.zip)03: Configure environment variables; maven_home = ... PATH =% maven_home%\bin; 04: Authentication: mvn-version confirmation under DOS 05: Manually set up a folder with a path of "E:/work/maven_lib", then point the local repository to the path: open "Apache-maven-3.0.5\conf\settings.xml" folder under the Settings.xml file, modify the Localrepository: <localRepository>e:/work/maven_lib</localRepository> Eclipse Configuration maven: (View notes "Eclipse plugin Rollup") 01: After the project file has been modified, in the case of compiling files in Taget/class, it is necessary to right-click the project: Run clean, otherwise the files under Taget will be packaged under Tomcat, giant pits; Eclipse+maven Common functions: 1, Subclipse check out the project documents;2, Project right button "Configure" Convert to Maven project;maven to Engineering general Engineering: Project Right-click--->maven--->disable Maven nature to general engineering. General Engineering to MAVEN project: Engineering Right-click--->configure--->convert to maven project. 3, Project right button "Maven" Update project;4. Modify the Web Module: Modify the Web_inf/web.xml file  Pom.xml: <scope> is also introduced in the,<dependency> in Pom 4, which primarily manages dependent deployments. Currently <scope> can use 5 values:* Compile, default, applies to all stages and will be published along with the project. * provided, similar to compile, expects the JDK, container or user to provide this dependency. such as Servlet.jar. * runtime, used only at runtime, such as JDBC driver, for run and test phases. * Test, used only during testing, to compile and run the test code. Will not be published with the project. * System, similar to provided, needs to explicitly provide an jar,maven that contains dependencies and does not find it in repository.   maven Warehouse configuration (MAVEN warehouse quick Mirror): Modify settings.xml (install directory/conf/settings.xml)

1, the local warehouse : root node settings modified here <localRepository>E:\workingfile\mavenRepository</localRepository>

2, Central warehouse : node mirrors under Add one of the following configurations:

Domestic connection MAVEN Official warehouse update depends on the library, the speed is generally very slow, collect some domestic fast maven warehouse image to spare.

==================== domestic Oschina provided the mirror, very good ===================

<mirror>

<id>CN</id><mirrorOf>central</mirrorOf>
<name>oschina central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>

========================================================

Oschina Maven Library Usage Help

================== other maven warehouse image ==========================

1. Maven Warehouse Address:

A shared warehouse

http://repo.maven.apache.org/maven2/

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/

A private warehouse

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 can build their own MAVEN warehouse: the way to build the following:

http://juvenshun.javaeye.com/blog/349534

2. The collected external warehouse address

http://www.ibiblio.org/maven/mule/dependencies/maven2/

MAVEN Central Warehouse-Details you may not know

address -At this time, http://repo1.maven.org/maven2/is the address of the real MAVEN central repository, which is built into Maven's source code, and other addresses include the famous ibiblio.org, all mirrored.

scale -more than 70,000,000 visits per week from 250,000 developers, with a potential for more than 4,000,000,000 total visits in 2010. The central warehouse stores more than 200,000,000 of the artifacts.

Index --The central warehouse has an index file for users to search for, the full index file size is approximately 60M, and the index is updated once a week.

blacklist -If an IP address maliciously downloads central repository content, such as 100 machines across the company using the same IP over and over again, this IP (or even the IP segment) will go to the blacklist, so a small amount of Maven should be used with a nexus.

garbage content -for various historical reasons, there is a lot of rubbish in the central warehouse, such as incomplete POM, The main responsibility for the wrong maven-metadata.xml is that the open source project is not very careful when uploading content, and the central warehouse is currently working on a more standardized process to prevent new junk content from entering.

The company behind the --maven is hosted in Apache, but the central warehouse is not an Apache resource, and the central warehouse is maintained by Sonatype.

submissions -as long as your project is open source, and you can provide complete pom information, you can submit project files to the central repository, which can be achieved through the open source Maven warehouse hosting service provided by Sonatype.

non-MAVEN users -in addition to MAVEN, other tools such as Ivy and Gradle also use the MAVEN central repository.

Maven scope (dependency control) description

compile (compilation scope):Compile is the default scope, and if a scope is not provided, the scope of the dependency is the compilation scope. Compilation scope dependencies are available in all classpath, and they are also packaged.

provided (scope provided) :provided dependency is only used when the JDK or a container has provided the dependency. For example, if you develop a Web application, you might need the Servlet API available in the compilation Classpath to compile a servlet, but you don't want to include the Servlet API in the packaged war, and this servlet API JAR is made by your Provided by the application server or the servlet container. A dependency that has been provided for scope is available at compile classpath (not at runtime). They are not transitive and will not be packaged.

Runtime (runtime Scope) :Runtime relies on the need to run and test the system, but it is not required at compile time. For example, you might need only the JDBC API JAR when compiling, but only if you need JDBC at runtime

Drive implementation.

Test scope :Test Range dependencies are not required for general compilation and runtime, they are available only during the test compilation and test run phases.

System -scoped :system-wide dependencies are similar to provided, but you must explicitly provide a path to the jar file in the local system. This is done to allow compilation based on local objects, which are part of the System class library. Such artifacts should always be available, and Maven will not look for it in the warehouse. If you set a dependency scope to a system scope, you must provide a SYSTEMPATH element at the same time. Note that this range is deprecated (you should always try to reference dependencies from a public or custom Maven repository).

Windows + maven + Eclipse

Related Article

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.