I guess that the build problems come from a not 100% matching lucene-jar. So to be sure that you use the same version as in the engine: try to get the correct lucene jar from ivyEngine.zip in /lib/shared directory and reference it in your project classpath.
**UPDATE**: since ivy 5.0 our osgi plugin hides the lucene jars explicitly from the classpath. so that other projects will not have these ivy-core dependcy problems in the future.
If you want to be 200% save that your project classes and ivy core classes are independet i recommend that you try re-packaging the lucene version you want to use. It means that you change the namespace of every class in the lucene JAR to not land in the JAR hell of conflicting versions. An example can be found here: where I [repacked hsqldb][1] of another version as in the ivy core. More infos about repackaging can be founde here on [repackage.org][2]
[1]: http://answers.axonivy.com/questions/960/use-the-latest-hsqldb-within-my-project
[2]: http://repackage.org/