maven 使用本地包 lib jar包 依赖一个lib目录
解决方法:
# 把本地的lib加入maven编译时的依赖路径
From:http://blog.chinaunix.net/uid-23173926-id-2942789.html
有些项目的jar包不是在maven服务器上能够下载的,那么需要将这样的包放在项目的lib目录下,
不过这样会导致maven打包时找不到包,报错。可以通过下面的配置解决这个问题
注:这种方法比较好,不用一个一个的加入jar文件
<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>
上面解决maven编译问题,下面还需要解决IntelliJ编译问题
File > Project Structure > Libraries > New Project Library > ... > Attach Jar Directories
# 把某个jar包加入maven寻找的路径
From stackoverflow:http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them
<dependency><groupId>org.swinglabs</groupId><artifactId>swingx</artifactId><version>0.9.2</version><scope>system</scope><systemPath>${project.basedir}/lib/swingx-0.9.3.jar</systemPath></dependency>
这种的不好处是,只能加入某个jar包而不是某个目录。
#把jar包安装入本地仓库
注意:正规maven的方法,要求jar包中有合法的artifactId信息
- 先安装jar包到本地仓库
- 引用安装的jar包
<repository><id>repo</id><releases><enabled>true</enabled><checksumPolicy>ignore</checksumPolicy></releases><snapshots><enabled>false</enabled></snapshots><url>file://${project.basedir}/repo</url></repository>
O
O
O
=完毕
O
O
O