Fix the problem with Maven failing to load the jar package under local lib/(package XXX does not exist)

Source: Internet
Author: User

This time a project was used by Maven to compile, I was in the local development of the jar package is placed in the Web-inf/lib directory, through

BuildPath imports the jar package and then uses the MyEclipse: Maven Package Command to fight the war packet, which runs under Tomcat and has a jar package under Lib under the war package.

But I upload to the server is the project source code, with SVN upload, and then the server with the Maven plugin compiled run, compile times wrong: Web-inf/lib can not find the jar package. Obviously maven compiles without automatically loading the jar package under Web-inf/lib.

The project's jar package is partially downloaded from the MAVEN library, partially placed under local web-inf/lib, where the local jar package is not found in the MAVEN library. This requires MAVEN to both load the jar package in the MAVEN library and load the local web-inf/lib
Jar package.

Now it's time to solve the problem by adding a configuration to the Pom.xml file:

<plugin>                <groupId>Org.apache.maven.plugins</groupId>                <Artifactid>Maven-compiler-plugin</Artifactid>                <version>3.6.0</version>                <Configuration>                    <Source>1.8</Source>                    <Target>1.8</Target>                    <encoding>UTF-8</encoding>                    <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/web-inf/lib;${proje Ct.basedir}/src/main/resources/lib</extdirs> </compilerArguments>                </Configuration>            </plugin>

Extended:

In addition, put under the resources package is also possible, if more than one LIB package, only need to be in the middle of multiple paths with a semicolon ";" Partition (Windows environment),

In a Linux environment, separate the word ":" with a colon and wait for verification

Fix the problem with Maven failing to load the jar package under local lib/(package XXX does not exist)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.