Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 8 Maven Plugin for Java 8

Is the tomcat7-maven-plugin working with a tomcat 8 server and java 8? I can't find any tomcat8-maven-plugin.

like image 517
myborobudur Avatar asked Nov 12 '14 09:11

myborobudur


People also ask

What is tomcat8 Maven plugin?

The Tomcat Maven Plugin provides goals to manipulate WAR projects within the Tomcat 8. x servlet container.

What version of Java does Tomcat 8 use?

Tomcat 8.0 is designed to run on Java 7. For reference, the following specifications have been supported: Tomcat 6: Servlet 2.5, JSP 2.1, and EL 2.1.

What is tomcat7 Maven plugin?

The Tomcat7 Maven Plugin provides goals to manipulate WAR projects within the Tomcat servlet container version 7.x.

Does Maven use Tomcat?

Yes, this is really possible and is very easy to handle through the use of powerful tool “Maven“. Maven provides a graceful plugin called tomcat7-maven-plugin through which the Tomcat Web Server can be embedded seamlessly into a Maven project.


1 Answers

Yes you can,

In your pom.xml, add the tomcat plugin. (You can use this for both Tomcat 7 and 8):

pom.xml

<!-- Tomcat plugin -->   <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>TomcatServer</server>    *(From maven > settings.xml)*   <username>*yourtomcatusername*</username>     <password>*yourtomcatpassword*</password>     </configuration>    </plugin>    

tomcat-users.xml

<tomcat-users>     <role rolename="manager-gui"/>           <role rolename="manager-script"/>            <user username="admin" password="password" roles="manager-gui,manager-script" />   </tomcat-users> 

settings.xml (maven > conf)

<servers>       <server>        <id>TomcatServer</id>        <username>admin</username>        <password>password</password>     </server> </servers>   

*** deploy/re-deploy**

mvn tomcat7:deploy OR mvn tomcat7:redeploy

Tried this on (Both Ubuntu and Windows 8/10):

  • Jdk 7 & Tomcat 7
  • Jdk 7 & Tomcat 8
  • Jdk 8 & Tomcat 7
  • Jdk 8 & Tomcat 8
  • Jdk 8 & Tomcat 9

Tested on Both Jdk 7/8 & Tomcat 7/8. (Works with Tomcat 8.5 and 9)

Note:
Tomcat manager should be running or properly setup, before you can use it with maven.

Good Luck!

like image 194
Borgy Manotoy Avatar answered Oct 07 '22 12:10

Borgy Manotoy