인텔리제이 라이브러리 다운받는법
필요한 라이브러리 찾은 후

복사해서

build.gradle → dependencies 에 붙여넣기 후

새로고침

package com.metacoding.myhttp;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class MyApp {
public static void main(String[] args) {
try {
URL url = new URL("https://jsonplaceholder.typicode.com/todos/1");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream())
);
String download = "";
while(true){
String line = br.readLine();
if(line == null) break;
download = download + line;
}
System.out.println(download);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
오후 2:56:52: Executing ':MyApp.main()'...
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
Note: D:\workspace\java_lec\myhttp\src\main\java\com\metacoding\myhttp\MyApp.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :MyApp.main()
{ "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 536ms
2 actionable tasks: 2 executed
오후 2:56:53: Execution finished ':MyApp.main()'.
Lombok 세팅



file - settings - plugins

적용해보기

class User {
int id = 1;
String username = "ssar";
}
<user>
<id>1</id>
<username>"ssar"</username>
</user> // xml
{
"id":1,
"username":"ssar"
} // json
Share article