从构建中排除包而不是从 Netbeans 8 中的视图中排除? [英] Exclude package from build but not from view in Netbeans 8?

查看:31
本文介绍了从构建中排除包而不是从 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天全站免登陆