第一:

1,如果是resources目录下文件profile参数中动态打入,在pom.xml中的build标签中加入如下配置:

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering><!-- 非常重要,表示是否动态打入参数 -->
<includes>
  <include>**/*.*</include><!--表示 resources目录下的多级路径 -->
  </includes>
</resource>
</resources>
2,如果想将打入参数的文件换个路径放置,则需要引入下面插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources1</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
          <!-- 系统参数${project.build.directory},可以直接使用 -->
<outputDirectory>${project.build.directory}/build/conf</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/classes</directory>
              <!-- 下面三个是resources路径下的三个文件夹,最终将其放到${project.build.directory}/build/conf下了-->
<include>mybatis</include>
<include>prop</include>
<include>spring</include>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin> 第二:
如果要动态打入参数的文件不在resources下,只需要加入如下插件就可以了
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions> <execution>
<id>copy-resources2</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/build/bin</outputDirectory>
<resources>
<resource>
              <!-- 下面的bin是项目的跟路径下有个bin文件夹 -->
<directory>bin</directory>
<include>start.sh</include>
<include>stop.sh</include>
<filtering>true</filtering><!-- 这个参数非常重要,必须是true,否则无法动态打入参数-->
</resource>
</resources>
</configuration>
</execution> </executions>
</plugin>

maven profile参数动态打入的更多相关文章

  1. maven profile的使用

    作为一名程序员,在开发的过程中,经常需要面对不同的运行环境(开发环境.测试环境.生产环境.内网环境.外网环境等等),在不同的环境中,相关的配置一般不一样,比如数据源配置.日志文件配置.以及一些软件运行 ...

  2. 【转】maven profile实现多环境打包

    作为一名程序员,在开发的过程中,经常需要面对不同的运行环境(开发环境.测试环境.生产环境.内网环境.外网环境等等),在不同的环境中,相关的配置一般不一样,比如数据源配置.日志文件配置.以及一些软件运行 ...

  3. 项目实现不同环境不同配置文件-maven profile

    最近接触的项目都是在很多地方都落地的项目,需要支持不同的环境使用不同的配置文件.一直以来都以为是人工的去写不同的配置文件,手动的去修改运用的配置文件.感觉自己还是太low呀.maven的使用的还停留在 ...

  4. 在eclipse激活maven profile配置

    profile简介 profile可以让我们定义一系列的配置信息,然后指定其激活条件.这样我们就可以定义多个profile,然后每个profile对应不同的激活条件和配置信息,从而达到不同环境使用不同 ...

  5. How to activate maven profile inside eclipse

    How to activate maven profile inside eclipse Normally maven is use for project dependency management ...

  6. Maven常用参数及其说明【转:http://blog.csdn.net/wangjunjun2008/article/details/18982089】

    Maven常用参数及其说明 -h,--help                              Display help information-am,--also-make         ...

  7. 使用maven profile实现多环境可移植构建(转自CSDN)

    使用maven profile实现多环境可移植构建 标签: maven profilemaven自动构建maven自动部署maven可移植构建持续集成 2014-04-25 23:37 26905人阅 ...

  8. asp.net向后台传参数动态加载图片

    //向后台传参数动态加载图片 $(function() { $("#Button1").click(function() { var stockcode = getUrlParam ...

  9. 通过maven profile 打包指定环境配置

    背景 最近换了个新公司接手了一个老项目,然后比较坑的是这个公司的项目都没有没有做多环境打包配置,每次发布一个环境都要手动的去修改配置文件.今天正好有空就来配置下. 解决这个问题的方式有很多,我这里挑选 ...

随机推荐

  1. iOS 7 改变Status Bar 颜色

    Set the UIViewControllerBasedStatusBarAppearance to NO in the Info.plist. In ViewDidLoad method or a ...

  2. m元素集合的n个元素子集

    理论: 假设有5个元素的集点,取出3个元素的可能子集如下:{1 2 3}.{1 2 4 }.{1 2 5}.{1 3 4}.{1 3 5}.{1 4 5}.{2 3 4}.{2 3 5}.{2 4 5 ...

  3. Spring的MethodInvokingFactoryBean

    通过MethodInvokingFactoryBean 可以向某静态方法注入参数. 如: <bean class="org.springframework.beans.factory. ...

  4. Redis 命令参考

    Redis 命令参考 http://redis.readthedocs.org/en/latest/index.html

  5. 使用zeranoe的自动化脚本mingw-w64-build-3.6.4在ubutun14.04_64bit上交叉编译ffmpeg 2.5

    编译期间,碰到的两个大问题,是环境变量设置问题. 先列出执行脚本是碰到的两个问题,后面给出解决方法并记录执行的命令步骤. 问题1: 编译binutils 2.5出错 ----------------- ...

  6. openssl 安装

    六.运行“nmake -f ms\ntdll.mak install”安装编译后的OpenSSL到指定目录. 七.查看安装结果C:\usr\local\ssl或C:\openssl-0.9.8.e下包 ...

  7. nth-child和nth-of-type的区别

    以前一般都用:nth-child,后来知道了:nth-of-type,然后就一般用nth-of-type 它们两有什么区别呢? 首先来看个现象: 假如有这样一个HTML结构 <div class ...

  8. ref 关键字out关键字

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  9. (原)JNI中env->GetByteArrayElements和AndroidBitmap_getInfo的冲突

    也不是很确定,前段时间的代码没有出问题,但是今天调试了半天,一直崩溃:vm aborting. 以前的部分代码: JNIEXPORT void JNICALL XXX (JNIEnv* env,job ...

  10. spring注解注入:<context:component-scan>使用说明

    spring从2.5版本开始支持注解注入,注解注入可以省去很多的xml配置工作.由于注解是写入java代码中的,所以注解注入会失去一定的灵活性,我们要根据需要来选择是否启用注解注入. 在XML中配置了 ...