Reputation: 1113
I'm working on a webapp with spring and maven and want to be able to run the application from within a local tomcat server and intellij. This dependency seems to be the culprit.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
when I remove this dependency the application runs fine in intellij because of the other dependency but then can't run on tomcat.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Can I set something up to automatically use the right dependency for intellij?
Upvotes: 0
Views: 391
Reputation: 717
You can setup maven profile in the pom.xml, then use specific profile for Intellij. Intellij allows you to select the profile while running the build.
<profiles>
<profile>
<id>intellij</id>
…
<dependencies>
<dependency>…</dependency>
</dependencies>
…
</profile>
<profile>
<id>release</id>
…
<dependencies>
<dependency>…</dependency>
</dependencies>
…
</profile>
Upvotes: 2