In case of Maven, the user should add the external library as dependency to the pom.xml of both projects but with different scope options.
For example, if the external dependency is Google Protobufs, this should be added to the main project pom.xml:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.2.0</version>
<scope>compile</scope>
</dependency>
while to the test project pom.xml add:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
A compile scope dependency is propagated to all classpaths of the project and at runtime is available to dependent projects which list the dependency scope as provided.
Thank you very mush. This post is helped for me alot
ReplyDelete