中的classifier标签有什么作用

时间:2025-02-17 11:41:53

<classifier>core</classifier>有什么作用?

答:

1.用法1

告诉maven依赖com\cloud\common-auth\0.0.1-SNAPSHOT目录下依赖哪个jar包,下面例子依赖common-auth-0.0.包

假如这个目录下有以下两个jar包:

common-auth-0.0.

common-auth-0.0.

<dependency>
    <groupId></groupId>
    <artifactId>common-auth</artifactId>
    <classifier>core</classifier>
</dependency>

2.用法2

使用maven-jar-plugin打包的时候,多打一个包,名字带有core的jar包

<!-- jar包plugin -->
<plugin>
  <artifactId>maven-jar-plugin</artifactId>
  <executions>
    <execution>
      <phase>compile</phase>
      <goals>
        <goal>jar</goal>
      </goals>
      <configuration>
<!-- 添加core 修饰方便其它兄弟项目依赖此项目  -->
<classifier>core</classifier>
        <includes>
          <include>**/com/cloud/</include>
        </includes>
      </configuration>
    </execution>
  </executions>
</plugin>

转载地址:/yayishuwu/chapter/1378