手动打jar包,推荐Maven

时间:2023-01-25 22:42:03
Manifest-Version: 1.0
Build-Jdk: 1.7.0_71
Built-By: wzhjdls
Created-By: IntelliJ IDE
Class-Path: /Users/wzhjdls/IdeaProjects/service/common/World/out/production/World/
Main-Class: com.HelloWord
要回车

 
Manifest-Version: 1.0
Build-Jdk: 1.7.0_71
Built-By: wzhjdl
Class-Path: /Users/wzhjdls/IdeaProjects/service/common/World/out/production/World/
Created-By: IntelliJ IDEA
Main-Class: HelloWord

jar -cvfm hh.jar MANIFEST.MF  打包,如果。MF文件中有路径,jar的时候就只需写.MF即可,否则要带Class文件

即使多个文件,也只需要主文件的路径即可
打jar包及上传过程:1. 进入项目的根目录2. mvn -Dmaven.test.skip clean package 或  mvn clean package 3.将文件上传至服务器,用sftp,首先登录 sftp -P 16020 chen.puqiang@gw1-m6.wemomo.com  然后上传:put /本机文件路径   /服务器路径  下载:get /本机路径  /服务器路径4. moa-demo-make-assembly.tar.gz  将该文件解压   tar xvf moa-demo-make-assembly.tar.gz 5. 启动项目 sh start.sh6. 查看日志文件  tail -f stdout.logsh文件的编写:(GroupStatistic为程序的指定入口#!/bin/bashjvm_args="-Xmx2048m -Xms1024m -verbose:gc -Xloggc:./gc.log -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSCompactAtFullCollection -XX:MaxTenuringThreshold=10 -XX:-UseAdaptiveSizePolicy -XX:PermSize=256M -XX:MaxPermSize=512M -XX:SurvivorRatio=3  -XX:NewRatio=2 -XX:+PrintGCDateStamps  -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails "nohup java -cp .:conf/*:lib/* ${jvm_args} com.immomo.moaservice.impl.GroupStatistic >> ./stdout.log 2>&1 &