0
votes

I'm a java/maven/scala noob currently learning Maven. This looks like a dup of How to know which artifact to get but isn't, I think. Suppose I want to get a specific dependency/plugin like the scala compiler, I go to the maven repo

http://mvnrepository.com/open-source/scala-compilers

and I see two links both labelled scala compiler. Click on them and I see

http://mvnrepository.com/artifact/org.scala-lang/scala-reflect

and

http://mvnrepository.com/artifact/org.scala-lang/scala-compiler

They are both labelled as scala compiler, but one says reflect. So, are they both compilers, or what? Presumably the compiler is what it says, but what's reflect? Why is it under compilers?

Most importantly, and this is what my question is really about, not scala per se, is this my misunderstanding of how the main maven repo labels things, or have they made a mistake?


Edit Rafael Saraiva: useful & accepted, thanks.

Alextsc: Will read, ta. Scala seems to be doing some serious growing in the past year!

Mifeet: Really? Very interesting, will read, thanks.

1
scala-reflect is the reflection library. It ties in with compilers because there is compile-time reflection (i.e. code generation during compilation). You can find an introduction about it here. - alextsc
Yeah, it's confusing how they uploaded the artifacts to the repository. Btw, I don't think you need to have either of these artifacts in your pom. Check out this answer for an example of a minimal pom for Scala. - Mifeet

1 Answers

1
votes

Although they are both labelled scala compiler and they share the same groupId org.scala-lang you must always pay attention to the artifactId which is what uniquely identifies a library/package (which is an artifact in maven).

To be more precise, a maven dependency is identified by three things:

  • The groupId -> both share org.scala-lang
  • The ArtifactId -> one is scala-reflect and the other scala-compiler
  • The version -> they may have parallel versions or they may not

A maven depency is then identified as such:

groupId:artifactId:version

For example: org.scala-lang:scala-compiler:2.11.8

If you get all this you will have no trouble differentiating different dependencies