Add the jar package maven project.

2011-03-23  来源:本站原创  分类:Development  人气:156 

Many beginners do not know how to add jar package maven project.
Ago when I did not touch the maven downloaded a demo, is a maven project.
I actually did as he pom.xml file one by one to write!!!
Many people take for granted things very difficult for beginners but it is a step past the threshold.
Therefore, simply write how to add jar package maven project.

According to a standard created with the m2eclipse maven web project of this blog, we have created a maven-based web project.

How do we add the created jar package?

Click the pom.xml file, we can see that the following seven labels.

Add the jar package maven project.

Are
Overview: maven project shows some basic information.
Dependencies: Adding jar package page, very important!
Plugins: add maven plugin page, such as tomcat-maven-plugin and so on.
Reporting: never used, ignoring the ~
Dependency Hierarchy: used to display jar package dependencies. When nothing can look at the jar package dependencies.
Effective POM: show maven's build path, plugin and the like can also be ignored.
pom.xml: import jar package of information, which can be modified in the Important

pom.xml basic introduction is the case.
Now we add the jar package.
Click the Dependencies tab.
Click the Dependencies of the input we want to add the button to add the name of a jar. Will be shown in the figure.
He would name all the versions of the corresponding jar files listed.

Add the jar package maven project.

Let's add a spring-context package

Add the jar package maven project.

Note the red line position. Version is the version number of this jar, we can modify the value of this version of the jar package upgrade.

type represents the type of dependencies.
Scope of the role that this cycle of dependency packages.
Which we temporarily ignore.
Saved if the first installation maven, there may be a long time to download a jar.
As long as the first time after the jar package is downloaded to the local need downloaded.
download jar package maven default address on the C drive -> Users ->% User %-->. m2 in

After downloading the jar package maven, we point to open the project in Maven Dependencies
Will find more than eight jar package to the following diagram

Add the jar package maven project.

But in addition to built-junit kits we just added a spring-context package ah.
Why more of these packages?

More of these packages is a package and the spring-context dependencies of the package.
maven will have a jar and add all the dependencies downloaded, so that a jar package to avoid missing the problem.

So in fact we only need to add
spring-webmvc
spring-orm
And the spring can be related to the 14 jar files.
This 14 jar files used for general spring3MVC developed enough.

相关文章