admin 发表于 2017-9-12 17:26:26

Maven命令行helloworld

创建项目
$ mvn archetype:generate -DgroupId=com.mycompany.helloworld -DartifactId=helloworld -Dpackage=com.mycompany.helloworld -Dversion=1.0-SNAPSHOT (一路回车)
$ cd helloworld

编译
$ mvn compile

打包(jar)
$ mvn package

运行
$ mvn exec:java -Dexec.mainClass=com.mycompany.helloworld.App

直接Java运行
$ java -cp target/helloworld-1.0-SNAPSHOT.jar com.mycompany.helloworld.App

运行测试
$ mvn test
$ mvn test -Dtest=MainTest#testHello
页: [1]
查看完整版本: Maven命令行helloworld