2017-05-05 54 views
0

我正在使用Maven 3.3。我是否需要添加任何特殊的存储库来访问servlet-api 3.0.1 jar?我已经添加到了我的pom.xml文件如何在我的Maven项目中包含javax.servlet servlet-api 3.0.1?

<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>servlet-api</artifactId> 
    <version>3.0.1</version> 
    <scope>provided</scope> 
</dependency> 

但是当我尝试做一个构建,我得到这个错误...

[ERROR] Failed to execute goal on project core: Could not resolve dependencies for project org.collegeboard.springboard:core:jar:99.0.0-SNAPSHOT: Could not find artifact javax.servlet:servlet-api:jar:3.0.1 in thirdparty (https://nexus.getmyco.com/nexus/content/repositories/thirdparty/) -> [Help 1] 

我需要这种依赖性,因为有人告诉我taht anoterh依赖(spring-test-4.0.6.RELEASE)需要这个。

回答

0

看看Spring-测试4.0.6.RELEASE的POM:http://search.maven.org/#artifactdetails|org.springframework|spring-test|4.0.6.RELEASE|jar

它实际上取决于以下因素:

<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>javax.servlet-api</artifactId> 
    <version>3.0.1</version> 
    <scope>compile</scope> 
    <optional>true</optional> 
</dependency> 
+0

能的范围被设定为 “规定”?据我所知,servelet-api默认由servlet容器提供。 – Shinchan

+0

范围应该设置为'提供'否则它是错误的。 – khmarbaise

+0

您可以按照您想要的方式设置范围。这只是来自Spring-POM的复制粘贴,向您展示如何通过自己了解Spring或任何其他库的依赖关系。 –

相关问题