Kubernetes-client: Could not resolve dependencies for project io.fabric8:openshift-client:jar:3.1-SNAPSHOT

Created on 18 Jan 2018  ·  6Comments  ·  Source: fabric8io/kubernetes-client

# mvn compile
[ERROR] Failed to execute goal on project openshift-client: Could not resolve dependencies for project io.fabric8:openshift-client:jar:3.1-SNAPSHOT: Failure to find io.fabric8:kubernetes-client:jar:tests:3.1-SNAPSHOT in https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of sonatype-nexus-snapshots has elapsed or updates are forced 

Most helpful comment

@harryge00

You need to hit mvn clean install first. Then 3.1-SNAPSHOT will get available in your local repository. After that, if you hit the mvn compile, it will work.

If you are updating it to 3.1.0 it is fetching the respected version from maven central and in case of 3.1-SNAPSHOT it's not able to find that version on maven central and giving the error.

Can you please try and let us know if this solves your problem

Thanks

All 6 comments

Change the 3.1-SNAPSHOT to 3.1.8 and the it works

@harryge00

You need to hit mvn clean install first. Then 3.1-SNAPSHOT will get available in your local repository. After that, if you hit the mvn compile, it will work.

If you are updating it to 3.1.0 it is fetching the respected version from maven central and in case of 3.1-SNAPSHOT it's not able to find that version on maven central and giving the error.

Can you please try and let us know if this solves your problem

Thanks

@piyush1594 Thanks for the prompt reply! It works. Just another question, how can I run the code in kubernetes-example?

I have tried the following

#  java -cp kubernetes-examples/target/kubernetes-examples-3.1-SNAPSHOT.jar io.fabric8.kubernetes.examples.ListExamples 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: io/fabric8/kubernetes/client/KubernetesClientException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: io.fabric8.kubernetes.client.KubernetesClientException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

@harryge00

You need to hit the following command

mvn exec:java -Dexec.mainClass="io.fabric8.kubernetes.examples.ListExamples" -Dexec.args="your-clister-url"

We are using exec-maven-plugin for this purpose.

Please try and revert back if you are not able to do so.

Thanks

@piyush1594 It works! Thanks so much.
I suggest adding how to build through maven in README so beginners can start developping.

@harryge00 Sure, we will do the needful.

Thanks for getting your hands dirty.

Was this page helpful?
0 / 5 - 0 ratings