Maven 根据不同的包路径打出不同的Jar包
需求
API对内部模块全部开放,对外部模块针对性开放,依赖JAR包需要API隔离。
POM文件配置
<plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <id>server</id> <goals><goal>jar</goal></goals> <phase>package</phase> <configuration> <classifier>server</classifier> <includes> <include>com/bingjjfly/server/**.class</include> </includes> </configuration> </execution> <execution> <id>client</id> <goals><goal>jar</goal></goals> <phase>package</phase> <configuration> <classifier>client</classifier> <includes> <include>com/bingjjfly/client/**.class</include> </includes> </configuration> </execution> </executions> </plugin> </plugins>
POM文件依赖配置
<dependency> <groupId>com.bingjjfly</groupId> <artifactId>projects</artifactId> <version>1.0.0</version> <classifier>server</classifier> </dependency>