Imagine that you have implemented your java jar library and you need to connect it. Here are some examples of how to do it.
1. Manually install jar into local maven repository
You need run this command on console:
1 2 3 4 5 6 7 |
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> -DgeneratePom=true |
After sucessfull execution, you can use your jar library as a usual dependency.
2. Add local dependency directly
You can use point local address to file in a dependency section.
1 2 3 4 5 6 7 |
<dependency> <groupId>com.thecodeexamples</groupId> <artifactId>sample_local_jar</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${project.basedir}/src/main/resources/yourLocalJar.jar</systemPath> </dependency> |
simple but timeless. harder to find also maven samples now that gradle is becoming popular