Reputation: 13
I'm new in Jenkins plugin development and I'm creating a plugin from which I want to make an HTTP request to a REST API and parse JSON result.
I found that I can make fetch() request in Jelly using script tags but I need to do it in Java.
I tried to add some import as:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
when I run mvn hpi:run
I got the message: 'package java.net.http does not exist'
Any ideas?
Upvotes: 1
Views: 331
Reputation: 161
What's your version of Java? If it's java 11, then try like below:
import java.net.http.HttpClient;
where the module name is java.net.http
Did you add the dependency to the java.net.http package? if not try this:
module org.example {
requires java.httpclient;
}
for more details: http://cr.openjdk.java.net/~mr/jigsaw/ea/module-summary.html
Upvotes: 0