Maven classifier not picked up

Hi,

I have a dependencies.gradle file which defines all my dependencies for all subprojects.

Ex :

ext {

libraries = [

sparkCore : “org.apache.spark:spark_core-2.10:akka23”

] }

Then in one of the subproject build.gradle file I use it as follows compile sparkCore

But when I build it using “gradle build” I get an error

  • What went wrong: Could not resolve all dependencies for configuration ‘:web-service:compile’. > Artifact ‘org.apache.spark:spark-core_2.10:1.1.0:spark-core_2.10.jar’ not found.

As you can see the “akka23” classifier is nowhere in the name. This is a custom jar built from the spark code line and hence I have added a classifier when uploading it to my own private maven repository.

I also trid the following syntax and that also does not seem to work.

sparkCore

: “org.apache.spark:spark-core_${scalaMajorVersion}:${sparkVersion}:akka23@jar”,

A similar configuration through maven pom works and is able to find the jars.

I am using gradle 1.12.

Try with ‘“org.apache.spark:spark_core-2.10:1.1.0:akka23”’. ’ “org.apache.spark:spark_core-2.10:akka23”’ is definitely not what you want, as it makes ‘akka23’ the version number, and doesn’t set a classifier.

Apologize that was a typo. Its the following sparkCore

: “org.apache.spark:spark-core_${scalaMajorVersion}:${sparkVersion}:akka23@jar”

So, I have the version in there…

I pasted the line that I have as is… i have the version in the string but still get the same problem.

Can you provide a reproducible example? Maven Central doesn’t have such an artifact.

I dont have an idea on how to give you a reproducible test in this case.

Here’s my setup. You create a jar for some application.

When you upload to maven you specify a classifer so the jar that you uploaded to maven will have the classifier name.

For ex:

Lets say the jar I have is called spark-core_2.10.jar

Then I uploaded that to our maven repository with version 1.1.0 and classifier akka23 So, the name of the jar in maven repository was spark-core_2.10-1.1.0-akka23.jar Now, in my gradle

I say

org.apache.spark:spark-core_2.10:1.1.0:akka23@jar This does not resolve to the uploaded jar file.

While in my pom

org.apache.spark spark-core_2.10 1.1.0 akka23

That works.

I dont have an idea on how to give you a reproducible test in this case. Here’s my setup. You create a jar for some application. When you upload to maven you specify a classifer so the jar that you uploaded to maven will have the classifier name. For ex: Lets say the jar I have is called spark-core2.10.jar Then I uploaded that to our maven repository with version 1.1.0 and classifier akka23 So, the name of the jar in maven repository was spark-core2.10-1.1.0-akka23.jar Now, in my gradle I say org.apache.spark:spark-core_2.10:1.1.0:akka23@jar This does not resolve to the uploaded jar file.

While in my pom org.apache.spark spark-core_2.10 1.1.0 akka23

That works.