每个互联网公司都会有各种各样的项目,每个项目都需要项目经理或者专门人员先搭建基础框架,目前常规的都基础框架为spring+springMVC+Mybatis,模板技术常用的velocty,基础框架搭建都是固定不变的,不必每次都从头再次搭建,好了,进入主题,使用maven archetype快速生成基础框架代码,官网提供有很多已有的archetype,但是不是我们想要的,我们可以使用一个标准的项目作为模板生成archetype,之后新项目使用自定的archetype生成项目即可
方式1-指令生成(最简单的方式)
首先准备基础环境,windows下安装使用Maven?
进入已有的项目目录
指令:mvn clean archetype:create-from-project -X -Darchetype.filteredExtentions=java,xml,jsp,properties,sh
ok,在进入生成的相应目录下
这里也是一个maven项目
直接mvn install就可以在本地使用这个archetype了
部署到私服,首先修改生成的maven项目的pom.xml,增加部署地址,之后就可以在eclipse中是用该archetype了,如何使用?
pom.xml文件:
修改后:
添加的代码:
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8080/nexus/content/repositories/thirdparty</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8080/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
方式2-在eclipse下直接生成,待更新。。。