使用 spring-boot-maven-plugin 和 exec 分类器,但不能 运行 来自 IDE 的应用程序了
using spring-boot-maven-plugin with exec classifier, but can't run the app from IDE anymore
我正在开发 Spring Boot 1.5.9 应用程序,我正在生成一个包含 Spring Boot 应用程序的 jar,但它也可以作为另一个项目的一部分导入。
因此,我使用以下配置生成 2 个 jar:exec 和常规 lib。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
但是,既然我有了这个,我就不能再从我的 IDE (Intellij) 运行 应用程序了,因为它找不到 application.yml.
我确定有诀窍,但我找不到任何东西..有什么想法吗?
我最终使用了 Maven 配置文件:
<profiles>
<profile>
<id>makeRelease</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
当我发布时,我正在调用此配置文件(带有参数 -P makeRelease 的 Maven),以便它生成 2 个 jar。
其余时间,常规行为适用。
我正在开发 Spring Boot 1.5.9 应用程序,我正在生成一个包含 Spring Boot 应用程序的 jar,但它也可以作为另一个项目的一部分导入。
因此,我使用以下配置生成 2 个 jar:exec 和常规 lib。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
但是,既然我有了这个,我就不能再从我的 IDE (Intellij) 运行 应用程序了,因为它找不到 application.yml.
我确定有诀窍,但我找不到任何东西..有什么想法吗?
我最终使用了 Maven 配置文件:
<profiles>
<profile>
<id>makeRelease</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
当我发布时,我正在调用此配置文件(带有参数 -P makeRelease 的 Maven),以便它生成 2 个 jar。
其余时间,常规行为适用。