Maven Basics
来源:互联网 发布:怎么做淘宝网页 编辑:程序博客网 时间:2024/05/17 10:56
I assumed that you have correctly installed and configured Java Development Kit.
First, you should download apache maven from this page: https://maven.apache.org/download.cgi.
There are several kinds of files for you. I choosed the binary zip archive, and unzipped the file under the directory: D:\Program Files\apache-maven-3.3.9:
Then right click on your computer as below, and choose the menu "属性".
Then go through the following steps, when you are at step 4, type the path of bin in your unzipped maven directory (for me, it is "D:\Program Files\apache-maven-3.3.9\bin") to the end of value.
Save and exit, open cmd.exe and type "mvn -v" to test whether you have installed and configured maven correctly.
Create a folder for test purpose: D:\java_test.
In cmd, change to the directory: D:\java_test which you just created. Type:
mvn archetype:generate -DgroupId=com.mycompany.helloworld -DartifactId=helloworld -Dpackage=com.mycompany.helloworld -Dversion=1.0-SNAPSHOT
Wait, and when you are asked to "Choose a number", type106.
Wait, and when you are asked to confirm Yes, type enter button.
Wait until the process is over, and refresh your D:\java_test directory, you will see a new folder named "helloworld" whose directory structure is as below:
Open App.java and AppTest.java, in top lines of these two file, revise package name to be com.mycompany.helloworld as below:
Open pom.xml and revise values of groupId, artifactId and version as below:
Then in cmd, change directory to be under the helloworld directory, and then type mvn package as bellow:
You can then find a new folder created:
In cmd, type:
java -cp target/helloworld-1.0-SNAPSHOT.jar com.mycompany.helloworld.App
and you will see:
Yes, "Hello World!" was printed to the screen.
Back to the file App.java, and you will know where this output is from:
That's all, bye.
by Yakima Teng on February 24, 2016 in Shanghai.
- maven basics
- Maven Basics
- maven Assembly Basics
- Basics
- Maven的pom.xml文件详解------The Basics
- Maven的pom.xml文件详解------The Basics
- Menu Basics
- XML Basics
- WAP Basics
- Internet Basics
- HTML Basics
- Xen Basics
- USB Basics
- DC Basics
- template basics
- OOP-basics
- RCU - Basics
- Git Basics
- oracle 两种认证方式总结
- linux设备驱动归纳总结(三):1字符型设备之设备申请
- SQL Server日期计算(使用DATEADD和DATEDIFF函数)
- block
- [leetcode] One Edit Distance 解题报告
- Maven Basics
- IOS Apps 开发(Swift)(2)——Learn the Essentials of Swift(2)
- 中国哪些人获得过诺贝尔奖(含莫言…
- 欢迎使用CSDN-markdown编辑器
- mysql的安装与mysql一机多实例(低版本)
- 欢迎使用CSDN-markdown编辑器
- calc_AJAX.html
- Vi/Vim查找替换使用方法
- Android开发优化之——对界面UI的优化(2)