Configuring HTTP Basic Auth secured repository is a little bit hard. Just remember the following things:
- For simplicity we use the same login value for everyone - myMavenRepo.
- You should use read URL with read password and write URL with write password. You can't use read URL with write password.
- There is difference between repository credentials and service credentials. Don't mess them up.
Help / Configuring Maven pom.xml file for HTTP Basic Auth secured repository
Security
Let's specify password to your repositories in ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>myMavenRepo.read</id>
<username>myMavenRepo</username>
<password>${yourHttpAuthReadPassword}</password>
</server>
<server>
<id>myMavenRepo.write</id>
<username>myMavenRepo</username>
<password>${yourHttpAuthWritePassword}</password>
</server>
</servers>
</settings>
Replace ${yourHttpAuthReadPassword}, ${yourHttpAuthWritePassword} with corresponding password values.
Get more info: official documentation
Reading
Since your repository is protected by HTTP Basic Auth you can directly use read URL in your /path/to/project/pom.xml file:
<project>
...
<repositories>
<repository>
<id>myMavenRepo.read</id>
<url>${myMavenRepo.read.url}</url>
</repository>
</repositories>
...
</project>
Replace ${myMavenRepo.read.url} with your read repository URL.
Get more info: official documentation
Publishing artifacts
Since your repository is protected by HTTP Basic Auth you can directly use write URL in your /path/to/project/pom.xml file:
<project>
...
<distributionManagement>
<repository>
<id>myMavenRepo.write</id>
<url>${myMavenRepo.write.url}</url>
</repository>
</distributionManagement>
...
</project>
Replace ${myMavenRepo.write.url} with your write repository URL.
To upload artifacts use mvn deploy command.
Get more info: official documentation