Java:如何使用自定义 Ant build.xml 将 ProGuard 集成到 Jar 项目中
我有一个简单的 java 项目,它引用两 (2) 个库 jar 文件。想要集成 ProGuard。
这是我当前的 build.xml:
<?xml version="1.0" ?>
<project name="Samples" default="dist" basedir=".">
<!-- generate JAR START -->
<description>Samples Library</description>
<!-- Setting global properties for this build -->
<property name="src" location="src" />
<property name="bin" location="bin" />
<target name="dist">
<jar destfile="Samples.jar" basedir="bin/">
<!-- Use ** to include the directory recursively -->
<include name="com/samples/**" />
</jar>
</target>
</project>
I have simple java project which refers to two (2) library jar files. Want to integrate ProGuard.
Here's my current build.xml:
<?xml version="1.0" ?>
<project name="Samples" default="dist" basedir=".">
<!-- generate JAR START -->
<description>Samples Library</description>
<!-- Setting global properties for this build -->
<property name="src" location="src" />
<property name="bin" location="bin" />
<target name="dist">
<jar destfile="Samples.jar" basedir="bin/">
<!-- Use ** to include the directory recursively -->
<include name="com/samples/**" />
</jar>
</target>
</project>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了几种集成它的方法,但这是最简单的方法。
这是proguard.cfg:
I found several ways to integrate it but this is the simplest way to do it.
Here's the proguard.cfg:
ProGuard 发行版包含 Ant 任务的手册页 以及一些完整的示例构建文件在目录
examples/ant
中。您可以指定任意数量的库 jar。您的后续回答表明您正在开发 Android 应用程序。然后,您应该查看 Android 示例。
The ProGuard distribution contains a manual page for the Ant task and also a few complete sample build files in the directory
examples/ant
. You can specify any number of library jars.Your follow-up answer suggests that you're working on an Android application. You should then have a look at the Android example.