2

I hope some one out there can help.

I have a large project that uses Ant for release builds, that must be "Run in the same JRE as workspace" This has always been fine in fb4.5 and 4.6 but in 4.7 fb.exportReleaseBuild gives us a java.lang.NullPointerException.

I can just load the project up in 4.6 and build it for now, but as you can't get 4.6 any more this isn't a long term solution.

I can reproduce the issue in 4.7 on two PC's by doing the following:

Create a new flex project called "buildTest", Add a build folder, Create a new file named build.xml (in the build folder) Put the following in the build file:

<?xml version="1.0" encoding="utf-8"?>
 <project default="default" basedir="../">
                <!-- target: default -->
                <target name="default">
                               <fb.exportReleaseBuild project="BuildTest"/>
                </target>
 </project>

Right click on the build file, Run as -> Ant Build... -> JRE (tab) -> select "Run in the same JRE as the workspace" -> Click "Run"

If you do this in 4.6 (on either of my boxes) it works fine. if you do it in 4.7 (again on either box) you get the following error:

BUILD FAILED C:\Users\germanD1\Documents\Projects\test Projects\Ant Test\BuildTest\build\build.xml:6: java.lang.NullPointerException

You can even create it and watch it fail in 4.7 then open the same proj in 4.6 and watch it work!!!

I hope someone can help, this is driving me mad.

Many thanks Dan

Dan
  • 23
  • 4
  • `"but as you can't get 4.6 any more this isn't a long term solution"` > FlashBuilder as a product isn't a long term solution. I recommend you switch to an IDE that is developed by a company that respects you. Sooner rather than later Adobe is going to drop FlashBuilder or at least support for Flex. Obviously they've already cut the budget on regression testing: your regression bug unfortunately is not the only one :( – RIAstar May 13 '13 at 14:09
  • I have it worse, I didn't even have 4.6 or 4.5... – Didi Kohen May 20 '14 at 13:54

2 Answers2

3

Unfortunately it appears it will not be possible to resolve the NullPointerException when using the fb.exportReleaseBuild ant task in FlashBuilder 4.7.

I also recently encountered this issue, and decided to crack open the implementation of the fb.exportReleaseBuild, which ultimately calls directly into the ExportReleaseVersionManager.java code that executes the "Export Release Build" feature provided by the FlashBuilder Eclipse plug-in.

If you review the erorr logs or enable enough ant output, the NullPointerException reported is:

com.adobe.flexbuilder.exportimport.releaseversion.ExportReleaseVersionManager.doBuild(ExportReleaseVersionManager.java:222)

If you decompile the file in question, you'll find the cause the error:

    220    if (PlatformUI.isWorkbenchRunning()) {
    221        IWorkbench workbench = PlatformUI.getWorkbench();
    222        IEditorPart[] dirtyEditors = workbench.getActiveWorkbenchWindow().getActivePage().getDirtyEditors();
    223        assert (dirtyEditors.length == 0);
    224    }

It turns out that the call to workbench.getActiveWorkbenchWindow() will always return null if the method is invoked from a non-UI thread, and when you run an ant build, that is a non-UI thread.

So, clearly, this was not regression tested, as previously stated, and there is likely no way of fixing it, unless of course one had the source code, which would then make it beyond trivial to fix.

thanks Adobe!

gordogre
  • 31
  • 3
0

I know your post is a while ago, but yesterday the same issue hit me - so for anybody else facing this I note down my experience. I was not able to compile with ant in FB 4.7 getting a java.lang.NullPointerException. I think RIAstars comment is true, but as a technology is end of life and you are still into Flex/Flash for whatever reason, you still need a work around; here I see three possibilities:

  • Install FB 4.6 and FB 4.7 side-by-side on your machine and do your ant tasks in FB 4.6, while you develop on FB 4.7
  • Try to let your build.xml run inside of Ant from the command line (on windows: download ant, set the environmental variable ANT_HOME and Path (append) to the install path of ant, and pass the sdks\4.11.0\ant\lib\flexTasks.jar to the lib folder of ant, navigate with the command line to the build.xml folder, type ant and hit enter).
  • Try another IDE, there are some around (e.g. check Fast alternative to Flash Builder)

In my case I failed with fb.exportReleaseBuild to make it run on my modular project structure. I created a ant script by first do a -dump-config (compiler option) from my projects and generate an ant script out of sourcemate (does about 50% of the work for you and a good intro in the ant syntax, but only works with FB 4.6 lol). On this base I created my ant build file, and fixed errors step by step with research and try and error (first time I use ant). I use ant with cmd line to create my release builds.

Well, all very annoying and time consuming - doing a release build like this, but at least it works and is automated.

Community
  • 1
  • 1
Marc Loeb
  • 570
  • 9
  • 27