惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
IT之家
IT之家
Stack Overflow Blog
Stack Overflow Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
腾讯CDC
P
Palo Alto Networks Blog
Spread Privacy
Spread Privacy
S
Schneier on Security
NISL@THU
NISL@THU
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Proofpoint News Feed
T
Threatpost
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
I
Intezer
C
Check Point Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cyber Attacks, Cyber Crime and Cyber Security
S
Securelist
Security Latest
Security Latest
大猫的无限游戏
大猫的无限游戏
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
云风的 BLOG
云风的 BLOG
量子位
T
Tor Project blog
博客园 - 叶小钗
The Cloudflare Blog
Simon Willison's Weblog
Simon Willison's Weblog
T
Tailwind CSS Blog
W
WeLiveSecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Security Affairs
罗磊的独立博客
Know Your Adversary
Know Your Adversary
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
Help Net Security
Help Net Security
美团技术团队
P
Privacy International News Feed
The Hacker News
The Hacker News
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

jobcher on 打工人日志

2023-12-21 打工人日报 2023-12-20 打工人日报 2023-12-19 打工人日报 2023-12-18 打工人日报 2023-12-17 打工人日报 2023-12-16 打工人日报 2023-12-15 打工人日报 2023-12-14 打工人日报 2023-12-13 打工人日报 2023-12-12 打工人日报 2023-12-11 打工人日报 2023-12-10 打工人日报 2023-12-09 打工人日报 2023-12-08 打工人日报 2023-12-07 打工人日报 2023-12-06 打工人日报 2023-12-05 打工人日报 2023-12-04 打工人日报 2023-12-03 打工人日报 2023-12-02 打工人日报 2023-12-01 打工人日报 2023-11-30 打工人日报 2023-11-29 打工人日报 2023-11-28 打工人日报 2023-11-27 打工人日报 2023-11-26 打工人日报 2023-11-25 打工人日报 2023-11-24 打工人日报 2023-11-23 打工人日报 2023-11-22 打工人日报 2023-11-21 打工人日报 2023-11-20 打工人日报 2023-11-19 打工人日报 2023-11-17 打工人日报 2023-11-16 打工人日报 2023-11-15 打工人日报 2023-11-14 打工人日报 2023-11-13 打工人日报 2023-11-12 打工人日报 2023-11-11 打工人日报 2023-11-10 打工人日报 2023-11-09 打工人日报 2023-11-08 打工人日报 2023-11-07 打工人日报 2023-11-06 打工人日报 2023-11-05 打工人日报 2023-11-04 打工人日报 2023-11-03 打工人日报 2023-11-02 打工人日报 2023-11-01 打工人日报 2023-10-31 打工人日报 2023-10-30 打工人日报 2023-10-29 打工人日报 2023-10-28 打工人日报 2023-10-27 打工人日报 2023-10-26 打工人日报 2023-10-25 打工人日报 2023-10-24 打工人日报 2023-10-23 打工人日报 2023-10-22 打工人日报 2023-10-21 打工人日报 2023-10-20 打工人日报 2023-10-19 打工人日报 2023-10-18 打工人日报 2023-10-17 打工人日报 2023-10-16 打工人日报 2023-10-15 打工人日报 2023-10-14 打工人日报 2023-10-13 打工人日报 2023-10-12 打工人日报 2023-10-11 打工人日报 2023-10-10 打工人日报 2023-10-09 打工人日报 2023-10-07 打工人日报 2023-10-06 打工人日报 2023-10-05 打工人日报 2023-10-04 打工人日报 2023-10-03 打工人日报 2023-10-02 打工人日报 2023-10-01 打工人日报 2023-09-30 打工人日报 2023-09-29 打工人日报 2023-09-28 打工人日报 2023-09-27 打工人日报 2023-09-26 打工人日报 2023-09-25 打工人日报 2023-09-24 打工人日报 2023-09-23 打工人日报 2023-09-22 打工人日报 2023-09-21 打工人日报 2023-09-20 打工人日报 2023-09-19 打工人日报 2023-09-18 打工人日报 2023-09-17 打工人日报 2023-09-16 打工人日报 2023-09-15 打工人日报 2023-09-14 打工人日报 2023-09-13 打工人日报 2023-09-12 打工人日报 2023-09-11 打工人日报
ant build.xml 编写
2022-04-21 · via jobcher on 打工人日志

ant build.xml 编写

生成 build.xml

Eclipse 自动生成 Ant 的Build.xml 配置文件,生成的方法很隐蔽
选择你要生成Build.xml文件的项目,右键. Export-> General -> Ant Buildfiles .
点 Next,选择项目,再点Finish.

编写 build.xml

  1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2
  3<!-- 每个构建文件对应一个项目。<project>标签时构建文件的根标签。它可以有多个内在属性,就如代码中所示,其各个属性的含义分别如下。
  4(1) default表示默认的运行目标,这个属性是必须的。
  5(2) basedir表示项目的基准目录。
  6(3) name表示项目名。
  7(4) description表示项目的描述。
  8 -->
  9<project default="build" name="Sort">
 10	<!-- 设置属性或文件路径,读取属性使用${property},value路径默认项目根目录 -->
 11	<property file="ant/builds.properties" />
 12
 13	<property name="src.dir" value="src/statics" />
 14
 15	<property name="classes.dir" value="ant/classes" />
 16
 17	<property name="lib.dir" value="lib" />
 18
 19	<property name="dist.dir" value="ant/dist" />
 20
 21	<!-- 定义classpath -->
 22	<path id="master-classpath">
 23		<fileset file="${lib.dir}/*.jar" />
 24		<pathelement path="${classes.dir}" />
 25	</path>
 26
 27	<!--一个项目标签Project包含多个target标签,一个target标签可以依赖其他的target标签
 28		在生成可执行文件之前必须先编译该文件,因策可执行文件的target依赖于编译程序的 target。
 29
 30		(1).name表示标明,这个属性是必须的。
 31		(2).depends表示依赖的目标。
 32		(3)if表示仅当属性设置时才执行。
 33		(4)unless表示当属性没有设置时才执行。
 34		(5)description表示项目的描述。
 35		Ant的depends属性指定了target的执行顺序。Ant会依照depends属性中target出现顺序依次执行每个target。在执行之前,首先需要执行它所依赖的target。
 36	 -->
 37	<!-- 初始化任务 -->
 38	<target name="init">
 39		<!-- 输出标签 ,${init}是builds.properties中的属性 -->
 40		<echo message="  Available Targets:"/>
 41        <echo message="-------------------------------------------------------"/>
 42        <echo message="  init ${init}   ..."/>
 43        <echo message="-------------------------------------------------------"/>
 44	</target>
 45
 46	<!-- 编译 -->
 47	<target name="compile" depends="init" description="compile the source files">
 48		<!-- 删除文件夹 -->
 49		<delete dir="${classes.dir}" />
 50		<!-- 创建文件夹 -->
 51		<mkdir dir="${classes.dir}" />
 52		<!-- 编译java生成class文件 ,其属性如下
 53			(1).srcdir表示源程序的目录。
 54			(2).destdir表示class文件的输出目录。
 55			(3).include表示被编译的文件的模式。
 56			(4).excludes表示被排除的文件的模式。
 57			(5).classpath表示所使用的类路径。
 58			(6).debug表示包含的调试信息。
 59			(7).optimize表示是否使用优化。
 60			(8).verbose 表示提供详细的输出信息。
 61			(9).fileonerror表示当碰到错误就自动停止。
 62		 -->
 63		<javac srcdir="${src.dir}" destdir="${classes.dir}">
 64			<!-- 编译需要的jar包 引用前面设置的class-path -->
 65			<classpath refid="master-classpath" />
 66		</javac>
 67	</target>
 68
 69
 70	<!-- 打包成jar -->
 71	<target name="pack" description="make .jar file">
 72
 73		<delete dir="${dist.dir}" />
 74
 75		<mkdir dir="${dist.dir}" />
 76		<!-- 该标签用来生成一个JAR文件,其属性如下
 77			(1) destfile表示JAR文件名。
 78			(2) basedir表示被归档的文件名。要操作的文件路径
 79			(3) includes表示别归档的文件模式。
 80			(4) exchudes表示被排除的文件模式。
 81		 -->
 82		<jar destfile="${dist.dir}/hello.jar" basedir="${classes.dir}">
 83			<!-- 不包含的类或内容 -->
 84			<exclude name="**/*Test.*" />
 85		</jar>
 86
 87	</target>
 88
 89	<!-- 生成zip压缩包 -->
 90	<target name="zip">
 91	    <delete dir="${release-dir}" />
 92		<mkdir dir="${release-dir}" />
 93		<!-- 该标签用来生成一个zip文件,其属性如下
 94			(1) destfile表示zip文件名。
 95			(2) basedir表示被归档的文件名。 要操作的文件路径
 96			(3) includes表示别归档的文件模式。
 97			(4) exchudes表示被排除的文件模式。
 98		 -->
 99		<zip destfile="${release-dir}/antTest.zip" update="true"
100			       basedir="ant" />
101	</target>
102</project>

欢迎关注我的博客www.jobcher.com