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
:
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.