maven nexus archetype

来源:互联网 发布:ip广播的网络设置 编辑:程序博客网 时间:2024/06/06 00:17
项目环境是eclipse加上m2eclipse插件 

1.配置好maven\conf目录下settings.xml文件的<servers>段,如 
01<servers>
02    <server>
03        <id>snapshots</id>
04        <username>admin</username>
05        <password>admin123</password>
06    </server>
07        <server>
08        <id>release</id>
09        <username>admin</username>
10        <password>admin123</password>
11    </server>
12</servers>

具体参考相关文章 

2.在要生成archetype项目上点右键,运行方式->Maven clean,清理一下项目 

3.点击Maven build...,在goal栏填写archetype:create-from-project,并运行 

4.生成成功后,打开项目目录下的target\generated-sources\archetype\pom.xml文件,加入 
01<distributionManagement>
02    <snapshotRepository>
03        <id>snapshots</id>
04        <url>http://localhost:8081/nexus/content/repositories/snapshots</url>
05    </snapshotRepository>
06</distributionManagement>
07<distributionManagement>
08    <snapshotRepository>
09        <id>release</id>
10        <url>http://localhost:8081/nexus/content/repositories/release</url>
11    </snapshotRepository>
12</distributionManagement>

具体参考相关文章 

5.打开系统控制台,进入项目目录下的target\generated-sources\archetype\,运行mvn deploy 

提示build success的话,你的archetype就上传到服务器了,默认的artifactId就是原来项目的artifactId加上-archetype 
0 0
原创粉丝点击