[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. python 条件与循环

    一.if语句   1.1 功能 计算机又被称作电脑,意指计算机可以像人脑一样,根据周围环境条件(即expession)的变化做出不同的反应(即执行代码) if语句就是来控制计算机实现这一功能   1. ...

  2. XamarinAndroid组件教程设置动画的设置插值器

    XamarinAndroid组件教程设置动画的设置插值器 为动画设置插值器,可以使用BaseItemAnimator抽象类中的SetInterpolator()方法,其语法形式如下: public v ...

  3. js获取form元素,不使用id

    <form method="post" name="form"> <input type="text" name=&quo ...

  4. Django之模板1

    Django模板 一.变量(只需要记住两种特殊符号) {{ }} 和{% %} {{ }}表示变量,在模板渲染的时候替换成值,变量名由字母数字和下划线组成. {% %}表示逻辑相关的操作. 点(.)在 ...

  5. VMware5.5-虚拟机的迁移和资源分配

    虚拟机的迁移 迁移:将虚拟机从一台主机(或数据存储)移到另一台主机(或数据存储). 迁移类型: 冷迁移 迁移处于关闭状态的虚拟机. 挂起 迁移处于挂起状态的虚拟机. vMotion 迁移处于开启状态的 ...

  6. 一个用SAM维护多个串的根号特技

    一个用SAM维护多个串的根号特技 基本介绍 在多个串的字符串题中,往往会出现一类题需要用到某个子串是否在一些母串中出现.此时对于 \(\text{parent}\) 树的 \(\text{right} ...

  7. [CTSC2017]吉夫特

    Description: 给定一个序列\(a_1,a_2,a_3...a_n\) 求有多少个不上升子序列: \(a_{b1},a_{b_2}...\) 满足 \(C_{a_{b1}}^{a_{b2}} ...

  8. c++中static变量有什么用

    主要有两点用途. 1.让一个变量长期有效,而不管其是在什么地方被申明.比如: int fun1() { static int s_value = 0; .... } 那么fun1不管在什么地方被调用, ...

  9. Docker安装管理界面portainer

    在Ubuntu或者Debian已经部署完毕Docker 拉取镜像文件: sudo docker pull docker.io/portainer/portainer Using default tag ...

  10. BZOJ4133 : Answer的排队

    设$f[i][j]$表示考虑前$i$个人,第$i$个人在前$i$个人中排名为$j$的方案数. 对于大小关系相同的一段,转移可以看成求$k$次前/后缀和,任意一项对另一项的贡献仅和其下标差值有关,FFT ...