[GRADLE-3178] Bad check if dependency exists in mavenLocal() Created: 03/Oct/14  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 4


 Description   

I have repositories defined like this

allprojects {
repositories {
mavenLocal()
maven {
url PUBLIC_REPO_URL
credentials

{ username NEXUS_USERNAME password NEXUS_PASSWORD } } }}

So. Gradle should look first to the local maven repo and then download it from the our company repo if is not stored locally.

But it fail with

I check the folder and android-styled-dialogs/1.1.2/ exist there already. But it is downloaded only .apklib version, no .aar version. If I delete whole directory, it works correctly. It looks that gradle simply check if android-styled-dialogs/1.1.2/android-styled-dialogs-1.1.2.pom exists and doesn't check if really exist required type of dependency.

So. It looks like bug.



 Comments   
Comment by Tom Dunstan [ 03/Oct/14 ]

This happens when a user references an artifact with an extension that doesn't match the packaging type, and the artifact has been downloaded by Maven, but not the file with the other extension.

In this case eu.inmite.android.lib:android-styled-dialogs:1.1.2 has packaging type apklib, and has a .apklib and a .aar file on maven central. The user is trying to use the .aar but because Maven has previously downloaded the pom and apklib, Gradle thinks that the local repo has the module and doesn't look for it any further.

To reproduce, build.gradle:

apply plugin: 'java'

repositories {
	mavenLocal()
	mavenCentral()
}

dependencies {
	compile group: 'eu.inmite.android.lib', name: 'android-styled-dialogs', version: '1.1.2', ext: 'aar'
}

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
	<groupId>forums</groupId>
	<artifactId>apktest</artifactId>
	<version>0.1</version>
	

	<dependencies>
		<dependency>
			<groupId>eu.inmite.android.lib</groupId>
			<artifactId>android-styled-dialogs</artifactId>
			<version>1.1.2</version>
			<type>apklib</type>
		</dependency>
	</dependencies>
</project>

Run mvn compile then gradle build.

Comment by Tomáš Procházka [ 02/Nov/14 ]

I found that it is not problem only with mavenLocal().

Also if you have something like

maven { url "http://dl.bintray.com/A/maven" } 
maven { url "http://dl.bintray.com/B/maven" }

And first repository contain only
compile 'com.viewpagerindicator:library:2.4.1@apklib'
and second one contain
compile 'com.viewpagerindicator:library:2.4.1@aar'

You can't use use @aar completly, Gradle don't check second one, because of ths bug
It is really huge problem, especially in Android world where many libraries exist as APKLIB and are slowly migrating to AAR format.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:42:02 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.