Maven Project introduces JAR package

Source: Internet
Author: User

The MAVEN project introduces the method of jar package, hoping to help the friends who are in need

Law I. Manual import: Project Right-->build path->configure Build path-> Select libraries-> Click Add External jars-> Select the JAR package import that has been prepared beforehand.

Method Two. Add through the dependencies tag of the Pom.xml file

Open the Pom.xml file for the MAVEN project. We can see 7 tabs below.

Overview: Displays some basic information about the MAVEN project Dependencies: Add a Jar package page Plugins: Add a Maven plugin page. such as Tomcat-maven-plugin Reporting: from useless, ignoring Dependency Hierarchy: Used to display the dependencies of the jar package. You can look at the dependencies of the jar package effective POM: Shows maven's compilation path, plugin, and so on. You can also ignore pom.xml: Import the jar package information, Where modifications can be made

Now we add the jar package. Click the Dependencies tab. Click the Add button in dependencies to enter the name of the jar package that we want to add. It will appear as shown in. It will list all versions of the jar package for 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 upgrade the jar package by modifying the value of this version. Type represents the types of dependent packages. The scope represents the cycle of the dependency package. 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 is in the C drive and user-->%user%-->.m2 after MAVEN has downloaded the jar package. We've opened the project with Maven Dependencies and found 8 more jar packages.
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. In fact, we just need to add SPRING-WEBMVC spring-orm to get the 14 jar packages associated with spring. And these 14 jar packages are used as a general SPRING3MVC development enough.

Method Three. Directly modify the dependencies of the Pom.xml file

Open the Pom.xml file, select Pom.xml, add dependencies

, annotated GroupID, Artifactid, and version, MAVEN will automatically add the appropriate package when updating the project

Follow up update ing ...

Resources:

http://liukai.iteye.com/blog/973120

Http://www.cnblogs.com/allenben/p/4728083.html

Maven Project introduces jar package (GO)

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.