Tony
Tony

Reputation: 31

How to get informative compile error messages when using flexmojos-maven-plugin?

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.

Upvotes: 3

Views: 1833

Answers (2)

Iwan Satria
Iwan Satria

Reputation: 2163

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'.

Upvotes: 0

gMale
gMale

Reputation: 17895

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>

Upvotes: 2

Related Questions