Eclipse,myeclipse development environment, MAVEN remote deployment to TOMCAT7 server (graphics)
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.
In the Pom.xml file build Add the following code, the corresponding place to modify the account and password, and the name of the publication,
you need to download a lot of builds for the first time. Be patient ...
<Build> <Finalname>Test_server</Finalname> <!--Legacy Code - <plugin> <groupId>Org.codehaus.mojo</groupId> <Artifactid>Tomcat-maven-plugin</Artifactid> <version>1.1</version> <Configuration> <URL>Http://****/manager/text</URL> <Server>Test</Server> <username>Test</username> <Password>Test</Password> </Configuration> </plugin> </Plugins> </Build>
or configure in setting
<Server> <ID>Private-ez-tomcat</ID> <username>Test</username> <Password>Test</Password> </Server>
Referencing in Pom.xml
<plugin> <groupId>Org.codehaus.mojo</groupId> <Artifactid>Tomcat-maven-plugin</Artifactid> <version>1.1</version> <Configuration> <URL>Http://*****/manager/text</URL> <Server>Private-ez-tomcat</Server> <Path>/test</Path> </Configuration> </plugin>
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= "Test"Password= "Test"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". You must specify a valid lifecycle phase or a goalinchThe 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. --[Help1][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 Moreinformation about the errors and possible solutions, please read the following articles:[error] [ Help1] http://cwiki.apache.org/confluence/display/maven/lifecyclephasenotfoundexception
Transferred from: http://www.cnblogs.com/taoweiji/p/3859860.html
Eclipse,myeclipse development environment, MAVEN remote deployment to TOMCAT7 server (graphics)