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. cmake add_custom_command 使用

    cmake add_custom_command 使用 今天整理编译工程,想在编译工程前面用tolua生成c文件, 使用命令add_custom_command后,附加的命令并不执行,如下: add_ ...

  2. 洛谷 4115 Qtree4——链分治

    题目:https://www.luogu.org/problemnew/show/P4115 论文:https://wenku.baidu.com/view/1bc2e4ea172ded630b1cb ...

  3. update_engine-整体结构(一)

    update_engine简介 update_engine是A/B升级的核心逻辑.理解了update_engine就理解了在Android系统中A/B升级是如何运行的.它的代码放在源码目录下syste ...

  4. Redis入门的简单使用

    Redis是什么? redis是一个开源的,面向键/值对的NOSQL的分布式数据库系统 NOSQL指的是非关系型的数据,简单直白地讲就是在非关系型的数据库中不存在表的概念,而是以键值对的方式, 即一个 ...

  5. mysql 8126

    注意: 1) 修改后的innodb_file_format格式, 只影响后续创建的表. 也就是后续创建的表,可以支持把row_format设为dynamic,之前创建的表仍然会报错 2) SET GL ...

  6. IO练习

    #IO操作 import time; fileObj = open('log.txt','a'); while(True): data = input('请输入要写入的内容 : '); if data ...

  7. CentOS 7.x 如何关闭 numa

    CentOS7.x中发现 numactl --interleave=all 执行失败. CentOS7.x中可以通过下面的方式关闭 numa: 1. 编辑 /etc/default/grub 文件,如 ...

  8. RN 使用第三方字体

    Android: 程序会尝试在 assets/fonts 目录下查找字体文件,如果没找到会使用默认的字体 所以将文件放到路径下才能生效! [project root]/android/app/src/ ...

  9. cmake中添加-fPIC编译选项方法

    合并openjpeg/soxr/vidstab/snappy等多个cmake库时,为了解决下述问题: relocation R_X86_64_32 against `.text' can not be ...

  10. python3学习笔记10(迭代器和生成器)

    参考http://www.runoob.com/python3/python3-iterator-generator.html 迭代器 迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束 ...