I am currently using gradle publish to be able to ublish the jar into Azure Artifact. I have followed the instructions as:
`maven {
url 'https://azuredevops.url/organization-name/project-name/_packaging/artifact/maven/v1'
name 'name'
authentication {
basic(BasicAuthentication)
}}`
Add or edit the settings.xml file in ${user.home}/.m2
`<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>id</id>
<username>username</username>
<password>[PERSONAL_ACCESS_TOKEN]</password>
</server>
</servers>
</settings>`
and after using gradle publish, I received:
Failed to publish publication 'mavenJava' to repository 'artifact name' Could not GET 'https://azuredevops.url/organization-name/project-name/_packaging/artifact/maven/v1/com/name/apps/utils/name/1.0.0-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [org.gradle.internal.buildevents.BuildExceptionReporter]
After clicking on the link I get following:
{"$id":"1","innerException":null,"message":"File name 'maven-metadata.xml'.' does not start
with artifactId 'artifact-name'","typeName":"Microsoft.VisualStudio.Services.Maven.WebApi.Exceptions.MavenInvalidFilenameException, Microsoft.VisualStudio.Services.Maven.WebApi","typeKey":"MavenInvalidFilenameException","errorCode":0,"eventId":3000}
Can someone help here ?
Firstly for PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target [org.gradle.internal.buildevents.BuildExceptionReporter]
Keytool import certificate command
1. keytool -import -trustcacerts -alias mdecert -file Certificate.cer -keystore /usr/lib/jvm/jre-1.8.0/lib/security/cacerts -storepass changeit
2. keytool -list -keystore "/usr/lib/jvm/jre-1.8.0/lib/security/cacerts"
Then 403 was faced, for that
The issue resolved once the proxy settings were changed as in case of gradle publish
the traffic was coming towards the Azure Artifacts and proxy was not required there. Hence I added nonproxyhosts alongwith the URL in gradle.properties
file which resolved the issue.