当你安装了m2eclipse后,就可以通过菜单【File】-【New】-【Project…】,选择其中的Maven-Maven Project,根据Maven提供的工程原型或模板archetype来生成简单的项目框架。
但如果你想生成struts2项目框架的话,则有可能找不到相应的archetype,我就是这种情况,如:
All Category
解决的方法是添加原型或模板目录,选择【Window】-【Preferences…】- 【Maven】-【archetypes】,选择【Add Remote Catalog…】按钮,在打开的窗口中输入如图所示内容:
Remote Catalogs
Catalog File:http://repo1.maven.org/maven2/archetype-catalog.xml
单击【Verify…】检验该文件是否可行,如上图所示,查找到archetypes的数量为2227个。
单击【OK】退出窗口。
重新New Project,Catalog选择Remote Catalog(上图添加catalogs时的Description),此时就有了struts2的archetype了:
Struts2-archetype-starter
m2eclipse加载remote archetype-catalog.xml时提示"Remote catalog is empty"
发现在添加remote地址时,m2eclipse插件(版本0.12.1)会出现 "Remote catalog is empty" 提示,导致找不到对应的工程模板
解决办法:
将archetype-catelog.xml保存到本地,然后在eclipse中添加为local catalog
或
直接运行命令
"mvn archetype:generate -DarchetypeCatalog="
下载工程,执行
mvn eclipse:eclipse
后,再手工导入eclipse
但如果你想生成struts2项目框架的话,则有可能找不到相应的archetype,我就是这种情况,如:
All Category
解决的方法是添加原型或模板目录,选择【Window】-【Preferences…】- 【Maven】-【archetypes】,选择【Add Remote Catalog…】按钮,在打开的窗口中输入如图所示内容:
Remote Catalogs
Catalog File:http://repo1.maven.org/maven2/archetype-catalog.xml
单击【Verify…】检验该文件是否可行,如上图所示,查找到archetypes的数量为2227个。
单击【OK】退出窗口。
重新New Project,Catalog选择Remote Catalog(上图添加catalogs时的Description),此时就有了struts2的archetype了:
Struts2-archetype-starter
m2eclipse加载remote archetype-catalog.xml时提示"Remote catalog is empty"
发现在添加remote地址时,m2eclipse插件(版本0.12.1)会出现 "Remote catalog is empty" 提示,导致找不到对应的工程模板
解决办法:
将archetype-catelog.xml保存到本地,然后在eclipse中添加为local catalog
或
直接运行命令
"mvn archetype:generate -DarchetypeCatalog="
下载工程,执行
mvn eclipse:eclipse
后,再手工导入eclipse