Ticistrac
Ticistrac

Reputation: 60

Scala SBT - External repository

I try to use the sbt from Scala. But i need reference to an external repository.

This is the pom.xml from https://www.spigotmc.org/wiki/spigot-maven/

<repositories>
    <!-- This adds the Spigot Maven repository to the build -->
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.15.1-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>

    <!--This adds the Bukkit API artifact to the build -->
    <!-- Do not include this in the pom.xml file if the Spigot API is already added -->
    <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.15.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
    </dependency>
</dependencies>

Actually, i have this :

name := "MyProject"

version := "1.0"

scalaVersion := "2.13.1"

libraryDependencies ++= Seq(
  "org.spigotmc" % "spigot-api" % "1.15.1-R0.1-SNAPSHOT" % "provided",
  "org.bukkit" % "bukkit" % "1.15.1-R0.1-SNAPSHOT" % "provided"
)

But i have an error saying that the dependence is not found

[error] not found: https://repo1.maven.org/maven2/org/spigotmc/spigot-api/1.15.1-R0.1-SNAPSHOT/spigot-api-1.15.1-R0.1-SNAPSHOT.pom

[error] https://hub.spigotmc.org/nexus/content/repositories/snapshots/ doesn't point to a file

I don't know (also with the doc https://www.scala-sbt.org/1.x/docs/) how to refer to https://hub.spigotmc.org/nexus/content/repositories/snapshots/

Can you help me please ?

Thanks ^^

Upvotes: 1

Views: 782

Answers (2)

rj00a
rj00a

Reputation: 1

I was able to resolve the dependency by building spigot locally with BuildTools.jar and adding Maven local as a resolver.

resolvers += Resolver.mavenLocal,

libraryDependencies += "org.spigotmc" % "spigot-api" % "1.16.4-R0.1-SNAPSHOT" % "provided"

Upvotes: 0

samizzy
samizzy

Reputation: 88

Since the artifact is not present in default mvn repository (https://repo1.maven.org/maven2/), you need to add the spigot repo.

resolvers+="Spigot Snapshots" at "https://hub.spigotmc.org/nexus/content/repositories/snapshots"

So the build.sbt will look like

name := "MyProject"

version := "1.0"

scalaVersion := "2.13.1"

resolvers+="Spigot Snapshots" at "https://hub.spigotmc.org/nexus/content/repositories/snapshots"

libraryDependencies ++= Seq(
  "org.spigotmc" % "spigot-api" % "1.15.1-R0.1-SNAPSHOT" % "provided",
  "org.bukkit" % "bukkit" % "1.15.1-R0.1-SNAPSHOT" % "provided"
)

You can follow the reference manual at https://www.scala-sbt.org/1.x/docs/Resolvers.html

Upvotes: 0

Related Questions