This guide implies that you are using simple security model that is based on uniqueness of URLs. If you are using HTTP Basic Auth then please read a corresponding guide
Help / Configuring Maven pom.xml file
Security
By default our service uses very simple security model - we create unique read/write URL for each user.
But this approach has its limitations - anyone who knows your URL can access your data. Because of that putting those URLs in to your pom.xml
file directly will be insecure.
To solve this problem you can store repository URL in ~/.m2/settings.xml
<settings> <profiles> <profile> <id>myMavenRepo</id> <activation> <property> <name>!doNotUseMyMavenRepo</name> </property> </activation> <properties> <myMavenRepo.read.url>{{readUrl}}</myMavenRepo.read.url> <myMavenRepo.write.url>{{writeUrl}}</myMavenRepo.write.url> </properties> </profile> </profiles> </settings>
Get more info: official documentation, stackoverflow question
Reading
To get data from your repository you can use read or write URLs. Configure myMavenRepo.read.url
variable as described in Security section.
After that you can configure your repository in /path/to/project/pom.xml
file:
<project> ... <repositories> <repository> <id>myMavenRepo.read</id> <url>${myMavenRepo.read.url}</url> </repository> </repositories> ... </project>
Get more info: official documentation
Publishing artifacts
To publish data to repository you can use only write URL.
Configure myMavenRepo.write.url
variable as described in Security section.
After that modify /path/to/project/pom.xml
to configure deploy plugin:
<project> ... <distributionManagement> <repository> <id>myMavenRepo.write</id> <url>${myMavenRepo.write.url}</url> </repository> <snapshotRepository> <id>myMavenRepo.write</id> <url>${myMavenRepo.write.url}</url> </snapshotRepository> </distributionManagement> ... </project>
To upload artifacts use mvn deploy
command.
Get more info: official documentation