Some people want to write Java Web Projects in Eclipse, and Maven is also a way to implement a Java Web project that can be packaged into a war and published to Tomcat.
Add the following code to the build of the Pom.xml file, modify the account and password accordingly, and the name of the publication
<Build> <Finalname>Daka_server</Finalname><!--original code--
<plugin> <groupId>Org.codehaus.mojo</groupId> <Artifactid>Tomcat-maven-plugin</Artifactid> <version>1.1</version> <Configuration> <URL>Http://localhost:8080/manager/text</URL> <Server>Healthpad</Server> <username>Dakaclub</username> <Password>Dakaclub</Password> </Configuration> </plugin> </Plugins> </Build>
Modify the Apache-tomcat-7.0.52-9080\conf\tomcat-users.xml file
<?XML version= ' 1.0 ' encoding= ' utf-8 '?><tomcat-users> <rolerolename= "Admin-gui"/> <rolerolename= "Admin-script"/> <rolerolename= "Manager-gui"/> <rolerolename= "Manager-script"/> <rolerolename= "MANAGER-JMX"/> <rolerolename= "Manager-status"/> <Userusername= "Dakaclub"Password= "Dakaclub"Roles= "Manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/> <rolerolename= "MANAGER-JMX"/> <rolerolename= "Manager-status"/></tomcat-users>
Right-click the project
Create a new Maven run task
Click Browse Workspace to select the project to run, fill in the Tomcat:deploy or Tomcat:redeploy in goals,
The network said to fill MVN tomcat:deploy, but in the Eclipse environment do not fill in mvn,
If you fill out the MVN tomcat:deploy will be an error:
[ERROR] Unknown lifecycle Phase "MVN". Must specify a valid lifecycle phase or a goal in the format<Plugin-prefix>:<goal>Or<Plugin-group-id>:<Plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle Phases Are:validate, Initialize, generate-sources, process-sources, Generate-resources, Process-resources, compile, process-classes, generate-test-sources, Process-test-sources, Generate-test-resources, Process-test-resources, Test-compile, process-test-classes, test, Prepare-package, package, Pre-integration-test, Integration-test, Post-integration-test, verify, install, deploy, Pre-site, site, Post-site, Site-deploy, Pre-clean, Clean, Post-clean. "Help 1][error" [ERROR] to see the full stack trace of the errors, re-run Maven with THE-E switch. [ERROR] Re-run Maven using The-x switch to enable full debug logging. [ERROR] [ERROR] For more information on the errors and possible solutions, please read the following articles:[error] [Help 1] http://c Wiki.apache.org/confluence/display/maven/lifecyclephasenotfoundexception
The
is done.