Many third-party jar packages are often introduced in Java development, but the development of Java Web development and other Java projects often leads to unnecessary exceptions due to the lack of dependency packages. It is often because of this reason that a lot of simple missing packages and version problems are a lot of effort. However, the open source world does not allow Java developers to expend too much effort on this.
Apache provides MAVEN tools to automate the build and release of projects. Just add the appropriate configuration to MAVEN's Pom.xml file, and the rest of the work will be given to Maven. But go for a cup of tea and be a quiet, handsome man. In addition to Maven there are Gradle, Ivy, Grape, Buildr, SBT, Leiningen and so on.
The various jar packages and their configuration files can be found on the http://www.mvnrepository.com/
Premise:
1. The JDK, Tomcat, Eclipse, maven, and Maven Eclipse plugins have been successfully installed.
2. Projects created by Maven
MAVEN publishing Web project to Tomcat step
1. Add under the <tomcat-users> node in Conf/tomcat-users.xml under the Tomcat installation directory
<rolerolename= "Admin-gui"/><rolerolename= "Admin-script"/><rolerolename= "Manager-gui"/><rolerolename= "Manager-script"/><rolerolename= "MANAGER-JMX"/><rolerolename= "Manager-status"/><Userusername= "Admin"Password= "Password"Roles= "Manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
2. Add under the <servers> node in Conf/settings.xml under Maven installation directory
<Server> <ID>TOMCAT7</ID><!-this name is consistent with the parameter values set by Maven in Eclipse--> <username>Admin</username> <Password>Password</Password></Server>
3. Add the Pom.xml <build> node in the project
<Plugins> <plugin> <groupId>Org.apache.tomcat.maven</groupId> <Artifactid>Tomcat7-maven-plugin</Artifactid> <version>2.1</version> <Configuration> <!--Note the URL here and modify it to a tomcat-monitored port - <URL>Http://localhost:8081/manager/text</URL> <Server>Tomcat7</Server> <!--the name here must match the ID configured in Setting.xml - <Path>/${project.artifactid}</Path> <!--The name here is the project name - <Server>Tomcat7</Server> </Configuration> </plugin> </Plugins>
4. Right-click Project->run as->maven build...-> enter Tomcat7:deploy in goals
5. Deploy to Tomcat
Start Tomcat first, and then execute
Right-click Project->run As->maven build to publish to Tomcat
Uploaded:http://Localhost:8081/manager/text/deploy?path=%2fwenku (2413 KB at 30154.2 kb/sec)[ INFO] Tomcatmanager status code: $-Deployed Application at Context Path/--------------------- ------------------------------------------------------------------------------------------------------ ---------------------4.6582015-11-13t16:13:11+08:00[INFO] Final memory:15m/- -----------------------------------------------------------------------
When the above information appears, it has been published successfully. You can see the specifics of the deployment under WebApps
At this point, you can access the appropriate Web site via http://localhost:8081/wenku/.
MAVEN publishes Web project to Tomcat