Skip to content

Instantly share code, notes, and snippets.

@alexstolr
Created July 11, 2019 12:38
Show Gist options
  • Save alexstolr/b7f8f32dbceb202e97d7258794d019ec to your computer and use it in GitHub Desktop.
Save alexstolr/b7f8f32dbceb202e97d7258794d019ec to your computer and use it in GitHub Desktop.
Sharing src/test classes between modules in a multi-module maven project
Add in base module pom (under dependencies for example):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>testutil-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Add dependency in child module:
<dependency>
<groupId>com.example</groupId>
<artifactId>submodule</artifactId>
<version>1.0</version>
<type>testutil-jar</type>
<scope>test</scope>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment