Composite build with API included build

I am relatively new to gradle.

How do I include a project in a composite build if the exposed part of the dependency project only is an API?

Lets say we have project A and B that are both stand alone gradle project. Project B can build an API of itself and we push that to our artifactory and let project A depend upon it. Now we want to make a change to the API in project B and use the new features in project A. To avoid needing to make snapshots of the API for project B all the time we want to make a composite build. How do we go about doing this?

Thus far I’m suspecting I should be able to use dependencySubstitution. This is what I have:

Project A build.gradle dependency:

compile('se.company:project-b:1.0.0:api")

This is how I am trying to replace this dependency in settings.xml for project A:

includeBuild('../project-b/') {
dependencySubstitution {
        substitute module('se.company:project-b:1.0.0:api') with project(':')
    }
}

but all I get is:

Cannot convert the provided notation to an object of type ComponentSelector: se.company:project-b:1.0.0:api.
The following types/formats are supported:

  • Instances of ComponentSelector.
  • String describing the module in ‘group:name’ format, for example ‘org.gradle:gradle-core’…
  • String describing the selector in ‘group:name:version’ format, for example ‘org.gradle:gradle-core:1.+’…

What am I missing? How can I make gradle understand that all I want is an API of the composite included project?