3

I'am using flexmojos-maven-plugin to build my Flex module. So on the compile phase I'm getting

org.apache.maven.plugin.MojoExecutionException: Error compiling!

with no information on where (at what source file) the error happens and what is nature of the compile error. I'll appreciate if anyone can instruct me on how to make flexmojos-maven-plugin print more information about compile errors.

Tony
  • 31
  • 3
  • Have you managed to compile anything (ever) or is this part of trying to get Maven working for the first time? – Andrew Aylett Jun 10 '10 at 11:38
  • 1
    This module was being developed (and compiled) under FlexBuilder by another guy. What I'm trying to do is to move build process to Maven. And I'm wondering how compile error messages can lack such basic information like file name, line number, etc. – Tony Jun 10 '10 at 11:47
  • I can say that I've never had an error message like that before (Maven always gives me file and line), which is why I was asking if you'd successfully compiled anything. It may help to try to get a trivial project building first. Also, can you post the entire output (maybe to pastebin)? Sometimes the actual error message can be quite a distance from the last output. – Andrew Aylett Jun 10 '10 at 13:16

2 Answers2

2

I had a similar problem. The first answer, to get more information when compiling is to use the built-in maven -X option.

mvn -X clean install

That will give you output that describes where this error is happening. For me, I had a very similar error to the one you have and it was ultimately coming from "Adobe's code," so to speak.

In my case, by skimming over the error stacktrace:

[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-SNAPSHOT:sign-air
(default-sign-air) on project barebones-air: Error invoking AIR api: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-SNAPSHOT:sign-air
(default-sign-air) on project barebones-air: Error invoking AIR api

...[other stacktrace output, snipped]...

Caused by: java.lang.NullPointerException
    at com.adobe.air.ADTOutputStream.addApplicationDescriptor(ADTOutputStream.java:330)
    at com.adobe.air.AIROutputStream.addApplicationDescriptor(AIROutputStream.java:63)
    at com.adobe.air.ApplicationPackager.addSpecialFiles(ApplicationPackager.java:242)
    at com.adobe.air.AIRPackager.addSpecialFiles(AIRPackager.java:172)
    at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java:63)
    at org.sonatype.flexmojos.plugin.air.packager.FlexmojosAIRPackager.createPackage(FlexmojosAIRPackager.java:72)
    at org.sonatype.flexmojos.plugin.air.SignAirMojo.doPackage(SignAirMojo.java:332)
    ... 26 more

...[other stacktrace output, snipped]...

I could tell it had something to do with the descriptor file. So I opened my descriptor file and (based on a few google searches) changed the following:

<content>[This value will be overwritten by Flash Builder in the output app.xml]</content>

to:

<content>MyAppName.swf</content>

and:

    <visible>false</visible>
</initialWindow>

to:

    <visible>true</visible>
</initialWindow>

The first change fixed the null pointer exception and the second allowed my application window to display.

I hope this helps someone,
-gMale


edit:

Also, be sure to explicitly point to your descriptor in the configuration of Flexmojos:

<plugin>
    <groupId>org.sonatype.flexmojos</groupId>
    <artifactId>flexmojos-maven-plugin</artifactId>
    <version>${flexmojos.version}</version>
    <configuration>
        <sourceFile>${application.name}.mxml</sourceFile>
        <finalName>${application.name}</finalName>             
        <descriptorTemplate>${project.build.sourceDirectory}/${application.name}-app.xml</descriptorTemplate>
        <storepass>${keystore.password}</storepass>
    </configuration>
    <extensions>true</extensions>
    <dependencies>
        <dependency>
            <groupId>com.adobe.flex</groupId>
            <artifactId>compiler</artifactId>
            <version>${flex.sdk.version}</version>
            <type>pom</type>
        </dependency>
    </dependencies>
</plugin>
gMale
  • 17,147
  • 17
  • 91
  • 116
0

I have been in a situation like this before. It turns out that the actual error message is hidden somewhere in the console output.

Try to copy-paste all the console outputs generated from that executed maven command into a text editor somewhere and search the string 'ERROR'.

Iwan Satria
  • 1,903
  • 1
  • 19
  • 22