I'm running Jenkins 1.6 (and also tried with Jenkins 2.0) on the same server where I have Tomcat 8. I need to deploy Maven multimodule application to Tomcat webapp. It has two war files from submodules that has to be deployed. Deploy plugin supports Tomcat up to 7, and it's work fine. However, the problem is that I need to use Tomcat 8, since my web application is not working on Tomcat 7. Is it possible to deploy war files from Jenkins to Tomcat 8?
Answer to your question
Below sample code can be used for setting role based authentication in tomcat8 container.
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="password" roles="manager-gui,manager-script" />
</tomcat-users>
For Maven Authentication in this path %MAVEN_PATH%/conf/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings ...>
<servers>
<server>
<id>TomcatServer</id>
<username>admin</username>
<password>password</password>
</server>
</servers>
</settings>
Using Tomcat 7 Maven Plugin (Can be used for Tomcat 8 Deployments also)
<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>
<path>/yourappcontextpath</path>
</configuration>
</plugin>
Deploy to tomcat can be performed any of these goals on need basis.
mvn tomcat7:deploy
mvn tomcat7:undeploy
mvn tomcat7:redeploy
Also, for more detailed logging you can enable java.util.logging.ConsoleHandler in logging.properties file %Tomcat_path%/conf/logging.properties.
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = java.util.logging.ConsoleHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = java.util.logging.ConsoleHandler