In such scenario we can follow any of these steps to continue to build our projects with Maven.
Method 1:
Using System Scope
Add the jar file in the lib folder or the project and in pom.xml refer to the same as follows:
<dependency>
<groupId>CLFWrapper</groupId>
<artifactId>CLFWrapper</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}\lib\CLFWrapper.jar</systemPath>
</dependency>
Method 2:
Adding the jar into local maven repository, and then referring the same in pom.xml
Browse to the directory where the jar is present and Run the following command on cmd prompt
mvn install:install-file -Dfile=CLFWrapper.jar -DgroupId=CLFWrapper -DartifactId=CLFWrapper -Dversion=1.0 -Dpackaging=jar
Note the groupId, artifactId and version you mention while adding the jar to local maven repository. The same must be used in pom.xml as below:
<dependency>
<groupId>CLFWrapper</groupId>
<artifactId>CLFWrapper</artifactId>
<version>1.0</version>
</dependency>
While personally I feel, Method 2 is a cleaner way to do it since system scope dependency only get used in build and test and are not exported, which is otherwise possible for compile scope (the default scope for maven dependencies).
0 comments:
Post a Comment