最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
In the previous chapter, we learned how to use Maven to create Java applications. Next we will learn how to build and test this project.
Go to the C:/MVN folder and open the consumerBanking folder. You will see a pom.xml file with the following code:
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">4.0.0 com.companyname.bank consumerBanking jar 1.0-SNAPSHOT consumerBanking http://maven.apache.org junit junit 3.8.1 test From the above xml code, we can see that Maven has added JUnit as the testing framework.
默认情况下 Maven 添加了一个源码文件 C:MVNconsumerBankingsrcmainjavacomcompanynamebankApp.java 和一个测试文件 C:MVNconsumerBankingsrctestjavacomcompanynamebankAppTest.java 。
Open the command console, jump to the C:MVNconsumerBanking directory, and execute the following mvn command to start building the project:
C:\MVN\consumerBanking>mvn clean package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------- [INFO] Building consumerBanking [INFO] task-segment: [clean, package] [INFO] ------------------------------------------------------------------- [INFO] [clean:clean {execution: default-clean}] [INFO] Deleting directory C:\MVN\consumerBanking\target ... ... ... [INFO] [jar:jar {execution: default-jar}] [INFO] Building jar: C:\MVN\consumerBanking\target\ consumerBanking-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Tue Jul 10 16:52:18 IST 2012 [INFO] Final Memory: 16M/89M [INFO] ------------------------------------------------------------------------ After execution, we have built our own project and created the final jar file. Here are the key concepts to learn:
We gave maven two goals, first cleaning up the target directory (clean), and then packaging the output of the project build as a jar (package) file.
The packaged jar file is available in consumerBankingtarget and is named consumerBanking-1.0-SNAPSHOT.jar.
Test reports are stored in the consumerBankingtargetsurefire-reports folder.
Maven compiles source files, as well as testing source files.
Then Maven runs the test case.
Finally, Maven creates the project package.
C:\MVN\consumerBanking\target\classes>java com.companyname.bank.App You can see the results:
Hello World! Add Java source file