Reputation: 7699
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?
Upvotes: 15
Views: 33329
Reputation: 43
When you setup this: n IntelliJ, open Menu > View > Tool Windows > Maven Projects, you will see this menu:
When you click on this picture you can enter the goal of Maven, for example tomcat7:run
Upvotes: 3
Reputation: 48236
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
Upvotes: 10
Reputation: 5213
If you have set
<packaging>war</packaging>
in your pom, IDEA should automatically identify the artifact (your WAR file) to deploy. No need to manually create an artifact.
Upvotes: 6