Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run app in tomcat using maven with IntelliJ

Without using maven, to run the app on tomcat from the Intellij IDE, all you have to do is create an artifact and a "tomcat" run configuration pointing to that artifact, this way you can see tomcat output, restart the server, and other stuff right in the IDE.

Now using maven, there's no need to create an artifact, because maven already does the compiling, packaging, etc.

I know i can deploy it using the command mvn tomcat7:redeploy but this way i can't see standart output/errors and debug. So what is the standard way to run the app from IntelliJ without having to create an artifact?

like image 201
Mateus Viccari Avatar asked Aug 17 '15 18:08

Mateus Viccari


1 Answers

In pom.xml add

<build>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <uriEncoding>UTF-8</uriEncoding>
                    <path>/your-path</path>
                    <update>true</update>
                </configuration>
            </plugin>
</build>

In IntelliJ, open Menu > View > Tool Windows > Maven Projects

Plugins > tomcat7 > tomcat7:run
like image 180
Neil McGuigan Avatar answered Sep 23 '22 00:09

Neil McGuigan