We've had a lot of benefit using Flexmojos in our Flex/Java project.
One thing that's bothered me (and maybe I've just missed the best
practices or some documentation on it).
We are working in a development environment where Java developers use
Eclipse and then use maven to build the latest Flex clients, and Flex
developers use FlexBuilder/Eclipse and have their mxml files compiled
to bin-debug as <moduleName>.swf.
The trouble is the flexmojos plugin builds the SWF into /target/ as
<build.getFinalName()>-moduleName.swf. Also the copy-flex-resources
copies the SWF artifact as <artifactID>-<version>-moduleName.swf (you
can configure it to stripVersion).
What I'm looking for is a way to configure either Flexbuilder or the
Flexmojos plugin to consistently output the SWF's as just
moduleName.swf, this would make things like running JSP pages that
include the latest FlexBuilder built SWF easier (currently we have a
production JSP that has <artifactID>-<version>-moduleName.swf , and a
debug one that has moduleName.swf).
I understand that the additional version and project name information
is standard Maven practice, and it makes sense as a configuration
default, but I'd like there to be a way to override that
configuration.
My suggestion is to allow the ApplicationMojo.java accept a
configuration argument.
<stripModuleArtifactInfo>true</stripModuleArtifactInfo>
Also in the CopyMojo I'd suggest the same configuration to control how
the SWF's are copied into your WAR:
<stripModuleArtifactInfo>true</stripModuleArtifactInfo>
What I'm wondering is if anyone else has experience setting up a
Flexbuilder/Maven development environment that allows devs to quickly
run and test their MXML without having to build in Flexbuilder and
then build in Maven.
I've created a patch for the flexmojos-maven-plugin project that could
be applied to Flexmojos (I haven't been able to compile and run it I'm
having trouble getting a Flexmojos build environment setup.), but it's
a very simple patch if one of the devs could test it out.
Index: src/main/java/org/sonatype/flexmojos/compiler/
ApplicationMojo.java
===================================================================
--- src/main/java/org/sonatype/flexmojos/compiler/ApplicationMojo.java
(revision 1536)
+++ src/main/java/org/sonatype/flexmojos/compiler/ApplicationMojo.java
(working copy)
@@ -100,6 +100,13 @@
protected File source;
/**
+ * When true will strip artifact and version information from the
built MXML module artifact.
+ *
+ * @parameter default-value="false"
+ */
+ private boolean stripModuleArtifactInfo;
+
+ /**
* When true, flexmojos will register register every compiled SWF
files as trusted. These SWF files are assigned to
* the local-trusted sandbox. They can interact with any other
SWF files, and they can load data from anywhere,
* remote or local. On false nothing is done, so if the file is
already trusted it will still as it is.
@@ -254,8 +261,9 @@
setMavenPathResolver( moduleBuilder );
moduleBuilder.setConfiguration( configuration );
moduleBuilder.setLogger( new CompileLogger( getLog() ) );
+ String moduleArtifactPrefix = stripModuleArtifactInfo ?
"" : build.getFinalName() + "-" ;
File outputModule =
- new File( build.getDirectory(), build.getFinalName()
+ "-" + moduleName + "." + project.getPackaging() );
+ new File( build.getDirectory(), moduleArtifactPrefix
+ moduleName + "." + project.getPackaging() );
updateSecuritySandbox( outputModule );
moduleBuilder.setOutput( outputModule );
Index: src/main/java/org/sonatype/flexmojos/war/CopyMojo.java
===================================================================
--- src/main/java/org/sonatype/flexmojos/war/CopyMojo.java (revision
1536)
+++ src/main/java/org/sonatype/flexmojos/war/CopyMojo.java (working
copy)
@@ -109,6 +109,13 @@
private boolean stripVersion;
/**
+ * When true will strip artifact and version information from the
built MXML module artifact.
+ *
+ * @parameter default-value="false"
+ */
+ private boolean stripModuleArtifactInfo;
+
+ /**
* Use final name if/when available
*
* @parameter default-value="true"
@@ -372,7 +379,8 @@
{
String classifier = StringUtils.isEmpty
( artifact.getClassifier() ) ? "" : "-" + artifact.getClassifier();
String version = stripVersion ? "" : "-" +
artifact.getVersion();
- fileName = artifact.getArtifactId() + version +
classifier + "." + SWF;
+ String artifactPrefix = stripModuleArtifactInfo ? "" :
artifact.getArtifactId() + version;
+ fileName = artifactPrefix + classifier + "." + SWF;
}
else
{
--
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?hl=en?hl=en
http://blog.flex-mojos.info/