Gradle 2.2.1 seems to ignore my classifier on my dependency, and then tries to download the wrong thing

First things first: here’s my setup:

===========
Gradle 2.2.1
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy: 2.3.6
Ant: Apache Ant™ version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_71 (Oracle Corporation 24.71-b01)
OS: Mac OS X 10.10.3 x86_64

Next, let’s get to the problem. I will say that I’m new to gradle, but what I’m seeing does not seem normal.

My build.gradle repositories looks like the following:

repositories {
//mavenLocal()
maven { url “(mynexus):8081/nexus/content/repositories/alfresco-proxy” }
maven { url “(mynexus):8081/nexus/content/repositories/code-release” }
maven { url “(mynexus):8081/nexus/content/repositories/external-deps” }
maven { url “(mynexus):8081/nexus/content/repositories/central” }
//mavenCentral()
}

dependencies {
compile group: ‘org.mybatis’, name: ‘mybatis’, version:‘3.0.4’, classifier:‘patched’
}

When I run “./gradlew --info build”, I see the following:

Download http://(mynexus):8081/nexus/content/repositories/alfresco-proxy/org/mybatis/mybatis/3.0.4/mybatis-3.0.4.pom
Download http://(mynexus):8081/nexus/content/repositories/central/org/mybatis/mybatis/3.0.5/mybatis-3.0.5.pom

  • What went wrong:
    Could not resolve all dependencies for configuration ‘:myproject:mysubproject:compile’.
    Artifact ‘mybatis-patched.jar (org.mybatis:mybatis:3.0.5)’ not found.
    Searched in the following locations:
    http://(mynexus):8081/nexus/content/repositories/central/org/mybatis/mybatis/3.0.5/mybatis-3.0.5-patched.jar

This is where things seem to break down.

The artifact definitely exists at: http://(mynexus):8081/nexus/content/repositories/alfresco-proxy/org/mybatis/mybatis/3.0.4/mybatis-3.0.4-patched.jar

It’s like the classifier was totally forgotten on the lookup, then somehow it started searching for 3.0.5 in a totally different repository, and then tried erroneously looking for 3.0.5-patched.

Any ideas?

Oh, I wanted to mention that I used this version of gradle because it was the latest available when I did a homebrew install on my mac.

Can you show us the pom file content ?
Have you tried with the Gradle wrapper and Gradle 2.4 ?

Thank you for your reply.

Sorry for the delay. I wanted to take your advice to heart and recreate the simplest pom-file where I can reproduce the error. In doing so, I think I figured out what’s going on. Ok, first things first, though. Here’s my pom-file:

<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>deleteme</groupId>
    <artifactId>deleteme</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.0.4</version>
            <scope>provided</scope>
            <classifier>patched</classifier>
        </dependency>
        <!-- This guy is dependent on 3.0.5, but downloads 3.0.5-patched -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.0.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>Alfresco</id>
            <url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
        </repository>
        <repository>
            <id>Maven Central</id>
            <url>http://repo1.maven.org/maven2</url>
        </repository>
    </repositories>
</project>

Second, I made an optimized build.gradle file. The info that I posted does not have sufficient information. This one will reproduce the problem.

description = 'myProject'

apply plugin: 'java'
apply plugin: 'maven'

group = 'deleteme'
version = '1.0.0-SNAPSHOT'

sourceCompatibility = 1.7
targetCompatibility = 1.7

repositories {
     maven { url "https://artifacts.alfresco.com/nexus/content/groups/public" }
     maven { url "http://repo1.maven.org/maven2" }
     maven { url "http://repo.maven.apache.org/maven2" }
}

dependencies {
    compile(group: 'org.mybatis', name: 'mybatis', version:'3.0.4', classifier:'patched') {}
    compile(group: 'org.mybatis', name: 'mybatis-spring', version:'1.0.1') {}
}

Here’s what looks to be happening:

  1. I do ./gradlew --info build
  2. The build pulls down the 3.0.4-patched version of mybatis
  3. The build pulls down the 1.0.1 version of mybatis-spring
  4. The 1.0.1 mybatis-spring pom.xml file has a dependency on mybatis version 3.0.5 (NOT 3.0.5-patched)
  5. The build transitively should pull down the 3.0.5 version of mybatis, but instead, gets confused by the classifier already present in the build.gradle file, and instead tries pulling 3.0.5-patched.
  6. The 3.0.5-patched item does not exist (which is the wrong thing to pull down regardless), so we get an error message.

The error message is:
Could not resolve all dependencies for configuration ‘:compile’.

Artifact ‘mybatis-patched.jar (org.mybatis:mybatis:3.0.5)’ not found.
Searched in the following locations:
http://repo1.maven.org/maven2/org/mybatis/mybatis/3.0.5/mybatis-3.0.5-patched.jar

Any help would be appreciated. I think I’ve nailed down a good, reproducible scenario.

My next steps will be to try newer gradle, which I’ll try installing manually (since the homebrew version of gradle seems a little bit old).

Thank you!

I just tried with gradle 2.4. Same issue!

gradle -v

------------------------------------------------------------
Gradle 2.4
------------------------------------------------------------

Build time:   2015-05-05 08:09:24 UTC
Build number: none
Revision:     5c9c3bc20ca1c281ac7972643f1e2d190f2c943c

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.4 compiled on April 29 2014
JVM:          1.7.0_71 (Oracle Corporation 24.71-b01)
OS:           Mac OS X 10.10.3 x86_64

gradle --info build

Starting Build
Settings evaluated using settings file '/master/settings.gradle'.
Projects loaded. Root project using build file '/Users/user/git/foo/build.gradle'.
Included projects: [root project 'foo']
Evaluating root project 'foo' using build file '/Users/user/git/foo/build.gradle'.
All projects evaluated.
Selected primary task 'build' from project :
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':jar', task ':assemble', task ':compileTestJava', task ':processTestResources', task ':testClasses', task ':test', task ':check', task ':build']
:compileJava (Thread[main,5,main]) started.
:compileJava
Download https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis/3.0.4/mybatis-3.0.4.pom
Resource missing. [HTTP GET: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis-parent/8/mybatis-parent-8.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis-parent/8/mybatis-parent-8.jar]
Download http://repo1.maven.org/maven2/org/mybatis/mybatis-parent/8/mybatis-parent-8.pom
Resource missing. [HTTP GET: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis-spring/1.0.1/mybatis-spring-1.0.1.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis-spring/1.0.1/mybatis-spring-1.0.1.jar]
Download http://repo1.maven.org/maven2/org/mybatis/mybatis-spring/1.0.1/mybatis-spring-1.0.1.pom
Resource missing. [HTTP GET: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis-parent/10/mybatis-parent-10.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis-parent/10/mybatis-parent-10.jar]
Download http://repo1.maven.org/maven2/org/mybatis/mybatis-parent/10/mybatis-parent-10.pom
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/3.0.5.RELEASE/d451d3dbb9a800ed8a858602244381b7f4e8cace/spring-core-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-parent/3.0.5.RELEASE/spring-parent-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-parent/3.0.5.RELEASE/b4b036480c5a5905f35a33605b8fb05131ff5c84/spring-parent-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-tx/3.0.5.RELEASE/spring-tx-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/3.0.5.RELEASE/509e195d269e687beb53f9b1013fd06d12693575/spring-tx-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-jdbc/3.0.5.RELEASE/spring-jdbc-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/3.0.5.RELEASE/ea54b9b493102d64f0f0cf357fe99d8de6d3e9ae/spring-jdbc-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/3.0.5.RELEASE/27cc1a0ff3ec46b6dae681c1089e4117b1d13703/spring-context-3.0.5.RELEASE.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom, /Users/user/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/76672afb562b9e903674ad3a544cdf2092f1faa3/commons-logging-1.1.1.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/apache/commons/commons-parent/5/commons-parent-5.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/apache/commons/commons-parent/5/commons-parent-5.jar]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/org/apache/commons/commons-parent/5/commons-parent-5.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-parent/5/a0a168281558e7ae972f113fa128bc46b4973edd/commons-parent-5.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/apache/apache/4/apache-4.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/apache/apache/4/apache-4.jar]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/org/apache/apache/4/apache-4.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.apache/apache/4/602b647986c1d24301bc3d70e5923696bc7f1401/apache-4.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/3.0.5.RELEASE/c65b8a791bd715e720a6defda80e448678f2371d/spring-beans-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/3.0.5.RELEASE/9ec211108fd0cf4b9f179c3b7e322d6dc5595865/spring-aop-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/3.0.5.RELEASE/dfb68e4ba3e98dd9636c6f49dd77ace5bad48ff4/spring-expression-3.0.5.RELEASE.pom]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.pom, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-asm/3.0.5.RELEASE/444f9609c5ff07c940901e4a8bbcfae7a9446734/spring-asm-3.0.5.RELEASE.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/aopalliance/aopalliance/1.0/aopalliance-1.0.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/aopalliance/aopalliance/1.0/aopalliance-1.0.jar]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/aopalliance/aopalliance/1.0/aopalliance-1.0.pom, /Users/user/.gradle/caches/modules-2/files-2.1/aopalliance/aopalliance/1.0/5128a2b0efbba460a1178d07773618e0986ea152/aopalliance-1.0.pom]
Resource missing. [HTTP GET: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis/3.0.5/mybatis-3.0.5.pom]
Resource missing. [HTTP HEAD: https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis/3.0.5/mybatis-3.0.5.jar]
Download http://repo1.maven.org/maven2/org/mybatis/mybatis/3.0.5/mybatis-3.0.5.pom
Download http://repo1.maven.org/maven2/org/mybatis/mybatis-spring/1.0.1/mybatis-spring-1.0.1.jar
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/3.0.5.RELEASE/1633e94943d57746ef76910489f1cd71fe667e04/spring-core-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-tx/3.0.5.RELEASE/spring-tx-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/3.0.5.RELEASE/91eb9bd9baa61a62590a8093667107cb2c7c8184/spring-tx-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-jdbc/3.0.5.RELEASE/spring-jdbc-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/3.0.5.RELEASE/2af0bad1d8d681ed2e014b684287acc448ab30cb/spring-jdbc-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/3.0.5.RELEASE/6b05e397566cc7750d2d25f81a7441fe1aeecb75/spring-context-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, /Users/user/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/5043bfebc3db072ed80fbd362e7caf00e885d8ae/commons-logging-1.1.1.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/3.0.5.RELEASE/4b352a9c3b427294e264ca4d460d07417ca9350e/spring-beans-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/3.0.5.RELEASE/c7a17803cc10512e26e285073639543f0c7c764/spring-aop-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/3.0.5.RELEASE/5b8e53877cb58c94f15a0d8172da3569f4b4f3fb/spring-expression-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [https://artifacts.alfresco.com/nexus/content/groups/public/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.jar, /Users/user/.gradle/caches/modules-2/files-2.1/org.springframework/spring-asm/3.0.5.RELEASE/7f22a0e9f325e6565b4ea56b479ad76311d146b/spring-asm-3.0.5.RELEASE.jar]
Found locally available resource with matching checksum: [http://repo1.maven.org/maven2/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, /Users/user/.gradle/caches/modules-2/files-2.1/aopalliance/aopalliance/1.0/235ba8b489512805ac13a8f9ea77a1ca5ebe3e8/aopalliance-1.0.jar]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/org/mybatis/mybatis/3.0.5/mybatis-3.0.5-patched.jar]
:compileJava (Thread[main,5,main]) completed. Took 30.047 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find mybatis-patched.jar (org.mybatis:mybatis:3.0.5).
  Searched in the following locations:
      http://repo1.maven.org/maven2/org/mybatis/mybatis/3.0.5/mybatis-3.0.5-patched.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 32.208 secs
Stopped 0 compiler daemon(s).

Well, looks like a bug or missing maven feature to me

Look at this debug output, and particularly

Visiting configuration deleteme:GradleProject:1.0.0-SNAPSHOT(compile).
Visiting dependency deleteme:GradleProject:1.0.0-SNAPSHOT(compile) → org.mybatis:mybatis:3.0.4(dependency: org.mybatis#mybatis;3.0.4 {compile=[default]})
Selecting new module version org.mybatis:mybatis:3.0.4

Visiting dependency deleteme:GradleProject:1.0.0-SNAPSHOT(compile) → org.mybatis:mybatis-spring:1.0.1(dependency: org.mybatis#mybatis-spring;1.0.1 {compile=[default]})
Selecting new module version org.mybatis:mybatis-spring:1.0.1

Visiting dependency org.mybatis:mybatis-spring:1.0.1(default) → org.mybatis:mybatis:3.0.5(dependency: org.mybatis#mybatis;3.0.5 {compile=[compile(), master()], runtime=[runtime(*)]})
Found new conflicting module version org.mybatis:mybatis:3.0.5
Selected org.mybatis:mybatis:3.0.5 from conflicting modules [org.mybatis:mybatis:3.0.4, org.mybatis:mybatis:3.0.5].

mybatis 2.0.5 is taken to resolve your conflict in dependencies (which is actually how this is supposed to work ?)

Forcing mybatis 2.0.4 does not work, as the mybatis-3.0.4.jar is searched, not only the 3.0.4-patched.jar
Your can try this with the following dependencies (note the short notation by the way) and see that the build also complains about not finding mybatis-3.0.4.jar

dependencies {
compile (‘org.mybatis:mybatis:3.0.4:patched@jar’){ force=true }
compile ‘org.mybatis:mybatis-spring:1.0.1’
}

gradlew dependencies --configuration compile clean build --refresh-dependencies
:dependencies
Root project - myProject
compile - Compile classpath for source set ‘main’.
±-- org.mybatis:mybatis:3.0.4
-– org.mybatis:mybatis-spring:1.0.1
±-- org.mybatis:mybatis:3.0.5 → 3.0.4
±-- org.springframework:spring-core:3.0.5.RELEASE
| ±-- org.springframework:spring-asm:3.0.5.RELEASE
| -– commons-logging:commons-logging:1.1.1
±-- org.springframework:spring-tx:3.0.5.RELEASE
| ±-- aopalliance:aopalliance:1.0
| ±-- org.springframework:spring-aop:3.0.5.RELEASE
| | ±-- aopalliance:aopalliance:1.0
| | ±-- org.springframework:spring-asm:3.0.5.RELEASE
| | ±-- org.springframework:spring-beans:3.0.5.RELEASE
| | | -– org.springframework:spring-core:3.0.5.RELEASE ()
| | -– org.springframework:spring-core:3.0.5.RELEASE (
)
| ±-- org.springframework:spring-beans:3.0.5.RELEASE ()
| ±-- org.springframework:spring-context:3.0.5.RELEASE
| | ±-- org.springframework:spring-aop:3.0.5.RELEASE (
)
| | ±-- org.springframework:spring-beans:3.0.5.RELEASE ()
| | ±-- org.springframework:spring-core:3.0.5.RELEASE (
)
| | ±-- org.springframework:spring-expression:3.0.5.RELEASE
| | | -– org.springframework:spring-core:3.0.5.RELEASE ()
| | -– org.springframework:spring-asm:3.0.5.RELEASE
| -– org.springframework:spring-core:3.0.5.RELEASE (
)
±-- org.springframework:spring-jdbc:3.0.5.RELEASE
| ±-- org.springframework:spring-beans:3.0.5.RELEASE ()
| ±-- org.springframework:spring-core:3.0.5.RELEASE (
)
| -– org.springframework:spring-tx:3.0.5.RELEASE ()
-– org.springframework:spring-context:3.0.5.RELEASE (
)

(*) - dependencies omitted (listed previously)
:clean UP-TO-DATE
:compileJava

FAILURE: Build failed with an exception.

1 Like

Thank you for the reply.
Just to follow up, are you thinking that this a gradle or a maven bug?

The reason I ask is that my maven builds have been going through successfully for almost a year, but once I switched to gradle, I start having these sorts of failures (there are a few situations like the above, which I can provide, if needed).

Honestly, I’m really not sure how to proceed. I’m starting to think that I will not be able to switch this project to gradle.

I suppose this is a Gradle bug, or more exactly a maven feature not yet introduced in Gradle. This is based on my experience (which is nothing compared to a Gradle dev) and documentation reading only.
@mark_vieira what do you think ?

This is a similar problem to what’s described here: Build failure when 4.1.0 of net.java.dev.jna:jna is selected in place of 3.3.0 due to change in artifacts with classifiers

Basically, Gradle is trying to ensure there’s a single version of a given dependency, but it ignores classifiers as describing “different” dependencies. Maven fails differently and will give you duplicate or mismatching dependencies (one with the classifier and one without).

The classifier is sort of the wrong thing for this. In this particular case, I think you want to use a different dependency instead of the classifier:
https://artifacts.alfresco.com/nexus/content/groups/public/org/mybatis/mybatis/3.0.4-alfresco-patched/

You’ll need to force it to prevent conflict resolution from picking 3.0.5:

dependencies {
    compile(group: 'org.mybatis', name: 'mybatis', version:'3.0.4-alfresco-patched') {
        force = true
    }
    compile(group: 'org.mybatis', name: 'mybatis-spring', version:'1.0.1') {}
}

I kind of came across same issue reported in Gradle fails to resolve between ivy dependencies with and without classifier

and force=true seems to not work here.

@sterling Do you got have any recommendations for #17420