1

I started a new play project: xyz. I wanted to add a dependency on customGroupId:customArtifactId:0.10 that is hosted in a nexus repository on host nexus.xyz.com but accessible only by an username and password.

So, I edited xyz\project\Build.scala with

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {

    val appName         = "xyz"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      "customGroupId" % "customArtifactId" % "0.10"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      credentials += Credentials("realm1", "nexus.xyz.com", "myUser", "myPassword"),

      resolvers += "realm1" at "https://nexus.xyz.com/svn/eessi/maven2/releases"
    )

}

Then I ran in xyz.

play
run

I get

play! 2.0.3, http://www.playframework.org
[xyz] $ run
[info] Updating {file:/C:/Users/grigocn/work/xyz/}xyz...
[warn]  module not found: customGroupId#customArtifactId;0.10
[warn] ==== local: tried
[warn]   c:\Users\grigocn\apps\play\framework\..\repository/local/customGroupId/customArtifactId/0.10/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/customGroupId/customArtifactId/0.10/customArtifactId-0.10.pom
[warn] ==== realm1: tried
[warn]   https://webgate.ec.europa.eu/CITnet/svn/eessi/maven2/releases/customGroupId/customArtifactId/0.10/customArtifactId-0.10.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/customGroupId/customArtifactId/0.10/customArtifactId-0.10.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
...

PS. I tried to follow this but didn't work: Play framework and sbt: passing credentials to a nexus passowrd protected repo

Community
  • 1
  • 1
raisercostin
  • 8,777
  • 5
  • 67
  • 76

2 Answers2

1

did you check if the realm name is correct? My nexus realm (I think is the default realm) for example is

Sonatype Nexus Repository Manager

Marco
  • 1,494
  • 13
  • 23
0

I discovered/remembered that the realm is not a unique identifier that i can use to refer to a server but is the text displayed by the server when you authenticate.

In this case the realm is the "PROXY_INTERNET" realm authentication

So now my configuration that works is the following. Notice that "eessi-releases" is not the realm or an id of the server.

import sbt._
import Keys._
import PlayProject._
import com.github.play2war.plugin._

object ApplicationBuild extends Build {

    val appName         = "reliable-transport-ui"
    val appVersion      = "1.0-SNAPSHOT"
    val bmServerVersion = "0.113"

    //val mySubProject = Project("transport-server", file("../reliable-transport-server/src/main/java")) 
    //val mySubProject2 = Project("transport-server", file("../reliable-transport-server/src/main/resources")) 


    val appDependencies = Seq(
      javaCore,
      javaJdbc,
      // Add your project dependencies here,
      "commons-io" % "commons-io" % "1.4"
    )

    import com.typesafe.sbteclipse.core.EclipsePlugin._

    import play.Project._ 

    val main = play.Project(appName, appVersion, appDependencies).settings(defaultScalaSettings:_*).settings(
        //Subversion is the realm - the text displayed by server when it asks for username/password. Don't change it from <Subversion>
        credentials += Credentials("Subversion", "webgate.ec.europa.eu", "grigocn", "<pass>")

        ,resolvers += "eessi-releases" at "https://webgate.ec.europa.eu/CITnet/svn/eessi/maven2/releases"

        ,resolvers += "eessi-thirdparty" at "https://webgate.ec.europa.eu/CITnet/svn/eessi/maven2/thirdparty"

        ,resourceDirectory in Test <<= baseDirectory(_ / "test-resources")

        ,EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource

        ,EclipseKeys.withSource := true 
    )
)
raisercostin
  • 8,777
  • 5
  • 67
  • 76