MyEclipse How to add a jar package using Maven

Source: Internet
Author: User
Many novices don't know how to add a jar package to a MAVEN project.
I haven't been in touch with Maven before. Download a demo, it's a MAVEN project.

I actually wrote!!! One of his pom.xml files.
What many people take for granted is a difficult threshold for beginners.

So simply write down how to add a jar package to your MAVEN project.
Under
How do we add a jar package after it is created?

Click the pom.xml file. We can see that there are 7 tabs below.

respectively is

Overview: Displays some basic information about the MAVEN project.
Dependencies: It's important to add a JAR package page!

Plugins: Add a Maven plugin page. such as Tomcat-maven-plugin.
Reporting: Never used, ignored ~

Dependency Hierarchy: Used to display the dependencies of the jar package. When it's okay, look at the dependencies of the jar package.
Effective
POM: Displays the compilation path of Maven, plugin and the like. You can ignore it.
Pom.xml: Import the jar package information, where you can modify it. Important

This is the basic introduction of Pom.xml.
Now we add the jar package.
Click the Dependencies tab.

Click the Add button in the dependencies
Enter the name of the jar package that we want to add. It will appear as shown in the following figure.
He will list all versions of the jar package with the corresponding name.


Let's add the Spring-context package first.


Look at the location of the red Line. Version is the build number of this jar package. We can modify the value of this version by
To upgrade the JAR package.

Type represents the types of dependent packages.
The scope represents the cycle of the dependency package.
These are our temporary disregard.

After saving. If you are installing MAVEN for the first time, there may be a long time for the jar pack download process.
As long as the jar package is downloaded locally for the first time, it will not need to be downloaded.

The MAVEN default jar package download address is in C-and user-->%user%-->.m2

After Maven downloads the jar package. We'll open up the Maven Dependencies in the project.
You will find 8 more jar packages. The following figure

But we only added a Spring-context package except for our own JUnit package.

Why do you have to make more of these bags?
Many of these packages are actually packages that have dependencies on Spring-context packages.

MAVEN will download and add all the dependencies of the jar package. This avoids the problem of missing jar packages.
So in fact we just need to add

Spring-webmvc
Spring-orm
will be able to get 14 jar packages related to spring.

And these 14 jar packages are used for general SPRING3MVC development Enough

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.