Maven的版本:执行似乎打破集结帮手:添加源 [英] Maven release:perform seems to break build-helper:add-source

查看:163
本文介绍了Maven的版本:执行似乎打破集结帮手:添加源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过的Maven的Flexmojos插件编写一个相当简单的Flex SWC模块。该模块还采用了的Flexmojos:在生成,源阶段创建我的Java服务和放大器的ActionScript3当量产生的目标;域类。常规源被安置在的src /主/弯曲和生成的来源是在的src /主/弯曲产生的 。生成的源不会检查到颠覆。像许多其他的Flexmojos用户我用的是构建辅助:添加源目标,本次源代码树添加到我的编译。这一直运作良好几个月,现在和Maven的输出通常是这样的:

I have a fairly simple Flex SWC module that is compiled via the Maven Flexmojos plugin. This module also uses the flexmojos:generate goal during the generate-sources phase to create Actionscript3 equivalents of my Java services & domain classes. The regular sources are housed in src/main/flex and the generated sources are in src/main/flex-generated. The generated sources are NOT checked into Subversion. Like many other flexmojos users I use the build-helper:add-source goal to add this second source tree to my compile. This has been working well for months now and the Maven output typically looks like this:

[INFO] ------------------------------------------------------------------------
[INFO] Building myproj Core Client -- Flex Service
[INFO]    task-segment: [deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [flexmojos:generate {execution: create-actionscript-classes}]
[INFO] Flexmojos 3.7.1
[INFO]   Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT file
[INFO] flexmojos 3.7.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Calling the generator for each Java class.
[INFO]   Generating: /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex-generated/com/myprojvision/core/domain/security/Group.as
.......
[INFO] [build-helper:add-source {execution: add-source}]
[INFO] Source directory: /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex-generated added.
[INFO] Flex compiler configurations:
.....
-compiler.source-path /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex /home/bsmith/develop/myproj/myproj-core/tags/myproj-core-1.0.2/flex-service/src/main/flex

注意如何很好地Flex编译器的源路径重新presents两个源目录。这种设置将成功打包,安装和部署SWC神器。不过,现在我们希望使用Maven发布插件,以自动释放的过程。该版本:prepare 目标运行良好。然而,释放:执行目标的失败,因为Flex编译器不会交给生成的源目录中一些未知的原因:

Notice how nicely the flex compiler source-path represents both source directories. This setup will successfully package, install, and deploy the SWC artifact. However, now we wish to use the Maven release plugin in order to automate the release process. The release:prepare goal runs fine. However, the release:perform goal fails because the flex compiler is not handed the generated source directory for some unknown reason:

[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building myproj Core Client -- Flex Service
[INFO] [INFO]    task-segment: [deploy]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [flexmojos:generate {execution: create-actionscript-classes}]
[INFO] [INFO] Flexmojos 3.7.1
[INFO] [INFO]    Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT file
[INFO] [INFO] Calling the generator for each Java class.
[INFO] [INFO]   Generating: /home/bsmith/develop/myproj/myproj-core/trunk/target/checkout/flex-service/src/main/flex-generated/com/myprojvision/core/domain/security/Group.as
...
[INFO] [INFO] [build-helper:add-source {execution: add-source}]
[INFO] [INFO] Source directory: /home/bsmith/develop/myproj/myproj-core/trunk/target/checkout/flex-service/src/main/flex-generated added.
...
[INFO] [INFO] Flex compiler configurations:
[INFO] -compiler.source-path /home/bsmith/develop/myproj/myproj-core/trunk/target/checkout/flex-service/src/main/flex 

请注意,在正确的地方生成的文件,构建辅助的正确调用,但柔性compiler.source路径缺少生成的源目录,因此一个Flex类未找到的错误产生。什么是如此惊人的,我对这个问题的释放:prepare做了[干净,核实]在分叉的Maven的生命周期和它的作品,但释放:执行不...所以它似乎并不确实其叉,这是问题。

Notice that the files are generated in the right place, the build helper is correctly called, but the flex compiler.source-path is missing the generated source directory and thus a Flex class-not-found error is produced. What is so amazing to me about this problem is the the release:prepare does a [clean, verify] in a forked Maven lifecycle and it works, yet release:perform doesn't...so it doesn't seem that its the fork that is the problem.

下面是构建辅助插件的配置:

Here is the configuration of the build-helper plugin:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${project.basedir}/src/main/flex-generated</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

请注意,如果我沟构建辅助插件,并使用flexmojo的sourcePaths配置,那么一切工作正常。

Note that if I ditch the build-helper plug and use the flexmojo's sourcePaths configuration, then everything works fine.

<sourcePaths>
   <path>${project.basedir}/src/main/flex</path>
   <path>${project.basedir}/src/main/flex-generated</path>
</sourcePaths>

不过sourcePaths是德precated和前进的方向对于那些有多个Flex源树是构建辅助。

However sourcePaths is deprecated and the way forward for those with multiple flex source trees is build-helper.

推荐答案

我在,我想包我的罐子内的.xml文件类似,这是一个问题。要添加它,我的构建辅助,Maven的插件,并把它添加像你上面。生成过程中精细的工作,但是当它来释放:执行会错过.xml文件了

I had a problem similar to this in that I wanted to package an .xml file within my jar. To add it, I used the build-helper-maven-plugin and added it like you have above. Worked fine during build, but when it came to release:perform it would miss the .xml file out.

我发现,而不是使用&LT;资源&GT; 聚甲醛的部分,而不是,我有一个更好的时间。我也参加了这个MaestroDev用户指南的建议,处理.xml文件为二进制文件,并把一些信息在POM以prevent它被过滤。

I found instead by using the <resources> section of the POM instead, I had a much better time. I also took the advice of this MaestroDev User Guide, treating the .xml file as a binary file and put some information in the POM to prevent it from being filtered.

<一个href="http://www.maestrodev.com/better-builds-with-maven/getting-started-with-maven/handling-classpath-resources/"相对=nofollow> MaestroDev用户指南(底部所谓的二元资源preventing过滤)

MaestroDev User Guide (at the bottom called "Preventing Filtering of Binary Resources")

这似乎为我工作。不知道这是否是因为如何弯曲是建立适合你,但它不看,如果你已经在一段时间的答案,这可能是它:)

This seemed to work for me. Not sure if it's suitable for you because of how flex is built, but it doesn't look as if you've had an answer in a while and this might be it :)

这篇关于Maven的版本:执行似乎打破集结帮手:添加源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆