현재 참여하고 있는 Java 백엔드 개발자 양성 부트 캠프에서 드디어 프로젝트에 돌입하게 되었다.
우리 조는 블로그를 만들기로 했다. (아직 구체적인 아이디어는 미정, 내일 진행할 예정이다.)
1. 환경설정
현재 에디터로
Spring tools 4 for eclipse 4.19.1 버전을 사용하고 있다.
그렇다. eclipse는 2021-03 (4.19.0)버전을 쓰고 있다.
부트캠프에서 배웠던 Java 8을 기반으로 Spring boot를 활용하기로 했다.
Maven과 Gradle 사이에서 고민했는데, 이 둘 중 Gradle이 속도가 더 빨라서 Gradle을 선택했다.
https://hyojun123.github.io/2019/04/18/gradleAndMaven/
JDK 8
Spring Boot 2.0
Gradle
Oracle DB
그 후 Spring Initializer를 활용하여 dependencies를 설정해주었다.
테스팅을 위해 "hello world"를 보여주는 index.html 파일을 추가해보았다.
그런데 돌아가질 않고 에러가 떠버렸다...
그래서 다시 찾아보니 application.properties에 제대로 설정하질 않았다.
https://7942yongdae.tistory.com/128
Spring error - Failed to configure a DataSource 에러 원인과 해결 방법
Failed to configure a DataSource 에러와 원인과 해결 방법 메시지 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. *************************** APPLICATION FAILED TO START ********
7942yongdae.tistory.com
2. Github에 올려 팀원들과 공유
여기서 의문점 어떤 사항들에 대해서 gitignore를 적용해야 할까?
그래서 찾아본 것들
https://4z7l.github.io/2020/07/06/gitignore.html
https://github.com/github/gitignore/blob/main/Gradle.gitignore
https://beomseok95.tistory.com/133
Spring initializer를 활용하다보니 자동으로 생성된 gitignore가 있었다.
거기에 *.properties를 추가해주었다.
Oracle DB에 접속할 때 사용하는 사용자와 사용자 비밀번호가 존재해서 넣어주었다.
그러나
다른 팀원들이 깃허브에서 pull을 해도 실행되지 않는 문제가 있었다.
자세히보니 gradle-wrapper.jar를 아직 커밋하지 않았었다.
왜 gradle-wrapper.jar 파일이 필요한지 찾아보니 빌드를 효율적으로 하도록 도와주는 것이었다.
이게 없다보니 빌드가 안되었다.
the gradle wrapper files are meant to be stored along with the other sources of your project in the version control system. the two main benefits of using the wrapper:
Standardizes a project on a given Gradle version, leading to more reliable and robust builds.
Provisioning a new Gradle version to different users and execution environment (e.g. IDEs or Continuous Integration servers) is as simple as changing the Wrapper definition.
https://discuss.gradle.org/t/adding-gradle-wrapper-files-to-gitignore/27428
Adding gradle wrapper files to gitignore
Why are people checking in these files to git? gradlew gradlew.bat gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties I have added these files to .gitignore. I don’t like having such files to VCS. The recommended way to execute an
discuss.gradle.org
그래서! 후에 내가 이 프로젝트를 풀했을 때 해야하는 것을 정리하고자 한다.
3. 프로젝트 시작하기
1) Github clone하기
git clone https://github.com/yujinns/blogProject
2) src/main/resources 디렉터리에 applications.properties 파일 추가하기
3) gradle/wrapper 디렉터리에 gradle-wrapper.properties 파일 추가하기
'Backend' 카테고리의 다른 글
[프로젝트] 블로그 만들기 #2. Mapper와의 전쟁 (0) | 2023.09.03 |
---|---|
[프로젝트] Nutrient API #1. 초기 세팅 및 에러 처리 (1) | 2023.08.27 |
[SpringBoot] 반갑다! 봄! (0) | 2023.04.14 |
[배포] HTTP로 웹 캠 사용이 안 될 때 HTTPS 적용 (0) | 2022.07.01 |
[Nginx] https 설정 (0) | 2022.07.01 |