1

I have a maven project that builds two jars as artifacts. The version number is 0.7 and one artifact is built the "default" way and the second has a classifier. As such, in my repository, they look like this:

Tue Jun 10 08:06:12 MST 2014    14915   gokenizer-0.7.pom   
Tue Jun 10 08:06:12 MST 2014    40  gokenizer-0.7-core.jar.sha1 
Tue Jun 10 08:06:12 MST 2014    40  gokenizer-0.7.pom.sha1  
Tue Jun 10 08:06:12 MST 2014    32  gokenizer-0.7.jar.md5   
Tue Jun 10 08:06:12 MST 2014    32  gokenizer-0.7.pom.md5   
Tue Jun 10 08:06:12 MST 2014    37969843    gokenizer-0.7.jar   
Tue Jun 10 08:06:12 MST 2014    41887392    gokenizer-0.7-core.jar  
Tue Jun 10 08:06:12 MST 2014    32  gokenizer-0.7-core.jar.md5  
Tue Jun 10 08:06:12 MST 2014    40  gokenizer-0.7.jar.sha1

As you can see, the jar with the classifier has "core" as its classifier.

The path to the repository is:

http://myhostname/plugin/repository/project/DomainIQCore/LastSuccessful/repository/com/example/domain/gokenizer/0.7/

All good? So how do I actually specify that I want the jar with the "core" classifier when building my project?

In my build.scala file, I tried this:

  libraryDependencies ++= Seq(
    "com.example.domain" % "gokenizer" % "0.7" % "core"
  ),

But then I get this error:

java.lang.IllegalArgumentException: Cannot add dependency 'com.example.domain#gokenizer;0.7' to configuration 'core' of module com.example#domainiq_2.10;0.1.0-SNAPSHOT because this configuration doesn't exist!

And when I try this:

  libraryDependencies ++= Seq(
    "com.example.domain" % "gokenizer" % "0.7-core"
  ),

It clearly builds the path to the repository wrong:

http://myhostname/plugin/repository/project/DomainIQCore/LastSuccessful/repository/com/example/domain/gokenizer/0.7-core/gokenizer-0.7-core.pom

I must obviously be doing something wrong. I thought the first way (with the 4th field as "core") was the way, but I have no idea what "because this configuration doesn't exist" means. Since it doesn't appear to even be trying to hit the repository, it seems that I have to tell SBT what "core" means? That doesn't make sense to me because I thought it was just part of the path, not a "configuration" as such.

When I remove the 4th field, it properly gets the non-classifier version of the jar, so I know the repository is there and working...

Help?

  • In maven, an artifact (a jar) is formatted like this: name-version.jar. To get what you want you will either have to refer to the version of your core jar as 0.7-core in your maven dependency or change the name of the core jar to blam-core with version 0.7 (blam-core-0.7). – DwB Jun 10 '14 at 16:27

1 Answers1

1

Of course, as always happens, post the question and find the answer ;)

Saying "classifier" so many times made me try a different search on the Great Google Machine which netted me the answer.

        "com.example.domain" % "gokenizer" % "0.7" classifier "core"

Not a percent sign. "classifier" as a keyword. I had no idea. Now it compiles.