You can build project A using the target test banner
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin>
Then enable it with type test-jar
in project B:
<dependency> <groupId>com.example</groupId> <artifactId>project-a</artifactId> <type>test-jar</type> <version>1.0-SNAPSHOT</version> <scope>test</scope> </dependency>
source share