1. 程式人生 > >Maven 根據不同的包路徑打出不同的Jar包

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>