简体   繁体   中英

Maven and Ivy dependency management

I have a project (project1) that is built using Maven. There is another project (project2) which uses SBT and is a Scala code base. The jar built by project1 is added as a dependency to project2. Since project2 is using ivy as its repository, how should I handle this in my Build file of project2?

Currently what I do is the following in my Build.scala of project2:

resolvers ++= Seq(
  "Local Maven Repository" at "file:///"+Path.userHome+"/Softwares/maven-repo"
),

This way of adding this dependency is a bit problematic as the path to the local maven repo might differ from each developer. Is there a proper way to refer to maven dependencies from within my Scala project?

As a default, I expect that all my developers are following convention and configure SBT with:

resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"

If you have developers that are not following convention for whatever reason, maybe they are forced to use a network drive or something, then they need to do some local configuration and not check their changes in (a cultural thing).

You could also look up an environment variable but then you still burden your devs with setting that up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM