I have a perfectly running maven project with a pom.xml file, which has some in inconsistent dependencies like few dependencies needing the same jar file, but with different versions. While the project is running nicely with in the intelliJ, but not from command line using Maven due to these dependency inconsistencies like below. Could not resolve version conflict among these:

[io.cucumber:cucumber-java:jar:7.0.0 -> io.cucumber:cucumber-core:jar:7.0.0 -> io.cucumber:messages:jar:17.1.1,   
io.cucumber:cucumber-java:jar:7.0.0 -> io.cucumber:cucumber-core:jar:7.0.0 -> io.cucumber:html-formatter:jar:17.0.0 -> io.cucumber:messages:jar:[17.1.0,18.0.0),    
io.cucumber:cucumber-java:jar:7.0.0 -> io.cucumber:cucumber-core:jar:7.0.0 -> io.cucumber:create-meta:jar:6.0.1 -> io.cucumber:messages:jar:[17.0.1,18.0.0),    
me.jvt.cucumber:reporting-plugin:jar:7.11.0 -> io.cucumber:gherkin:jar:26.0.3 -> io.cucumber:messages:jar:[19.1.4,22.0.0)] 

While trying to update the dependency versions, I have edited the pom.xml on the MAC file system, while the pom.xml file is in git control, which I feel is wrong thing to do. This resulted in the total pom.xml file getting corrupted, I assume.

Even after complete removal(including folders at ~/Library/Application Support/JetBrains/ideaC2023.1, ideaC2022.1 etc) and installation of the intelliJ CE, I keep seeing the same errors.

First the few of the errors, and the corresponding existing dependencies

(1)java: package org.apache.logging.log4j does not exist==>
   

   <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-core</artifactId>
       <version>2.20.0</version>
   </dependency>
   <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
   <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
       <version>2.20.0</version>
   </dependency>

(2) java: package io.appium.java_client does not exist==>
    

    <dependency>
       <groupId>io.appium</groupId>
       <artifactId>java-client</artifactId>
       <version>8.5.1</version>
   </dependency>

(3) java: package io.restassured.path.json does not exist ==>
  

   <dependency>
       <groupId>org.json</groupId>
       <artifactId>json</artifactId>
       <version>20230227</version>
   </dependency>

(4) java: package io.cucumber.java.en does not exist -->

             <dependency>
               <groupId>io.cucumber</groupId>
               <artifactId>cucumber-java</artifactId>
               <version>7.0.0</version>
           </dependency>```


----------
I did closed the project, reopened it, and invalidated the cache and restarted the intelliJ etc., the regular trouble shooting stuff. Overall, the pom.xml file is totally is being disregarded. I also, deleted the project on the file system, and re-cloned the same project (which I pushed to the repo just yesterday), but still the same fate.

I believe giving complete pom.xml file here is not that useful, even though I don't mind it at all. Another tit bit of info is that earlier the  pom.xml file is consistently giving **'stackoverflow error'**, but this never prevented the project from compiling and running just fine.

I am using JDK 17.0.7 and maven 3.8.3 and used 3.9.2 also. 

***I am thinking this is some sort of corruption of the intelliJ CE work space, which I can't get cleaned up.***

Thanks a lot for your helpful suggestions.

----------



1

There are 1 answers

0
PraNuta On

I could able to solve this problem in this manner.

  1. Simply cut all the dependencies and save them in a separate place. Save the pom.xml file and Project --> rebuild, but don't run the project. Disregard any error messages, quoting the missing classes which is obvious.
  2. Add the dependencies from the original list one by one, and doing the save, rebuild cycle sequentially. You would see the missing class errors reported getting reduced little by little as you keep adding the Maven dependencies.
  3. Do this until you have added all the dependencies back in to pom.xml file one by one and all the build errors of missing classes, packages will be gone.
  4. If you get any transitive dependency messages, add that message causing dependency at a higher version available at maven repository as an additional dependency(which has no vulnerability). This way you can resolve all the transitive dependency messages in intelliJ which is like an yellow shade around the dependency.