Publish two depending modules to maven repository


I have a project with two modules and one module depends on the other.
I want to deploy one artifact that includes both modules

How can I do that? Now when I try to publish there is only one module in repository.

My build.gradle from first module:

publishing {
publications {
aar(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId project.getName()

        // Tell maven to prepare the generated "*.aar" file for publishing


artifactory {
contextUrl = "artifactory’
publish {
repository {
// The Artifactory repository key to publish to
repoKey = libraryVersion.endsWith(‘SNAPSHOT’) ? ‘libs-snapshot-local’ : ‘libs-release-local’

        username = "username"
        password = "password"
    defaults {
        // Tell the Artifactory Plugin which artifacts should be published to Artifactory.
        publishArtifacts = true

        // Properties to be attached to the published artifacts.
        properties = ['qa.level': 'basic', '': 'core']
        // Publish generated POM files to Artifactory (true by default)
        publishPom = true


dependencies {
compile project(’:data’)