Missing in deployed pom files if different than jar artifact is used

When library depends on different type of artifact, pom should contain element in dependency declaration, but Cradle omit it during deploy to repo. it is really serious problem.

Link to old forum that this was originally started: http://gradle.1045684.n5.nabble.com/Publishing-a-maven-artifact-depending-on-an-aar-or-other-non-quot-jar-quot-artifacts-td5713019.html

Some related error reports and discussion

https://code.google.com/p/android/issues/detail?id=72807 https://groups.google.com/forum/#!topic/adt-dev/PM50ZXFXN_k

Example of affected project

Can somebody look at this problem please?

It is really big problem, all dependecies with non jar dependecies deployed by gradle is not possible to use by maven :frowning:

Come on guys, this is a really painful issue.

The Poms generated by Gradle that list AARs as dependencies don’t actually specify the the type as AAR. Which means the deps actually resolve to JAR files and not AAR files.

This means that builds break.

You can force Gradle to include ‘<type>’ in the published POM by specifying the type in the dependency declaration. For example:

compile ‘com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2@aar’

Great. In which version of Gradle?

I don’t think so, I tested it, but maybe it is fixed already. I will try it with the latest version next week.

@Mark which version of Gradle is it fixed in?

Looks to work in versions 2.0+. I didn’t test with earlier versions.

Fantastic, now if we just need to get the Android SDK to use that in their builds.

If you’re using the Android Gradle plug-in >1.0.0, you should be using Gradle 2.+ http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

@Sterling it’s not about what version of Gradle I’m using (I don’t use Gradle - not rigorous enough for me), it’s about what version of Gradle is being used by the Android SDK team as the POM artifacts they are generating are invalid.

See https://code.google.com/p/android/issues/detail?id=72807

But it must work correctly also without explicit @aar declaration. Gradle should check default type from the pom.xml a and then use it as in the new pom.xml. Because if I explicitly use @aar, current version of Gradle skip transitive dependencies.

I tested it now with 2.2 and it really works only if I use @aar :frowning:

So this works correctly

compile ‘com.android.support:appcompat-v7:21.0.3@aar’) {transitive=true}


compile com.android.support:appcompat-v7:21.0.3’ not.

So I think that this is still issue. In this case gradle should check type of dependency from it’s pom. It already must do, so it only doesn’t use the result in right way.

The problem with @aar is that I can’t really use this in inter-project dependencies, can I?

We have a project which publishes several aars into a maven repositories. The dependencies between the project is done with

compile project(':foo')

And then we publish all of them at once. This dependency is converted into a pom dependency that is broken. Gradle is publishing both the aar being consumed and the artifact doing the consumption. It should be able to properly add the missing type node in the pom.

Xavier, I’m not sure the Gradle guys understand the problem.

Can I suggest you create a Gradle project on Github that exhibits the problematic behaviour.