简体   繁体   中英

Tomcat - Server in Eclipse

I have a really basic Spring app which I deploy using mavens tomcat:run command and it works fine. However, I want it to start and deploy to the server which is located in Eclipse 'server' tab. At the moment it looks like it's deploying to a different one?

I have got WTP plugin installed.

Also, here are my dependencies and plugins:

    <dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.2.2.RELEASE</version>
    </dependency>
</dependencies>

<build>
    <!--BEGIN - Plugins -->
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat9-maven-plugin</artifactId>
            <version>9</version>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <path>/</path>
                    <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>
    </plugins>
    <!--END - Plugins -->
</build>

You need to first add the server from server tab and then configure the project on the server. Then you simply just right click on the project and select run on server, then your project will run on the server that is defined in the servers tab in eclipse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM