We follow an approach derived from here to host the artifacts.
These instructions are for Gradle. Similar properties are applicable to Maven as well.
- Add a new repo
repositories {
maven {
url 'https://github.com/Project-Sustain/synopsis-sketch/raw/mvn-repository'
}
}
- Declare the dependency
dependencies {
api 'sustain.synopsis:sketch:1.0'
}
To publish a new version please follow the instructions given below.
- Apache Maven 3
-
Checkout the branch corresponding to the version from the repository and build the jar
git checkout v1.0.1; gradle shadowJar
Please note that we use shadowJar plugin to create a jar that embeds some if its dependencies. -
Copy the jar
cp $PROJECT_HOME/build/libs/sustain-synopsis-sketch-1.0.1-all.jar /tmp/
-
Checkout the
mvn-repository
branch
git checkout mvn-repository
-
Take a copy of the pom from one of the existing releases and update the version property. Let's assume that the copy of this pom is available at
/tmp/sketch-1.0.pom
. It is not necessary to update the version in the file name. -
Use the Maven install plugin to install the jar and the pom file into the repo
mvn install:install-file -DgroupId=sustain.synopsis -DartifactId=sketch -Dversion=1.0.1 -Dfile=/tmp/sustain-synopsis-sketch-1.0.1-all.jar -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true -DpomFile=/tmp/sketch-1.0.pom
Make sure to look at the version, file, and pomFile properties. -
Add the updated and newly added files to Git, commit, and push to the
mvn-respository
branch. -
Do not merge this branch with the master