When hosting your own public maven repository (e.g. for your cool open source project), you know that it is necessary to provide md5 and/or sha1 hashes for your artifacts or maven won’t download anything.
Until now, I used (because of ignorance) a 3rd party tool to create the needed hash codes. Then I created the directory structure and added the files to it.
But there’s a much easier way to do all the above mentioned automatically. The maven deploy plugin can be parametrized to fill a local repository with your artifacts. You only need to execute the following in your project folder:
mvn deploy:deploy-file -Durl=file://<path/to/your/repo> -DrepositoryId=local -Dfile=./target/
To add the javadocs and sources (I assume you created them) use:
mvn deploy:deploy-file -Durl=file://<path/to/your/repo> -DrepositoryId=local -Dfile=./target/
mvn deploy:deploy-file -Durl=file://<path/to/your/repo> -DrepositoryId=local -Dfile=./target/
That will:
- create the directory structure for your repository
- add the artifacts
- create the hashes for every file
- generate the maven-metadata.xml
Pingback: Maven Repository Concepts: Releases vs Snapshots repository | Sing's Tech Musings