gpt4 book ai didi

java - Gradle distZip 任务在 Windows 上执行但在 Linux 上运行

转载 作者:太空宇宙 更新时间:2023-11-04 06:54:53 24 4
gpt4 key购买 nike

我使用 Gradle 作为我的构建配置工具。我正在 Windows 桌面上进行开发,但实际的发行版将在 Linux 上运行。

当我运行“distZip”任务时,它会生成一个 zip 文件,其中包含一个 .bat 文件,该文件在 Windows 上运行良好,但在 Linux 上运行不佳。

有没有办法配置 Gradle,以便它创建 Linux 兼容的脚本?

这是我的 build.gradle 文件:

buildscript {
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.RC3")
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar {
baseName = 'gs-rest-service'
version = '0.1.0'
}

repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
}

mainClassName="com.RestfulServer.Application"

dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("com.fasterxml.jackson.core:jackson-databind")
compile 'org.slf4j:slf4j-api:1.7.6'
compile 'ch.qos.logback:logback-classic:1.1.1'
compile 'ch.qos.logback:logback-core:1.1.1'

// Local file dependencies
compile files('libraries/AWS/aws-java-sdk-1.7.2.jar',
'libraries/AWS/third-party/joda-time-2.2/joda-time-2.2.jar',
'libraries/AWS/third-party/httpcomponents-client-4.2.3/httpclient-4.2.3.jar',
'libraries/AWS/third-party/httpcomponents-client-4.2.3/httpcore-4.2.jar')

testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}

最佳答案

应用程序插件中的 distZip 已经创建了 shell 脚本和 .bat 文件。它也应该在您的 zip 文件中。

关于java - Gradle distZip 任务在 Windows 上执行但在 Linux 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22888588/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com