Intellij无法运行具有特定依赖项的Spring应用程序
我正在使用spring和maven开发一个webapp,希望能够在本地tomcat服务器和intellij中运行该应用程序。这种依赖似乎是罪魁祸首Intellij无法运行具有特定依赖项的Spring应用程序,spring,maven,tomcat,intellij-idea,Spring,Maven,Tomcat,Intellij Idea,我正在使用spring和maven开发一个webapp,希望能够在本地tomcat服务器和intellij中运行该应用程序。这种依赖似乎是罪魁祸首 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided<
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
org.springframework.boot
弹簧启动机tomcat
假如
当我删除此依赖项时,由于另一个依赖项,应用程序在intellij中运行良好,但随后无法在tomcat上运行
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
org.springframework.boot
SpringBootStarterWeb
我可以设置一些自动为intellij使用正确的依赖项吗?您可以在pom.xml中设置maven配置文件,然后为intellij使用特定的配置文件。Intellij允许您在运行构建时选择配置文件
<profiles>
<profile>
<id>intellij</id>
…
<dependencies>
<dependency>…</dependency>
</dependencies>
…
</profile>
<profile>
<id>release</id>
…
<dependencies>
<dependency>…</dependency>
</dependencies>
…
</profile>
intellij
…
…
…
释放
…
…
…