maven 使用本地包 lib jar包 依賴一個lib目錄
解決方法:
1. 把本地的lib加入maven編譯時的依賴路徑
如下配置:
     <plugin> 
              <artifactId>maven-compiler-plugin</artifactId> 
              <configuration> 
                  <source>1.6</source> 
                  <target>1.6</target> 
                  <encoding>UTF-8</encoding> 
                  <compilerArguments> 
                   <extdirs>lib/</extdirs> 
                 </compilerArguments> 
              </configuration> 
            </plugin>
 
        
2. 本地system 配置
這種的不好處是,只能加入某個jar包而不是某個目錄
<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>
 
        
3. 把jar包安裝入本地倉庫
- 先安裝jar包到本地倉庫
- 引用安裝的jar包
注意: 正規maven的方法,要求jar包中有合法的 artifactId信息
<repository>
    <id>repo</id>
    <releases>
        <enabled>true</enabled>
        <checksumPolicy>ignore</checksumPolicy>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <url>file://${project.basedir}/repo</url>
</repository> 
        4. 使用install 插件 (推薦使用)
配置如下:
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
				<executions>
					<execution>
						<id>install-external</id>
						<phase>clean</phase>
						<configuration>
							<file>${basedir}/lib/app-0.0.1.jar</file>
							<repositoryLayout>default</repositoryLayout>
							<groupId>com.dalong.locallib</groupId>
							<artifactId>appbanner</artifactId>
							<version>0.0.1</version>
							<packaging>jar</packaging>
							<generatePom>true</generatePom>
						</configuration>
						<goals>
							<goal>install-file</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
 
        
5. 使用命令
mvn install:install-file -Dfile=D:/jar/xxx.jar -DgroupId=xxx.xxx -DartifactId=xxx -Dversion=x.x -Dpackaging=jar
