Correct way to declare multiple scope for Maven dependency?

前端 未结 4 1775
离开以前
离开以前 2021-02-03 17:05

I have a dependency that I want to use in test scope (so that it is in the classpath when I am running unit tests), and in runtime scope (so that I can

4条回答
  •  广开言路
    2021-02-03 17:31

    The runtime scope also makes the artifact available on the test classpath. Just use runtime. (See the Maven documentation.)

    To avoid having the dependency resolved transitively, also make it optional with true:

    
      ch.qos.logback
      logback
      0.5
      runtime
      true
    
    

提交回复
热议问题