0

I am trying to publish an artifact to Maven Central. I am using Gradle's plugin, Maven Publish. From what I have gathered, I need to put my credentials in a file, gradle.properties. I have done so and placed that file in my ~.gradle directory. I even put an identical gradle.properties into my project's directory to make sure, but that doesn't seem to work either. Then, in my build.gradle, I reference the variables in my gradle.properties.

When running gradle publish, I get a 401 error unauthorized. When I try and look this problem up, I don't seem to able to find much help. Documentation isn't very clear to me either, I get explanations on what things do but not how to do it.

Here is my project directory, gradle.properties, and build.gradle:

Project Directory

If I write my username and password in plain text it works, but obviously I don't want to do that. How can I fix this problem, or is there a better way to do this?

I am confused because even with my gradle.properties in my project directory directly next to build.gradle, this is not working.

Suede
  • 416
  • 2
  • 5
  • 16

1 Answers1

1

So it turns out, in trying to solve this problem, I added a gradle.properties to my ~/.gradle folder in both my C and D drives. After deleting the file in both locations, build.gradle recognized the variables in gradle.properties

Suede
  • 416
  • 2
  • 5
  • 16