Flex Mojo Maven Compile Question - apache-flex

I am trying to get the flex mojos maven compiler to run my projects.
Anyone with feedback on the below information is appreciated.
I am using this configuration for the maven compiler plugin and for
some reason every time I run the clean install on my SWF project I
still see the following in the compile step for the app.
info.rvin.mojo
flex-compiler-mojo
true
true
-compiler.accessible=false
-compiler.actionscript-file-encoding UTF-8
-compiler.allow-source-path-overlap=false
-compiler.as3=true
-compiler.debug=false
That means I can not connect to my app via the Flex Builder's debug
tool. Any thoughts on how I should properly configure the plugin in
the pom.xml?
Thanks!

adam, we're just starting to build out the chapter on flexmojos in Maven: The Definitive Guide. For starters, use the new plugin groupId, artifactId that is listed in that chapter. velo moved the flexmojos project over to the Sonatype Forge a few months ago, and we're just getting the 3.0 release out.

To anyone out there reading this: remember Maven is a build tool; it only (typically) executes (parts of) your code as a consequence of executing the tests you've implemented.

Related

Is there a direct way to get a full ejb/servlet application example for glassfish

I have an application that is currently running on JBoss AS but does not work on Glassfish. I'm trying to work through the documentation here but I'm having trouble figuring out things like what the file structure of the application should be and what (if any) additional files are needed. This documentation also refers to examples but to get the examples you need to install Netbeans and access an update tool tied to the glassfish instance installed with Netbeans. When I do this the server won't start, the update tool won't run, and I can't get the examples. Is there an easy way to get these examples (e.g. a simple download)? I've found other examples such as this one, but they are also dependent upon Netbeans.
Is there a simple and complete ejb/servlet example for Glassfish that can be simply downloaded and does not depend upon Netbeans or other IDE?
The obvious example is the Java EE CargoTracker. It was written to show what a "real" application might look like with pure Java EE APIs so should work on both JBoss and GlassFish. You will need Maven installed to build and run it, but there are more complete details in the readme for the project. Note that some of the information is a little out of date (mostly links to java.net which has been sunset in favour of a GitHub site) but the application itself is still a good example of Java EE 7 APIs.
https://github.com/javaee/cargotracker
I found the examples on github here:
https://github.com/javaee/glassfish-samples
To get and build the examples you will need Git and Maven. These examples are small, complete, and concise. The example that was helpful for my particular problem was this example:
glassfish-samples\ws\javaee5\enterprise\servlet-stateless-ear
It demonstrated that I needed to change the structure of my project such that the servlet was in a .war file and not in a .jar file in the lib folder of my project.

Is it necessary to use gradle with roboelectric for android unit testing?

I and my team have built up an android library project. it is built up on eclipse but we are using ant to build it. Presently we aren't using gradle. I have a roboelectric with dependencies jar file instead. But when I use this, while running the unit tests, the following error comes up
WARNING: multiple versions of ant detected in path for junit
[junit] jar:file:/Users/prateekarora/Desktop/eclipse/plugins/org.apache.ant_1.9.2.v201404171502/lib/ant.jar!/org/apache/tools/ant/Project.class
[junit] and jar:file:/Users/prateekarora/trunk/client/android/MCCMobileClient/test2/libs/robolectric-2.3-with-dependencies.jar!/org/apache/tools/ant/Project.class
When I remove the apache ant from eclipse's plugin folder, this stops working.
Can Anybody explain why this is happening?
Also, is it necessary to use roboelectric with gradle? If no, where can I find the roboelectric's jar files with/without dependencies?
It is not necessary to use gradle with robolectric. It is just about running specified java class (from junit) with proper classpath (including you source, test code and dependencies). Fixing your case is not something that is easy to make over stackoverflow (it will be some challenge even if you sit behind same computer).
Here are possible solutions:
Migrate your project build to the gradle
Keep using ant but move from dependency management from manuals jars to ivy
Keep using ant and manual jars dependency, but try to get robolectric.jar with all dependencies except ant one
The first one option is the easiest option as for me. It will require to change mindset a bit but this is officially only one supported build tool by Google as well there are a lot of examples and people that could help.
The second one also require you to learn how to use new tool. As well there less examples about ivy usage especially in android projects.
The third one will require to write custom script that removes ant from jar file or to rebuild robolectric-all.jar without one (ant) dependency. This will require to dive into maven build tool learning

Jar to include to use javax.annotation.*

I'm a bit confused. I need to compile a project in jDeveloper 11.1.1.6.0. The server side of the project is deployed on the Glassfish server. On the machine of the project's creator everything compiles without any problems.
Using project properties -> Libraries and Classpath I added the libraries such as gf-client.jar, security etc. from $glassfish_home/glassfish/modules and some others (e.g. hibernate3.jar from hibernate dir).
When I try to compile the project I receive the following errors:
package javax.annotation.security does not exist
and
package javax.persistence does not exist.
I suppose that I miss some jars to include. I tried to find which jars (from Glassfish or from JDK) contain javax.annotation.* and javax.persistence.* but I couldn't.
If you have any ideas I would be thankful!
I was having the same problem and was able to solve it by adding a couple of dependencies to the Maven pom.xml file. See this answer for more details.
So I found the source of the problem. The application consists of 2 projects, of which only one (mentioned in the question) uses EJB. I'm not sure if it is the way it should be, but I tried adding ejb-files to another project. And after clean all and rebuild all it compiled like a charm for me. I hope this will help somebody in the future.

How can I use the same buildscript for Flash Builder 4 and Ant/Mvn?

I'm setting up a build system for a Flash Builder 4 (Flex 4) based project; and I'm struggling to get a setup that compiles in the IDE the same as it does from the command line on the build server.
I come from a C# background; and my expectation is that I'll be able to create a "solution" with a collection of "projects" that I can compile from the IDE, or from the command line on the build server.
The best I've managed sofar is 2 separate build "scripts", a custom ant script for the build server, and the default Flash Builder IDE config based on a workspace; but this is making my DRY daemons jump around in fury.
Please can someone point me in the right direction :)
If you use Maven and flex-mojos for your command line builds, then you can use the flexbuilder mojo to generate the Eclipse project files from your Maven build scripts. I'm sure there are some rough edges with the process, but at least it's DRY.
You might also check out IntelliJ IDEA. It can open the Maven project directly, and will create the Flex facets and configuration from the Maven build script. It will auto-detect when the pom.xml file changes, and prompt for re-import (which is nice). You can enable auto-import, too. The down side is that it doesn't have the profiler or nice GUI editor that Flash Builder has.

How is FlexBuilder compiling my app?

I'd like to see the command-line arguments that FlexBuilder is using to compile my application. This is so that I can build them into the ANT script I'm working on. Is there any way to view the command line compilation step?
The reason I'm asking for this is that when I compile my app using Ant/Flex SDK vs. FlexBuilder my app behaves differently.
So I figured out the answer.
First of all, you can get a better idea of how FlexBuilder compiles your app by adding a -dump-config=C:\myConfig.xml to the compile arguments in FlexBuilder. This outputs an xml file containing configuration settings used in the compilation step. You can also use this file as an argument to compc or mxmlc if you'd like. Read more about it
here...
But, here's what actually solved my problem. I was using the regular old Flex SDK installed on our integration server to compile my apps using Ant. This is the free SDK you can download from Adobe's site. I then took the FlexBuilder directory from my local machine and copied it up to the integration server and pointed my build script to use that version of the SDK (and changed my path env variable).
When I compiled using the FlexBuilder version of the SDK, all was well and the strange bugs I was seeing in my app disappeared.
Moral of the story, make sure you are using the same version of the SDK for your automated builds as you use to build locally.

Resources