开发者

Exclude selected packages in jar command - build script

My project structure has these base packages.

  • a.b.c.core
  • a.b.c.web
  • a.b.c.common

And core,web,common packages will have sub packages. I have compiled all the java files under src dir and copied the class files to a dir.

<javac srcdir="${src}" destdir="${build}/myapp" debug="true">
  <classpath refid="compile.classpath"/>
  <classpath refid="ant.classpath" />
</javac>

Now i want to build a jar say core.jar with class files belonging to a.b.c.core and its subpackages. Similarly a web.开发者_开发百科jar and common.jar. Can someone give a sample code for jar task to accompolish this?

Thanks


Rather than excluding specific areas, I'd just include the ones you want:

<jar destfile="core.jar"
     basedir="${build}/myapp"
     includes="a/b/c/core/**"
/>
<jar destfile="common.jar"
     basedir="${build}/myapp"
     includes="a/b/c/common/**"
/>
<jar destfile="web.jar"
     basedir="${build}/myapp"
     includes="a/b/c/web/**"
/>

The jar task documentation is pretty good though... if the above doesn't do what you want, then that should help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜