I have downloaded the sourc开发者_如何转开发e code of Apache Lucene using Subversion. Now I want to create a JAR file for a particular Java file in the contrib portion of the code.
The problem is that when I do javac x.java
to get a class file and package it into a JAR file using jar cf jarfile.jar x.class
the package hierarchy is not preserved in the JAR file.
What is the correct way of packaging class files into the JAR file maintaining the package hierarchy?
Particularly with Subversion checked out code is there a better way of packaging selected Java files.
mindas:/tmp/test$ pwd
/tmp/test
mindas:/tmp/test$ ls
mindas:/tmp/test$ mkdir some
mindas:/tmp/test$ mkdir some/package
mindas:/tmp/test$ touch some/package/SomeFile.class
mindas:/tmp/test$ jar cf jarfile.jar some/package/SomeFile.class
That does preserve the structure.
Lucene have ant's build.xml
, you can make jar by using ant package
at lucene source directory. For contribs there are also contrib/contrib-build.xml
精彩评论