Bài 1: Setup project với Intellij IDEA và Gradle

Mình sử dụng Intellij là vì

  • giao diện của Intellij đẹp hơn Eclipse và Netbean
  • thao tác với Git trên Intellij dễ dàng hơn (ý kiến cá nhân)
  • short-cut keys tiện hơn (cũng là ý kiến cá nhân)

Mình sử dụng Gradle là vì:

  • mình ghét XML, nhìn rối vãi
  • hết =)))))

I. Cài đặt Intellij

Bạn down bản Community Edition ở đây https://www.jetbrains.com/idea/download/#section=windows

Sau đó thì cài đặt như bình thường.

II. Cài đặt Gradle

Link https://gradle.org/install/

III. Khởi tạo project

IV. Môi trường để thực hành

Mình vẫn sẽ dùng wordpress để làm site thực hành. Các bạn có thể xem lại hướng dẫn ở đây. https://giangtester.com/bai-6-tao-wordpress-site-de-thuc-hanh-selenium/

V. Configuration

  • Edit file build.gradle
plugins {
    id 'java'
    id 'eclipse'
    id 'idea'
}

group 'com.giangtester'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile('org.junit.jupiter:junit-jupiter:5.4.2')
    compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
}

test {
    useJUnitPlatform()
    testLogging {
        events "passed", "skipped", "failed"
    }
}
  • Add .gitignore to project
# Binaries
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.war
*.ear
*.sar
*.class

# Maven
target/
test-output/
bin/
config/
report/

# IntelliJ project files
*.iml
*.iws
*.ipr
.idea/

# eclipse project file
.settings/
.classpath
.project

# OS
.DS_Store

# Misc
*.swp

# Log
*.log

.metadata
.gradle
/gradle
/build
/out
4 1 vote
Article Rating
Subscribe
Notify of
guest
8 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] ← Previous Next → […]

Thu Hương_88
Thu Hương_88
4 years ago

Mình chưa hiểu lắm về việc dùng gradle thay cho xml. Bạn có thể giải thích kỹ hơn về tác dụng của xml/gradle đc k? Cảm ơn b nhiều

Tài
Tài
1 year ago

Tại sao mình làm theo các bước nhưng vẫn không thể hiển thị Gradle trong intellij nhỉ

Ngân
Ngân
28 days ago

New project của mình không có Gradle thì phải làm sao để nó hiển thị vậy bạn

Screenshot_3