Maven of the role of classifier

Original Address: https://blog.csdn.net/liupeifeng3514/article/details/79733655

Directly look at an example, to be introduced into the Maven json package, then using:

<dependency>  
    <groupId>net.sf.json-lib</groupId>   
    <artifactId>json-lib</artifactId>   
    <version>2.2.2</version>  
</dependency>  

However, when executing mvn install command, but throws an error that can not find net.sf.json-lib: json-lib: 2.2.2 This package, to the warehouse seen at http: //repo2.maven. org / maven2 / net / sf / json-lib / json-lib / 2.2.2 /

 

 

Name of the jar's more than a name associated with the JDK, for example jdk15, in accordance with the above configuration is obviously not find the jar, so there it comes in a classifier, which represents at the same version for different jdk environment or use the jar, if you configure this element, it will be the element name added to the end to find the appropriate jar, for example:

<dependency>  
    <groupId>net.sf.json-lib</groupId>   
    <artifactId>json-lib</artifactId>   
    <version>2.2.2</version>  
    <classifier>jdk15</classifier>    
</dependency>  

Such configuration can be found json-lib-2.2.2-jdk15.jar, the other is not explained, it should be understood that his use of it.

 

Guess you like

Origin www.cnblogs.com/dyh004/p/11579949.html