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

后端 未结 5 2113
旧时难觅i
旧时难觅i 2020-12-30 05:00

i am trying to do mvn tomcat:deploy and i came across with the error

 [ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1         


        
相关标签:
5条回答
  • 2020-12-30 05:19

    The following way works for me.

    1. Please change your pom.xml to include

      <project>
          ...
          <build>    
              <plugins>    
              ....
                  <plugin>
                      <groupId>org.apache.tomcat.maven</groupId>
                      <artifactId>tomcat7-maven-plugin</artifactId>
                      <version>2.1</version>
                      <configuration>
                          <url>http://localhost:8080/manager/text</url>
                          <server>my-tomcat</server>
                          <path>/myapp</path>
                      </configuration>
                  </plugin>
              </plugins>
              ...
          </build>
          ...
      </project>
      
    2. Make sure your Tomcat 7 server have the following lines on TOMCAT_HOME/conf/tomcat-users.xml:

      <!-- Role to manage WAR files via HTML /manager. The name should be as is! -->
      <role rolename="manager-gui"/>
      <!-- Role to manage WAR files via script like Maven. The name should be as is! -->
      <role rolename="manager-script"/>
      
      <!-- One user cannot have manager-gui and manager-script roles -->
      <user username="managerGui" password="managerPwd" roles="manager-gui"/>
      <user username="manager" password="managerPwd" roles="manager-script"/>
      
    3. Configure your USER_HOME/.m2/settings.xml to include the password.

      <settings>
          ...
          <servers>
              ...
              <server>
                  <id>my-tomcat</id>
                  <username>manager</username>
                  <password>managerPwd</password>
              </server>
          </servers>
      
      </settings>
      
    4. Deploy using mvn tomcat7:redeploy

    Read more on http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

    0 讨论(0)
  • 2020-12-30 05:22

    In my case solution worked. I did one petty mistake of not starting Apache Tomcat Server.

    Apart from this, make user that you do appropriate entry in maven/conf/setting.xml within tag:-

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

    In Apache Tomcat 7 tomcat-users.xml, following line should be added within

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

    In Pom.xml

     <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
            <url>http://localhost:8888/manager/text</url>
            <server>TomcatServer</server>
            <path>$ReplaceWithWarFileName$</path>
            <update>true</update>
            <username>admin</username>
            <password>password</password>
        </configuration>
    </plugin>
    
    0 讨论(0)
  • 2020-12-30 05:30

    A solution which worked in my case is:

    1. Go to the module having Main class.
    2. Right click on pom.xml under this module.
    3. Select "Run Maven" -> "UpdateSnapshots"
    0 讨论(0)
  • 2020-12-30 05:32

    First you must be aware of the move of the tomcat-maven-plugin to the apache software foundation Second you shouldn't put configuration stuff into maven/conf/settings.xml you should use the users settings.xml file HOME/.m2/settings.xml instead.

    Apart from the above you should use the following URL for accessing Tomcat:

    http://localhost:8080/manager/html
    
    0 讨论(0)
  • 2020-12-30 05:33
    1. A solution that worked for me was in the Run options :

      1_ Maven Install

      2_ Maven Build

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