maven-通过maven命令创建maven项目
2016-04-10 17:50
225 查看
这里默认已经安装好了Maven工具。可以通过在cmd打开的命令提示符中运行mvn -v
查看安装的maven信息。
首先要注意mvn archetype:create 在maven3.0.X及以上版本运行时会报错所以最好运用 mvn archetype:generate 创建maven项目
错误信息类似以下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration
of mojo org.apache.maven.plugins:maven-archetype-plugin:2.4:create for parameter #: Cannot create instance of interface org.apache.maven.artifact.repository.ArtifactRepository -> [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]
mvn archetype:generate -DgroupId=包名 -DartifactId=项目名称 -DarchetypeArtifactId=maven-archetype-webapp
(如果是创建javaProject则是:mvn archetype:generate -DgroupId=包名 -DartifactId=项目名称 )
例如:
mvn archetype:generate -DgroupId=com.lyx -DartifactId=snatchWeb
-DarchetypeArtifactId=maven-archetype-webapp
过程中可能会让你选择你直接回车选择默认的选项就可以
当出现 BUILD SUCESS 表示maven项目创建成功了,你可以去项目所在的文件下在看是否存在。
这时 cd到该项目的项目名称下执行
mvn eclipse:eclipse 命令
这样就可以创建完成了。
查看安装的maven信息。
首先要注意mvn archetype:create 在maven3.0.X及以上版本运行时会报错所以最好运用 mvn archetype:generate 创建maven项目
错误信息类似以下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration
of mojo org.apache.maven.plugins:maven-archetype-plugin:2.4:create for parameter #: Cannot create instance of interface org.apache.maven.artifact.repository.ArtifactRepository -> [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]
第一步:创建web项目:
cd到希望项目存储的文件夹下,执行以下命令mvn archetype:generate -DgroupId=包名 -DartifactId=项目名称 -DarchetypeArtifactId=maven-archetype-webapp
(如果是创建javaProject则是:mvn archetype:generate -DgroupId=包名 -DartifactId=项目名称 )
例如:
mvn archetype:generate -DgroupId=com.lyx -DartifactId=snatchWeb
-DarchetypeArtifactId=maven-archetype-webapp
过程中可能会让你选择你直接回车选择默认的选项就可以
当出现 BUILD SUCESS 表示maven项目创建成功了,你可以去项目所在的文件下在看是否存在。
第二步:生成eclipse项目文件
如果需要导入到Eclispe编译器中还需要生成所需的.classpath和project文件这时 cd到该项目的项目名称下执行
mvn eclipse:eclipse 命令
这样就可以创建完成了。
相关文章推荐
- spring security:第一个程序
- Git 版本控制工具(学习笔记)
- 实现两个虚拟域内用户相互收发邮件
- 四则运算网页版
- js原型链
- 华为OJ平台练习题
- 几种常见的窗函数
- 进程间通信 - 命名管道实现
- 仿iOS底部弹出popUpWindow
- 关于jsp乱码的一点小分析
- 内核弹窗
- 线程相关——HandlerThread、IntentService、ResultReceiver:结果接收者、AsyncTask:异步任务、Android中处理线程间通信的方式
- EF下CodeFirst、DBFirst与ModelFirst分析
- 20145326 《Java程序设计》实验一实验报告
- leetcode 100. Same Tree
- linux使用未解决问题
- HDU-5662 YJQQQAQ and the function (枚举&&单调栈)
- Android技术积累:开发规范
- 开发检测MySQL主从同步插件
- JS项目