Quantcast
Channel: Techie Shah
Viewing all articles
Browse latest Browse all 25

Spring Boot Maven plugin - How to deploy WAR to an external tomcat's webapp folder?

$
0
0

 Introduction

Spring Boot Maven plugin by default generates the WAR file inside the target folder. In this post, I will explain how to copy the generated war file to an external Tomcat's webapps folder using Spring Boot Maven plugin.

In my earliest post, you can learn how to package a Spring Boot application as WAR. 

Solution

Step 1 

Follow this link to specify the packaging as WAR in pom.xml and also to configure the SpringBootServletInitializer class

Step 2 (optional)

Specify a cleaner name for WAR using the finalName tag in pom.xml 

<finalName>auth</finalName>

Step 3

Specify the outputDirectory directory

    <build>
	<finalname>auth</finalname>
	<plugins>
		<plugin>
        <groupid>org.springframework.boot</groupid>
			<artifactid>spring-boot-maven-plugin</artifactid>
			<configuration>
	        <outputdirectory>D:/Development Utils/apache-tomcat-9.0.30/webapps</outputdirectory>
			</configuration>
		</plugin>
	</plugins>
    </build>
    

Conclusion

In this post, we learn how to package and copy the WAR file to an external tomcat's webapps folder using Spring Boot Maven plugin.


Viewing all articles
Browse latest Browse all 25

Trending Articles