the maven classifier properties, dependency of

classifier element is used to help define some of the attachment member to the output member. Corresponding to the attachment member and the main member, such as the main member is a kimi-app-2.0.0.jar the program may also be generated as kimi-app-2.0.0-javadoc.jar using a number of plug-ins, kimi-app-2.0.0 such that the two subsidiary members -sources.jar. At this time, javadoc, sources classifier is the two subsidiary members, so that the attachment member will have their own unique set of coordinates.

Note:

Classifer not directly define the project, because the project is not directly affiliated member generated by default, but to help the generation of additional plug-ins.

classifier that purpose:

1. maven download javadoc / sources when the carrier package

2. The introduction of dependency, usually when we need to introduce rely only:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.1.2.RELEASE</version> 
        </dependency>

But some shelf package is quite special:

Such as JSON-lib, I use sonatype search engines search the jar was found, JSON-lib the jar offers two versions of the SDK, as shown:

 

                                          

This time it is necessary to use the classifier attribute specifies:

Copy the code
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier> 
        </dependency>
Copy the code

If you do not define a classifier, then it will throw an error that can not find maven jar file.

 

Reference Links: https://www.cnblogs.com/love-kimi/archive/2012/10/09/2716507.html

Guess you like

Origin www.cnblogs.com/summary-2017/p/10927009.html