Skip to content

youngwan657/template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

202 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Template

travis-ci

Skill Set

  • Spring : Java Framework
  • Spring Social : Social Login (facebook)
  • Spring Mobile : Spring Mobile MVC
  • Mybatis : SQL mapping Framework
  • Ehcache : cache Framework
  • Maven : Build & Dependency Management
  • Bootstrap : CSS Framework
  • Tiles2 : JSP Layout Framework
  • Selenium : Automatic Web Browser Test Framework
  • JUnit : Java Test Framework
  • Mockito : Mocking Framework
  • MoreUnit : Code, Test Code ์ด๋™ ํˆด
  • Emma : Code Coverage ๊ฒ€์‚ฌ ํˆด (eclipse)
  • Cobertura : Code Coverage ๊ฒ€์‚ฌ ํˆด (jenkins)
  • Checkstyle : Coding Convention ๊ฒ€์‚ฌ ํˆด
  • FindBugs : ์ฝ”๋“œ ์ •์  ๋ถ„์„ ํˆด

๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ธํŒ…

JDK

์„ค์น˜ํ•˜๊ธฐ

$ yum install java-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64

์ฐธ๊ณ  : http://www.oracle.com/technetwork/java/javaee/downloads/index.html

MySQL

์„ค์น˜ํ•˜๊ธฐ

$ yum install mysql-server

์ฐธ๊ณ  : http://dev.mysql.com/downloads/mysql

์‹œ์ž‘ํ•˜๊ธฐ

$ service mysqld start

๊ธฐ๋ณธ DB, Table ์ƒ์„ฑํ•˜๊ธฐ

$ mysql -u root < src/main/db/create.sql

SpringSource Tool Suite

์„ค์น˜ํ•˜๊ธฐ

http://www.springsource.org/downloads/sts

Maven

์„ค์น˜ํ•˜๊ธฐ

http://maven.apache.org/download.html

Lombok

์„ค์น˜ํ•˜๊ธฐ

http://projectlombok.org/mavenrepo/index.html

Project clone

STS์˜ File > Import > Projects from Git > URI ์„ ํƒ ํ›„ ์•„๋ž˜ ์„ค์ •๊ฐ’์„ ์ž…๋ ฅํ•œ๋‹ค.

URI : ssh://git@github.com:[ID]/template.git
Host : github.com
Repository path : [ID]/template.git
Protocol : ssh
Port : ์—†์Œ
User : git
Password : ์—†์Œ

Import existing projects ์‹œ No projects found ๋ผ๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์•„๋ž˜ ๋‹จ๊ณ„๋ฅผ ์ˆ˜ํ–‰ ํ›„ ๋‹ค์‹œ ์‹œ๋„ํ•œ๋‹ค.
Package Explorer์—์„œ template ์šฐํด๋ฆญ > Configure > Convert To Maven Project๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ maven project๋กœ ์ƒ์„ฑํ•œ๋‹ค.

Eclipse project ์ƒ์„ฑ

๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„์ง„ template project์—์„œ ๊ฒฝ๋กœ์—์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž…๋ ฅํ•˜์—ฌ eclipse project๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

$ mvn eclipse:eclipse

๋ธŒ๋ผ์šฐ์ € ์„ค์น˜

Selenium ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด ์•„๋ž˜ ๋ธŒ๋ผ์šฐ์ € ์„ค์น˜ํ•œ๋‹ค.

  • Internet Explorer
  • Chrome
  • Firefox

STS Setting

Eclipse Plugin ์„ค์น˜

  • STS > Help > Install New Software... ํด๋ฆญ ํ›„ work with์— ์„ค์น˜ํ•˜๊ณ ์ž plugin URL์„ ์ž…๋ ฅํ•œ๋‹ค.

MoreUnit : http://moreunit.sourceforge.net/update-site

Ctrl + j : ๊ตฌํ˜„ ์ฝ”๋“œ์™€ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ๊ฐ„ ์ด๋™ํ•œ๋‹ค.
Ctrl + r : ๊ตฌํ˜„ ์ฝ”๋“œ์—์„œ ํ…Œ์ŠคํŠธ์ฝ”๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•œ๋‹ค.

Checkstyle : http://eclipse-cs.sf.net/update

  • Checkstyle ํ™œ์„ฑํ™”

     ํ”„๋กœ์ ํŠธ ์ด๋ฆ„์„ ์šฐํด๋ฆญ ํ›„ Checkstyle > Activate Checkstyle
    
  • View

     Window > Show View > Others > Checkstyle > Checkstyle violations
    

Emma : http://update.eclemma.org/

  • ์ปค๋ฒ„๋ฆฌ์ง€ ๊ฒ€์‚ฌ

     ํ”„๋กœ์ ํŠธ ์ด๋ฆ„์„ ์šฐํด๋ฆญ ํ›„ Coverage As > Junit Test ์ˆ˜ํ–‰ ํ›„ ์•„๋ž˜ view์—์„œ ๊ฒฐ๊ณผ ํ™•์ธํ•œ๋‹ค.
    
  • View

     Window > Show View > Others > Java > Coverage
    

FindBugs : http://findbugs.cs.umd.edu/eclipse

  • ์ •์  ๋ถ„์„

     ํ”„๋กœ์ ํŠธ ๋ช… ์šฐํด๋ฆญ > Find bugs > Find bugs ์ˆ˜ํ–‰ ํ›„ ์•„๋ž˜ view์—์„œ ๊ฒฐ๊ณผ ํ™•์ธํ•œ๋‹ค.
    
  • View

     Window > Show View > Find Bugs > Bug Explorer	
    

Java Convention์„ ๊ธฐ๋ณธ ํ…œํ”Œ๋ฆฟ์œผ๋กœ ์‚ฌ์šฉํ•จ

  • Preference > Java > Code Style > Formatter > New > Java Convention๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ธฐ๋ณธ ํ…œํ”Œ๋ฆฟ ์ƒ์„ฑํ•œ๋‹ค.

Checkstyle ์„ค์ •ํŒŒ์ผ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ

Preference > Checkstyle > New ์„ ํƒํ•˜์—ฌ ์•„๋ž˜ ์„ค์ •๋Œ€๋กœ ์ž…๋ ฅํ•œ๋‹ค.

Type : External Configuration File
Name : tinyCheckstyle
Location : tinyCheckstyle.xml

Line Width : 120

  • Preference > Java > Code Style > Formatter > Edit > Line Wrapping > Maximum line width : 120
  • Preference > XML > XML Files > Editor > Line width : 120
  • Preference > Web > JSP Files > Editor > Line Width : 120

Tab Indent ์„ค์ •

  • Preference > Java > Code Style > Formatter > edit > Indentation > 4
  • Preference > Java > Code Style > Formatter > edit > Indentation > Tab policy > Tabs only

Encoding ์ˆ˜์ •

  • Preference > Web > CSS Files > Encoding : ISO 10646/Unicode(UTF-8)
  • Preference > Web > HTML Files > Encoding : ISO 10646/Unicode(UTF-8)
  • Preference > Web > JSP Files > Encoding : ISO 10646/Unicode(UTF-8)
  • Preference > General > Content Types > Text > Java Properties Files > *.properties > UTF-8์„ ์„ ํƒ ํ›„ Update

๊ฐœํ–‰๋ฌธ์ž (LF ์‚ฌ์šฉ, Not CRLF)

  • Preference > General > Workspace > New text file line delimiter : Unix

md ํŒŒ์ผ editor ์„ค์ •

  • Preferences/General/Editors/File Associations/*.md ํŒŒ์ผ์— Text Editor ์ถ”๊ฐ€ํ•œ๋‹ค.

์ž์ฃผ ์“ฐ๋Š” static import ๋“ฑ๋ก

Preference > Java > Editor > Templates > New Type์— ํด๋ฆญ ํ›„ ์•„๋ž˜ ๋‚ด์šฉ ์ถ”๊ฐ€ํ•œ๋‹ค.

name : ti
context : java
description : ti ์ž…๋ ฅ ํ›„ Ctrl + Space ์ž…๋ ฅ ์‹œ ์•„๋ž˜ package๊ฐ€ ์ž๋™ import
pattern : 
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.junit.matchers.JUnitMatchers.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;

static import ์—์„œ *์ด ํ’€๋ฆฌ์ง€ ์•Š๊ฒŒ ์„ค์ •

  • Preference > Java > Code Style > Organize Imports > Number of static imports๋ฅผ 1๋กœ ์„ค์ •ํ•œ๋‹ค.

resources ์ˆœ์„œ ๋ณ€๊ฒฝ

STS์—์„œ local ์„ค์ •์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ค์ •ํ•œ๋‹ค.
Project Properties > Java Build Path > Order and Export ์—์„œ ์•„๋ž˜์™€ ๊ฐ™์€ ์ˆœ์„œ๋กœ ์„ค์ • ๋ณ€๊ฒฝํ•œ๋‹ค.

src/main/java
src/main/resources
src/main/resources-local
src/main/resources-dev
src/main/resources-release

AWS ์šด์˜ ์„œ๋ฒ„ ์„ค์น˜ (Amazon Linux AMI)

Tomcat

์„ค์น˜ํ•˜๊ธฐ

$ yum install tomcat6-webapps tomcat6-admin-webapps

์‹œ์ž‘ํ•˜๊ธฐ

$ service tomcat6 start

mvn์œผ๋กœ tomcat์— ๋ฐฐํฌํ•˜๊ธฐ ์œ„ํ•ด์„œ /usr/share/tomcat6/conf/tomcat-users.conf ํŒŒ์ผ์— ์•„๋ž˜ ๋‚ด์šฉ ์ถ”๊ฐ€ํ•œ๋‹ค.

<tomcat-users>
    <role rolename="manager"/>
    <user username="admin" password="" roles="manager"/>
</tomcat-users>

UTF-8์„ ์ง€์›ํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜ ๋‚ด์šฉ ์ค‘ ๊ฐ€์žฅ ์•„๋ž˜ ์ค„์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

<Connector port="8080" protocol="HTTP/1.1" 
	connectionTimeout="20000" 
	redirectPort="8443" 
	URIEncoding="UTF-8" />

pom.xml ํŒŒ์ผ์— AWS ๋ฐฐํฌ ์„œ๋ฒ„ IP ์„ค์ •

!-- mvn tomcat:deploy ๋ฐฐํฌ ๊ฐ€๋Šฅ -->
<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>tomcat-maven-plugin</artifactId>
	<version>${tomcat-maven-plugin.version}</version>
	<configuration>
		<url>http://54.248.89.221:8080/manager</url>
		<path>/ROOT</path>
	</configuration>
</plugin>

์ตœ์ดˆ ๋ฐฐํฌ ์‹œ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•œ๋‹ค.

mvn tomcat:deploy

์ตœ์ดˆ ๋ฐฐํฌ๊ฐ€ ์•„๋‹ ๊ฒฝ์šฐ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•œ๋‹ค.

mvn tomcat:undeploy tomcat:deploy

ssh๋กœ War ํŒŒ์ผ ๋ฐฐํฌ

/usr/share/tomcat6/webapps์˜ root๊ถŒํ•œ์ด ํ•„์š”ํ•œ ํด๋”์— ssh๋กœ WARํŒŒ์ผ์„ ๋ฐฐํฌํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ์•„๋ž˜ ๋ถ€๋ถ„ ์ˆ˜์ • ํ•„์š”ํ•˜๋‹ค.
/etc/sudoers ํŒŒ์ผ์— ์•„๋ž˜ ๋ถ€๋ถ„ ์ฃผ์„ ์ฒ˜๋ฆฌํ•œ๋‹ค.

Defaults    requiretty

๋นŒ๋“œ ์„œ๋ฒ„

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors