Add local jar file to maven in eclipse

1. Right-click on the project -> create a new folder (eg: lib)
2. Add the following files to pom.xml:

<dependency>
<groupId>dubbo</groupId>
<artifactId>dubbo</artifactId>
<version> 2.8.4</version>
<scope>system</scope>
<!--Introduction path-->
<systemPath>${project.basedir}/lib/dubbo-2.8.4.jar</systemPath>
</dependency >


Then right-click the Maven-Updata project.


However, when generating the war package, the local jar is not added to the war, and the following configuration needs to be added in pom.xml:

<plugins>

<plugin>

..

</plugin>

<!-- start -->
    < plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin<


                <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>










Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326525059&siteId=291194637