Hi! to save other people’s time! Today experience same issue, using ‘maven-publish’ plugin, when running our multi project gradle build on my outdated (local) gradle v1.8, and fixed it by simply updating to gradle v1.12 !
It should be ‘install { repositories.mavenInstaller { … } }’, not ‘android { task installArchives(type: Upload) { repositories.mavenInstaller { … } } }’. Check “53.6. Interacting with Maven repositories” in the Gradle User Guide and the self-contained samples in the ‘gradle-all’ download.
Probably this only works together with the ‘java’ plugin, not with the Android plugin. You can try ‘task install(type: Upload) { … }’ (still outside the ‘android {}’ block), but perhaps you have to configure some additional stuff there.
Yea, switching to the java plugin causes the install task to function correctly. Dependencies get populated correctly and such. Is this the place to talk about the android plugin? Or do I need to head elsewhere?
The ‘maven’ plugin can only automatically add dependency entries to the generated POM when used together with the ‘java’ plugin. For Android, I’d follow what’s described under “Library Publication” in the Android Build System Docs (http://tools.android.com/tech-docs/new-build-system/user-guide).
For Android specific questions, you can also try the Android tools list and Stack Overflow.
I experienced this problem as well with Gradle 2.2.1
As described by Daz it is indeed because something is invoking the “publications” block. In my case I traced it to a line that accessed ‘project.properties’
Any update on this? I can confirm that this happens to me as well on 2.2.1 with the same project structure as above.
Graeme, I cannot figure out how your solution applies to the posts above. What is this “passphrase” thing?
I do not explicitly access the project properties in my top-level gradle.build although I have a “gradle.properties” alongside it that contains common version numbers used in the dependencies section of both the top-level build file and in the sub-projects ones.
GRADLE-2837 is reported as fixed pointing at your comment but, IMHO, it is far from it.
when I run gradlew eclipse build publish… I correctly get all the gradleApi dependencies in my eclipse classpath, so they are correctly added in the compile configuration BUT when how can I add them in the generated maven POM ? Basically I’m using some guava classes in my plugin, and I’d like to add them in the generated jar.