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>

  

 

posted @ 2019-01-07 10:37  BINGJJFLY  阅读(1072)  评论(0编辑  收藏  举报