Java Development with Ant phần 2

Nhiều người trong số các chỉ định được sử dụng bởi các nhà sản xuất và người bán để phân biệt sản phẩm của họ được khẳng định là nhãn hiệu hàng hoá. Trong trường hợp những chỉ định xuất hiện trong cuốn sách, và các ấn phẩm Manning nhận thức của một tuyên bố nhãn hiệu, chỉ định đã được in trong ban đầu | Creating the build file Now that we have the files in the right places and we know what we want to do the build file needs to be rewritten. Rather than glue all the tasks together in one long list of actions we have broken the separate stages directory creation compilation packaging and cleanup into four separate targets inside the build file. xml version project name structured default archive target name init mkdir dir build classes mkdir dir dist target Creates the output directories target name compile depends init javac srcdir src destdir build classes ----- Compiles into the output directories target target name archive depends compile jar destfile dist basedir build classes target target name clean depends init delete dir build delete dir dist target Creates the archive Cleans the output directories project This build file adds an init target to do initialization work which means creating directories. We ve also added two other new targets clean and archive. The archive target uses the jar task to create the JAR file containing all files in and below the build classes directory which in this case means all .class files created by the compile target. One target has a dependency upon another a dependency that Ant needs to know about. The clean target cleans up the output directories by deleting them. It uses the delete task to do this. We have also changed the default target to archive so this will be the target that Ant executes when you run it. Target dependencies We need a way of ensuring that Ant runs some targets before other targets that depend on their outputs. In our current project for the archive to be up to date all the source files must be compiled which means the archive target must come after the compilation target. Likewise compile needs the directories created in init so Ant must execute it after the init task. These are dependencies that we need to communicate to Ant. We do this as the targets are declared listing .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
63    70    1    23-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.