- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Apache Ant 来编译、jar 并运行学校的 java 项目。我遇到了一个问题,我不知道如何将单个 .txt 文件包含到我的 .jar 中,然后在我的 java 代码中引用它。
这是我的 build.xml 中的编译和 jar 命令。
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes"/>
</target>
<target name="jar">
<mkdir dir="build/jar"/>
<jar destfile="build/jar/BinaryTree.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="cs3345.MainLauncher"/>
</manifest>
</jar>
</target>
我使用什么命令将 .txt 文件包含到我的 jar 中。我已经看到了一些关于它的 Stack Overflow 问题,特别是
adding non-code resources to jar file using Ant
How can I include data text files in a jar using Ant?
但是他们都没有真正解释如何包含文件。他们只是发出了对我来说并没有真正意义的命令。我试过了,
<jar destfile="build/jar/BinaryTree.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="cs3345.MainLauncher"/>
</manifest>
<fileset dir="src/resources" />
</jar>
但这似乎没有帮助,因为我只是不理解 Ant,我找不到它的文档来真正解释为什么你在 ant 中做不同的事情。
我的 .txt 文件位于 src/resources 中。
最佳答案
<jar>
任务任务多个文件集:
<jar destfile="build/jar/BinaryTree.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="cs3345.MainLauncher"/>
</manifest>
<fileset dir="src/resources" />
</jar>
<manifest>
任务是一个子实体。它非常类似于 <manifest>
任务。你的 jar 中有一个名为 META-INF/MANIFEST.MF
的文件这是向该 jar 添加另一个属性。这个特定的属性告诉 Jar 什么是主类,在执行 jar 时应该启动该类。
<fileset dir="src/resources"/> is adding all the files that are found in the
资源目录。如果您只想添加特定文件怎么办?您可以使用selectors 。例如:
<jar destfile="build/jar/BinaryTree.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="cs3345.MainLauncher"/>
</manifest>
<fileset dir="src/resources">
<include name="foo.txt"/>
</fileset>
</jar>
这次我不会添加整个 resources
目录树。我只是添加一个名为 foo.txt
的文件进入我的 jar 文件。
关于java - Apache Ant : adding and using a . txt 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19368614/
我有一个场景,我们必须通过 Azure AD 对企业用户进行身份验证,但通过 Azure AD B2C 对外部用户进行身份验证——所有这些都来自同一个登录屏幕。 有一些 Web 应用程序将共享此功能。
在使用 Azure AD B2C 和 Azure AD B2B 之前,我通常会将应用程序添加到我们租户的 Azure AD 中,并且 Office 365 用户可以使用其帐户 (SSO) 访问应用程序
当 Azure Active Directory 信任访问本地 Active Directory 用户时,我们是否可以使用本地 AD 用户名(域限定的 sam 帐户名称,例如:cosmos\brahm
什么是在网站上展示广告的好托管广告管理器? 我听说过OpenX ,但从未使用过。 最佳答案 我们使用名为 Ad Serving Solutions http://www.adservingsoluti
是否可以将用户从云 Azure Active Directory 同步到本地 AD? On Premises 这里有点错误,因为它实际上是 Azure 中的虚拟网络,带有 Windows Server
我正在关注这里的答案:Multi-Tenant Azure AD Auth in Azure AD B2C with Custom Policies 以及这里的演练:https://github.co
我正在尝试使用/common Azure AD 端点在 Azure AD B2C 中使用 Azure AD Auth。根据How to sign in any Azure Active Directo
来自 Mercurial 文档: The manifest is the file that describes the contents of the repository at a particu
我正在尝试将 firebase admob 与 React Native 集成到我的应用程序中,一切都适用于 testID横幅 ('ca-app-pub-3940256099942544/293473
我有一个应用程序需要根据其本地 AD 通用名称来过滤权限。几点注意事项: Azure AD Connect 正在 OnPrem AD 和 Azure 之间同步数据 我已成功将登录用户的组信息从 Azu
我正在使用 blogspot 平台并在我的网站上使用了 Google Adsense。我想对齐一个自动 Adsense 广告,它根本不居中,而带有代码的广告则完全没有问题。它只是自动广告,有人可以帮助
为什么redirect URL必须完全匹配?在域级别进行匹配是否不足以提供适当的安全性? 如果我有数百条路径怎么办? 示例网址: https://myawesomesite.com https://m
我即将创建一个新的 Azure AKS 群集,并且希望将 AKS 与 Azure Key Vault 集成。几个月前,在学习阶段,我看到需要使用Azure AD pod管理的身份来做到这一点,但现在我
我正在尝试配置我的 Azure AD 以同步我的本地 AD DS,如果在 Microsoft Azure AD 中添加任何用户,它应该自动在我的本地 AD 中注册。 我已创建 Azure AD 并配置
我有大约 50 个用户的 Azure AD。这些用户是我们购买Office365时创建的。假设 Azure AD 上的域是 example.com。 ([email protected])在本地,我们
我正在尝试获取组 Azure AD 的名称,Azure 登录 (openId) 后的内部 token 我收到 json 格式的组 ID,但我需要组名称。 登录后的Json: Claims 尝试使用Gr
我们希望将 Azure AD B2C 用于我们的 Web 应用程序,以允许用户使用其公司 ADFS 帐户登录。 根据Azure Active Directory B2C: Add ADFS as a
首先,我无法了解为什么需要这些数据,也无法了解有关网络的细节。您必须相信我,除了运行 LDAP 查询的 PowerShell 脚本之外,没有其他方法可以获取这些数据。 我正在使用具有多个林和多个域的网
我是一个相当新的 PS 用户...正在寻求有关 powershell 脚本的帮助来获取用户所属的安全组列表。 描述我需要什么: 我有包含许多用户(samaccountnames)的输入列表(txt 文
我有两个要存储在目录中以供我的应用程序使用的声明。这些内容不可供用户编辑,但可用于应用程序从 token 中读取。 内置策略可以检索声明,但是,使用自定义策略检索这些声明没有取得任何成功。 通读文章“
我是一名优秀的程序员,十分优秀!