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