Before marking this question as duplicate, let me tell you this question is a bit different.
I have a project with three modules, namely -ejb, -ear and -web on NetBeans. I am currently working on the -web module, and till last night everything was working fine and I made my git commit
on a working project after which I did a clean and build on my project which failed to build since my internet connection was down. Since I am using ESAPI from OWASP, it needs to download a few dependencies each time while building, and since my internet connection was down, it failed to build.
Today, when I tried to do a clean and build with a working internet connection, the -web module is giving me errors about maven dependencies.
Failed to execute goal on project Papercraft-web: Could not resolve dependencies for project com.onclave.papercraft:Papercraft-web:war:0.00.09.00-METIS: Failed to collect dependencies for [org.springframework:spring-aop:jar:4.2.4.RELEASE (compile), ... org.owasp.esapi:esapi:jar:2.1.0.1 (compile), javax:javaee-web-api:jar:7.0 (provided)]: No versions available for org.owasp.esapi:esapi:jar:[2.0,3) within specified range -> [Help 1]
So the problem is with the esapi
dependency. From other related posts from SO, I found out that if I provide an exact version as a dependency, that might solve the problem, so I did mention the exact dependency as [1.2] which is available at maven central. Now, if I do a clean and build, maven fails again, but this time with:
Failed to execute goal on project Papercraft-web: Could not resolve dependencies for project com.onclave.papercraft:Papercraft-web:war:0.00.09.00-METIS: Failed to collect dependencies for [org.springframework:spring-aop:jar:4.2.4.RELEASE (compile), ... org.owasp.encoder:encoder-esapi:jar:[1.2,1.2] (compile), org.owasp.esapi:esapi:jar:[2.1.0.1,2.1.0.1] (compile), javax:javaee-web-api:jar:7.0 (provided)]: No versions available for org.owasp.esapi:esapi:jar:[2.0,3) within specified range -> [Help 1]
So, it did find the correct version of esapi, i.e., 1.2
but it is giving the same error. I have no idea what is happening here. What am I missing?
This is the dependency:
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder-esapi</artifactId>
<version>[1.2]</version>
</dependency>
I have two questions regarding this,
Thank you.
your artifact & group is not matching either use
<!-- http://mvnrepository.com/artifact/org.owasp.encoder/encoder -->
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>1.2</version>
</dependency>
or use
<!-- http://mvnrepository.com/artifact/org.owasp.esapi/esapi -->
<dependency>
<groupId>org.owasp.esapi</groupId>
<artifactId>esapi</artifactId>
<version>2.1.0.1</version> <!-- check for other versions too, 1.x is not available -->
</dependency>