Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grazel not supporting private repositories #46

Closed
sylwek845 opened this issue Nov 24, 2022 · 5 comments
Closed

Grazel not supporting private repositories #46

sylwek845 opened this issue Nov 24, 2022 · 5 comments

Comments

@sylwek845
Copy link

I'm trying to migrate to bazel, but I cannot find a way of adding private repo, it seems like rules_jvm_external does support this ->

maven_install(
    artifacts = [
        "junit:junit:4.12",
        "androidx.test.espresso:espresso-core:3.1.1",
        "org.hamcrest:hamcrest-library:1.3",
    ],
    repositories = [
        # Private repositories are supported through HTTP Basic auth
        "http://username:password@localhost:8081/artifactory/my-repository",
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Is it missing or I is it me who missed it in the docs?

Thanks

@arunkumar9t2
Copy link
Contributor

arunkumar9t2 commented Nov 24, 2022

Rules JVM supports basic auth alone and as long as you don't use headers Grazel should be abel to migrate them. Could you share how the repo is declared in Gradle?

The following works for example:

 maven {
   url "$urll"
   credentials {
       username "<user_name>"
       password "<password>"
   }
}

@sylwek845
Copy link
Author

sylwek845 commented Nov 28, 2022

@arunkumar9t2 thats what I have eg

    maven(url = "https://somedomain.jfrog.io/somedomain/mvn-release") {
        credentials {
            username = "user"
            password = ")632432,4,3243,2432.43fsdfs,"
        }
    }

it complains about special characters so I changed it to URLEncoding but now I get forbidden. Any ideas ?

@arunkumar9t2
Copy link
Contributor

Got it thanks, does escaping the special characters in WORKSPACE manually help?

@sylwek845
Copy link
Author

No it does not. so when I convert the password in gradle to URLEncoding, it seems to work fine, and in WORKSPACE I can see it updates the url to the below.

"https://user:%29632432%2C4%2C3243%2C2432.43fsdfs%2C@somedomain.jfrog.io/somedomain/mvn-release",

But when I run migrateToBazel I get the following error

forbidden: https://somedomain.jfrog.io/somedomain/mvn-release/com/somedomain/android/somedomain-ui-kit-compose/11.15.2/somedomain-ui-kit-compose-11.15.2.pom

And I get the same for other libraries. Any ideas? Thanks

@sylwek845
Copy link
Author

@arunkumar9t2 Managed to find a way around. Not sure why but it worked after I changed the url and added artifactory like ->

maven(url = "https://somedomain.jfrog.io/artifactory/somedomain/mvn-release") {
        credentials {
            username = "user"
            password = ")632432,4,3243,2432.43fsdfs," //also apply URL encoding
        }
    }

Decided to share it, it may save some time for others! If you have any explanation for above let me know.

also I applied URL encoding for the password, I updated the one in gradle file as it does not affect it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants