Gradle don't import VertX library in Eclipse

Viewed 63

I imported a java project on eclipse where there is build.gradle as follow:

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'application'
    id 'java-library'
    id 'eclipse'
}

repositories {
    mavenCentral()
}

dependencies {

    implementation 'io.vertx:vertx-core:4.2.6'    
    implementation 'io.vertx:vertx-web:4.2.6'
    implementation 'io.vertx:vertx-web-client:4.2.6'
    implementation 'io.vertx:vertx-mqtt:4.2.6'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.13.2'

    /* for logging */
    implementation 'org.slf4j:slf4j-api:1.7.25'
    implementation 'org.slf4j:slf4j-jdk14:1.7.36'
}

But eclipse show an error "The import io cannot be resolved", in the code:

import io.vertx.core.Vertx;

/*
 * Data Service as a vertx event-loop 
 */
public class RunService {


    public static void main(String[] args) {
        Vertx vertx = Vertx.vertx();
        DataService service = new DataService(8080);
        vertx.deployVerticle(service);
    }
}

What can i do?

Project structure:

enter image description here

1 Answers

JCenter was deprecated and made read-only last year. Newer versions from this year, like the ones you're trying to use, will never be on JCenter. You need to replace it with mavenCentral().

Related