How to add a jar to local maven repository and then referencing it in a java gradle project

Adding a jar to local maven repository and then referencing it in a java gradle project

Pre-requiste
1. You need to have maven and compatible java version available and installed.

First install the jar to local maven repository using the following command

mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file  \
    -Dfile=path-to-your-artifact-jar \
    -DgroupId=your.groupId \
    -DartifactId=your-artifactId \
    -Dversion=version \
    -Dpackaging=jar \
    -DlocalRepositoryPath=path-to-specific-local-repo


In my case the command was
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=C:\stimulsoft-reports-2020.2.3-SNAPSHOT\stimulsoft-reports-webviewer-2020.2.3-SNAPSHOT.jar -DgroupId=com.stimulsoft -DartifactId=stimulsoft-reports-webviewer -Dversion=2020.2.3-SNAPSHOT -Dpackaging=jar -DlocalRepositoryPath=C:\Users\tomymad\.m2\repository


Screenshot




Now inside the build.gradle file

dependencies {
compile group: 'com.stimulsoft', name: 'stimulsoft-reports-webviewer', version: '2020.2.3-SNAPSHOT'
}

Hope this helps :)




No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days