
DgroupId=com.example -DartifactId=myjar \ $ mvn install:install-file -Dfile=/path/to/myjar-1.0.jar \
MAVEN INSTALL DEPENDENCIES LOCALLY INSTALL
You can install a Jar file myjar-1.0.jar into your local repository with the following command: The next option you have when you don’t have a repository manager available is to install the needed dependency into your local repository cache. Install a Jar file in your local repository cache Additionally, this approach is useless when it comes to building assemblies and fat jars, since system-scoped dependencies will not be included into these.
MAVEN INSTALL DEPENDENCIES LOCALLY SOFTWARE
Since only absolute file paths can be provided with system scope, a build becomes inherently dependent on a particular environment which is an absolute no-go for independent and self-contained software builds. More importantly, the Maven documentation states that this feature is deprecated! So, if you have ever considered using system scope for one of your dependencies, don’t do it. Thus, system dependencies are especially useful for resolving dependencies on artifacts which are now provided by the JDK, but where available as separate downloads earlier. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM. As described in the Maven documentation,ĭependencies with the scope system are always available and are not looked up in repository.

System scope is a dependency scope that allows to address a Jar file on the local file system so that this file is used to resolve a dependency instead of contacting a remote repository. You are, however, strongly discouraged to use this approach. The second option is to use Maven’s system scope. If you don’t have a local repository available or if you need your build to be independent from some repository server you still have some more options. Having a local repository manager at one’s disposal is convenient but unfortunately not always an option. This should usually not be a problem if a Maven project exclusively exists inside the company. A project having such dependencies can only be built when the local repository is online and reachable. This approach has one disadvantage: when specific dependencies are only available through a corporate repository, a build becomes dependent on this particular environment. An administrator can upload any dependencies not available from a public repository into the local repository to make them available to all users in the company. This allows for an auditing of the used dependencies and their respective versions and provides an option to disallow certain dependencies. The first option should be the most widespread one in a corporate environment and is also the most straightforward one: all dependencies are loaded from a local, company-wide repository manager such as Nexus or Artifactory. Use a corporate repository manager such as Nexus or Artifactory


