Eclipse Configuration Maven

Source: Internet
Author: User

Original Address http://blog.csdn.net/anialy/article/details/8226887

Thanks to the author's pro-Test available


Briefly:

Now you need to configure the Maven plug-in in Eclipse, install the MAVEN application, configure the MAVEN environment variables, build a project for MAVEN management, and import the Gson package with Maven, and write a simple JSON output program



Steps:


Help-->eclipse Marketplace

1. First download the MAVEN integration for Eclipse WTP in Eclipse Marketplace,

As follows


I'm downloading it.



Then check to see if the download was successful, Window-> ShowView-> Maven




2. Download Maven's Bin

Http://maven.apache.org/download.html

The download here is



This is the apache-maven-3.5.2-bin.tar.gz i downloaded.





After downloading, unzip, find a path to put in, the bin location, set in the environment variable

New environment variable Maven_home


Path where the bin is added


When you are done, check it (you must first match the Java environment variables)

Enter cmd

Echo%maven_home%

Mvn-v

The version information will then appear, even if the path configuration is successful


3. To make the MAVEN plug-in installed in eclipse the same as that installed in Windows, you need to have Maven in Eclipse reposition

Window-> Preference-> Maven-> installation-> ADD

As follows




4. Create a new MAVEN project


Then select the Use Default Workspace Location (In fact this path is the documents and Settings\ user name \.m2\repository)



Then click Next,

Enter GroupID and Artifactid to fill in,


After the MAVEN project was established,


5. Open Pom.xml try to add MySQL JDBC driver

Add the following configuration,

[HTML] View plain copy <dependency> <groupId>mysql</groupId> <artifactid>mysql-conne Ctor-java</artifactid> <version>5.1.10</version> </dependency>

After saving, the MySQL folder appears in the Repository subdirectory


The introduction of the package is automatically managed through the Pom.xml configuration


6. Here's an example of using MAVEN to import Gson packages

Right-click the item, Maven-> add dependency



Then appear the window, in the red circle below the Gson, so will automatically search, appear in accordance with the list, double-click Com.google.code.gson, so the top of the group ID and Artifact ID and version will automatically fill in the following figure data

Click OK,


The Gson import dependency is automatically added to the Pom.xml

[HTML] View plain copy <dependency> <groupid>com.google.code.gson</groupid

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.