雖然如此,但還是很大方的提供了產出多種 jar 檔的方法。
<profiles> <profile> <id>impl</id> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <classifier>impl</classifier> <excludes> <exclude>**/mock</exclude> <exclude>**/mock/*</exclude> <exclude>**/proxy</exclude> <exclude>**/proxy/*</exclude> </excludes> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>mock</id> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <classifier>mock</classifier> <excludes> <exclude>**/impl</exclude> <exclude>**/impl/*</exclude> <exclude>**/proxy</exclude> <exclude>**/proxy/*</exclude> </excludes> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>proxy</id> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <classifier>proxy</classifier> <excludes> <exclude>**/mock</exclude> <exclude>**/mock/*</exclude> <exclude>**/impl</exclude> <exclude>**/impl/*</exclude> </excludes> </configuration> </plugin> </plugins> </build> </profile> </profiles>然後執行不同參數的 mvn package 就可以得到多種 jar 檔。
mvn package -Pimpl mvn package -Pmock mvn package -Pproxy---
沒有留言:
張貼留言