카테고리 없음

[Gradle] 프로젝트 생성

프리랜서가 들려주는 IT세계 2019. 9. 16. 09:54
반응형

Gradle 프로젝트 생성

Eclipse 환경

새로운 프로젝트를 생성

Gradle 선택
Next 선택!
Next 선택!
Next 선택!
Finish 선택!
build.gradle 파일

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java Library project to get you started.
 * For more details take a look at the Java Libraries chapter in the Gradle
 * User Manual available at https://docs.gradle.org/5.4/userguide/java_library_plugin.html
 */

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
}

repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

dependencies {
    // This dependency is exported to consumers, that is to say found on their compile classpath.
    api 'org.apache.commons:commons-math3:3.6.1'

    // This dependency is used internally, and not exposed to consumers on their own compile classpath.
    implementation 'com.google.guava:guava:27.0.1-jre'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'
}

 

위와 같이 Groovy 형태로 간결하게 작성해주면 된다. 자신이 필요한 환경에 맞춰서.

Test를 위해 Test파일 하위에 java를 실행시켜보자~

위와 같이 Gradle로 Run!

Run As -> Gradle Tset를 클릭하면,

Console 창

콘솔 창에서는 위와 같이 결과 화면이 나온다.

Gradle Executions 창

Gradle Executions 창에는 위와 같이 나온다.

Run configuration 설정 창

Run configuration 창에 들어가면, 자신이 원하는 Task 환경을 커스텀이 가능하다.

Name 은 자유롭게 기술해주면 된다.

Gradle Task 부분에는 자신이 원하는 Task를 기술해주면 됩니다.

 

Working Directory는 현재의 Project 디렉토리를 넣어주면 됩니다.

반응형