在NetBeans 8中从构建中排除软件包,但从视图中排除软件包? [英] Exclude package from build but not from view in Netbeans 8?

查看:91
本文介绍了在NetBeans 8中从构建中排除软件包,但从视图中排除软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从构建过程中排除特定的程序包(例如com.domain.various),以使其不会出现在最终的jar文件中?

How can I exclude a specific package (e.g. com.domain.various) from the build process, so that it doesn't show up in the final jar file?

我已经尝试过以下方法:

I already tried to it the following way:

  1. 右键单击项目->项目属性
  2. 在树中选择来源"
  3. 点击包含/排除->添加排除模式

但这也将软件包隐藏在Netbeans IDE中,但是我仍然需要在项目视图中使用该软件包...

But this also hides the package within the Netbeans IDE, but I still need the package in the project-view...

有什么想法吗?

推荐答案

您可以为NetBeans构建自定义目标.它使用Ant作为默认的构建工具. 使用NetBeans菜单无法做到这一点.您必须编辑build.xml并覆盖build-impl.xml的编译/jar创建目标.

You can customize targets for NetBeans build. It uses Ant as the default build tool. There is no way of doing it using NetBeans menus. You must edit build.xml and override the compilation/jar creation targets of build-impl.xml.

编辑:

nbproject/project.properties上有一个属性:

# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=

只需使用要排除的文件对其进行编辑(project.properties上有示例.例如,要排除my.package.to.exclude中的所有文件:

Just edit it with the files you want to exclude (there are examples on project.properties. For example, to exclude all files from my.package.to.exclude:

dist.archive.excludes=**/my/package/to/exclude/**

这篇关于在NetBeans 8中从构建中排除软件包,但从视图中排除软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆