Adding Tomcat Server in Intellij

前端 未结 2 1134
半阙折子戏
半阙折子戏 2020-12-29 23:43

There are many questions on this website regarding that please be assured that I have checked them and didn\'t find my answer.

I am really a newbie in IntelliJ. He

相关标签:
2条回答
  • 2020-12-30 00:23

    Tomcat integration is available only in IntelliJ IDEA Ultimate Edition, while you are running the Community Edition. Here is the page that describes the difference between the editions.

    0 讨论(0)
  • 2020-12-30 00:25

    Did you think of using maven? If you do so, you can use the "tomcat7-maven-plugin" and its goals "deploy" and "undeploy".

    Here's an example pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>de.example</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <artifactId>dm-p0-servlet</artifactId>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.2</version>
                    <configuration>
                        <url>http://localhost:8080/manager/text</url>
                        <server>tomcat7-local</server>
                        <path>/miniservlet</path>
                    </configuration>
                    <executions>
                        <execution>
                            <id>clean-undeploy</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>undeploy</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>package-deploy</id>
                            <phase>package</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
    
                </plugin>
            </plugins>
        </build>
    
        <dependencies>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
                <scope>provided</scope>
            </dependency>
    
        </dependencies>
    </project>
    

    The element <server>tomcat7-local</server> refers to the <servers> section in ~/.m2/settings.xml, where the credentials for the Tomcat server authentication are stored:

        <servers>
            <server>
                <id>tomcat7-local</id>
                <username>adminScript</username>
                <password>geheim</password>
            </server>
        </servers>
    

    The username "adminScript" and its password are defined in <Tomcat-Home>/conf/tomcat-users.xml .

    0 讨论(0)
提交回复
热议问题