MAVEN relies on a jar package in a local non-repository
Http://www.cnblogs.com/piaolingxue/archive/2011/10/12/2208871.html
Blog Category:
Maven
Today, when using a MAVEN compilation to package a Web application, you encounter a problem:
The project was developed with the introduction of a dependency jar package, placed in the Web-inf/lib directory, and the Web Libariary imported through BuildPath.
There is no problem with developing in eclipse, but using MAVEN to compile plug-ins is always a good time to find the classes in the jar package web-inf/lib.
Obviously when compiling the Web-inf/lib is not configured in the Maven-complier-plugin plugin src directory to go,
Then add this directory, or not. Rogue, first install this jar package in the local library and add dependency.
Later, Google found that Maven provided the scope for system dependency, the original document is as follows:
System
This "is" similar to provided except, which has to provide the JAR which contains it explicitly.
The artifact are always available and are not looked up in a repository.
This allows you to add dependency without having to install the jar package in the Web-inf/lib directory into your local library.
The specific configuration recorded:
XML code
<dependency>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/paypal_base.jar</systemPath>
</dependency>
! A better way is to configure the compile parameter <compilerarguments>, and add extdirs to add the jar package relative path to the configuration as follows:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>src\main\webapp\WEB-INF\lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>