maven搭建

为maven搭建
1、搭建maven对象有很多,如artifactory、Nexus等,我们以nexus为例,介绍maven搭建
2、nexus,http://nexus.sonatype.org/download-nexus.html,有war和zip两个可供选择,
war后须要安排到一个application server中,zip包自带jetty办事器,解压后自行启动
3、tar -zvxf nexus-oss-webapp-1.9.2.2-bundle.tar.gz,
cd nexus-oss-webapp-1.9.2.2
mv nexus-oss-webapp-1.9.2.2 nexus
cd /usr/local/nexus/bin/jsw/linux-x86-64
履行./nexus start,即可启动nexus
4、浏览器接见http://localhost:8081/nexus/index.html,正常打开ok,未登录时,只能显示Repositories一个菜单,用默认的admin/admin123登录,左侧显示所有菜单。默认景象下中已经后很多jar,我们可以手工添加一些jar.
5、选择Repositories-》3rdparty-》artifactsupload,该tab页下可以把我们本地的jar上传到仓库中,GAV Definition选择GAV Parameters,然后点击Select Artifact(s) to Upload..选择要上传的jar文件即可

以上过程就是全部搭建的过程,剩下就是我们怎么在maven中从本身搭建的中指定的jar包,以下省略maven本地的安装过程。
1、maven设备好后,凡是会在C:Documents and Settings当前用户名\.m2目次下有个setting.xml文件,若是没有,可以从maven安装路径下的conf目次拷贝,
2、在setting.xml文件的<profiles>标签中新加以下内容
<profile>
      <id>nexus</id>
      <repositories>
        <repository>
        <id>nexus</id>
            <name>215 private nexus</name>
            <url>http://地址:8081/nexus/content/groups/public</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
      
      </repositories>
      <pluginRepositories>
        <pluginRepository>
            <id>nexus</id>
            <name>local private nexus</name>
            <url>http://10.10.1.215:8081/nexus/content/groups/public</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>      
       </pluginRepositories>
    </profile> 
 
    <activeProfiles>
        <activeProfile>nexus</activeProfile>
  </activeProfiles>  

3、在我们项目中的pom.xml文件中添加依附的jar
   <dependency>
      <groupId>test_jar</groupId>
      <artifactId>test</artifactId>
      <version>1.3</version>
    </dependency>
完成以上步调就大功成功啦!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值