Spring Boot我的jar文件在哪里

时间:2018-08-26 19:52:26

标签: java spring-boot jar

春季启动使设置简单应用程序变得非常容易。 但是实际上需要花费更长的时间才能获得可以上传到远程服务器的jar文件。 我正在使用IntelliJ,没有命令行,并且使用了gradle。该应用程序以某种方式在Intellij之外运行。但是创建的文件在哪里?我的Bootjar罐子在哪里?

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar {
    baseName = 'gs-spring-boot'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")

    compile("org.springframework.boot:spring-boot-starter-actuator")

    testCompile("org.springframework.boot:spring-boot-starter-test")

    // add spring data repos
    compile("org.springframework.boot:spring-boot-starter-data-jpa")

    compile("org.postgresql:postgresql:42.2.4")

    // REST interface
    compile("org.springframework.boot:spring-boot-starter-data-rest")

    // Security
    compile("org.springframework.boot:spring-boot-starter-security")
}

更新:添加了项目结构的图片:

enter image description here

更新2:文件夹结构:

enter image description here

1 个答案:

答案 0 :(得分:1)

如果仅在IDE中运行它,则不会创建jar。为此,您需要从IDE或命令行运行gradle构建(就您而言),以将其构建到jar中。

从命令行转到您的项目目录,然后输入以下内容:

RND

这将执行gradle包装器,该包装器应下载运行构建所需的所有内容,然后执行构建。

然后您将在./gradlew build

中找到您的jar
相关问题