tomcat-maven-plugin 403 error

前端 未结 21 1364
礼貌的吻别
礼貌的吻别 2020-12-07 18:05

When I use mvn tomcat:deploy of tomcat-maven-plugin there is a 403 error:

Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.0:deploy (default-cli) on pr

相关标签:
21条回答
  • 2020-12-07 18:36

    This solution is for "Apache" Tomcat7 plugin: As it is already mentioned before you need to add "/text" to the end of the url

    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <port>8080</port>
        <path>/deployPath</path>
        <url>http://localhost:8080/manager/text</url>
        <server>TomcatServer</server>
    </configuration>
    

    Configure you "settings.xml" which is located inside .m2 folder

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

    Since you use Tomcat 7, the MOST important thing is that you should create a different user for "manager-script" role, as it is mentioned in the documentation!

    <role rolename="manager-script"/>
    <user username="tomcat" password="password" roles="manager-script"/>
    
    0 讨论(0)
  • 2020-12-07 18:37

    you should use /text:

    http://localhost:8080/manager/text

    and also add to user role manager-script

    0 讨论(0)
  • 2020-12-07 18:38

    I used to get the same error, you just have to make sure that tomcat-users.xml file contain the user (admin in my case) with roles as (manager, manager-gui, admin, manager-script).

    I have tomcat 7, maven 3 on ubuntu.

    0 讨论(0)
  • 2020-12-07 18:38

    Passing from tomcat6 to tomcat7 recap:

    1. Add roles in tomcat-user.xml
    2. Add /text or /html to your url
    3. Change plugin version

      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat7-maven-plugin</artifactId> 
      <version>2.2</version>
      
    4. Change the option tomcat:deploy with tomcat7:deploy

    0 讨论(0)
  • 2020-12-07 18:39

    May be you should check your configuration file in ~/.m2/settings.xml this file have to be with the follow struct :

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <localRepository/>
      <interactiveMode/>
      <usePluginRegistry/>
      <offline/>
      <pluginGroups/>
      <servers/>
      <mirrors/>
      <proxies/>
      <profiles/>
      <activeProfiles/>
    </settings>
    

    After that you should to be sure that your server conf is correct for your project, instance of:

      <servers>
         <server>
            <id>mytomcat</id>
            <username>test</username>
            <password>test</password>
         </server>
      </servers>
    

    later run mvn tomcat:deploy. Remember that also you could run tomcat:deploy -X for see the debbug.

    0 讨论(0)
  • 2020-12-07 18:39

    If you are using Eclipse with the plugin m2eclipse and you still have this error after trying these solutions, it could be because this plugin has not the manager included. You should download Tomcat separately and configure Eclipse to use it (check this link: tomcat-maven-plugin: Server returned HTTP response code: 403)

    0 讨论(0)
提交回复
热议问题