eclipse 中maven 加入本地jar文件

1.在项目上单击右键-》新建文件夹(如:lib)
2.在pom.xml 加入下面文件:

<dependency>
<groupId>dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.4</version>
<scope>system</scope>
<!--引入路径 -->
<systemPath>${project.basedir}/lib/dubbo-2.8.4.jar</systemPath>
</dependency>


之后右键Maven-Updata project即可。


但是在生成war包时,没有把本地的jar加入添加到war,还需要在pom.xml中,添加下面配置:

<plugins>

<plugin>

..

</plugin>

<!-- start -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
            <webResources>
                <resource>
                    <directory>${project.basedir}/lib</directory>
                    <targetPath>WEB-INF/lib</targetPath>
                    <filtering>false</filtering>
                    <includes>
                        <include>**/*.jar</include>
                    </includes>
                </resource>
            </webResources>
        </configuration>
    </plugin>
        <!-- end -->  
    </plugins>










猜你喜欢

转载自gjp014.iteye.com/blog/2374670