什么时候解决了属性?

时间:2011-01-25 14:57:44

标签: maven-2 maven

我在 base-pom 中定义了一个配置文件,其中使用属性由子pom 定义(部署位置为appserver-module)。该配置文件应在初始完整构建之后使用,因此可以继承到所有子节点。

问题是:这些属性如何/何时解决:进行初始完整构建或进行特定子模块的本地构建时?

<profile>
  <id>quickdeploy</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <outputDirectory>${ear.path}</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>

${ear.path}在子模块中定义......

1 个答案:

答案 0 :(得分:0)

我刚尝试使用m2eclipse创建了两个工件。第一个是q4794952.base,它是一个简单的maven项目,其类型设置为 pom 。然后我创建了第二个工件(右键单击基础项目,New =&gt; Maven =&gt; Maven模块),它自动在基础工件中创建父标记和(子)模块。

当使用像上面的过程创建的模块结构时(或者在标签中已知模块的genereal中),子模块中的属性对“base”是已知的,并将在“full-Build”中解析(通过使用help:effective-pom和构建结果可以看出)。如果只构建子模块,它也会被解析,因为配置文件是从父pom获取的,属性是在(子)模块中设置的。

这是我的“basepom”:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.stackoverflow</groupId>
  <artifactId>q4794952.base</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <profiles>
    <profile>
    <id>quickdeploy</id>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <outputDirectory>${ear.path}</outputDirectory>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
  </profiles>
  <modules>
    <module>q4794952.sub</module>
  </modules>
</project>
相关问题