sitelink1 https://www.omnibuscode.com/board/board_dev_bnd/61050 
sitelink2  
sitelink3  

sitelink1 에서 샘플 프로젝트도 다운로드 가능하지만

아주 기본적인 환경만 구성한 샘플 프로젝트 생성을 원한다면 다음과 같은 절차로 생성하면 된다.

 

1. gradle cli 로 다음과 같이 프로젝트 생성

 

\ReleaseTest>gradle init

Starting a Gradle Daemon, 1 busy and 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

 

Select type of build to generate:

  1: Application

  2: Library

  3: Gradle plugin

  4: Basic (build structure only)

Enter selection (default: Application) [1..4] 4

 

Project name (default: ReleaseTest):

 

Select build script DSL:

  1: Kotlin

  2: Groovy

Enter selection (default: Kotlin) [1..2] 2

 

Generate build using new APIs and behavior (some features may change in the next minor release)? (default: no) [yes, no]

 

 

> Task :init

Learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.10.2/samples

 

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

 

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

 

For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

 

BUILD SUCCESSFUL in 7m 42s

1 actionable task: 1 executed

 

2. build.gradle 에 다음과 같은 내용을 넣어준다. (내용은 알아서 적당히 수정)

 

plugins {

    id 'java'

    id 'war'

    id 'eclipse'

    id 'eclipse-wtp'

}

 

group = 'com.mydomain'

version = '1.0.0'

sourceCompatibility = '17'

 

repositories {

    mavenCentral()

}

 

dependencies {

 

    runtimeOnly 'com.h2database:h2:2.2.224'

 

    implementation 'jakarta.servlet:jakarta.servlet-api:6.0.0'

    implementation 'commons-logging:commons-logging:1.2'

    implementation 'com.fasterxml.jackson.core:jackson-core:2.17.0'

    implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0'

    implementation 'com.googlecode.json-simple:json-simple:1.1.1'

 

    // Selenium 의존성 추가 

    implementation 'org.seleniumhq.selenium:selenium-java:4.16.1'

    implementation 'org.seleniumhq.selenium:selenium-chrome-driver:4.16.1'

 

}

 

eclipse {

    wtp {

        // WTP Component 설정

        component {

            contextPath = 'example' // context root 설정

            deployName = 'example' // 프로젝트의 배포 이름 설정

            

            // Targeted Runtimes 설정

            file {

                // 서버 이름 추가 (Eclipse에 등록된 서버 이름 사용)

                withXml {

                    def node = it.asNode()

                    def runtimes = node.appendNode('runtime', [:])

                    runtimes.appendNode('runtime', ['id': 'Apache Tomcat v10.1'])

                }

            }

        }

 

        // WTP Facet 설정

        facet {

            facet name: 'jst.web', version: '4.0' // Dynamic Web Module 버전 설정

            facet name: 'java', version: '17' // Java 버전 설정

        }

    }

}

 

3. 이클립스에서 다음을 설정

  • 프로젝트에서 우클릭하여 Properties 진입
  • "Project Facets" 선택후 우측 화면에서 "Convert to faceted from..." 링크 클릭
  • "Dynamic Web Module", "Java" 체크후 "Runtimes" 탭에서 서버 선택
    • 서버를 등록하지 않은 상태라면 이클립스 메인 메뉴에서 "Window>Preferences" 로 창의 띄워 "Server>Runtime Environments"에 서버를 등록한다
  • Apply 누르면 Web Project 로 자동 변환
  • 프로젝트 Properties 의 "Targeted Runtimes" 로 진입하여 서버를 체크

 

 

※ 참고 사항

3번에서 위와 같이 설정한 후에도 프로젝트를 Gradle Refresh 하면 Properties 에 설정한 서버 관련 값들이 초기화 되지만

Gradle 설정에 적용한 환경이 그대로 반영되므로 Tomcat 서버에 Add 하여 실행해도 정상 동작하게 된다.

 

 

 

 

 

번호 제목 글쓴이 날짜 조회 수
» eclipse 용 gradle web application project (no spring) 생성하기 황제낙엽 2025.05.04 17
17 라이브러리 개발 프로젝트에서 jar 로 build 후 파일을 특정 로컬 경로로 copy 하는 예제 황제낙엽 2025.02.07 51
16 [Gemini] gradle init 으로 프로젝트 생성하는 절차 내용 황제낙엽 2025.01.24 60
15 [ChatGPT] eclipse 의 web project 에서 gradle refresh 때마다 context root 가 초기화 황제낙엽 2024.11.14 90
14 Gretty, Jetty 에서 ssl 적용 황제낙엽 2024.11.12 127
13 [ChatAI] Gradle Wrapper의 버전을 업그레이드하는 절차 황제낙엽 2024.11.12 131
12 eclipse 용 gradle web application sample project (no spring) file 황제낙엽 2024.11.12 96
11 [phind] Gradle 프로젝트를 생성할 때 nested sub project 가 함께 생성되는 이유 황제낙엽 2024.11.12 78
10 IDE(IntelliJ, Android Studio, Eclipse) 에서 build.gradle 에 dependencies 추가후 의존 라이브러리 갱신하기 황제낙엽 2024.10.30 117
9 [POST, 2021.06.28] Gradle을 이용해 Web 어플리케이션을 만들고 빌드하고 실행하기 file 황제낙엽 2023.12.30 77
8 build.gradle 의 dependencies 황제낙엽 2023.12.29 72
7 error: unmappable character 황제낙엽 2023.12.29 70
6 Task :compileJava FAILED 황제낙엽 2023.12.29 91
5 사용자 라이브러리 파일(*.jar) 를 의존성에 추가하는 방법 황제낙엽 2023.12.28 81
4 Windows 에 Gradle 설치 황제낙엽 2023.12.23 80
3 Eclipse, Gradle 프로젝트 생성, Dynamic Web Project 로 변경 황제낙엽 2023.12.23 81
2 [2014~2015] gradle 영문 튜토리얼 (Getting Started With Gradle) 황제낙엽 2023.07.13 748
1 Maven, Gradle 의 비교와 Gradle + Eclipse에서 gradle의 빌드가 안될때 황제낙엽 2023.07.11 98