There is a few different confusing Tag and URL in Maven pom.xm
<distributionManage>
<distributionManagement> <downloadUrl>https://xxxx/</downloadUrl> <repository> <uniqueVersion>false</uniqueVersion> <id>es-maven</id> <name>xxx systems Maven Repository</name> <url>sftp://xxx/export/web/maven2/</url> <layout>default</layout> </repository> <site> <id>es-maven-site</id> <url>sftp://xxxx/export/web/site/${artifactId}</url> </site> </distributionManagement>
- it contains url where when you run "mvn deploy" the new generated snapshot file will be uploaded there
<repository>
<repository>
<id>xx-maven</id>
<name>xxx Systems Maven Repository</name>
<url>https://xxx/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
The red "true" "false" means when you do "mvn deploy" it will be able to create snapshot or not
1. Maven release:prepare
The current location of the development trunk. A valid SCM URL format appropriate to the SCM provider. The "SCM:Provider:" prefix is used to determine the provider being used.
2. Maven release
Reference: http://maven.apache.org/guides/mini/guide-releasing.html
Compared with local reporsitory and deploy/release remote server, the structure of maven snapshot release, and release are same. because everything is done locally before sending to server??? That is my understanding
Why configure remote repository in settings.xml
(reference: http://juvenshun.iteye.com/blog/359256)
Suppose you work on 3 project at the same time, they all point to same remote repository, so you need configure them in 3 POM for the 3 different projects, right? repeated code, hard to maintain???
So the solution is adding to your own .m2/settings.xml file
<settings> ... <profiles> <profile> <id>dev</id> <!-- repositories and pluginRepositories here--> </profile> </profiles> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> ... </settings>
Deploy to remote repository
(reference: http://juvenshun.iteye.com/blog/359256)
<distributionManagement> <repository> ... <snapshotRepository> ....
This is the keyword I have been searching for a while:
"Maven会根据你项目的版本来判断将构件分发到哪个仓库" according to juvenshun from Iteye.