范围“提供"不在类路径中添加jar [英] scope "provided" does not add in jars in classpath

查看:65
本文介绍了范围“提供"不在类路径中添加jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用工件的范围提供的" pom文件的依赖项.由于存在提供的"范围,因此这些依赖项jar不会添加到MANIFEST.MF的类路径中.

I am using a dependency of scope "provided" pom file of an artifact. Because of "provided" scope, those dependency jars are not added in classpath of MANIFEST.MF.

您能帮我吗,这样罐子不应该下载,而应该添加到类路径中.

Could you help me so that the jars should not be downloaded but should be added in classpath.

推荐答案

好吧,如果您希望它在语义上正确,请删除<scope>provided</scope>并将其保留为默认值(<scope>compile</scope>).然后将<optional>true</optional>设置为依赖项,以便将其包含在清单的类路径中.

Well, if you want it semantically right, remove <scope>provided</scope> and leave it default (<scope>compile</scope>). Then set <optional>true</optional> for a dependency, so it will be included in manifest's classpath.

通过使用provided范围,您实际上是说您不希望它出现在清单的类路径中,因为它总是由容器提供的.

By using provided scope you actually say that you don't want it to be in manifest's classpath since it's anyway provided by the container.

这篇关于范围“提供"不在类路径中添加jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆