[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. 解决Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-f8IeEI/MYSQL-python/

    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-f8IeEI/MYS ...

  2. C# 自定义等待窗口

    private SynchronizationContext syncContext = null; public WaitWindow() { InitializeComponent(); sync ...

  3. 学习Nodejs:《Node.js开发指南》微博项目express2迁移至express4过程中填的坑

    <Node.js开发指南>项目地址https://github.com/BYVoid/microblog好不容易找到的基础版教程,但书中是基于express2的,而现在用的是express ...

  4. 双11线上压测netty内存泄露

    最近线上压测,机器学习模型第一次应用到线上经历双11大促.JSF微服务有报错 LEAK: ByteBuf.release() was not called before it's garbage-co ...

  5. 关于ugc的一点思考

    ugc会使互联网繁荣,但依赖大众用户创造的内容质量上会存在参差不齐,这是ugc本身存在的问题. 就拿技术论坛或社区来说,好的内容不少,但质量不好的内容也很多.社区在引导用户发言的同时,也应 对用户创造 ...

  6. BZOJ.4540.[HNOI2016]序列(莫队/前缀和/线段树 单调栈 RMQ)

    BZOJ 洛谷 ST表的一二维顺序一定要改过来. 改了就rank1了哈哈哈哈.自带小常数没办法. \(Description\) 给定长为\(n\)的序列\(A_i\).\(q\)次询问,每次给定\( ...

  7. Java并发编程(十)-- Java中的锁

    在学习或者使用Java的过程中进程会遇到各种各样的锁的概念:公平锁.非公平锁.自旋锁.可重入锁.偏向锁.轻量级锁.重量级锁.读写锁.互斥锁.死锁.活锁等,本文将简概的介绍一下各种锁. 公平锁和非公平锁 ...

  8. PAT Basic 1016

    1016 部分A+B (15 分) 正整数 A 的“D​A​​(为 1 位整数)部分”定义为由 A 中所有 D​A​​ 组成的新整数 P​A​​.例如:给定 A=3862767,D​A​​=6,则 A ...

  9. poj1064 Cable master(二分查找,精度)

    https://vjudge.net/problem/POJ-1064 二分就相当于不停地折半试. C++AC,G++WA不知为何,有人说C函数ans那里爆int了,改了之后也没什么用. #inclu ...

  10. 12、mysql补充

    本篇导航: 视图 触发器 事务 存储过程 函数 流程控制 一.视图 视图是一个虚拟表(非真实存在),其本质是[根据SQL语句获取动态的数据集,并为其命名],用户使用时只需使用[名称]即可获取结果集,可 ...