MAVEN-based Javaweb project build deployment

Source: Internet
Author: User
Tags apache tomcat

installation files that need to be prepared:

1 JDk

Http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html

The Jdk-8u45-windows-x64.exe has 64-bit and 32-bit

2 Apache Tomcat

http://tomcat.apache.org/, download the required version, with 64-bit and 32-bit, corresponding to the JDK, 32-bit Tomcat is not able to start the 64-bit JDK.

Apache-tomcat-7.0.62-windows-x64.zip

3 Apache Maven

HTTP://MAVEN.APACHE.ORG/DOWNLOAD.CGI, also rely on JDK

Apache-maven-3.3.3-bin.zip

Installation:

1 Installation of JDK

Double-click EXE file to install to D drive

Set Environment variables:

ClassPath.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

Java_home D:\Program files\java\jdk1.8.0_45

Path.; %java_home%\bin;

2 Installation of Apache Tomcat

Only need to decompress, the default consumption of 8080 port, if occupied, you can change the port

Registering Tomcat as a service

Register Uninstall Service: http://blog.csdn.net/nddjava/article/details/6426911

Command line startup service: http://www.cnblogs.com/wlei/archive/2011/12/24/2300389.html

3 Apache maven Installation

Only need to decompress, set environment variables

Path D:\Program Files\apache-maven-3.3.3\bin

You can enter mvn-version on the command line to verify that the configuration is successful

Compiling the source code to package

In the command line Mode CD command to enter the source code directory

Input Command MVN Clean package, the use of commands related to the life cycle of MAVEN, can be consulted: http://juvenshun.iteye.com/blog/213959

After a successful build, a war package is generated in the target directory of the project

The above is the ideal state, in fact, you may encounter a lot of problems in the construction. Sometimes the project has dependencies, possibly the central warehouse (which can use Nexus as a central warehouse), the remote repository, and the Maven build is based on the Pom.xml file, and if the dependent component is not there, the build will go wrong, so in practical applications maven needs to be configured.

<?xml version= "1.0" encoding= "UTF-8"?>

<settings xmlns= "http://maven.apache.org/SETTINGS/1.0.0"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://maven.apache.org/SETTINGS/1.0.0http://maven.apache.org/xsd/settings-1.0.0.xsd" >

<localRepository>F:\CI\maven3.0.3_repository</localRepository>

<servers>

<server>
<id>dev</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>deploymentRepo</id>
<username>deployment</username>
<password>111111</password>
</server>

</servers>

<mirrors>

<mirror>
<id>central</id>
<mirrorOf>*</mirrorOf>
<NAME>MDP remoteartifactory</name>
<url>http://10.0.111.153:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>

<profiles>

<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://10.0.111.153:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://10.0.111.153:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
</settings>

Deploy the war package into Tomcat

Under the WebApps subdirectory of the Tomcat installation directory, restart Tomcat

MAVEN-based Javaweb project build deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.