There are several ways to resolve this.
Keeping your repository
The ideal is to install the jars in a repository of your company / house. For this you need a server with Artifactory or Nexus .
The advantage of having your own repository is that you can use it to manage the versions of your projects as well.
Another advantage is that it caches the central repository and its environment gets faster.
Dependencies with scope system
You can also point to the dependency path of type system
. Consider the following example:
<dependency>
<groupId>javax.sql</groupId>
<artifactId>jdbc-stdext</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/rt.jar</systemPath>
</dependency>
These dependencies may also be within the project. Use the ${basedir}
variable to indicate the project home directory.
The problem with this approach is that you need to keep the Jars in the repository, which is not very suitable.
See the documentation for more details.
Note: Maven has added a restriction on the use of libs within the project, as can be seen in the error edited in the question. You should then use a directory outside the project.
Installing dependencies in the local repository
Another solution is to use the install
plugin to install the jars in a local repository. This can be done with the mvn install:install-file
command and the appropriate parameters. See documentation for more details.
Example:
mvn install:install-file -Dfile=morena7.jar -DgroupId=sk.gnome \
-DartifactId=morena -Dversion=7.0 -Dpackaging=jar
Please note that the above data was invented and will only work in the environment in which it was installed.
The problem with this approach is that the installation process needs to be repeated in each environment, that is, on each development machine and on the Continuous Integration server, if any.