zoukankan      html  css  js  c++  java
  • maven profile参数动态打入

    第一:

    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>
  • 相关阅读:
    父母的房产继承买卖赠予以及网络红包代金券优惠券的国家最新税法规定
    家里这7个地方要装柜子,少装一个都是灾难!
    centos里的压缩解压命令tar总结
    2019年9月2日开学!寒假时间也定了……
    理赔时很容易出差错的3个“隐蔽”点
    Linux命令:用“dirs”、“pushd”、“popd”来操作目录栈
    python金融反欺诈-项目实战
    模型分数分布
    PSi-Population Stability Index (PSI)模型分稳定性评估指标
    Kolmogorov–Smirnov test(KS)
  • 原文地址:https://www.cnblogs.com/qiumingcheng/p/5203949.html
Copyright © 2011-2022 走看看