Develop/git-github

git & github basic - DSC Ewha 세션 | git & github basic - DSC Ewha Session

DSC Ewha에서 진행하는 미니세미나에서 세번의 발표를 하게되었습니다.두번째 세션으로 git과 github의 기초개념과 가장 메인이되는 커맨드를 알려드렸습니다 :) Git basic from 민정 김 I gave three presentations at the mini seminar held by DSC Ewha.In the second session, I covered the basic concepts of git and github, along with the most essential commands :) Git basic from 민정 김

git & github basic - DSC Ewha 세션 | git & github basic - DSC Ewha Session

728x90

DSC Ewha에서 진행하는 미니세미나에서 세번의 발표를 하게되었습니다.
두번째 세션으로 git과 github의 기초개념과 가장 메인이되는 커맨드를 알려드렸습니다 :)

 

 

I gave three presentations at the mini seminar held by DSC Ewha.
In the second session, I covered the basic concepts of git and github, along with the most essential commands :)

 

 

댓글

Comments

Develop/Springboot

[inflearn] 스프링 부트 개념과 활용 2.스프링 부트 시작하기 | [inflearn] Spring Boot Concepts and Utilization 2. Getting Started with Spring Boot

1. Spring Boot 소개1-1. Spring Boot Start특징토이를 만드는게 아니라 제품수준의 어플리케이션을 만들때 도와주는 툴.opinated view : 스프링 부트가 갖고있는 컨벤션을 의미한다 (널리 사용되는 설정)Spring platform에 대한 기본 설정 뿐만아니라 다른 library에 대한 설정(tomcat)도 기본적으로 해준다목표모든 스프링 개발을 할 때 더 빠르고 더 폭넓은 사용성을 제공한다.일일히 설정하지 않아도 convention으로 정해져있는 설정을 제공한다. 하지만 우리의 요구사항에 맞게 이런 설정을 쉽고 빠르게 바꿀 수 있다.(스프링 부트를 사용하는 이유)non-fucntional 설정도 제공해 준다. 비즈니스로직 구현에 필요한 기능 외에도 non-functional..

[inflearn] 스프링 부트 개념과 활용 2.스프링 부트 시작하기 | [inflearn] Spring Boot Concepts and Utilization 2. Getting Started with Spring Boot

728x90

1. Spring Boot 소개

1-1. Spring Boot Start

특징

토이를 만드는게 아니라 제품수준의 어플리케이션을 만들때 도와주는 툴.

opinated view : 스프링 부트가 갖고있는 컨벤션을 의미한다 (널리 사용되는 설정)

Spring platform에 대한 기본 설정 뿐만아니라 다른 library에 대한 설정(tomcat)도 기본적으로 해준다

목표

  • 모든 스프링 개발을 할 때 더 빠르고 더 폭넓은 사용성을 제공한다.
  • 일일히 설정하지 않아도 convention으로 정해져있는 설정을 제공한다. 하지만 우리의 요구사항에 맞게 이런 설정을 쉽고 빠르게 바꿀 수 있다.(스프링 부트를 사용하는 이유)
  • non-fucntional 설정도 제공해 준다. 비즈니스로직 구현에 필요한 기능 외에도 non-functional feature도!
  • XML 사용하지 않고, code generation도 하지 않는다.

Spring 루 : 독특하게 code generation을 해주는데 지금은 잘 사용되지 않는다. generation을 안해서 더 쉽고 명확하고 커스터마이징하기 쉽다. > spring boot의 bb

System Requirements

Spring boot 는 java 8 이상을 필요로 한다.

지원하는 servletContainer로는 tomcat, jetty Undertow가 있다.

 

2. Spring Boot 시작하기

Intellij ultimate를 사용하면 Spring boot initializer가 있으나, community 버전은 없다. 따라서 자신이 원하는 build tool을 이용해서 만들어 주면된다 Spring boot initializer를 이용하지 않고, 프로젝트 생성하는 법 을 공부 할 것이다.

 

2-1. gradle project에서 시작

 

auto import OK (build.gradle 파일 변경할 때 마다 바로바로 변경 : dependency 추가 등)

spring.io > project > spring boot > Learn > Reference Doc > Gradle Installation

https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/#getting-started-gradle-installation

 

Spring Boot Reference Guide

This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use and customize. If you have not already done so, you might want to read the "Part II, “Getting Started”" and "Part III, “Using Spring Boot

docs.spring.io

 

build.gradle

build.gradle 파일을 입력해준다.

plugins {
    id 'org.springframework.boot' version '2.0.3.RELEASE'
    id 'java'
}

의존성 관리와 매우 관련이 있는 설정이다.

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

일반적으로 프로젝트는 하나이상의 "starter"에 대한 의존성을 선언한다.
spring boot는 의존성 선언을 간소화했으며, jar를 생성하는데 유용한 Gradle 플러그인을 제공한다.

 

initial build.gradle 파일

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    baseName = 'spring-boot-getting-started'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

 

SpringBootApplication.java

package com.jyami;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String args[]){
        SpringApplication.run(Application.class, args);
    }

}

 

SpringBootApplication 어노테이션을 사용해서, SpringApplication을 run하는 메소드 호출

Spring MVC가 돌아가려면 여러 dependency가 필요한데, 어떻게 하여 수많은 의존성들이 들어왔는가?

mvc앱을 설정해야하는데 (bean, tomcat .. )

: 이게 @SpringBootApplication에 설정되어있다. > InableAutoCompletecation

 

Intellij 설정에서
Build, Execution, Deployment > Compiler > Annotation Processors에 들어가
Enable annotation processing에 체크해줘야 gradle로 build한 annotation들을 사용할 수 있다.

 

Run (실행하기)

Run을 하고 log를 보면 벌서 Tomcat이 8080 port에서 실행되고 있음을 알 수 있고
http://localhost:8080 을 띄어보면, tomcat web application이 동작함을 알 수 있다. (error이긴 하지만)

 

build (빌드하기)

gradle build

이 package를 build한다. java프로젝트이므로 jar파일이 생성되고, 이 jar파일을 생성한다

java -jar build/libs/spring-boot-getting-started-0.1.0.jar

jar 파일을 실행하면, 아까와 같은 spring web application이 동작하게 된다.

 

 

2-2. 웹으로 Spring Boot project 시작

http://start.spring.io

원하는 build 형태의 spring boot project를 생성해준다. (dir 형태로!)

 

 

3. 스프링 프로젝트의 구조

gradle java 기본 프로젝트 구조와 동일하다

저장 파일 파일 경로 설명
소스 코드  src/main/java -
소스 리소스 src/main/resource java application에서 resources 기준으로 아래 것들을 참조 가능 (classpath)
테스트 코드 src/test/java -
테스트 리소스 src/test/resource test 관련 리소스를 만들 수 있다

 

메인 애플리케이션 위치 (@SpringBootApplication) : 기본 패키지  package com.jyami
프로젝트가 쓰고있는 가장 최상위 패키지! > why? 컴포넌트 스캔을 하기 때문

com.jyami에서부터 시작을 해서, 그 아래에 있는 파일들을 스캔해서 bean으로 등록한다.

 

src/main/java 위치에 넣으면 모든 패키지를 스캔하므로

 

만약 java>com.hello 패키지가 있고, 그안에 메인 애플리케이션이 아닌 java파일이 있으면, 그 java파일은 component 스캔이 이루어지지 않는다.

1. Introduction to Spring Boot

1-1. Spring Boot Start

Features

It's a tool that helps you build production-level applications, not just toy projects.

opinated view : This refers to the conventions that Spring Boot has (widely used configurations)

It provides default configurations not only for the Spring platform but also for other libraries (like tomcat) out of the box.

Goals

  • Provides faster and broader usability for all Spring development.
  • Provides convention-based configurations without having to set everything up manually. But you can easily and quickly change these settings to match your requirements. (This is the reason to use Spring Boot)
  • Provides non-functional configurations as well. Beyond features needed for business logic, it also covers non-functional features!
  • Does not use XML and does not do code generation.

Spring Roo : It uniquely does code generation, but it's not widely used anymore. By not doing generation, things are easier, clearer, and simpler to customize. > The predecessor of Spring Boot

System Requirements

Spring Boot requires Java 8 or higher.

Supported servlet containers include Tomcat, Jetty, and Undertow.

 

2. Getting Started with Spring Boot

If you use IntelliJ Ultimate, it has a Spring Boot Initializer built in, but the Community edition does not. So you can create one using whichever build tool you prefer. We'll learn how to create a project without using the Spring Boot Initializer.

 

2-1. Starting from a Gradle Project

 

auto import OK (Applies changes immediately whenever the build.gradle file is modified: adding dependencies, etc.)

spring.io > project > spring boot > Learn > Reference Doc > Gradle Installation

https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/#getting-started-gradle-installation

 

Spring Boot Reference Guide

This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use and customize. If you have not already done so, you might want to read the "Part II, “Getting Started”" and "Part III, “Using Spring Boot

docs.spring.io

 

build.gradle

Enter the build.gradle file content.

plugins {
    id 'org.springframework.boot' version '2.0.3.RELEASE'
    id 'java'
}

This is a configuration closely related to dependency management.

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

Typically, a project declares dependencies on one or more "starters".
Spring Boot simplifies dependency declarations and provides a useful Gradle plugin for generating jars.

 

initial build.gradle file

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    baseName = 'spring-boot-getting-started'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

 

SpringBootApplication.java

package com.jyami;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String args[]){
        SpringApplication.run(Application.class, args);
    }

}

 

Using the SpringBootApplication annotation to call the method that runs SpringApplication

Spring MVC requires many dependencies to run — so how did all those dependencies get pulled in?

We need to configure the MVC app (bean, tomcat, etc.)

: This is all configured in @SpringBootApplication. > EnableAutoConfiguration

 

In IntelliJ settings, go to
Build, Execution, Deployment > Compiler > Annotation Processors and
check Enable annotation processing to be able to use annotations built with Gradle.

 

Run

When you run the application and check the logs, you can see that Tomcat is already running on port 8080.
If you open http://localhost:8080, you can confirm that the Tomcat web application is working. (Even though it shows an error page)

 

Build

gradle build

This builds the package. Since it's a Java project, a jar file is generated.

java -jar build/libs/spring-boot-getting-started-0.1.0.jar

When you run the jar file, the same Spring web application will start up just like before.

 

 

2-2. Starting a Spring Boot Project from the Web

http://start.spring.io

It generates a Spring Boot project in your desired build format. (As a directory structure!)

 

 

3. Spring Project Structure

It follows the same structure as a standard Gradle Java project.

File Type File Path Description
Source Code  src/main/java -
Source Resources src/main/resource In a Java application, files below the resources directory can be referenced (classpath)
Test Code src/test/java -
Test Resources src/test/resource You can create test-related resources here

 

Main Application Location (@SpringBootApplication) : Default package  package com.jyami
This should be in the topmost package of the project! > Why? Because of component scanning.

Starting from com.jyami, it scans files underneath and registers them as beans.

 

If you place it directly under src/main/java, it would scan all packages.

 

If there's a package java>com.hello with a Java file that isn't the main application, that Java file will not be picked up by component scanning.

댓글

Comments

Develop/git-github

git-flow 전략

git-flow clean code study에서 앞으로의 협업을 대비하여 git-flow 전략을 이해하고 실습하는 시간을 가졌습니다.당시 스스로 작성한 노트입니다. git-flow 전략을 이해하기 위해 아래 우아한 형제들 블로그를 참고했습니다. http://woowabros.github.io/experience/2017/10/30/baemin-mobile-git-branch-strategy.html 우린 Git-flow를 사용하고 있어요 - 우아한형제들 기술 블로그안녕하세요. 우아한형제들 배민프론트개발팀에서 안드로이드 앱 개발을 하고 있는 나동호입니다.오늘은 저희 안드로이드 파트에서 사용하고 있는 Git 브랜치 전략을 소개하려고 합니다. ‘배달의민족 안드로이드 모바일 파트에서 이렇게 브랜치를 관리하고..

git-flow 전략

728x90

git-flow

 

clean code study에서 앞으로의 협업을 대비하여 git-flow 전략을 이해하고 실습하는 시간을 가졌습니다.

당시 스스로 작성한 노트입니다. 

 

git-flow 전략을 이해하기 위해 아래 우아한 형제들 블로그를 참고했습니다.

 

http://woowabros.github.io/experience/2017/10/30/baemin-mobile-git-branch-strategy.html

 

우린 Git-flow를 사용하고 있어요 - 우아한형제들 기술 블로그

안녕하세요. 우아한형제들 배민프론트개발팀에서 안드로이드 앱 개발을 하고 있는 나동호입니다.오늘은 저희 안드로이드 파트에서 사용하고 있는 Git 브랜치 전략을 소개하려고 합니다. ‘배달의민족 안드로이드 모바일 파트에서 이렇게 브랜치를 관리하고 있구나’ 정도로 봐주시면 좋을 것 같습니다.

woowabros.github.io

 

1. Branch Naming

master

배포버전 브랜치 > tag를 이용해서 버전을 기록한다.

  • X . 0 : 프로젝트 추가
  • 1 . X : 기능 추가

 

develop

개발 브랜치

  • 2줄 전략 : merge + rebase 를 이용해서 git flow를 이쁘게 본다! 어느 시점에 반영이 됐는지 보기 위해서

 

feature

기능 브랜치

  • develop에서 갈라져 나온 기능 : git flow를 깔끔하게 보기 위해, origin develop의 갈라나온 시점을 잘 관리해 주어야 한다. git pull --rebase origin devlop 을 이용해서 제일 마지막에 반영된 develop에서 branch가 갈라 나온 것 처럼 보이게 한다.

 

hotfixes

배포버전에서 버그가 났을 떄 고치기 위한 브랜치

  • hotfixes에서 수정하고 나면 develop과 master에 push한다.

 

release

배포 직전에 QA 수정

  • 베타 서버와 같은 버전, QA 받고 나면 develop과 master에 push한다.

 

 

2. github issue 이용 관련 intelli J 단축키

ctrl+shift+a - intellij에 github 등록해서 issue 바로 접근

alt+shift+n  - issue이름으로 feature branch를 딴다.

 

 

3. git-flow 전략에 따른 git bash 명령어

git checkout feature/git-flow-2

git fetch                                     ## 원격에 있는 반영사항들을 local에 알리기

git commit -m "git-flow-2 commit"

git pull --rebase origin develop

git push origin feature/git-flow-2

git checkout develop

git pull origin devlop

git merge --no-ff feature/git-flow-2

git push origin develop

커밋 메시지 여러개를 하나로 !

git rebase -i HEAD~2
# s : commit 최신것을 스쿼시하겠다. 둘중에 의미없는 message를 지우거나 수정한다.

git-flow

 

In our clean code study group, we took some time to understand and practice the git-flow strategy to prepare for future collaboration.

These are the notes I wrote at the time. 

 

To understand the git-flow strategy, I referenced the blog post from Woowa Brothers (Baemin) below.

 

http://woowabros.github.io/experience/2017/10/30/baemin-mobile-git-branch-strategy.html

 

We Use Git-flow - Woowa Brothers Tech Blog

Hello, I'm Dongho Na, an Android app developer on the Baemin Front-end Development Team at Woowa Brothers. Today, I'd like to introduce the Git branch strategy we use in our Android team. Think of it as a look into how the Baemin Android mobile team manages their branches.

woowabros.github.io

 

1. Branch Naming

master

Release version branch > Uses tags to record versions.

  • X . 0 : New project added
  • 1 . X : New feature added

 

develop

Development branch

  • Two-line strategy: Use merge + rebase to keep the git flow looking clean! This helps you see at which point changes were integrated.

 

feature

Feature branch

  • Branches off from develop: To keep the git flow looking clean, you need to carefully manage the point where it diverges from origin develop. Use git pull --rebase origin devlop to make it look like the branch was created from the latest reflected develop.

 

hotfixes

Branch for fixing bugs found in the release version

  • After fixing in hotfixes, push to both develop and master.

 

release

QA fixes right before deployment

  • Same version as the beta server. After QA is done, push to both develop and master.

 

 

2. IntelliJ Shortcuts for Using GitHub Issues

ctrl+shift+a - Register GitHub in IntelliJ to access issues directly

alt+shift+n  - Create a feature branch named after the issue.

 

 

3. Git Bash Commands Following the git-flow Strategy

git checkout feature/git-flow-2

git fetch                                     ## 원격에 있는 반영사항들을 local에 알리기

git commit -m "git-flow-2 commit"

git pull --rebase origin develop

git push origin feature/git-flow-2

git checkout develop

git pull origin devlop

git merge --no-ff feature/git-flow-2

git push origin develop

Squash multiple commit messages into one!

git rebase -i HEAD~2
# s : commit 최신것을 스쿼시하겠다. 둘중에 의미없는 message를 지우거나 수정한다.

댓글

Comments