Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20347

How to enable all optional dependencies for tests

$
0
0

I’m not sure exactly what you’re doing but I think you can do this via an additional configuration in the subprojects.

Eg:

project(':sub') {
   configurations {
      optional
   }
   dependencies {
      compile 'foo:required:1.0' 
      optional 'foo:optional:1.0'
   }
} 
project(':main') {
   dependencies {
      compile project(':sub') 
      testRuntime project(path: ':sub', configuration: 'optional') 
   } 
} 

See DependencyHandler docs

By default, when you declare dependency to projectA, you actually declare dependency to the ‘default’ configuration of the projectA. If you need to depend on a specific configuration of projectA, use map notation for projects: configurationName project(path: ':projectA', configuration: 'someOtherConfiguration')


Viewing all articles
Browse latest Browse all 20347

Trending Articles