Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy WAR file to Tomcat using Maven?

I'm using Maven in my Java project and I want to deploy the WAR to my localhost Tomcat.

I have this lines in my pom.xml file:

<properties>
    <tomcat.target>C:\Directory</tomcat.target>
</properties>

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.3</version>
      <configuration>
        <webappDirectory>${tomcat.target}</webappDirectory>
      </configuration>
    </plugin>
  </plugins>
</build>

The output logs are:

[INFO] --- maven-install-plugin:2.3.1:install (default-install) ---
[INFO] Installing C:\Directory\name.war to C:\Directory\name.war
[INFO] Installing C:\Directory\pom.xml to C:\Directory\name.pom

As you can see I want to config this line:

to C:\Directory\name.war

How to point it to Tomcat's /webapps folder?

like image 279
user80042 Avatar asked Dec 06 '25 03:12

user80042


1 Answers

<configuration>
                    <url>http://127.0.0.1:8080/manager</url>
                    <server>TomcatServer</server>
                    <path>/mkyongWebApp</path>
                </configuration>

check the link http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/

like image 159
Biswajit Avatar answered Dec 08 '25 16:12

Biswajit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!