相关疑难解决方法(0)

properties-maven-plugin:加载属性文件时出错

我想从我的pom.xml中提取属性文件中的所有属性.这些是常见的属性,如依赖版本,插件版本和目录.我正在使用properties-maven-plugin,但它不能像我想要的那样工作.

我的pom.xml的基本部分:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0-alpha-1</version>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>read-project-properties</goal>
      </goals>
      <configuration>
       <files>
          <file>${basedir}/pom.properties</file>
        </files>
      </configuration>
    </execution>
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

现在,当我运行"mvn属性:read-project-properties"时,我收到以下错误:

[INFO] One or more required plugin parameters are invalid/missing for 'properties:read-project-properties'

[0] Inside the definition for plugin 'properties-maven-plugin' specify the following:

<configuration>
  ...
  <files>VALUE</files>
</configuration>.
Run Code Online (Sandbox Code Playgroud)

pom.properties文件与pom.xml位于同一目录中.我该怎么做才能让properties-maven-plugin读取我的属性文件?

编辑

我在http://jira.codehaus.org/browse/MOJO-1523提交了一个问题.它已被关闭为"不是一个bug",原因是:

这是设计的.项目定义必须是自包含的,否则如果从别处作为传递deps的一部分引用它则不再完整.

maven-2 maven-plugin

9
推荐指数
2
解决办法
3万
查看次数

是否可以从蚂蚁设置maven属性?

我尝试使用maven-antrun-plugin检查第一次执行是否存在文件,然后相应地设置属性.在antrun-plugin的另一个执行(另一个阶段)中,我想要使用该属性.但是在一次执行中设置的属性不能在另一个执行中使用,因为它是一个ant而不是maven属性并且不会被传播.

是否可以将ant属性传播到maven,或者换句话说从ant设置maven属性?

使用像这个问题中的另一个Maven构建不是一个选项.

可能以某种方式工作的另一种方式是外部build.xml,但这也不是一个选项,因为我必须把东西放在一个pom中.

我已经阅读过使用GMaven来设置Maven属性,但我想留下蚂蚁.

maven-2 properties maven-antrun-plugin

8
推荐指数
1
解决办法
6313
查看次数