1

I use maven version range for one of the dependency in project A,

<dependency>
    <groupId>com.test</groupId>
    <artifactId>B</artifactId>
    <version>[0.2,)</version>
</dependency>

In Eclipse I also have project com.test.B in the same Workspace as project A. I want to get version 0.2.5 which is the latest version in my remote repo, but in Eclipse it reference to 0.2.6-SNAPSHOT which is my current development version and I haven't upload to remote repo yet, so I got

'Maven dependencies' references non existing library

error in Eclipse. How can I make Eclipse reference to the latest version in remote repo instead of current version in workspace? I tried Disable workspace resolution, didn't work. delete project B from the workspace do the trick, but I need project B.

cece2048
  • 1,121
  • 2
  • 11
  • 17
  • possible duplicate: https://stackoverflow.com/questions/4407055/how-do-i-stop-maven-version-ranges-from-using-snapshots – Fran Montero Mar 16 '18 at 07:20
  • @FranMontero hey Fran, but in this case, there is no 0.2.6-SNAPSHOT in remote repo or my local ~/.m2 folder – cece2048 Mar 16 '18 at 07:34
  • I found out this is same problem as this https://stackoverflow.com/questions/20100641/maven-m2eclipse-disable-workspace-resolution-causes-artifact-missing/49357084#49357084 and close project B solve this without modify pom or delete the whole project. – cece2048 Mar 19 '18 at 07:02

1 Answers1

1

There are two ways that this can be resolved @Sophia!

  • You could either go to your Project, right click and say 'Maven' -> 'Update Project'
  • If the above approach doesn't help, you can clean your project. Right click on your pom.xml Run as -> Maven build (with the goals as clean install).

When u fire multiple commands in single line..say mvn versions:resolve-ranges clean install...it will fetch SNAPSHOT when do release build.

Try with separate execution of commands.

Firstly run mvn versions:resolve-ranges and then run clean install

Hope these steps solve your problem!

N00b Pr0grammer
  • 4,503
  • 5
  • 32
  • 46