如何在我的Maven项目中包含javax.servlet servlet-api 3.0.1?

时间:2017-05-05 14:37:35

标签: spring maven jar dependencies javax

我正在使用Maven 3.3。我是否需要添加任何特殊的存储库才能访问servlet-api 3.0.1 jar?我已将此添加到我的pom.xml文件

<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]

我需要这种依赖,因为我被告知anoterh依赖(spring-test-4.0.6.RELEASE)需要这个。

1 个答案:

答案 0 :(得分:0)

看看spring-test-4.0.6的pom.RELEASE: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>