Suppose that our Maven project depends on a particular library such as ftp4j-1.2.7.jar, which is not listed by online maven repostiories such as mavenrepostory.com or findjar.com. We can include the library in the following way to the pom file.
Next, designate a fake dependency for the jar, e.g.,
groupId: UNKNOWN
actifactId: ftp4j
version: 1.2.7.
Firstly, create a folder "lib" under the current project root directory and place the ftp4j-1.2.7.jar in the "lib/UNKNOWN/ftp4j/1.2.7/" folder.
Now in the pom, create <remote repository> whose url is local (the url points to the "lib" folder):
<repositories>
...
<repository>
<id>pseudoRemoteRepo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
Finally we can add the ftp4j.jar as a dependency:
<dependencies>
...
<dependency>
<groupId>UNKNOWN</groupId>
<artifactId>ftp4j</artifactId>
<version>1.2.7</version>
</dependency>
</dependencies>
No comments:
Post a Comment