属性什么时候解决?
我在我的 base-pom 中定义了一个配置文件,它使用由子 pom 定义的属性(应用程序服务器的部署位置)模块)。该配置文件应在初始完整构建后使用,从而继承到所有子 pom。
问题是:如何/何时解决这些属性:何时进行初始完整构建或何时进行特定子模块的本地构建?
<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}
在子模块中定义...
I defined a profile at my base-pom which uses a property that is defined by a sub-pom (deploy-location of the appserver-module). The profile shall be used after the initial full-build and thus be inherited to all sub-poms.
The question is: how/when are such properties resolved: when doing the initial full build or when doing a local build of a specific submodule ?
<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}
is defined in a submodule ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚尝试了你的问题,并使用 m2eclipse 创建了两个工件。第一个是 q4794952.base,它是一个简单的 Maven 项目,其类型设置为 pom。然后我创建了第二个工件(右键单击基础项目, New => Maven => Maven Module ),它自动在基础工件内创建父标签和(子)模块。
当使用由上述过程创建的模块结构时(或者一般情况下,模块由标签已知),子模块的属性是“基础”已知的,并将在“完整构建”中解析(可以当然可以通过使用 help: effective-pom 和构建结果来查看)。如果您只构建子模块,它也会被解析,因为配置文件是从父 pom 中获取的,并且属性是在(子)模块中设置的。
这是我的“basepom”:
I just tried out your question a created two artifacts with m2eclipse. The first is q4794952.base which is a simple maven project and has its type set to pom. Then I created the second artifact from (right click on the base project, New => Maven => Maven Module ) which automatically creates the parent tag and the (sub)module inside the base artifact.
When using a module structure like created by the process above (or in genereal where the module is known by the tag) the property from the submodule is know to the "base" and will be resolved in the "full-Build" (as can be seen by using help:effective-pom and the build result of course). If you build just the submodule it's resolved as well because the profile is taken from the parent pom and the property is set in the (sub)module.
Here's my "basepom":