Spring Boot Maven Plugin 打包后指定主类教程
{/'title/':/'plugin 使用 spring boot maven plugin 打包后如何指定 main/',/'description/':/'在使用 Spring Boot Maven Plugin 打包后,可以通过在 pom.xml 文件中配置 //<start-class>// 元素来指定要执行的主类。//n//n例如://nxml//n<build>//n <plugins>//n <!-- Spring Boot Maven Plugin -->//n <plugin>//n <groupId>org.springframework.boot</groupId>//n <artifactId>spring-boot-maven-plugin</artifactId>//n <configuration>//n <start-class>com.example.MyApplication</start-class>//n </configuration>//n </plugin>//n </plugins>//n</build>//n//n在上面的示例中,com.example.MyApplication 是要执行的主类。//n//n打包后,可以使用 java -jar 命令来运行生成的可执行 JAR 文件。//n//n例如://n//njava -jar my-application.jar//n//n这将会执行 com.example.MyApplication 类中的 main 方法。/',/'keywords/':/'spring boot, maven plugin, 打包, 主类, start-class, java -jar, 命令行/',/'content/':/'在使用 Spring Boot Maven Plugin 打包后,可以通过在 pom.xml 文件中配置 <start-class> 元素来指定要执行的主类。//n//n例如://nxml//n<build>//n <plugins>//n <!-- Spring Boot Maven Plugin -->//n <plugin>//n <groupId>org.springframework.boot</groupId>//n <artifactId>spring-boot-maven-plugin</artifactId>//n <configuration>//n <start-class>com.example.MyApplication</start-class>//n </configuration>//n </plugin>//n </plugins>//n</build>//n//n在上面的示例中,com.example.MyApplication 是要执行的主类。//n//n打包后,可以使用 java -jar 命令来运行生成的可执行 JAR 文件。//n//n例如://n//njava -jar my-application.jar//n//n这将会执行 com.example.MyApplication 类中的 main 方法。/
原文地址: https://www.cveoy.top/t/topic/mV75 著作权归作者所有。请勿转载和采集!