4편 JAVA spring boot study - java 코드 파일 build하기

송인성·2022년 3월 12일

우선 해당 폴더로 build하고 싶은 gradlew build파일이 있는 프로젝트 파일로 이동을 합니다.
각자 프로젝트 path가 다를것이기때문에 이부분은 생략하겠습니다.

해당 프로젝트에 gradle 파일이 있는지 확인합니다.

	./gradlew build

build가 성공적으로 되었다면 아래와 같은 메시지가 나옵니다.

	BUILD SUCCESSFUL in 1s
	7 actionable tasks: 7 up-to-date
	cd build
    cd libs
	ls

를 입력하면

	hello-spring-0.0.1-SNAPSHOT-plain.jar 
	hello-spring-0.0.1-SNAPSHOT.jar

와 같이 나오게 됩니다. 저는 빌드를 두번 했기때문에 두개가 나왔습니다.
해당 빌드된 파일중에 어떤것 실행할지 결정합니다.

java -jar hello-spring-0.0.1-SNAPSHOT.jar

아래와 같이 성공적으로 실행되는 것을 볼 수 있습니다.
저는 8080에 인텔리제이 상에서 이미 실행한 애플리케이션이 있기에 port에러가 있었지만 8080 포트를 사용하는 애플리케이션이 없었다면 성공적으로 실행될 것입니다!

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.4)

2022-03-12 16:29:42.353  INFO 11257 --- [           main] h.hellospring.HelloSpringApplication     : Starting HelloSpringApplication using Java 11.0.11 on insungsong.local with PID 11257 (/Users/insungsong/Documents/spring-study/hello-spring/build/libs/hello-spring-0.0.1-SNAPSHOT.jar started by insungsong in /Users/insungsong/Documents/spring-study/hello-spring/build/libs)
2022-03-12 16:29:42.356  INFO 11257 --- [           main] h.hellospring.HelloSpringApplication     : No active profile set, falling back to 1 default profile: "default"
2022-03-12 16:29:43.103  INFO 11257 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-03-12 16:29:43.118  INFO 11257 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-03-12 16:29:43.118  INFO 11257 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.58]
2022-03-12 16:29:43.176  INFO 11257 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-03-12 16:29:43.176  INFO 11257 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 765 ms
2022-03-12 16:29:43.407  INFO 11257 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: class path resource [static/index.html]
2022-03-12 16:29:43.522  WARN 11257 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.PortInUseException: Port 8080 is already in use
2022-03-12 16:29:43.525  INFO 11257 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-03-12 16:29:43.540  INFO 11257 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-03-12 16:29:43.555 ERROR 11257 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
profile
코드 한줄에 의미를 생각할 수 있는 개발자가 되어 가는중... 🧑🏻‍💻

0개의 댓글