infinyon / fluvio-client-java

A Java Client for Fluvio!
Apache License 2.0
6 stars 3 forks source link

[Bug]: Unable to read from github packages #70

Open ashwinbhaskar opened 2 years ago

ashwinbhaskar commented 2 years ago

What happened I use SBT and I am trying to download the fluvio java client. This is in my build.sbt file

ThisBuild / credentials += Credentials("Artifactory Realm", "maven.pkg.github.com", "my-user-name", "my accees token with read packages role")

ThisBuild / resolvers += Resolver.url("fluvio", url("https://maven.pkg.github.com/infinyon/fluvio-client-java"))(Resolver.ivyStylePatterns)

libraryDependencies += "com.infinyon" % "fluvio-16" % "0.12.11"

When I compile I get this error unauthorized: https://maven.pkg.github.com/infinyon/fluvio-client-java/com.infinyon/fluvio-16/0.12.11/ivys/ivy.xml (GitHub Package Registry)

When I navigate to https://maven.pkg.github.com/infinyon/fluvio-client-java/com.infinyon/fluvio-16/0.12.11/ivys/ivy.xml on my browser. It asks me to enter username and token. After entering it displays this message maven package "com.infinyon.fluvio-16.0.12.11" does not exist under owner "infinyon"

Expected behavior Should allow me to download the client because my auth is correct.

Describe the setup

How to reproduce it (as minimally and precisely as possible) Steps to reproduce the behavior:

  1. Run the commands
    sbt new scala/scala3.g8
    ##Give a name to project, say fluvio-test
    cd fluvio-test
  2. Open the file build.sbt and paste the following
    
    val scala3Version = "3.1.2"

ThisBuild / credentials += Credentials("Artifactory Realm", "maven.pkg.github.com", "", "")

ThisBuild / resolvers += Resolver.url("fluvio", url("https://maven.pkg.github.com/infinyon/fluvio-client-java"))(Resolver.ivyStylePatterns)

lazy val root = project .in(file(".")) .settings( name := "fluvio-test", version := "0.1.0-SNAPSHOT",

scalaVersion := scala3Version,

libraryDependencies ++= Seq(
  "com.infinyon" % "fluvio-16" % "0.12.11",
  "org.scalameta" %% "munit" % "0.7.29" % Test
)

)


4. Run `sbt compile` in the root folder of the project. 

**Additional context**
Add any other context about the problem here.
sehz commented 2 years ago

Thanks for the filing issue. Moving to Java client repo

ashwinbhaskar commented 2 years ago

I was able to make this work by using this sbt plugin. Adding the snippet for someone that is stuck like me and would want to use the plugin instead. Add this to your build.sbt file

ThisBuild / resolvers += Resolver.githubPackages("infinyon")

ThisBuild / githubTokenSource := TokenSource.Environment("GITHUB_TOKEN") // Make sure you set the environment variable `GITHUB_TOKEN` before starting sbt