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

Gradle publish fails #351

Closed
DeadlyMC opened this issue Feb 5, 2021 · 23 comments
Closed

Gradle publish fails #351

DeadlyMC opened this issue Feb 5, 2021 · 23 comments
Labels
documentation Issues related to docs

Comments

@DeadlyMC
Copy link

DeadlyMC commented Feb 5, 2021

I'm trying to deploy some files to a maven repo using the maven-publish gradle plugin with no luck. It always errors with a status 401 : Unauthorized.
Capture

This is the gradle publish task:
image

The alias and token aren't wrong as ive used them in the web login without any issues.

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

Hey :) Did you associate a proper path with w permission?

@DeadlyMC
Copy link
Author

DeadlyMC commented Feb 5, 2021

yes, m with /*

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

Could you enable debug in configuration? As far as I remember, I've added some extra logging during the authorization.

@dzikoysk dzikoysk added the investigation Issue is currently investigeted, e.g. author is trying to reproduce problem label Feb 5, 2021
@DeadlyMC
Copy link
Author

DeadlyMC commented Feb 5, 2021

Capture
This is all that shows up when i run gradlew publish

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

Add -Dtinylog.writerActive.level=DEBUG as VM option and check again

@BluCobalt
Copy link

the console output:
image
the gradle exception:
image

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

Nah, I always forget that Gradle does not use basic auth by default. Just add it below the credentials:

credentials {
    // [...]
}
authentication {
    basic(BasicAuthentication)
}

Sorry for such a slow response, I'm kinda busy today 😅

@dzikoysk dzikoysk added the documentation Issues related to docs label Feb 5, 2021
@BluCobalt
Copy link

Lol, it's fine.
I added the authentication bit but it still gives me a 401 on maven-metadata.xml . Here is my publishing block:
image

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

Does your Authentication header start with a Basic phrase?

I've added a log statement to print the response message for authentication error during deploy, check this build:
reposilite-2.9.10.zip (GitHub doesn't support .jar files, so rename zip to jar)

@BluCobalt
Copy link

image

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

Let's try one more time 🤔

reposilite-2.9.10.zip

@BluCobalt
Copy link

image

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 5, 2021

It looks like the associated path to the token does not really match the uri:

image

And you have enabled this option in configuration?

# Allow to omit name of the main repository in request
# e.g. /org/panda-lang/reposilite will be redirected to /releases/org/panda-lang/reposilite
rewritePathsEnabled: true

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 6, 2021

yes, m with /*

Oh, wait, I didn't notice that you have asterisk after slash. Take a look at this table:

image

As you can see, there is no path that may end with * character. The only place where you can use functional asterisk is at the beginning of the path, to use it as a wildcard for repository name. Just regenerate your token with / or */ path and then it should work.

@BluCobalt
Copy link

Thank you! Setting a token with / worked.

@DeadlyMC you can close this and I'll gen new keys

@dzikoysk dzikoysk removed the investigation Issue is currently investigeted, e.g. author is trying to reproduce problem label Feb 6, 2021
@dzikoysk
Copy link
Owner

dzikoysk commented Feb 6, 2021

I've marked it as a documentation issue and I'll close it when I add BasicAuthentication to the docs :) I also think it might be a good idea to add a warning, when someone will generate a token with path that ends with asterisk.

@BluCobalt
Copy link

While you're here, do you know how (if possible) to change the text on the index page? I already set it in the reposilite.cdn but it still just says
image

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 6, 2021

Are you sure it is not caused by Cloudflare cache?

@BluCobalt
Copy link

Yes, I have disabled caching for the subdomain with a page rule:
image

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 6, 2021

As I thought, it is a known bug, that you can't use apostrophe:

window.REPOSILITE_DESCRIPTION = 'Legacy Fabric's maven repo'

You should be able to replace it with \' or just the Unicode representation.

@BluCobalt
Copy link

Escaping it worked, thanks!

@DeadlyMC
Copy link
Author

DeadlyMC commented Feb 6, 2021

Thank you! I'm able to publish too. Is the basic authentication bit imp? I was able to push without it

@dzikoysk
Copy link
Owner

dzikoysk commented Feb 6, 2021

I'm not sure when Gradle uses other auth method, but there was an issue related to this: #171 (comment)

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

No branches or pull requests

3 participants