Friday, July 8, 2016

Gradle로 이클립스에 Spring 환경 구축하기 - 초보자용

1. 이클립스를 통해 Gradle 프로젝트를 생성



2. build.gradle 파일을 수정

apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'war'

sourceCompatibility = 1.8
targetCompatibility = 1.8

version = '1.0'
jar {
    manifest {
        attributes 'Implementation-Title': 'Gradle Quickstart',
                   'Implementation-Version': version
    }
}

repositories {
    mavenCentral()
}

def version = [
spring: '4.3.1.RELEASE'
]

dependencies {
    compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
    compile "org.springframework:spring-context:${version.spring}"
    testCompile group: 'junit', name: 'junit', version: '4.+'
}

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

test {
    systemProperties 'property': 'value'
}

uploadArchives {
    repositories {
       flatDir {
           dirs 'repos'
       }
    }
}


3. Run As > Gradle Build... 를 선택하고 아래와 같이 입력한다







































4. 아래와 같이 스프링 라이브러리가 로딩되어 있음을 볼 수 있다.




참고 사이트
http://goo.gl/X5xVzr
http://goo.gl/g9egF6
http://stag.tistory.com/21

No comments: