Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Maven relies on jar packages in local non-repository-handling of client compilation errors when jar packages are placed in directories such as WEB-INF/lib

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

MAVEN

Today, when packaging a web application using maven compilation, I encountered a problem:

The project introduced the dependency jar package in the development, placed it in the WEB-INF/lib directory, and imported the web libariary through buildpath.

There's no problem with developing in eclipse, but it's cheap to start with maven compiling plug-ins and you can't always find the classes in the jar package WEB-INF/lib.

Obviously, WEB-INF/lib is not configured in the maven-complier-plugin plug-in src directory at compile time.

So add this directory, it still doesn't work. Scoundrel, first install this jar package into the local library, and then add dependency.

Later, google found that maven provides a dependency on scope for system. The original text of the document is as follows:

System

This scope is similar to provided except that you have to provide the JAR which contains it explicitly.

The artifact is always available and is not looked up in a repository.

This allows you to add dependency without having to install the jar package in the WEB-INF/lib directory into the local library.

Record the specific configuration:

Xml code

Org.apache

Test

1.0

System

${basedir} / src/main/webapp/WEB-INF/lib/paypal_base.jar

! A better way is to configure the compilation parameters and add extdirs to add the relative path of the jar package to the configuration, as follows:

Maven-compiler-plugin

1.6

1.6

UTF-8

Src\ main\ webapp\ WEB-INF\ lib

Get [download address]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report