1、maven插件wagon-maven-plugin自动部署远程Linux服务器  (http://xxgblog.com/2015/10/23/wagon-maven-plugin/)

            <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<fromFile>executableJar/${final.name}.jar</fromFile>
<url>scp://${user}:${password}@${ip}/data/app/uploadDir</url>
<commands>
<!--<command>/etc/init.d/nginx stop</command>-->
<command>cp /data/app/${final.name}.jar /data/app/uploadDir/${final.name}.jar_`date "+%Y-%m-%d_%H-%M-%S"`</command>
<command>sh /data/app/diary-starter.sh stop</command>
<command>mv -f /data/app/uploadDir/${final.name}.jar /data/app/${final.name}.jar</command>
<command>sh /data/app/diary-starter.sh restart</command>
<!--<command>/etc/init.d/nginx start</command>-->
</commands>
<displayCommandOutputs>true</displayCommandOutputs>
</configuration>
</plugin>

2、maven插件maven-resources-plugin 设置加载资源文件的时候占位符是否需要被替换

  要用到<resource/>标签和maven-resources-plugin插件了,用法如下:

    <build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>application.properties</exclude>
<exclude>application-prod.properties</exclude>
<exclude>application-test.properties</exclude>
<!--<exclude>application-remoteTest.properties</exclude>-->
<!--<exclude>application-remoteProd.properties</exclude>-->
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.properties</include>
<include>application-${profileActive}.properties</include>
</includes>
</resource>
</resources>
<finalName>../executableJar/${final.name}</finalName>

  resource的filtering属性用来表示资源文件中的占位符是否需要被替换,true为需要替换。

            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>

 以上<nonfilteredFileExtension>作用:maven打包时,会编译特定文件使得文件不可用。用上面的方法可以排除某些文件不编译

Maven 打包项目 部署到服务器 重启服务 插件的更多相关文章

  1. Springboot 项目部署到服务器上

    项目部署到服务器上,有两种方式,一种 jar 包,一种 war 包 jar包 部署时,后续的域名配置,SSL证书等在nginx中配置 war包 部署时,后续的域名配置可以在tomcat中配置就好,修改 ...

  2. java项目部署Linux服务器几种启动方式总结经验

    一:两种部署包: 部署之前先说下两种包,java项目部署到服务器一般有用war包的,也有用jar包的,微服务spring-cloud普及后大部分打包都是jar,部署之前先搞清楚自己要打war包还是ja ...

  3. springboot项目部署云服务器

    Springboot项目部署云服务器 springboot项目部署云服务器还是挺简单的 首先你要有java运行环境,就是jdk的安装,如果还没有装没有参考安装:阿里云ECS建网站(建站)超详细全套完整 ...

  4. 服务器小白的我,是如何将 node+mongodb 项目部署在服务器上并进行性能优化的

    前言 本文讲解的是:做为前端开发人员,对服务器的了解还是小白的我,是如何一步步将 node+mongodb 项目部署在阿里云 centos 7.3 的服务器上,并进行性能优化,达到页面 1 秒内看到 ...

  5. ssm项目部署到服务器过程

    ssm项目部署到服务器过程 特别篇 由于准备春招,所以希望各位看客方便的话,能去github上面帮我Star一下项目 https://github.com/Draymonders/Campus-Sho ...

  6. 关于使用IDEA,使用Maven打包项目

    关于使用IDEA,使用Maven打包项目 在近期的一个接口项目中,使用的是SpringBoot + Maven的配置, 由于使用IDEA不久,不太熟悉使用Maven进行项目打包.记录一下. 由于使用的 ...

  7. 如何把vue.js项目部署到服务器上

    如何把vue.js项目部署到服务器上面,我用的是tomcat服务器 1-改一下config/index.js文件,如下图,把assetsPublicPath: './', productionSour ...

  8. Eclipse导入git上的maven web项目 部署 - lpshou

    http://www.tuicool.com/articles/fqm2Qf   推酷 文章 微博 主题 站点 活动 应用 周刊 登录   Eclipse导入git上的maven web项目 部署 - ...

  9. 使用maven打包项目遇到错误: http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

    今天在使用maven打包项目时遇到一个错误: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin ...

随机推荐

  1. centos7 升级openssh到openssh-8.0p1版本

    环境介绍 centos7.3和centos7.6升级完毕测试登录ssh以及重启后登录ssh均无问题. 前期请自行配置好yum源(如果不会请百度) 整个过程不需要卸载原先的openssl包和openss ...

  2. python安装media报错

    Try https://pypi.python.org/pypi/setuptools easy_install LEE 我后来,依次在Python2.7中装了 numpy-1.7.0-win32-s ...

  3. shell脚本,如果文件中的第一列有相同的,就把相同的那些行的其他字段相加

    命令:awk '{a[$1]+=$2}{b[$1]+=$3}END{for(i in a){print i,a[i],b[i]}}'

  4. 工控随笔_14_西门子_Step7项目:打开项目不可用解决方法

    由于计算机系统区域和语言的设置,以及Step建立项目时的不同设置,有时候利用Step7打开项目时 会遇到如下情况:   项目不可用. 具体如下图所示: 图 step 7 打开时项目不可用 一.Step ...

  5. react连连看

      // Math.floor(t * Math.random()); var isInclude = function (array, element) { let alen = array.len ...

  6. LAB1 partI

    序言 1. master.go 可以正常调用Distributed() 和 Sequential(). Sequential 顺序执行主要用于调试. 2. master : 创建一个 RPC serv ...

  7. MTSC2018 | 确认过眼神,在这里能遇见Google、阿里、百度......

    MTSC2018部分Topic曝光啦 Google,阿里,百度,美团,小米,360,网易等公司是如何将技术转化为现实生产力,提高工作效率的?离开Saucelab的Jonathan又是如何规划Appiu ...

  8. C# 导出Excel Table td 样式

    <td style="vnd.ms-excel.numberformat:@;"><s:property value="accountCode" ...

  9. 廖雪峰Java8JUnit单元测试-2使用JUnit-3参数化测试

    参数化测试: 可以把测试数据组织起来 用不同的测试数据调用相同的测试方法

  10. 通用mapper版+SpringBoot+MyBatis框架+mysql数据库的整合

    转:https://blog.csdn.net/qq_35153200/article/details/79538440 开发环境: 开发工具:Intellij IDEA 2017.2.3 JDK : ...