Getting Thrift into Maven Locally
I spent the better part of a morning trying to figure out how to get Thrift to be available in a Maven repository for a project I’m working on. Yes, I know there’s a JIRA issue for this but the comments are not clear and it’s more tailored towards publishing in the central Apache repository. Also, I tried using ‘ant publish’ and got “Execute failed: java.io.IOException: Cannot run program “../../compiler/cpp/thrift”: java.io.IOException: error=2, No such file or directory”. I don’t need that kind of problem installing a library nor do I want to build the whole Thrift library.
What I did to finally get this into my local maven repository is this.
- Download and unarchive the latest stable Thrift release
- Change into the Thrift Java root directory
- cd lib/java
- Run the default ant target, “dist”
- ant
- Install the build artifact into the local Maven repository. Note: Be sure to update the version to match what you downloaded.
- mvn install:install-file -Dfile=libthrift.jar -DgroupId=org.apache.thrift -DartifactId=libthrift -Dversion=0.4.0 -Dpackaging=jar -DgeneratePom=true