Build a flex project on, ant or Maven? - apache-flex

I am going to write a build commands for flex 4.5 project, which is only based on actionscript not with java. I am very new to both maven and ant.So can you people suggest which is more compatible and robust with Flex 4.5

Maven definitely has better integration with Flex than Ant. There are several reasons:
Mature plugins. Maven has especially great plugins for integration with Flex. The one that seems most matured and is in active development is Flexmojos
Dependency management. Maven can download libraries required by Flex on the fly. Maven embedded dependency management functionality is invaluable, especially for Flex projects.
Generating project structure. You can generate typical project to start from scratch using Maven. Personally I find it to be very useful and helpful.
Even though there are popular and supported bundle of readily available Ant tasks (called Flex Ant Tasks) available both with the open source Flex SDK and with Flash Builder (also I should point out that Ant might more also good choice if you're perplexed by Maven complexity or you need build automation for simple small-to-midsize project), Maven turns out to be more mature and more appropriate choice.
PS. You can find short manual on how to start with Maven for building Flex projects here.

Related

How to use Spring 5.0 in NetBeans 8.2?

When I create a Java Web project in NetBeans and select a Framework, in this case Spring Web MVC, only two options appear:
Version 4.0.1
Version 3.2.7
You can do this in Netbeans:
Download the Spring Framework you need from here
Extract the contents of the archive and copy the contents of the lib directory to your netbeans location e.g /home/stanley/netbeans-8.2/java/modules/ext/spring-(version) e.g 5.1.4
On your netbeans go to Tools > Libraries > New Library
Name your Library as Spring Framework (version) e.g 5.1.4 and add all the jars from the location in 2 above.
Restart your netbeans application.
You should have the new Framework as shown in the diagram below:
TL;DR
The easiest way to create a new spring project is using Spring Initializr. All you need to do is fill in the form, download the project, unzip it and open in NetBeans.
Explanation
Regardless of a language and IDE, it is usually good idea to create a new project based on a standard build-tool for the language's ecosystem and avoid creating an IDE-specific project. That makes it easier to share the project with people who use a different IDE and switch your IDE in the middle of the project.
There are several build-tools for Java ecosystem but I'd suggest to pay attention to two of them: Maven and Gradle. Those are most widespread and supported by IDEs.
NetBeans supports Maven out of box. It supports Gradle too but in 8.2 you are supposed to install a support plugin for Gradle (from Tools -> Plugins menu).
You can generate a new Maven or Gradle project using NetBeans. Select corresponding menu item when selecting the type of the project.
Then you will have to add the dependencies of the project to its descriptor (pom.xml for Maven or build.gradle for Gradle). See the documentation for the build-tool of your choice to understand how exactly to do that.
Spring provides Spring Initializr service to generate a new project based on spring's libraries. It is the easiest way for a quick start.
Since you are using Netbeans and it supports Maven out of the box, you can get an existing Maven archetype to setup a basic Spring application for you to start from.
Although there isn't any official archetype, there are a lot of really nice 3rd party ones like https://github.com/kolorobot/spring-mvc-quickstart-archetype
The steps to start a new project are quite fast and straight forward (Netbeans 11)
File -> New Project -> Java with Maven -> Project from archetype
In the search filter enter spring-mvc-quickstart-archetype, enter your project details and click Finish

Using XCore generated classes in a war aggregating multiple Maven projects

I have a maven project called myproject.app. I also have another project using vaadin and gwt called myproject.ui and another project, which is an Xcore-Project converted to Maven called myproject.model.
I want to aggregate them all in a war. For this I have a myproject.war with a pom declaring the dependencies.
For Vaadin and GWT everthing is working fine as these projects are pure maven projects. The Xcore project gives me headaches because I can't manage to provide the Plugin Dependencies declared in this project in the war.
I have tried to add the needed libraries in the pom but I can only get old versions (2.2.3) from Central - the XCore project uses 2.8./3.8..
How can I solve this?
The answer is to convert the eclipse dependencies (EMF, XCore ...) to maven artifacts using the Maven Tools 4 Eclipse.
http://wiki.eclipse.org/MT4E_FAQ
For professional usage it is necessary to setup a maven repository, I used Nexus with success (if you are developing locally and alone it would be enough to install the artifacts in you local repository).
http://www.sonatype.org/nexus/
You can get it working by setting up a hosted repository with the converted Eclipse artifacts (documented in the mt4e reference) and creating a repository group aggregating the preconfigured maven central proxy and the hosted repository with the eclipse artifacts.
You need to setup your local settings.xml to use the nexus and you're good to go. Eclipse's artifacts are usable via maven coordinates.
Keep the orbit artifacts in mind and design your patch files carefully.

Adding Flex capabilities to an existing J2EE Enterprise Application Project

I have an J2EE Enterprise Application Project in which I would like to add a few Flex screens. How do I go about adding Flex capabilities.
I have build Flex/J2EE applications from scratch but can't think of the best way to do this.
I am currently using Flex Builder Plugin for IBM Rational Application Developer 7.5. Any idea on how to proceed.
J D
The FB4 plugin has the ability to add different flex natures to your java project..right click on the project folder from package explorer and you should see an option Add/Change project type.
On the other hand, why would you want to use only one project both for Flex and Java? I found that is easier to work separately with them, especially if the project is large.

Flex/Java application

I want to build a website that uses Flex/Flash as the GUI, and Java for the business tier, all to be deployed on Glassfish.
Not having done this before, I am wondering how the overall development/build process works.
Flex has an IDE, and I am wondering would I also develop the Java part of the application in the same IDE? Or, do I make the Flex part in the Flex IDE, and the Java part elsewhere, and somehow make them work together?
And, regarding deployment, what are the general pieces involved in this type of application.
I am used to a java website being an EAR or WAR, does the Flex part get built into the EAR/WAR, or is it a separate thing that is deployed independently from the Java artifact?
For the build process, does one build the Flex part separately from the Java part, or can they be built together, i know this is close to the previous question about what pieces are deployed in a Flex/Java application.
Just looking for big picture type answers to get an idea of the development and build process when building a web application.
For our project, we have our Java and Flex code separated by project. When building and deploying our project, our Flex code builds and puts the swf into the web directory of our Java code. The Java code is Warred and deployed through Tomcat.
Many developers use Eclipse with the Flex Eclipse plugin for Flex-Java projects.

Should I use the Flex or Air SDK to develop an Air app?

I want to develop an Adobe air application. Whats the difference between using the Air SDK or Flex SDK and what are the advantages / disadvantages? My application will use a SQLlite database and PHP may be involved later if I turn the whole thing into a web app.
thanks
"If you want to develop an Air application, you must use the Air SDK. If you want to develop a Flex application that runs on Air, you need to use both." - #joshtnjala
I believe #joshtnjala to be partially correct, but I wanted to add on it. If using the Flex 3.3 SDK, you no longer require the AIR SDK as those tools are available to the Flex 3.3 SDK. It is important to note, because I see a lot of confusion or misuse of the term, Flex is actually three things.
Flex SDK (currently 3.3)
allows developers without the Flash and/or Flex IDE's, to develop and compile/publish Actionscript3 and MXML code to flash content (SWF). For example, one could use FlashDevelop for an IDE, and compile the code using the Flex 3.3 SDK.
Flex Framework
(From adobe [http://www.adobe.com/products/flex/overview/][1]) Flex is a free, open source framework for building highly interactive, expressive web applications that deploy consistently on all major browsers, desktops, and operating systems. It provides a modern, standards-based language and programming model that supports common design patterns. MXML, a declarative XML-based language, is used to describe UI layout and behaviors, and ActionScriptâ„¢ 3, a powerful object-oriented programming language, is used to create client logic. Flex also includes a rich component library with more than 100 proven, extensible UI components for creating rich Internet applications (RIAs), as well as an interactive Flex application debugger.
Flex Builder 3
Flex Builder is merely an IDE to assist in the development of flash (SWF), or AIR content. This builder utilizes the SDK above to compile. The framework may or may not be used depending on the developers needs. Many developers have taken themselves out of the FLASH IDE (THAT NASTY TIMELINE!) and began scripting their AS3 purely in the Flex Builder IDE as it provides many useful features for the "advanced" programmer; Not to mention its a very clean UI and is built on eclipse so it has many plugins and a solid community behind its architecture.
That being said, to expand on what joshtnala said, the difference between using the AIR SKD and the Flex 3.3 SDK, is that if you merely want to build an AIR app, composed of Actiosncript3 code, the AIR SDK is all you need (33mb unpacked). If you intend to use MXML and any part of the "Flex Framework" then you must use the Flex 3.3 SDK (190mb unpacked). This will allow you to use the many available components such as Datagrids, Accordions, etc, in your AIR application. So in the end, both will develop an AIR application as Flex 3.3 SDK incorporates the AIR 1.5 development tools. Abstract your project out, figure out what you will need, if a component works for that, or if a custom implementation is needed, etc, then choose your toolkit.
Hope this helps.
These frameworks are combinable. If you want your app to be both on the web and the desktop, make it using the Flex SDK, then wrap the desktop version of this using Air.
If you're considering deploying on the web, and communicating with a backend server and all that jazz, then flex is the way to go. If your target is desktop users, then AIR.
If you want to develop an Air application, you must use the Air SDK. If you want to develop a Flex application that runs on Air, you need to use both.

Resources