Gradle Android Maven Plugin doesn't create the pom file automatically


(Philip Jentscheck) #1

Hello everybody,

I would like to know how i can create a pom file with “Gradle Android Maven Plugin”. I followed the steps on http://www.gradle.org/docs/current/userguide/maven_plugin.html (chapter “Convention Methods”). I also created the directory “buildDir” and get no errors. The App was build successfully but nevertheless the pom file was not created. I am using Android Studio IDE.

Edit: Is it possible that the newpom.xml file only exists on runtime and does not exist in my project folder buildDir after runtime? Maybe I am looking for something which can’t be found.

My app/build.gradle looks like this:

apply plugin: 'android'
  android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"
      defaultConfig {
        minSdkVersion 16
        targetSdkVersion 19
    }
      buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}
  apply plugin: 'maven'
  task writeNewPom << {
    pom {
        project {
            inceptionYear '2008'
            licenses {
                license {
                    name 'The Apache Software License, Version 2.0'
                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    distribution 'repo'
                }
            }
          }
    }.writeTo("$buildDir/newpom.xml")
}
  dependencies {
    compile 'com.android.support:support-v4:+'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.android.support:appcompat-v7:+'
    compile files('libs/retrofit-1.5.1.jar')
}

Can someone tell me if I missed something? :slight_smile:

Best Regards, Philip