Mohammed
Mohammed

Reputation: 11

trying to build a job on jenkins where i use fluway-sbt plugin

I am building a certain job which is using flyway-sbt. the weird thing that the job is running locally but failed in jenkins and the error message is:

[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      org.flywaydb:flyway-sbt:4.2.0 (sbtVersion=1.0, scalaVersion=2.12)
[warn] 
[warn]  Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading org.flywaydb:flyway-sbt;sbtVersion=1.0;scalaVersion=2.12:4.2.0
[error]   Not found
[error]   Not found
[error]   not found: https://repo1.maven.org/maven2/org/flywaydb/flyway-sbt_2.12_1.0/4.2.0/flyway-sbt-4.2.0.pom
[error]   not found: /root/.ivy2/localorg.flywaydb/flyway-sbt/scala_2.12/sbt_1.0/4.2.0/ivys/ivy.xml
[error]   not found: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.flywaydb/flyway-sbt/scala_2.12/sbt_1.0/4.2.0/ivys/ivy.xml
[error]   not found: https://repo.typesafe.com/typesafe/ivy-releases/org.flywaydb/flyway-sbt/scala_2.12/sbt_1.0/4.2.0/ivys/ivy.xml
[error]   not found: https://repo.typesafe.com/typesafe/maven-releases/org/flywaydb/flyway-sbt_2.12_1.0/4.2.0/flyway-sbt-4.2.0.pom

any guess, please?

I had a look on the below: https://github.com/flyway/flyway/issues/1281 and Error adding flyway-sbt plugin for Scala 2.12 (Play Framework)

but no luck!

Upvotes: 1

Views: 38

Answers (1)

Gastón Schabas
Gastón Schabas

Reputation: 3468

Based on the error you got

Error downloading org.flywaydb:flyway-sbt

Seems like you are using and old plugin from org org.flywaydb. Latest release published on maven for org.flywaydb - flyway-sbt was on Apr 27, 2017


From the README of github repo sbt - flyway-sbt

This project is based on the original flyway - flyway-sbt that was in the flyway repository through version 4.2.1.

This means that flyway-sbt was moved from orgazniation flyway to sbt. The new maven repo is com.github.sbt - flyway-sbt_2.12_1.0. Latest relase is 10.21.0 published on Nov 16, 2024.

From the README it says to install the plugin you should add the following line to your /project/plugins.sbt file

addSbtPlugin("com.github.sbt" % "flyway-sbt" % "10.21.0")

and add the following config to your build.sbt file

enablePlugins(FlywayPlugin)

flywayUrl := "The jdbc url to use to connect to the database"
flywayUser := "The user to use to connect to the database"
flywayPassword := "The password to use to connect to the database"
flywayLocations := Seq("filesystem:src/main/resources/db/migration")
Test/ flywayUrl := "The jdbc url to use to connect to the database"
Test/ flywayUser := "The user to use to connect to the database"
Test/ flywayLocations := Seq("filesystem:src/main/resources/db/migration")
Test/ flywayPassword := "The password to use to connect to the database"

Then you can run the tasks flywayMigrate to do the migration or flywayClean to clean it.


Probably, you can run the task locally because you have the artifact in your local cache, meanwhile in jenkins when it tries to pull the artifact it's not able to find it.

From Error adding flyway-sbt plugin for Scala 2.12 (Play Framework)

Adding the following lines to plugins.sbt file should fix the problem

resolvers += "Flyway" at "https://davidmweber.github.io/flyway-sbt.repo"
addSbtPlugin("org.flywaydb" % "flyway-sbt" % "4.2.0")

If you try to access to https://davidmweber.github.io/flyway-sbt.repo or even https://davidmweber.github.io/ you will get a 404.

This makes me think that the repo is not available anymore and you have to use the releases published by sbt org.

If you really need that version, maybe you could try to publish the one you have in your local cache to an artifactory repo that your jenkins is allowed to access or find the way to build and publish a release for that version from flyway - flwyay-sbt - tag: flyway-4.2.0

Upvotes: 1

Related Questions