开发者

Maven release:perform seems to break build-helper:add-source

I have a fairly si开发者_Go百科mple 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

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 

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>

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>

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


Besides the flex-generated sources are not checked into SVN, may be you need to generate them under the target folder. I think this may confuse the release plugin. Try generating the sources under that folder and add it to the build with the build-helper plugin.


Having the same problem here as well. Doesn't seem to matter if the files are checked into version control or not, because I've tried it both with and without them checked in and the result was the same.

I'm going to try adding mine to the same source path to see if it fixes the problem, but it's certainly a compromise. The first time I tried doing that it seemed like GraniteDS didn't particularly care for it.

EDIT: I just took a look at the source code for the flexmojos plugin and sourcePaths is not deprecated. This was after a checkout from trunk

svn co http://svn.sonatype.org/flexmojos/trunk flexmojos


lo,

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.

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.

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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜