Tôi muốn sử dụng Tác vụ CreateStartScripts của gradle để tạo tập lệnh để khởi động ứng dụng.Làm cách nào tôi có thể sử dụng Tác vụ CreateStartScripts của Gradle
tôi sử dụng nó theo cách sau:
apply plugin: 'java'
mainClass = 'UIMain';
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
task copyResources(type: Copy) {
from 'config.ini'
into 'build/dist'
}
task copyLibs(type: Copy) {
from configurations.default
from configurations.default.allArtifacts.files
into 'build/dist/libs'
}
task generateScript(type: CreateStartScripts) {
applicationName = "Dagang"
mainClassName = mainClass
outputDir = "build/dist/"
classpath = ""
}
task distribute(dependsOn: [
build,
copyLibs,
copyResources,
generateScript
]) <<{
description = 'Copies all the project libs to the distribution place.'
}
Tuy nhiên khi tôi chạy xây dựng, nó chạy vào báo lỗi như:
Một vấn đề xảy ra đánh giá dự án root 'Dagang'. [org.gradle.BuildExceptionReporter] Nguyên nhân: Không thể tìm thấy thuộc tính 'CreateStartScripts' trên dự án gốc 'dagang'.
Có ai có thể cho tôi chút ánh sáng không? Cảm ơn.
đó chính xác là những gì tôi cần. cảm ơn. – Wudong