Re: Configure multiple source mxml files to generate multiple swf files

2018-02-12 Thread Vaibhav Shah
Hello Christofer,Thanks for your response.Yes, I am using IntelliJ, how you
guessed it? :) Default bundled maven is 3.3.9 in it.The reason why I am
using older version 3.8 of flexmojos is because there are few issues noticed
while I was using the version 7.1.0. I tried addressing most of them, but
for that I had to use the Flex 4 SDK eventually. It wasn't working with Flex
3 SDK. (Also, I had to use maven 3.2.5 with it, and it wasn't working with
maven 3.3.9. Refer  this

  
link where I saw similar problem happening with others too.)The last problem
which I was facing with flexmojos-maven-plugin 7.1.0 and Flex SDK
4.6.0.23201 was that the SDK 4 had couple of new interfaces introduced, eg.
INavigatorContent. These interfaces were not implemented anywhere, or they
required some sort of modification in existing code. (One sample error was
like this: /Error: The children of Halo navigators must implement
INavigatorContent./). Hence, I switched to older version where the new
interfaces related errors disappeared and I could build project without any
modifications in code.



--
Sent from: http://apache-flex-development.247.n4.nabble.com/


Re: Configure multiple source mxml files to generate multiple swf files

2018-02-09 Thread Christofer Dutz
Hi Vaibhav,

every plugin that is executed during the build is performed in an "execution" 
and every execution has an "id". 
If a plugin is added via "packaging" or binds to default phases, this execution 
is defined by the plugin developer. So YES the Id is defined by the flexmojos 
developer, but this is a totally normal thing for every maven plugin.

Take this output from another maven build, I just ran:

[INFO] --- download-maven-plugin:1.4.0:wget (get-fontawesome) @ plclogger ---
[INFO] Got from cache: 
/Users/christofer.dutz/Maven-Repository/.cache/download-maven-plugin/font-awesome-4.7.0.zip_df252855391c0a4f40161f9b242d95c8
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:copy-resources (copy-site-resources) @ 
plclogger ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 1 resource to 
/Users/christofer.dutz/Projects/Apache/PLC4X/examples/plclogger/target/site/js
[INFO] Copying 1 resource to 
/Users/christofer.dutz/Projects/Apache/PLC4X/examples/plclogger/target/site/css
[INFO] Copying 6 resources to 
/Users/christofer.dutz/Projects/Apache/PLC4X/examples/plclogger/target/site/fonts
[INFO] 
[INFO] --- maven-site-plugin:3.4:site (default-site) @ plclogger ---
[INFO] configuring report plugin 
org.apache.maven.plugins:maven-surefire-report-plugin:2.20.1

You can see in the "--" lines ... the first executes the wget goal of the 
download-maven-plugin and the execution id is "get-fontawesome".
The second is the copy-resources goal of the maven-resources-plugin and the 
execution is called "copy-site-resources" ... and so on ...

I did notice however, that you are using an insanely old version of Flexmojos 
... the current version is 7.1.1 ... 
And I am the one responsible for everything that happened beyond 5.x.

Your last problem reported is not a Maven problem, but a IDE integration 
problem. I would assume you are using IntelliJ?
Here the version bundled is probably newer than the maven version Flexmojos 3.8 
is able to run with.

Chris



Am 09.02.18, 06:06 schrieb "Vaibhav Shah" :

Hello Christopher,

Thanks a lot for response and the valuable information about
'default-compile-swf' ID.

I have tried the same, and it works like a charm! As long as any one of the
executions have the ID as 'default-compile-swf', all the executions are
processed correctly (without the dummy plugin declaration) by maven and I
get their output as well.

I never would have thought that the ID of the execution would make such a
difference! Just out of curiosity: is it the flexmojos-maven-plugin specific
behavior defined such that it executes correctly for specific ID? Or is it a
generic behavior of all maven plugins?

Regarding the modules, I agree with you. Ideally the apps should have been
in different modules, but don't know who developed this years ago and why
they didn't think about it :D



--
Sent from: http://apache-flex-development.247.n4.nabble.com/




Re: Configure multiple source mxml files to generate multiple swf files

2018-02-09 Thread Vaibhav Shah
One more observation and its solution:

Default behaviour: the flexmojos-maven-plugin tries to generate the flex
compiler configuration file via the plugin goal generate-config-swf whenever
the pom.xml changes.

Problematic scenario: if your pom.xml has only the plugin declarations with
'executions' in it, then the above goal fails with following error:
/java.lang.RuntimeException:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:generate-config-swf
(default-cli) on project TreasuryAgreements-UI: Source file not expecified
and no default found!/

Solution: need to add one dummy plugin declaration without 'executions' as
mentioned above for similar error. After that, the error no longer appears
and the config file is generated correctly.



--
Sent from: http://apache-flex-development.247.n4.nabble.com/


Re: Configure multiple source mxml files to generate multiple swf files

2018-02-08 Thread Vaibhav Shah
Hello Christopher,

Thanks a lot for response and the valuable information about
'default-compile-swf' ID.

I have tried the same, and it works like a charm! As long as any one of the
executions have the ID as 'default-compile-swf', all the executions are
processed correctly (without the dummy plugin declaration) by maven and I
get their output as well.

I never would have thought that the ID of the execution would make such a
difference! Just out of curiosity: is it the flexmojos-maven-plugin specific
behavior defined such that it executes correctly for specific ID? Or is it a
generic behavior of all maven plugins?

Regarding the modules, I agree with you. Ideally the apps should have been
in different modules, but don't know who developed this years ago and why
they didn't think about it :D



--
Sent from: http://apache-flex-development.247.n4.nabble.com/


Re: Configure multiple source mxml files to generate multiple swf files

2018-02-08 Thread Maxim Solodovnik
I was able to implement this by creating multiple blocks like
[compile, rename]
mapped to the different Maven phases 


On Thu, Feb 8, 2018 at 8:42 PM, Christofer Dutz 
wrote:

> Hi Vaibhav,
>
> your first compilation (the one you are defining in the first plugin
> definition)
> also has an implicit execution id. You should be able to see it in the
> console when the first compilation is done.
>
> So you should be able to use just one plugin definition with 4 executions
> as long as the id of the fourth execution matches the default.
> "default-compile-swf"
>
> Then it should work with only one plugin definition.
>
> However I can't explain, why it didn't work with the modules. But I also
> have to admit that I never really used that feature as it's a maven habit
> Of having only one artifact per module, which doesn't fit well with the
> modules concept.
>
> Chris
>
>
> Am 08.02.18, 11:56 schrieb "Vaibhav Shah" :
>
> Hello Christopher,
>
> I have found a solution, rather a hack, to the problem mentioned in
> last
> post.
>
> Solution: you need to specify the flexmojos-maven-plugin twice in the
> pom.xml. In first instance, you specify any of the main application
> mxml as
> sourceFile. In the second instance, you specify all the main
> application
> mxmls as sourceFile in respective  tags. This makes it work
> somehow, and I now get all 3 swf files generated successfully from
> their
> respective mxml files. Here is the complete working pom.xml for
> reference:
>
> 
> http://maven.apache.org/POM/4.0.0;
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd;>
> 4.0.0
>
> com.test
> TA_UI_Test2
> 1.0-SNAPSHOT
> swf
> TA_UI_Test2 Flex
>
> 
> 
> com.adobe.flex.framework
> playerglobal
> 10-3.3.0.4852
> swc
> 
> 
> com.adobe.flex.framework
> rpc
> 4.5.1.21328
> swc
> 
> 
> com.adobe.flex.framework
> framework
> 3.2.0.3958
> swc
> 
> 
> com.adobe.flex.framework
> mx
> 4.5.0.19786
> pom
> 
> 
>
> 
> src
>
> 
>
> 
> org.sonatype.flexmojos
> flexmojos-maven-plugin
> 3.8
> true
> 
> File1.mxml
> true
> 
> ${basedir}/target/File1.swf
> 
> 
> 
> com.adobe.flex
> compiler
> 3.2.0.3958
> pom
> 
> 
> 
>
>
>
> 
> org.sonatype.flexmojos
> flexmojos-maven-plugin
> 3.8
> true
> 
> 
> 
> 
> 
> Build1
> 
> File1.mxml
> true
> ${basedir}/target/
> File1.swf
> 
> 
> compile-swf
> 
> 
> 
> Build2
> 
> File2.mxml
> true
> ${basedir}/target/
> File2.swf
> 
> 
> compile-swf
> 
> 
> 
> Build3
> 
> File3.mxml
> true
> ${basedir}/target/
> File3.swf
> 
> 
> compile-swf
> 
> 
> 
> 
> 
> com.adobe.flex
> compiler
> 3.2.0.3958
> pom
> 
> 

Re: Configure multiple source mxml files to generate multiple swf files

2018-02-08 Thread Christofer Dutz
Hi Vaibhav,

your first compilation (the one you are defining in the first plugin definition)
also has an implicit execution id. You should be able to see it in the console 
when the first compilation is done.

So you should be able to use just one plugin definition with 4 executions as 
long as the id of the fourth execution matches the default.
"default-compile-swf"

Then it should work with only one plugin definition.

However I can't explain, why it didn't work with the modules. But I also have 
to admit that I never really used that feature as it's a maven habit
Of having only one artifact per module, which doesn't fit well with the modules 
concept.

Chris


Am 08.02.18, 11:56 schrieb "Vaibhav Shah" :

Hello Christopher,

I have found a solution, rather a hack, to the problem mentioned in last
post.

Solution: you need to specify the flexmojos-maven-plugin twice in the
pom.xml. In first instance, you specify any of the main application mxml as
sourceFile. In the second instance, you specify all the main application
mxmls as sourceFile in respective  tags. This makes it work
somehow, and I now get all 3 swf files generated successfully from their
respective mxml files. Here is the complete working pom.xml for reference:

 
http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;> 
4.0.0 

com.test 
TA_UI_Test2 
1.0-SNAPSHOT 
swf 
TA_UI_Test2 Flex 

 
 
com.adobe.flex.framework 
playerglobal 
10-3.3.0.4852 
swc 
 
 
com.adobe.flex.framework 
rpc 
4.5.1.21328 
swc 
 
 
com.adobe.flex.framework 
framework 
3.2.0.3958 
swc 
 
 
com.adobe.flex.framework 
mx 
4.5.0.19786 
pom 
 
 


src




org.sonatype.flexmojos
flexmojos-maven-plugin
3.8
true

File1.mxml
true

${basedir}/target/File1.swf



com.adobe.flex
compiler
3.2.0.3958
pom







org.sonatype.flexmojos
flexmojos-maven-plugin
3.8
true





Build1

File1.mxml
true
${basedir}/target/File1.swf


compile-swf



Build2

File2.mxml
true
${basedir}/target/File2.swf


compile-swf



Build3

File3.mxml
true
${basedir}/target/File3.swf


compile-swf





com.adobe.flex
compiler
3.2.0.3958
pom







 

I still don't understand how come above hack works, and it doesn't work
without the dummy plugin definition. However, it serves my purpose as of
now. :)

Thanks again for prompt response. Appreciate your time and inputs. Hope
above helps someone.

Cheers.. :)




Re: Configure multiple source mxml files to generate multiple swf files

2018-02-08 Thread Vaibhav Shah
Hello Christopher,

I have found a solution, rather a hack, to the problem mentioned in last
post.

Solution: you need to specify the flexmojos-maven-plugin twice in the
pom.xml. In first instance, you specify any of the main application mxml as
sourceFile. In the second instance, you specify all the main application
mxmls as sourceFile in respective  tags. This makes it work
somehow, and I now get all 3 swf files generated successfully from their
respective mxml files. Here is the complete working pom.xml for reference:

 
http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;> 
4.0.0 

com.test 
TA_UI_Test2 
1.0-SNAPSHOT 
swf 
TA_UI_Test2 Flex 

 
 
com.adobe.flex.framework 
playerglobal 
10-3.3.0.4852 
swc 
 
 
com.adobe.flex.framework 
rpc 
4.5.1.21328 
swc 
 
 
com.adobe.flex.framework 
framework 
3.2.0.3958 
swc 
 
 
com.adobe.flex.framework 
mx 
4.5.0.19786 
pom 
 
 


src




org.sonatype.flexmojos
flexmojos-maven-plugin
3.8
true

File1.mxml
true

${basedir}/target/File1.swf



com.adobe.flex
compiler
3.2.0.3958
pom







org.sonatype.flexmojos
flexmojos-maven-plugin
3.8
true





Build1

File1.mxml
true
${basedir}/target/File1.swf


compile-swf



Build2

File2.mxml
true
${basedir}/target/File2.swf


compile-swf



Build3

File3.mxml
true
${basedir}/target/File3.swf


compile-swf





com.adobe.flex
compiler
3.2.0.3958
pom







 

I still don't understand how come above hack works, and it doesn't work
without the dummy plugin definition. However, it serves my purpose as of
now. :)

Thanks again for prompt response. Appreciate your time and inputs. Hope
above helps someone.

Cheers.. :)



--
Sent from: http://apache-flex-development.247.n4.nabble.com/


Re: Configure multiple source mxml files to generate multiple swf files

2018-02-08 Thread Vaibhav Shah
Hello Christopher,

I realized that I need to use the  in order to specify multiple
executions of the same plugin. So I have updated the flexmojos-maven-plugin
this way now, where each execution should compile a different sourceFile (so
I can compile 3 sourceFiles with 3 executions):


org.sonatype.flexmojos
flexmojos-maven-plugin
3.8
true


Build1

File1.mxml
true
File1.swf


compile-swf



Build2

File2.mxml
true
File2.swf


compile-swf



Build3

File3.mxml
true
File3.swf


compile-swf





com.adobe.flex
compiler
3.2.0.3958
pom




However, while running the maven build with above in my pom, it gives
following error:
/[ERROR] Failed to execute goal
org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:compile-swf
(default-compile-swf) on project TA_UI_Test2: Source file not expecified and
no default found! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.8:compile-swf
(default-compile-swf) on project TA_UI_Test2: Source file not expecified and
no default found!
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Source file not
expecified and no default found!
at org.sonatype.flexmojos.compiler.SwfMojo.setUp(SwfMojo.java:310)
at
org.sonatype.flexmojos.AbstractIrvinMojo.execute(AbstractIrvinMojo.java:154)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more/


Why does above error appear even if the sourceFile is specified for each
execution?



--
Sent from: http://apache-flex-development.247.n4.nabble.com/


Re: Configure multiple source mxml files to generate multiple swf files

2018-02-08 Thread Vaibhav Shah
Hello Christopher,

Thanks for prompt and detailed response.

Actually I am given some existing legacy Flex project to migrate it to
Maven. So I have just completed that migration using the pom.xml mentioned
in my original post. However, I see in the code that there are total 3 mxml
files under 'src' directory, which have
'...' defined. That means, all 3 of them
are individual flex applications (I am assuming this based on syntax because
I am a java person, and new to flex - just working on this for migration to
maven part only).

Also, when I open the same project in Flex Builder and compile it, then
there are total 3 swf files generated, one for each of the mxml file having
 tag.

I want the same effect in the flex-maven project too, i.e. when I build flex
project using the flexmojos-maven-plugin, there should be 3 SWF files
created, one for each mxml file having  tag. Is that anyhow
possible?

P.S. As mentioned in the original post, I tried duplicating the same plugin
configuration with different 'mxml' names in sourceFile tags. I expected 3
different SWF files to be generated that way. On the contrary, maven just
executed the last instance of the flexmojos-maven-plugin specified in pom,
not all 3 of them.



--
Sent from: http://apache-flex-development.247.n4.nabble.com/


Re: Configure multiple source mxml files to generate multiple swf files

2018-02-07 Thread Christofer Dutz
Hi Vaibhav,

If you are building an swf there can only be one source mxml as this is what's 
used when you execute the application.
In SWF you have a single source file and the flex compiler adds all mxml and as 
classes that are directly and indirectly referenced from that.
You could add an additional MXML or AS class and simply reference Main, 
Secondary1, Secondary2 and Secondary3 from that file.

But to me it looks as if you are trying to compile a library. In that case you 
should remove the sourceFile config option and change the packaging to swc 
instead of swf. This will create a library that contains all classes - but is 
not an executable SWF anymore.

If it's not a library, could you please explain why you want to have multiple 
sourceFiles? Which effect are you expecting?

Chris



Am 08.02.18, 07:20 schrieb "Vaibhav Shah" :

Hello,

*Currently working code:*

I am able to build a flex project using flexmojos-maven-plugin successfully.
However, I can only provide one 'sourceFile' under my plugin configuration.
Refer below my working pom.xml, which builds Main.mxml file correctly from
'src' directory. It generates the 'swf' file for Main.mxml successfully:


http://maven.apache.org/POM/4.0.0;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;>
4.0.0

com.test
TA_UI_Test2
1.0-SNAPSHOT
swf
TA_UI_Test2 Flex



com.adobe.flex.framework
playerglobal
10-3.3.0.4852
swc


com.adobe.flex.framework
rpc
4.5.1.21328
swc


com.adobe.flex.framework
framework
3.2.0.3958
swc


com.adobe.flex.framework
mx
4.5.0.19786
pom




src



org.sonatype.flexmojos
flexmojos-maven-plugin
3.8
true

Main.mxml
true




com.adobe.flex
compiler
3.2.0.3958
pom









*Problem description:*

Now I have got multiple other mxml application files under my 'src'
directory, i.e. all mxml files under one single 'src' directory. How do I
add them in above plugin, which only expects one single name in sourceFile
configuration?

*Things I have tried:*

I tried copy-pasting multiple blocks of flexmojos-maven-plugin, and each of
them having different sourceFile specified. However, that does not help,
because maven just generates the final 'swf' file from the last block of
flexmojos-maven-plugin. For eg. if first plugin block has sourceFile
Main.mxml, and second plugin block has sourceFile Secondary1.mxml, then the
'swf' will be generated for Secondary1.mxml only, not for Main.mxml.

Also, I have tried adding following moduleFiles tag after the sourceFile
tag:


 Secondary1.mxml
 Secondary2.mxml
 Secondary3.mxml


Above generates total 4 swf files: one for the Main.mxml specified as
'sourceFile', and 3 others for the Secondary mxml files specified under
moduleFiles. However, only the swf generated for the Main.mxml actually
works, and it has proper ~1mb size. Whereas, rest of the 3 swf files
generated for moduleFiles are 100-200kb in size, and they are not opening in
browser.

*Help needed:*
I have googed and posted my question on StackOverflow too, but no luck yet.
Could you please provide any other suggestions to generate correct
individual swf files for respective mxml files using single pom/maven build?



--
Sent from: http://apache-flex-development.247.n4.nabble.com/