I am trying to add the javax.servlet-api project to my Maven Java project (see this link for more information about versions for this dependency). I want to add version 3.1.0 to my project. So naturally, I add this dependency to my pom.xml file:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
However, when Maven tries to download the jar/pom files for this artifact, it gets an error because it automatically converts version 3.1.0 to 3.1, which is not its actual version, and it cannot find that version of the artifact in the central Maven repo:
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/3.1/javax.servlet-api-3.1.pom
[WARNING] The POM for javax.servlet:javax.servlet-api:jar:3.1 is missing, no dependency information available
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/3.1/javax.servlet-api-3.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
...
[ERROR] Failed to execute goal on project my-java-project: Could not resolve dependencies for project com.example.myproject:my-project:war:1.0-SNAPSHOT: Could not find artifact javax.servlet:javax.servlet-api:jar:3.1 in central (http://repo.maven.apache.org/maven2) -> [Help 1]
Does anyone know how I can tell Maven to not strip off trailing zeroes in the version tag of a dependency in my pom.xml file? Any other workaround known?
NOTE: I did check out this SOF post (Maven dependency for Servlet 3.0 API?), but this author's solution was to use a <scope>provided</scope>
dependency for servlet-api, which I do not have interest in doing becuase I want to avoid needing to use the provided scope.