Software Project Management_JUnit && Maven

Task1:

Develop the project “HelloWorld”

-A .java program: Just print out “Hello” + your name;

-A test case using Junit to verify whether the program works well.

Steps to realize:

A .java program: Just print out “Hello” + your name;

Using Eclipse to creat a new java project:

Run it:

A test case using Junit to verify whether the program works well.

File->Build path->Add Library->JUnit;

File->new->class "junit" and then run it, shown as follow:

Task2:

Install Maven and Build the “HelloWorld” Project

-Create the directories as “Convention Over Configuration.

-Use “compile, test, package” to build the project.

1.Download Maven from http://maven.apache.org/ and then configure environment variables.

控制面板>系统>高级系统设置>环境变量

 2.Check Maven is installed or not "mvn -v"

3.Using Eclipse "File>New>Other>Maven>Maven Project"

In AppTest.java:

Then,run it and we got:

Yahooo!Finished!

We can also use cmd to creat package. But it is "mafan"/complex . So I used Eclipse to creat maven directly.

原文地址:https://www.cnblogs.com/wanyou/p/4461102.html