Hi,
i am building a multi-module swf artifact that i then include as a
dependency in a war artifact that uses copy-flex-resources to copy the
main swf and modules into my packaged webapplication.
The stripModuleArtifactInfo is exactly what i need to guarantee
interoperability between maven builds and flexbuilder.
However when the modules are copied into the war with this option the
artifacts appear with a hyphen infront of their name.
Ex. -Module1.swf
I have tracked this down to what i think is a bug in the copy mojo which
does not consider the possibility that the final fileName of the copied
artifact may start with the classifier.
I've attached a patch that i have tested. I have changed the code a
little. Options like useFinalName have no relevance when the artifact is
a module and stripModuleArtifactInfo when the artifact is not a module.
In order to get the project to build i had to do a couple of things not
mentioned in the documentation on the site
(http://flexmojos.sonatype.org/building-sources.html)
1) Add -DskipTests=true otherwise the build failed in the tests for the
Tester module
2) Add a dependency to jdom in the flexmojos-maven-plugin project. (This
is something that i also have to do to all my projects that use
flexmojos, i add it in the plugin section of my pom's, is this normal?)
If you have any problems with the patch or would like me to create an
issue let me know.
Max
--
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos
http://flexmojos.sonatype.org/
Index: flexmojos-maven-plugin/src/main/java/org/sonatype/flexmojos/war/CopyMojo.java
===================================================================
--- flexmojos-maven-plugin/src/main/java/org/sonatype/flexmojos/war/CopyMojo.java (revision 1921)
+++ flexmojos-maven-plugin/src/main/java/org/sonatype/flexmojos/war/CopyMojo.java (working copy)
@@ -236,20 +236,31 @@
private File getDestinationFile( Artifact artifact )
throws MojoExecutionException
{
- String classifier = StringUtils.isEmpty( artifact.getClassifier() ) ? "" : "-" + artifact.getClassifier();
-
+ boolean isModule = !StringUtils.isEmpty( artifact.getClassifier() );
MavenProject pomProject = getProject( artifact );
String fileName;
- if ( !useFinalName )
+ if ( isModule )
{
- String version = stripVersion ? "" : "-" + artifact.getVersion();
- String artifactPrefix = stripModuleArtifactInfo ? "" : artifact.getArtifactId() + version;
- fileName = artifactPrefix + classifier + "." + artifact.getType();
+ if ( !stripModuleArtifactInfo )
+ {
+ fileName = artifact.getArtifactId() + "-" + artifact.getVersion() + artifact.getClassifier() + "."
+ + artifact.getType();
+ }
+ else
+ {
+ fileName = artifact.getClassifier() + "." + artifact.getType();
+ }
}
else
{
- String artifactPrefix = stripModuleArtifactInfo ? "" : pomProject.getBuild().getFinalName();
- fileName = artifactPrefix + classifier + "." + artifact.getType();
+ if ( !useFinalName )
+ {
+ fileName = artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType();
+ }
+ else
+ {
+ fileName = pomProject.getBuild().getFinalName() + "." + artifact.getType();
+ }
}
if ( stripVersion && fileName.contains( artifact.getVersion() ) )