带有 Flex4 设置的复杂 Maven2
我一直在努力让 Maven2 与我合作,并且想知道是否有人对如何使其工作有任何想法......我正在开发一个 Flash 项目,我们正在考虑从我们的混合 Flex4/ 切换FlashCS4 到纯粹的 Flex4 解决方案。我们希望使用 Maven2 构建系统,这样我们的开发人员就不必在他们的机器上手动下载、安装和配置 Flex4。
我已经成功使用 Maven2 和 Flex4 创建了一个单模块项目(我正在使用 Sonatype FlexMojos 插件及其位于 http://repository.sonatype.org/内容/组/flexgroup/)。当涉及到制作这个多模块时,我真的开始遇到麻烦了......
我们的项目组织如下:
|- bin | |- moduleX.swf | |- moduleY.swf | |- ... |- lib | |- moduleA.swc | |- moduleB.swc | |- ... |- src | |- moduleA | |- moduleB | |- ... |- test | |- moduleA | |- moduleB | |- ... |- share | |- asset1 | |- asset2 | |- ... |- ...
基本上,我们的每个模块的源代码位于“src/
I have been struggling to get Maven2 to cooperate with me, and was wondering if anyone out there had any ideas on how to get this working.... I am working on a Flash project, and we are considering switching from our hybrid Flex4/FlashCS4 to a pure Flex4 solution. We would like to use the Maven2 build system, so that our developers do not have to manually download, install, and configure Flex4 on their machines.
I have managed to create a single-module project using Maven2 with Flex4 (I am using the Sonatype FlexMojos Plugin and their Maven2 repository located at http://repository.sonatype.org/content/groups/flexgroup/). I really start running into trouble when it comes to making this multimodule....
Our project is organized as follows:
|- bin | |- moduleX.swf | |- moduleY.swf | |- ... |- lib | |- moduleA.swc | |- moduleB.swc | |- ... |- src | |- moduleA | |- moduleB | |- ... |- test | |- moduleA | |- moduleB | |- ... |- share | |- asset1 | |- asset2 | |- ... |- ...
Basically, each of our modules has its sources located under "src/<modulename>/" and its test sources located under "test/<modulename>/", with generated SWF files being placed in "bin" and generated SWC files being placed in "lib". Our assets (things that we would like to be able to reference using the "@Embed" or "[Embed]" tags) live under "share". I have looked at the references on project inheritance and aggregation, but can't seem to find anything that would allow us to keep our existing project directory structure. We would like this migration to be as quick, painless, and non-disruptive as possible. I would really appreciate it if anyone can figure out how to create a "pom.xml" file that allows us to keep our current infrastructure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您确定要迁移到 Maven 2,那么修改项目结构将为您省去很多麻烦,因此每个模块都包含自己的源代码和测试并遵循 Maven 约定。
如果您确实无法做到这一点,您可以创建一个并行模块层次结构,并使用指向现有结构的相对路径配置每个模块。该结构最终可能看起来像这样:
您可能还需要添加临时 pom,以便可以构建相关集(例如包含所有共享模块的
share
pom)。然后,您可以:
Embed
资源解压到 target/flex/resources 中,下面是一个示例配置,用于实现其中一个 pom 的这些步骤:
If you are certain about moving to Maven 2, it will save you a lot of pain to modify the project structure so each module contains its own sources and tests and follows the Maven conventions.
If you really can't do that, you can create a parallel module hierarchy, and configure each module with relative paths pointing back to your existing structure. The structure could end up looking something like this:
You may also want to add interim poms so you can build related sets (e.g. a
share
pom containing all the share modules).You could then:
Embed
resources into target/flex/resourcesHere is an example configuration to achieve those steps for one of the poms:
多模块项目应该如下所示:
如果您计划构建单个工件,那么在单个项目中拥有多个源是没问题的,但如果您尝试在单个项目中从多个源构建多个工件,则 Maven 不会配合。
如果您无法移动源代码树;在当前结构中创建一个多模块 pom 层次结构,并编辑新的子 pom 将其 src 和 test 目录指向当前源层次结构 src 和 test 目录。
您也可以让输出文件夹全部指向同一个文件夹。
A multi-module project should look like this
Having multiple sources in a single project is fine if you plan on building a single artifact, but Maven does not cooperate if you are trying to build multiple artifacts from multiple sources in a single project.
If you can not move the source tree around; create a multi-module pom hierarchy in the current structure and edit the new child-poms to point their src and test directories to the current source hierarchy src and test directories.
You can have the output folders all point to the same folder as well.