Resolving jar packages in the Web-inf/lib directory cannot be packaged with Maven

Source: Internet
Author: User

Part of the jar package in the project is based on the Pom file dependency, part of the BuildPath into the Web-inf/lib directory, and finally when using MAVEN packaging, found unable to put the jar package Web-inf/lib under the war package, The class that introduced the jar in the Web-inf/lib directory could not be compiled with an error.

How to resolve:

Add the following Maven plugin to the Pom file:

<build>
    <plugins>
      <plugin>
        <artifactid>maven-compiler-plugin</ artifactid>
        <configuration>
          <source>1.7</source>
          <target>1.7</target >
          <encoding>UTF-8</encoding>
               <compilerArguments>
                  <!--<extdirs>${ Basedir}/webroot/web-inf/lib</extdirs>-
                   <extdirs>${basedir}/src/main/webapp/web-inf/lib </extdirs>
               </compilerArguments>
        </configuration>
      </plugin>
    </ Plugins>
  </build>

After adding this code, re-use MAVEN to package the compilation can be in the Web-inf/lib directory of Jar package and Pom file dependent jar package into the war package.

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.