Do a Deploy Remote Tomcat with Ecipse / Spring Tool suit

0

How to make a remote deploy of a Spring Boot Application on a Tomcat server?

The file to be deploy must be a war .

Since that way it would be efficient since on the server or work computer it would not be necessary to lift a tomcat for each one.

    
asked by kelgwiin 23.03.2017 в 15:44
source

1 answer

0

1.- Install Maven Integration for Eclipse / STS (m2eclipse)

2.- Create a Maven project

2.1.- File->New->Project... .>Maven -> Maven Project (If already created just import the project)

2.2.- Next, leave all the fields in default.

2.3.- Select "maven-archetype-webapp" and next.

2.4.- Enter an arbitrary number in "Group Id" and "Artifact" (eg "org.myorg" for GroupId and "myapp" for Artifact) and click on "Finish" (You can see in the root of project the pom.xml file)

3.- Edit the pom.xml file that is in your project and change the hostname by the IP where the tomcat is installed. (Replace yourhost with your IP)

    ...
    <packaging>war</packaging>
    <build>
        <plugins>
             <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <webXml>WebContent\WEB-INF\web.xml</webXml>
                    <path>/path-to-deploy</path>
                    <url>http://yourhost:8080/manager/text</url>

                    <server>tomcat7</server>
                    <username>username</username>
                    <password>userpass</password>
                </configuration>
            </plugin>
        </plugins>

        <finalName>Name of Service</finalName>
    </build>
    ...

4.- Add the following configuration to the file %USERPROFILE%.m2\settings.xml %USERPROFILE% = Path to the user's folder.

On Windows C: \ Users \ username.m2 \ settings.xml

<settings ...>
    ...
    <servers>
        <server>
          <id>tomcat7</id>
          <username>test</username>
          <password>test</password>
        </server>
    </servers>
    ...
</settings>

NOTE: The user of the tomcat must have the role manager-script , in this case the user test has associated said role.

5.- Right click on the project run maven build

  • Then in Run Configurations edit the maven entry and place the following parameters:

Goals = tomcat7: redeploy

User settings : C: \ Users \ username.m2 \ settings.xml

    
answered by 23.03.2017 / 15:44
source