Go: maven2 Create an Eclipse project, set up M2_repo

Source: Internet
Author: User

from:http://tonychanhoho.iteye.com/blog/1584324

M2_repo is a storage location used to define the MAVEN 2 repository on the hard disk, and Windows defaults to the C:\Users\ machine name \.m2\repository. The M2eclipse plug-in is installed with the appropriate settings in eclipse.

Creating an Eclipse-enabled project with Maven is very simple, in the MVN project directory (enter the folder shift+ right-click into cmd):
MVN Eclipse:eclipse
Can.

Then open eclipse->import->general:existing Projects into workspace-> contains the catalog for the project, and Eclipse automatically searches for the Eclipse project that you just created.

When you import the project, you will find the Eclipse newspaper "can't find M2_repo" error, in fact, this is an environment variable, that is point to your local library. Both Linux and Windows are $home/.m2/repository.

Add the variable to eclipse by:
Windows-Preferences, Java---Build Path, Classpath Variables, new,name input m2_repo,path input/home/user/.m2 /repository (with desktop sibling directory). The error disappears after confirmation.

Once you've made such a setup, Eclipse integrates MAVEN functionality, and if you add a new dependent jar package in Pom.xml, perform mvn eclipse:eclipse and then refresh workspace at the root of the project. The newly-dependent jar package is added to the project's build path.

Go: maven2 Create an Eclipse project, set up M2_repo

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.