将本地开发的 Maven 2 项目部署到 Linux Tomcat 下的步骤
本文是《集成 Maven 2 插件到 Eclipse 的过程》的姊妹篇,介绍如何将你开发好的 Maven 2 项目部署到 Linux 的 Tomcat 下。
1.配置 Maven 环境变量
配置 Path 环境变量,指向 Maven 2 的 bin 目录。比如我的 Maven 2 安装在 D 盘的 tools 目录下,于是我在环境变量 Path 里加进一条:
D:\tools\apache-maven-2.0.11\bin;
然后 commandLine 输入 mvn -v,打印出 maven 的版本号等信息,证明环境变量配置成功。
2.添加 assembly 插件实现自定义打包
修改 pom.xml 相关设置如下:
user nginx nginx ;worker_processes 8;error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { use epoll; worker_connections 8192;}http { include mime.types; default_type application/octet-stream; log_format main '[$time_local] $remote_addr - "$request" ' '$status "$http_user_agent" ' '"$args"'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 120; client_max_body_size 120m; client_body_buffer_size 128k; server_names_hash_bucket_size 128; large_client_header_buffers 4 4k; open_file_cache max=8192 inactive=20s; open_file_cache_min_uses 1; open_file_cache_valid 30s; gzip on; gzip_http_version 1.0; gzip_disable "MSIE [1-6]."; gzip_min_length 1000; gzip_buffers 4 8k; gzip_types text/plain text/css application/x-javascript; server {listen 80;chunkin on;server_name www.defonds.com;charset utf-8;access_log logs/host.access.log main;#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}error_page 411 = @my_411_error;location @my_411_error {chunkin_resume;}location = /favicon.ico {log_not_found off;access_log off;expires 90d;}location / {proxy_pass http://localhost:8080;include proxy.conf;} } # HTTPS server # server { listen 443; server_name www.defonds.com; ssl on; ssl_certificate defondssync.crt; ssl_certificate_key defondssync.key; charset utf-8;access_log logs/ssl.host.access.log main;error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}location = /favicon.ico {log_not_found off;access_log off;expires 90d;}location / {proxy_pass http://localhost:8080;include proxy.conf;} }}