<plugin> <!-- generate test-jar artifacts for creating test-test dependencies across modules --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin>
pom (即父POM)。这只是一个小麻烦,但有没有简单的方法来解决这个问题?
pom
它不会为这些模块创建主JAR。也许这是 test-jar
test-jar
skipIfEmpty does the trick ,很荣幸 wemu
skipIfEmpty
<plugin> <!-- generate test-jar artifacts for creating test-test dependencies across modules --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <goals> <goal>test-jar</goal> </goals> <configuration> <skipIfEmpty>true</skipIfEmpty> </configuration> </execution> </executions> </plugin>
文档: https://maven.apache.org/plugins/maven-jar-plugin/test-jar-mojo.html#skipIfEmpty