When developing in ActionScript, as in any other language, there are two questions: “What should I write?” And “What should I collect?”. If you are an advanced developer, you probably already use
IntelliJ IDEA as
IDE and
maven as
a build tool . This article shows the optimality of this solution and describes the process of setting up the working environment. If you do not like beer (and do not understand the meaning of this phrase and to whom I have just nodded) and do not consider yourself a lazy cattle, you can not waste your time.
The article is more like a spark than a step-by-step tutorial, especially as it is dedicated to EAP, so if you’re a really lazy brute without a drop of risk, then wait for the release :)
')
I note that the installation will be considered in Windows, but all software cross-platform - Unix, Mac and Windows (I myself only recently crawled to M $ Vista with openSUSE due to AIR). My machine configuration: ThinkPad T61, Intel Core 2 Duo T9300 (2.5 GHz), 2 GB RAM, Windows Vista SP1. On the storage server (you hardly need it) FreeBSD 6.3, nginx 0.6.32.
IDE Feature Overview
Until recently, there was no less realistic alternative to
Flex Builder . But in the
upcoming version of IntelliJ IDEA called
Diana, a debugger appeared and Flex support was acceptable. What is IntelliJ IDEA and what can it do? Easier to say that she can not. She does not know how to make coffee (only indirectly, through
IDE Talk ). Because of this, comparing it with the Flex Builder is equivalent to comparing the capabilities of a pedestrian with a race car in the context of passing a speed course.
Objectively:
- MXML import expression manager (Flex Builder can only optimize in AS). Moreover, you look at the screenshot of how it is displayed (there is no large mxml component at hand to create a full-fledged screenshot, but when there are 4 groups of 5-12 expressions, gray selection smiles, and the inability of FB to monitor this economy makes you think about changing IDE ).
- Export project for ANT. That is, it translates its project metafiles into ANT files, which allows you not to bathe on the topic of how someone will build your project without IntelliJ IDEA (but it's best to use the build tool right away).
- Displays the use of an element in a project on the fly in a context where it is really needed without the need to explicitly use Find Usages (which works for all elements). Flex Builder can only Find Usages, besides, the list of elements is small and works only until the dependent source code is changed, then you need to restart the environment :), otherwise the list of the found will be obviously small.
- Highlighting code. Eh, only one word that says a simple Russian man looking at the moon. This is more than the highlight. Diana is not blonde.
- Even if you come home drunk, Diana will feed you and will not be outraged that you are some kind of third-party file that does not belong to any of the projects, and will meekly do everything in her power from what you did when you were clean and sober. .
Here you can write a very long list. She is really quite intelligent. You just try it (especially, of course, those who are working on large and complex projects will appreciate it). Flex Builder has only one advantage - profiling.
Here in the comments the doubts went , so I’ll add a couple more possibilities that I should have listed first:
Generate and
Refactor .
Subjectively:
- In the file tree, you can see the project metafiles created by the environment, that is, .project for Eclipse and * .ipr. If I need to get into them with dirty hands, I can do it without leaving.
- In the settings you can find the inclusion of antialiasing, which is necessary in Windows XP for ClearType fonts such as Consolas (for sure, and for Eclipse you can find a solution, but here it is right before our eyes - actually, therefore, it is subjective).
- Code folding is initially configured, and not easy - here you are a clean sheet. In such a non-customized form, if I need it, I will give the author of the code a gun so that he can shoot himself in the footsteps of the god class. And such reasonableness in everything (Flex Builder does not even know how to highlight xml, in honor of which should I finish the paid product myself by installing plug-ins of the first need ?).
- The list of open project files is stored in the project itself. Do you know what this means? This means that if you keep its project metafiles in SVN, then when you come home and open the editor, you will receive the same set of open files as at work (yes, a little doubtful plus).
Assembly tool overview
Why is it needed at all if the IDE already supports compilation? If this is not obvious to you, I recommend reading the
article in Wikipedia . Why
maven , but not
ant ? Because maven is a
declarative, not an imperative assembly . A good selection of links about maven in
Agahov's blog . At the moment, there is no real alternative to the
flex-mojos plugin plugin that provides spells for Flex.
IDE installation
So. Now it's time to install it.
We download the latest EAP (at the time of this writing, the last EAP is 8940, I recommend not saving a few MB and downloading an installer with a weight of 111 MB) and installing it. When you first start it asks about the settings, licenses, plugins, that is, it will make the initial configuration.
By the way, about the
price . For
open source projects it is free . For those involved in education, it is also free or offered at a significant discount. For personal use only costs $ 249. And Flex Builder 3 Standard
is several times more expensive - as much as $ 249. Feel the difference. Therefore, I did not raise my hand in due time to buy it, but I paid for IntelliJ IDEA without hesitation even having the opportunity to get a free license.
When choosing the installed plugins, put only what you need, as this, of course, will reduce resource consumption (and also remove the excess from the interface). Subsequently, you can remove / add plugins in File -> Settings -> Plugins
After installation, I recommend immediately increasing the memory allocation for IDEA - open bin / idea.exe.vmoptions in its root folder:
-Xms256m -Xmx512m -XX:MaxPermSize=128m
It may seem strange to you in the initial setting of the editor. But everything is customizable, the following describes a part of what I did not like and solutions:
- View. Why is Look And Feel Default Alien? In Appearance -> Look And Feel = Windows.
- Setting the cursor in the editor anywhere, and not at the end of the line. I'm lazy to aim (in Eclipse, at the end of the line by default), so Editor -> Behavior -> Uncheck Allow placement of care after end of line.
- Spaces instead of tabs for indents. Again in Flex Builder, the default tabulation is, and here I have to shoot these spaces in bursts. GlobalCode Style -> Put a check in Use tab character (note Use same settings for all file types).
If you use the maven, which is not advertised here by me, but the built-in IDE Builder, then to solve the problem of compiler error output in Russian (you also have a brain aversion to the Russian language in this context, yes?), Open bin / jvm.config in the Flex SDK and add the parameters
-Duser.language=en -Duser.country=US
(since IDE Builder uses fcsh), when building something else, change the JVM parameters in the appropriate place. If you use maven, read below.
Everything. Installed and opened. Remember, this is an EAP.
Installation tool assembly.
It does not need to be put. Maven is built into IDEA (but you can also specify to use external). But I still recommend setting it up. To eradicate the Russian language, set the environment variable
MAVEN_OPTS = -Duser.language=en -Duser.country=US
). If you
install it separately, I recommend changing the memory settings
-Xms256m -Xmx512m -XX:MaxPermSize=128m
(I separately installed from ports in FreeBSD - the installation went without problems).
Creating a project
Consider the development of the simplest project HelloWorld.
- File -> New Project
- At this step, you can change nothing and just click Finish. At the moment there are archetypes for flex-projects , but in order not to complicate things, we will not use the archetype.
After that the project will be open.
To compile the project, you do not need to manually download anything, but for the IDEA to work properly, it needs the source code of the Flex SDK.
Download the latest stable build (at the time of writing it is
3.2.0.3794 from Thu Oct 23, 2008 ), unzip it somewhere and install it in IDEA.
- File -> Project Structure
And point the way
Unfortunately, IDEA now has an error in defining the Flex SDK by default for the Flex Facet (more precisely, there should not be a facet at all , remember that this is an EAP), so manually specify: File -> Project Structure -> Facets -> Flex HelloWorld )
Now you can create.
- Rename (Refactor -> Rename or Shift + F6) the scr / main / java and src / test / java folders by changing java to flex respectively (they were carefully created by maven, if you create a project from the archetype, you will not need to rename anything).
- In accordance with the project structure proposed by maven, we will create a New Mxml Component.
- And paste the following code: [HelloWorld.mxml]
- Edit pom.xml: [pom.xml]
- After saving the changes, pom.xml IDEA will offer to re-import the project (that is, it will update everything it needs according to the new POM (yes, for now, it does it a little crookedly, but the developers have been notified and are working on it )).
- In the target folder, the result is HelloWorld-1.0.swf result.png
I did not comment on the POM. References to already been given. I will note only that due to the fact that at present in the world of Flex maven is not very common, most of the libraries in the central repository is missing. You can add your maven project to the central repository , but the third-party library is unlikely, so for myself I raised the server (which is listed in the repositories), http://maven.flyti.org (if you need some kind of library, then you You can write to me and I will add it to my public repository, but it would be better to ask the creators to put them in the central one).
Update 0 as a reply to a comment.
I do not see any objective advantages for transferring my projects to a new IDE. A lot of crap for code coloring? Dismiss.
If the listed objective advantages, such as maven and ant support, the possibility of working find usages without a query on the context, etc., is not enough for you, then I forgot two more main and most important advantages: Generate and Refactor .
Update 1
Dependency on artifact compiler should be in plugins, a real example of POM .