dtrott / maven-thrift-plugin

Maven Thrift Plugin that executes the thrift code generator (base on protocol buffers plugin)
120 stars 68 forks source link

NPE with java:beans generator #5

Closed ntolia closed 13 years ago

ntolia commented 13 years ago

I am using Thrift 0.6.0 with the 0.1.10 thrift plugin. If I use

java:beans

I get a NPE with the following stack trace java.lang.NullPointerException at org.apache.thrift.maven.Thrift.moveGeneratedFiles(Thrift.java:117) at org.apache.thrift.maven.Thrift.compile(Thrift.java:85) at org.apache.thrift.maven.AbstractThriftMojo.execute(AbstractThriftMojo.java:158) at org.apache.thrift.maven.ThriftCompileMojo.execute(ThriftCompileMojo.java:22) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) ...

This happens because with the java:beans generator, the code is output into the "gen-javabean" directory. However, Thrift.java defines GENERATED_JAVA to be "gen-java" and this causes the NPE. Not sure what the recommended fix is but I would be happy to spin up a patch after discussion.

dtrott commented 13 years ago

I don't think the plug-in is the right place to handle this kind of issue. I think a better approach is to fix the thrift code generator to not insert these additional directories in the first place.

To that end I have logged an issue against thrift: https://issues.apache.org/jira/browse/THRIFT-1069

dtrott commented 13 years ago

THRIFT-1069 has now been committed to the thrift mainline.

I have updated the plug-in code to use the new -out parameter If you want to test it you will need to build both the plug-in and thrift from source.

Once the new version of thrift is released, I will do a release of the plug-in.

ntolia commented 13 years ago

Looks good. Looking forward to Thrift 0.7.

ntolia commented 13 years ago

Now that Thrift 0.7 is out (see https://thrift.apache.org/download/), we would really appreciate a new version of the plugin that can handle the new -out parameter.

Thanks for all the hard work! Also, is there anything I can do to help in the release?