I am setting up Jenkins to learn how to implement the automated deployment of a maven project in tomcat.
tomcat-users.xml has the roles and username defined, the ones of interest
<role rolename="manager-script"/>
<user username="jenkins" password="jenkins" roles="manager-script"/>
I have set up web.xml to allow the PUT method
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
and even tried to setup the manager application to allow the PUT method for /text/*
pattern
<security-constraint>
<web-resource-collection>
<web-resource-name>Text Manager interface (for scripts)</web-resource-name>
<url-pattern>/text/*</url-pattern>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>manager-script</role-name>
</auth-constraint>
</security-constraint>
But when I request the manager deploy script from the command line I get a 405 response.
curl -u jenkins:jenkins -F filedata=target/**.war "http://localhost:8080/manager/text/deploy?path=/devops&update=true"
This is the output:
<!doctype html><html lang="es"><head><title>Estado HTTP 405 ÔÇô Method Not Allowed</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>Estado HTTP 405 ÔÇô Method Not Allowed</h1><hr class="line" /><p><b>Tipo</b> Informe de estado</p><p><b>mensaje</b> El Metodo HTTP POST no est├í soportado por esta URL</p><p><b>descripci├│n</b> El m├®todo HTTP especificado no est├í permitido para el recurso requerido.</p><hr class="line" /><h3>Apache Tomcat/8.5.42</h3></body></html>
which is an HTML response saying the HTTP POST method is not supported for that route.
I am using -F filedata=target/**.war because if I use -T option under windows the war file can't be opened
curl -v -u jenkins:jenkins -T target/**.war "http://localhost:8080/manager/text/deploy?path=/devops&update=true"
output: curl: Can't open 'target/**.war'!
And seems request Tomcat with filedata option is a POST method which it is not allowed. How can I ensure the POST verb is enabled for manager application?