springboot打包程序操作
    		       		warning:
    		            这篇文章距离上次修改已过432天,其中的内容可能已经有所变动。
    		        
        		                
                Spring Boot 打包程序通常使用 Maven 或 Gradle 构建工具。以下是使用 Maven 和 Gradle 打包 Spring Boot 应用程序的基本命令。
Maven:
打包命令:
mvn clean package这将创建一个可执行的 JAR 文件在 target/ 目录下。
Gradle:
打包命令:
./gradlew build这将创建一个可执行的 JAR 文件在 build/libs/ 目录下。
确保你的 pom.xml 或 build.gradle 文件中包含了 Spring Boot 的 Maven 或 Gradle 插件配置。
pom.xml 示例配置:
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>build.gradle 示例配置:
plugins {
    id 'org.springframework.boot' version '2.x.x'
    id 'java'
}
 
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
}
 
task unpack(type: Copy) {
    dependsOn bootJar
    from(zipTree(tasks.bootJar.outputs.files.singleFile))
    into('build/dependency')
}确保替换版本号为你使用的 Spring Boot 版本。
评论已关闭