How do I get maven to copy a project-dependent jar into the Web-inf/lib directory?

Source: Internet
Author: User
Scenario: When you do maven Web development, the dependency jar is not put under Src/main/webapp/web-inf/lib, which is not the same as when we use Eclipse development tools for Web development. How can you only copy the dependent jar package to the corresponding Lib directory at compile time? Technical keywords: How to perform the corresponding goal at some stage of the corresponding life cycle
1. Execute the  maven-dependency-plugin:copy-dependencies command in the compile phase of the default life cycle:             <plugin> <groupId>org.apache.maven.plugins</groupId> < artifactid>maven-dependency-plugin</artifactid> <executions> <execution> <id>install </id> <phase>install</phase> <goals> <goal>sources</goal> </goals> </ execution> <execution> <id>compile</id> <phase>compile</phase> <goals> < goal>copy-dependencies</goal> </goals> <configuration> <outputdirectory>src/main/ webapp/web-inf/lib</outputdirectory> </configuration> </execution> </executions> </ Plugin> 2. When a change is made to a dependent jar package, the clean lifecycle should be performed, and all old jar packages should be removed so that the Web-inf/lib and Maven dependency management jar packages are consistent. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactid>maven-clean-plugin</ Artifactid> <executions> <execution> <id>clean</id> <phase>pre-clean</phase> <goals> <goal> clean</goal> </goals> <configuration> <directory>src/main/webapp/web-inf/lib</ directory> </configuration> </execution> </executions> </plugin>

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.