Tomcat in Intellij Idea Community Edition

2020-02-16 05:41发布

Is it possible to run a web application using Tomcat Server in Intellij Idea Community Edition?

I tried to find some information about it but haven't achived any success.

15条回答
Animai°情兽
2楼-- · 2020-02-16 06:29

The maven plugin and embedded Tomcat are usable work-arounds (I like second better because you can debug) but actual web server integration is a feature only available in intelij paid editions.

查看更多
女痞
3楼-- · 2020-02-16 06:29

You can use tomcat plugin with gradle. For more information, you here.

apply plugin: 'tomcat'

dependencies {
    classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4'
}

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

[tomcatRun, tomcatRunWar, tomcatStop]*.stopPort = 8090
[tomcatRun, tomcatRunWar, tomcatStop]*.stopKey = 'stfu'
tomcatRunWar.contextPath = "/$rootProject.name"
tomcatRunWar.ajpPort = 8000

if (checkBeforeRun.toBoolean()) {
    tomcatRunWar { dependsOn += ['check'] }
}
查看更多
唯我独甜
4楼-- · 2020-02-16 06:31

I am using intellij CE to create the WAR, and deploying the war externally using tomcat deployment manager. This works for testing the application however I still couldnt find the way to debug it.

  1. open cmd and current dir to tomcat/bin.
  2. you can start and stop the server using the batch files start.bat and shutdown.bat.
  3. Now build your app using mvn goal in intellij.
  4. Open localhost:8080/ **Your port number may differ.
  5. Use this tomcat application to deploy the application, If you get the authentication error, you would need to set the credentials under conf/tomcat-users.xml.
查看更多
登录 后发表回答