To create an artifact with a profile, you need to create a Maven Run / Debug configuration, as shown in the following figure

Then in Tomcat Run / Debug Configuration, add the assembly above in the "Before Run" section by clicking the + button and select "Run Another Configuration", then select the maven assembly.

The result should look like this.

Now, if you run the Tomcat configuration first, the maven build will complete before Tomcat.
source share