Overview
This may be a trivial question or may not be eligible to be here but any suggestion will be helpful.
When a dependency is added to the pom.xml
bunch of errors show up while compiling a project into java jar without any code change what so ever
Steps
Clone a git repo for the project and execute
mvn clean compile
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.743 s [INFO] Finished at: 2018-05-31T22:21:04+00:00 [INFO] Final Memory: 25M/389M [INFO] ------------------------------------------------------------------------
Add new required dependency to pom.xml of the same project MVN Ref
<dependency> <groupId>org.apache.storm</groupId> <artifactId>storm-hive</artifactId> <version>1.1.1</version> </dependency>
Now again execute
mvn clean compile
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project saavn-storm-lib: Compilation failure: Compilation failure: [ERROR] /home/user/backend/storm/storm_lib/src/main/java/com/storm/bolts/Helper.java:[167,57] unreported exception org.json.JSONException; must be caught or declared to be thrown . . . .
Multiple occurrences of JSONException related error message, followed by
[ERROR] /home/user/backend/storm/storm_lib/src/main/java/com/storm/bolts/Helper.java:[132,58] cannot find symbol [ERROR] symbol: method unescapeJson(java.lang.String) [ERROR] location: class org.apache.commons.lang3.StringEscapeUtils
More info
pom.xml
contains<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.3.2</version> </dependency>
Corresponding dependency is present locally as well
ls -l ~/.m2/repository/org/apache/commons/commons-lang3/3.3.2/ commons-lang3-3.3.2.jar commons-lang3-3.3.2.jar.sha1 commons-lang3-3.3.2.pom commons-lang3-3.3.2.pom.sha1 _remote.repositories
This method is deprecated in subsequent releases but it is very much present in this version and it was working so far.
Question
- Why these were not shown in the first place as they seems to be present already, given no code was modified ?
JSONException
related errors can be taken care of but why some dependency is suddenly missing and how to rectify that ?