[root@666 maven_work]# mvn archetype:create -DgroupId=helloword -DartifactId=helloworld
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.493 s
[INFO] Finished at: 2017-11-27T14:46:23+08:00
[INFO] Final Memory: 7M/145M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'create' in plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.1 among available goals crawl, create-from-project, generate, help, integration-test, jar, update-local-catalog -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException
以create报错
[root@666 maven_work]# mvn archetype:create -DgroupId=helloword -DartifactId[root@666 maven_work]# mvn archetype:generate -DgroupId=helloword -DartifactId=helloworld
成功!!
生成以下文件:
# tree helloworld/
helloworld/
|-- pom.xml
`-- src
|-- main
| `-- java
| `-- helloword
| `-- App.java
`-- test
`-- java
`-- helloword
`-- AppTest.java 7 directories, 3 files

进到项目中,然后进行:

# cd helloworld/
[root@666 helloworld]# ls
pom.xml src
[root@666 helloworld]# mvn package
第一次编译的话,需要联网,因为Maven会自动下载依赖包.成功后会生成:target文件夹
[root@666 helloworld]# ls
pom.xml src target [root@666 helloworld]# tree target/
target/
|-- classes
| `-- helloword
| `-- App.class
|-- helloworld-1.0v.jar
|-- maven-archiver
| `-- pom.properties
|-- maven-status
| `-- maven-compiler-plugin
| |-- compile
| | `-- default-compile
| | |-- createdFiles.lst
| | `-- inputFiles.lst
| `-- testCompile
| `-- default-testCompile
| |-- createdFiles.lst
| `-- inputFiles.lst
|-- surefire-reports
| |-- helloword.AppTest.txt
| `-- TEST-helloword.AppTest.xml
`-- test-classes
`-- helloword
`-- AppTest.class 12 directories, 10 files

手动运行jar包查看结果

# java -cp target/helloworld-1.0v.jar helloword.App
Hello World!

这里列举几个常用的命令

mvn compile 编译项目
mvn test 编译运行单元测试
mvn package 打包(jar or war)
mvn install 将项目安装到本地仓库
mvn clean 清空项目
mvn eclipse:eclipse 生成eclipse工程

maven创建helloword项目的更多相关文章

  1. Eclipse+Maven创建webapp项目<一>(转)

    还在为jar下载而烦恼吗?还在为jar依赖关系而烦恼吗?还在为jar冲突而烦恼吗?强大的maven项目管理工具来拯救你们呢?自动下载jar,自动下载jar依赖包.你什么都不用做,只需要在中央仓库中co ...

  2. 【maven】maven创建web项目-pom文件提示web.xml is missing and <failOnMissingWebXml> is set to true

    使用maven创建web项目,选择war类型后,pom文件红叉 提示web.xml is missing and <failOnMissingWebXml> is set to true ...

  3. Eclipse+Maven创建webapp项目

    Eclipse+Maven创建webapp项目<一> 1.开启eclipse,右键new-->other,如下图找到maven project 2.选择maven project,显 ...

  4. Eclipse+Maven创建webapp项目<一>

    Eclipse+Maven创建webapp项目<一> 1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显 ...

  5. Maven创建servlet项目演示(三)

    上一节用Maven新建了web项目成功后,本文演示在此基础上应用servlet. 从对tomcat服务器进行配置可的过程中可以知道,tomcat作为servlet容器运行,负责处理客户请求,把请求传送 ...

  6. Eclipse+Maven创建webapp项目<一><二><三>

    转-http://www.cnblogs.com/candle806/p/3439469.html Eclipse+Maven创建webapp项目<一> 1.开启eclipse,右键new ...

  7. Eclipse使用Maven创建Web项目

    一.Maven插件下载.jdk下载 1.maven下载地址: http://maven.apache.org/download.cgi 2.jdk下载地址: http://www.oracle.com ...

  8. Eclipse+Maven创建webapp项目<二> (转)

    Eclipse+Maven创建webapp项目<二> 1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显 ...

  9. Eclipse+Maven创建webapp项目<一> (转)

    Eclipse+Maven创建webapp项目<一> 1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显 ...

随机推荐

  1. shell 日期加减,日期大小比较的方法

    1 日期加减方法可实现当天的日期加减,指定日期的加减,天周月年. 只判断yymmdd的秒 twoDayAgoTime=`date -d \`date -d "-2 day" +%Y ...

  2. ServiceNow在中国还有没有模仿者?

    美国版的“ServiceNow”:https://www.servicenow.com 中国版的“ServiceHot” :http://www.itsmcn.com

  3. ORM(二)

    一.ORM简介         对象关系映射(Object Relational Mapping,简称ORM)模式是一种为了解决面向对象与关系数据库存在的互不匹配的现象的技术.简单的说,ORM是通过使 ...

  4. IIS 注册 ASP.NET 2.0 4.0

    在CMD窗体,运行如下命令: 2.0:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i 4.0:C:\WINDOWS ...

  5. Xamarin Essentials教程打开文件

    Xamarin Essentials教程打开文件 FileSystem类的OpenAppPackageFileAsync()方法可以用来打开App包中特定的文件,其语法形式如下: public sta ...

  6. Adams输出宏代码

    for variable_name=loopobj object_names=.amachinery.* type=macro var set var=filename1 str=(eval(STR_ ...

  7. 前面的内容 也是要去掉白名单 和 8.8.8.8这种非问题IP的 高风险 么? (目前我们没有获取客户的中风险、低风险数据,可以处理掉高风险)

    前面的内容 也是要去掉白名单  和 8.8.8.8这种非问题IP的 高风险 么?   (目前我们没有获取客户的中风险.低风险数据,可以处理掉高风险) == 整体把关.不清楚细节,所以只能从整体决策.做 ...

  8. MySql基础笔记(三)其他重要的事情

    其他重要的事情 一)索引管理优化 1.把多条alter语句整合为一条 2.去除重复的索引 1)当一个索引的最左边部分包含到其他索引中时,被认定为重复索引 create table user( id i ...

  9. [BZOJ2863]愤怒的元首

    Description: Pty生活在一个奇葩的国家,这个国家有n个城市,编号为1~n. ​ 每个城市到达其他城市的路径都是有向的. ​ 不存在两个城市可以互相到达. 这个国家的元首现在很愤怒,他大喊 ...

  10. Django——中间件设置缓存

    如图所示查看网站缓存时间 在app中创建middleware.py文件,导入MiddlewareMixin,创建类并继承MiddlewareMixin 在settings中的MIDDLEWARE=[ ...