在我们的一个项目中,我们使用properties-maven-plugin的read-project-properties目标来读取文件中的属性值,然后将其用于过滤资源.有关此过程的一般用途的讨论,请参阅此文章.
我们希望使用开发人员特定settings.xml中定义的合适配置文件覆盖文件中找到的一些值(与我们覆盖POM中设置的属性的方式相同).
但是,这不适用于properties-maven-plugin设置的属性.
我们如何实现目标?
作为一种解决方法,我们目前正在使用properties-maven-plugin注册一个额外的开发人员特定文件来实现此效果,但使用常规方式(配置文件)会更方便.
更一般地说,问题是:properties-maven-plugin的read-project-properties目标设置的属性如何与maven的属性定义优先级层次结合,这在这篇非常有用的博客文章中有所描述.
我将POM的相关元素提取到一个演示我的问题的玩具项目中.这是玩具项目的POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xxx</groupId>
<artifactId>MavenTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Maven Test</name>
<description>A maven project to test filtering and the maven-properties-plugin</description>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<!-- Read properties from a file -->
<execution>
<id>load-filter-properties</id>
<goals>
<goal>read-project-properties</goal>
</goals>
<phase>initialize</phase>
<configuration>
<files>
<file>filters/filterTest.properties</file>
</files>
<quiet>false</quiet>
</configuration>
</execution>
<!-- The following execution is for debug purposes only -->
<execution>
<id>write-project-properties</id>
<inherited>false</inherited>
<goals>
<goal>write-project-properties</goal>
</goals>
<phase>package</phase> …Run Code Online (Sandbox Code Playgroud) 我是一名新手,请原谅,如果这在其他地方很明显或很好.
我想使用Vagrant编写开发人员虚拟机的脚本.部分任务是安装(简单)和配置eclipse(即安装插件和功能,导入格式设置和其他工作区配置等 - 不是那么简单).
我可以使用shell配置程序以及一些自动执行eclipse设置的脚本.或者我可以尝试使用ansible供应商.安赛可以帮助我吗?是否有任何ansible模块为标准的eclipse设置任务提供解决方案?
当然,我可以手动创建一个合适的eclipse安装,然后打包并分发它.为了使这个可重复,我需要记录所有步骤,并确保本文档完整.这不是我想要做的.我想编写安装过程的脚本,以便可以随时重复和扩展.