Integration configuration of marven and Eclipse and integration of marveneclipse

Source: Internet
Author: User

Integration configuration of marven and Eclipse and integration of marveneclipse

Maven, as a project construction tool, is very popular in the development process and can help manage the bao dependency problems in the project. In addition, many of its functions greatly reduce the difficulty of development, the following describes how to install maven and how to integrate it with eclipse.

Maven official website address: Workshop.

 

Maven requires JDK support. Before installing maven, ensure that JDK has been installed on your computer and environment variables have been configured. you can install and configure the JDK on your own. Install

1. Install maven

Maven of the corresponding version has been downloaded and the JDK environment has been configured;

1. Extract the downloaded compressed package to a path. Here, the decompressed path is: e: \ maven \ apache-maven-3.2.2,

2. After decompression, You need to configure the environment variable, create the MAVEN_HOME environment variable, the value is: e: \ maven \ apache-maven-3.2.2, and then add the following content to the end of the path environment variable value: % maven_home % \ bin; note that different values must be separated by semicolons when adding value-added values to the path, and the last value must end with a semicolon, click OK to complete environment variable configuration.

3. For testing, enter mvn-v in the command line and press Enter. If shown in, maven is successfully installed,

 

Maven can be used independently after installation. Here we will not introduce how it is used separately. Here we will introduce how it integrates with eclipse.

2. Integration with eclipse

Eclipse is an integrated development environment that is widely used in the development process. The following describes how to use maven in eclipse and how to support maven in Versions later than eclipse 4.4, that is, you do not need to install the maven plug-in, but you need to install the plug-in for versions earlier than 4.4. You can go to the following url: http://marketplace.eclipse.org/content/maven-integration-eclipse-luna,

1. Find the maven option in windows --> preferences ,,

We can find maven --> installations, and we can see that there is already, but we need to use the maven we just installed, select the add button, and find the maven path we just extracted, as shown below,

Because I have installed it here, I am prompted that it already exists. After modifying the maven location, we need to modify the configuration file.

2. modify the configuration file, find the maven decompressed directory, enter the conf folder, and edit settings. xml: Find the annotated localRespository tag in settings. This tag is used to configure the local maven repository. we add the following configuration: <localRepository> E: /apache-maven-3.3.1-bin/mvn/mvnrepository </localRepository> to set the local repository to my local directory. Save the settings.

3. Update the configuration file in eclipse

In eclipse, go to windows --> preferences, find maven, find User settings, and change the configuration file to the configuration file you just modified, as shown in,

After the modification is complete, it is integrated with eclipse.

 

After the above steps, maven and eclipse are integrated, and maven can be used next. However, if your computer accesses the Internet through proxy, you must go to settings. configure the agent in the xml file so that you can download the required file from the maven repository. The method for configuring the agent is as follows. add the following content to the xml file,

<proxy>       <id>myProxy</id>       <active>true</active>       <protocol>http</protocol>     <username></username>      <password></password>          

Id proxy ID identification proxy

Active sets whether the proxy is enabled

Protocol used by the protocol proxy

The username used to connect to the proxy. For example, if the proxy does not need a username, you can delete this tag.

The password used to connect to the proxy, as shown in the preceding figure.

Host proxy URL

Port used by the port proxy

The above is the configuration of Using proxy to access the Internet. If no proxy is used for accessing the Internet, no configuration is required.

3. Create a project using maven

Java and java Web projects are the most used during java development,

File --> new ---> project, and find maven. For example, select,

Click next,

Click next,

The first red box indicates creating a java project, and the second is a java Web project. Here, select the first project,

Enter the content in the red box and click finish. ecplise will start to create a project. At this time, it will connect to the network to download the required jar package from the Internet, the path of the jar package is the path of the local repository configured, my path under: E: \ apache-maven-3.3.1-bin \ mvn \ mvnrepository, in E: the \ apache-maven-3.3.1-bin \ mvn \ mvnrepository \ org \ apache \ maven \ plugins folder is the dependency plug-in required by the maven plug-in.

 

The maven environment has been set up and a maven project has been created. The next step is to use maven.

Reprinted from: https://www.cnblogs.com/teach/p/5906425.html

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.