Home > Net >  Which profile does Intellij use when you do Run Application?
Which profile does Intellij use when you do Run Application?

Time:07-18

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?

CodePudding user response:

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 the scope element.

  • Related