tomcat-maven-plugin 403 error

前端 未结 21 1270
礼貌的吻别
礼貌的吻别 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:40

    If you are using Tomcat 7:

    1. Change your configuration in pom.xml to use the Tomcat 7 version of the plugin

      <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.1</version>
          <configuration>
              <url>http://127.0.0.1:8080/manager/html</url>
              <server>TomcatServer</server>
              <path>/your_context</path>
              <username>some_user_name</username>
              <password>some_password</password>
          </configuration>
      </plugin>
      

    Notice the and values - they are DIFFERENT from the ones for Tomcat 6.

    1. Don't forget to change the "tomcat:deploy" to "tomcat7:deploy" in your scripts, or External Tools Configurations launchers in Eclipse.
    2. Add a server configuration to your settings.xml, usually located under .m2 folder
    <server>
        <id>TomcatServer</id>
        <username>some_user_name</username>
        <password>some_password</password>
    </server>
    
    1. If you need additional options, like deploying a WAR file located in a non-standard folder, visit: Tomcat 7 Maven Plugin
    0 讨论(0)
  • 2020-12-07 18:40

    This is also possible:

    <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>tomcat-maven-plugin</artifactId>
        <configuration>
            <server>myserver</server>
            <username>admin</username>
            <password>admin</password>
        </configuration>
    </plugin>
    
    0 讨论(0)
  • 2020-12-07 18:41

    There are a few steps one must be sure that are accomplished. this can be a true black hole.

    If your are using tomcat-maven-plugin from org.codehaus.mojo, you must use this configuration:

    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <warFile>your_war_filename.war</warFile>
        <server>server_name_on_settingsxml</server>
    </configuration>
    

    Please ensure that you have 'server_name_on_settingsxml' server credentials defined on maven settings.xml. Use mvn tomcat:deploy (you must use this 'tomcat' prefix), this is the only way that when deploying the above configurations are read.

    However if you are using tomcat7-maven-plugin from org.apache.tomcat.maven, you must use mvn tomcat7:deploy. The 'tomcat7' prefix will read configuration from plugin:

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
    

    I was using tomcat:deploy, and i had on the pom.xml the tomcat7-maven-plugin defined. So, the maven deploy was never reading my configurations tag...

    If you ensure you have usernames and passwords correctly define and you use the correct plugin when deploying, it will work.

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