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/<artifactId>-<version>.jar -DpomFile=pom.xml
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/<artifactId>-<version>-javadoc.jar -DpomFile=pom.xml -Dclassifier=javadoc
mvn deploy:deploy-file -Durl=file://<path/to/your/repo> -DrepositoryId=local -Dfile=./target/<artifactId>-<version>-sources.jar -DpomFile=pom.xml -Dclassifier=sources
That will:
- create the directory structure for your repository
- add the artifacts
- create the hashes for every file
- generate the maven-metadata.xml
Einsortiert unter:Build, config and deploy Tagged: generate, maven, maven-metadata.xml, md5, repository, sha1
