Maven test dependency in multi module project

后端 未结 3 656
难免孤独
难免孤独 2020-11-27 10:26

I use maven to build a multi module project. My module 2 depends on Module 1 src at compile scope and module 1 tests in test scope.

Module 2 -

   <         


        
3条回答
  •  自闭症患者
    2020-11-27 11:13

    As https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html says:

    How to create a jar containing test classes When you want to create a jar containing test-classes, you would probably want to reuse those classes. There are two ways to solve this:

    1. The easy way Create an attached jar with the test-classes from the current project and loose its transitive test-scoped dependencies.

    2. The preferred way Create a separate project with the test-classes.

    Please read that article for detail.

提交回复
热议问题