运行应用程序时,Intellij使用哪个配置文件?
我有两个maven profiles.一个是dev,它依赖于嵌入式的tomcat
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
和prod,但没有。
在Intellij的右上角,我可以看到两个配置文件。 当我运行检查DEV配置文件时,该应用程序会失败,因为它找不到嵌入式tomcat。
如果我在主配置文件中包含依赖性并删除范围标签,则应用程序加载。 我在做什么错? 当您从Intellij中运行应用程序时,它在哪个配置文件下运行该应用程序?
I have two maven profiles.One is Dev which has a dependency on embedded Tomcat
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
and Prod which has not.
At the upper right corner of Intellij I can see the two profiles.
When I Run Application having checked the Dev profile, the app fails because it can't find the embedded Tomcat.
If I include the dependncy in the main profile and removing the scope tag,the app loads.
What am I doing wrong?
when you do Run Application from within Intellij under which profile does it run the application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
提供的
范围意味着该依赖关系应由运行应用程序的外部环境(例如应用程序服务器)提供,以防万一您将其部署为战争文件。就您而言,当您在开发环境中运行它时,没有人可以提供这种依赖性,因此指定此范围可能没有意义。这就是当您删除范围
元素时它可以工作的原因。The
provided
scope means that this dependency is supposed to be provided by the external environment that runs your application, e.g. the application server, in case you deploy it as a war file. In your case, when you run it in the development environment, there is noone to provide this dependency, so specifying this scope probably doesn't make sense. This is the reason it works when you remove thescope
element.