When I was on the 0.8.x plugin, I had the following (see below), which
worked.  We published the AAR, a source jar, the javadoc jar, and an apklib
and our pom.withXml listed the dependencies so we could fix some
information in the generated pom (components.aar was a component we
registered. I'm not sure if it was needed or not).  With the upgrade this
doesn't work.  The list of nodes in the pom.withXml does not include a
dependencies node. I removed our artifact (artifact ("build/libs/${
project.name}-${project.version}.aar")) and now the AAR artifact doesn't
get published at all (at least as far as I can tell.  It has an older
timestamp than the other snapshots).  The generated pom is missing
dependencies.

publishing {
    publications {

        androidArchive(MavenPublication) {

            artifact ("build/libs/${project.name}-${project.version}.aar") {
                from components.aar

                pom.withXml {
                    final Node node = asNode()
                    final List<String> aarGroupIds =
Arrays.asList("com.package", "com.package.identity")

                    for (final Node n : node.children()) {
                        if (n.name().toString().contains("dependencies")) {
                            for (final Node dependency : n.children()) {
                                boolean foundType = false;
                                boolean groupIdIsAarType;
                                for (final Node child :
dependency.children()) {
                                    final String childName = child.name
().toString();
                                    if (childName.contains("scope")) {
                                        child.setValue("compile")
                                    } else if
(childName.contains("groupId")) {
                                        final String childValue =
child.text();
                                        groupIdIsAarType =
aarGroupIds.contains(childValue);
                                    } else if (childName.contains("type")) {
                                        foundType = true;
                                    }
                                }

                                if (!foundType && groupIdIsAarType) {
                                    dependency.appendNode("type", "aar");
                                }
                            }
                            break;
                        }
                    }
                }
            }
            artifact javadocJar
            artifact sourceJar
            artifact apklib
        }
    }
}


On Wed, Mar 26, 2014 at 8:47 PM, Xavier Ducrohet <[email protected]> wrote:

> What's in your build.gradle?
>
>
> On Wed, Mar 26, 2014 at 5:40 PM, Scott Battaglia <
> [email protected]> wrote:
>
>> The 0.9.x release notes say: "
>>
>>    - Generated POM files now have the proper dependencies even if the
>>    pom object is manipulated in build.gradle"
>>
>> Are there any instructions on using this properly?  I can't find it in
>> the user guide.  And running the following:
>>
>> gradle clean build publishToMavenLocal
>>
>> generates a pom with missing dependencies.
>>
>> Thanks
>>  Scott
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
> http://developer.android.com | http://tools.android.com
>
> Please do not send me questions directly. Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to