在项目开发中通常会引用其他的jar,怎样把自己的项目做为一个jar包的形式发布到私服仓库中,主要有以下三个步骤

(怎样配置maven私服仓库,就不再这里说明了,可以参考以前的文章)1.在maven的setting.xml中配置用户名和密码:

<servers>
<server>
<username>admin</username>
<password>admin123</password>
<id>nexus-release</id>
</server>
<server>
<username>admin</username>
<password>admin</password>
<id>nexus-snapshots</id>
</server>
</servers>
注意:要在nexus中打开相应的snapshots和releases仓库中的允许发布的开关 2.在发布的项目中配置pom.xml 

如果有parent只需在parent中的pom.xml中配置,没有则在本项目的pom.xml配置即可
<distributionManagement>
<repository>
<id>nexus-release</id>
<url>http://192.168.0.247/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://192.168.0.247/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement> <!--上传source.jar 非必须 -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

3.在依赖的项目添加依赖(注意版本是snapshot还是release)

snapshot版本还是release版本取决于发布项目中的配置

例如

<properties>
<!-- 依赖的版本定义 -->
<mes.version>0.0.1-RELEASE</mes.version>
</properties>
<dependencies>
<!-- 系统消息服务 -->
<dependency>
<groupId>com.longda.message</groupId>
<artifactId>mes-core</artifactId>
<version>${mes.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

</dependencies>

相应的待发布项目中配置如下

<modelVersion>4.0.0</modelVersion>
<groupId>com.longda.message</groupId>
<artifactId>mes-core</artifactId>
<version>0.0.1-RELEASE</version>
<packaging>jar</packaging>
<name>mes-core</name>
<url>http://maven.apache.org</url>
<properties>
<project.release.version>0.1-RELEASE</project.release.version>

</dependencies>

注意:简而言之就是两边的版本一定要对应上,至于是发布snapshot版本还是release版本需要在第二步中指定

版权声明:本文为博主原创文章,未经博主允许不得转载。

maven项目打包发布到私有仓库的更多相关文章

  1. maven学习(4)-本地项目打包发布到私有仓库

    发布本地项目到私服仓库 在前面章节有介绍maven发布本地jar包到私服仓库,这里详细介绍一下步骤. 在项目开发中通常会引用其他的jar,怎样把自己的项目做为一个jar包的形式发布到私服仓库中,主要有 ...

  2. Maven 项目打包发布

    在Eclipse左侧右击项目,Debug As -> Debug Configurations -> 双击Maven Build 然后看弹出框的右侧右侧的Name随便填写一个名字,Base ...

  3. maven项目打包发布时跳过测试

    mvn命令: mvn clean install -Dmaven.test.skip=true eclipse build... 命令: clean install -Dmaven.test.skip ...

  4. maven 项目打包到本地仓库并且推送到私服仓库

    首先进入到项目文件夹下,然后进入cmd命令窗口,第一步先clean一下,输入命令 mvn clean. 第二步打包到本地,输入命令mvn clean package -Dmaven.test.skip ...

  5. Storm系列(三):创建Maven项目打包提交wordcount到Storm集群

    在上一篇博客中,我们通过Storm.Net.Adapter创建了一个使用Csharp编写的Storm Topology - wordcount.本文将介绍如何编写Java端的程序以及如何发布到测试的S ...

  6. SpringBoot系列三:SpringBoot基本概念(统一父 pom 管理、SpringBoot 代码测试、启动注解分析、配置访问路径、使用内置对象、项目打包发布)

    声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.了解SpringBoot的基本概念 2.具体内容 在之前所建立的 SpringBoot 项目只是根据官方文档实现的一个基础程 ...

  7. maven 项目打包 及window下部署到tomcat

    1.maven项目打包 2.将war文件拷贝到tomcat目录webapps下(不要再建目录)3.将必要的jar文件拷贝到tomcat目录libx下 war包 或jar 包 会生成到项目所在路径 的t ...

  8. Java学习之道:Java项目打包发布

    Java项目打包发布 如果只想发布为一个可执行的jar包,使用eclipse的Export功能就可以了 使用eclipse的Export功能,将项目中的所有package打包为一个pet.jar文件, ...

  9. VS2010下创建的VB.NET项目打包发布安装包的流程

    VS2010下创建的VB.NET项目打包发布安装包的流程 参考:http://blog.csdn.net/liuyanlinglanq/article/details/8609675  关于relea ...

随机推荐

  1. Structs复习 命名空间

    引入jar包 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...

  2. 吴裕雄 16-MySQL UNION 操作符

    描述MySQL UNION 操作符用于连接两个以上的 SELECT 语句的结果组合到一个结果集合中.多个 SELECT 语句会删除重复的数据. 语法MySQL UNION 操作符语法格式:SELECT ...

  3. SSM综合练习

    CRM系统 CRM项目外观 1. 开发环境 IDE: Eclipse Neon Release (4.6.0) Jdk: 1.8 数据库: MySQL 2. 创建数据库 创建crm数据库,这里使用的是 ...

  4. Keil 报错汇总

    main.c(6): warning:  #1-D: last line of file ends without a newline 解决:main.c 最后一行加回车就可以了. keil中文注释出 ...

  5. java 开学第四周

    package english; import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException ...

  6. 2018面向对象程序设计(Java)第8周学习指导及要求

    2018面向对象程序设计(Java)第8周学习指导及要求 (2018.10.18-2018.10.21)   学习目标 掌握接口定义方法: 掌握实现接口类的定义要求: 掌握实现了接口类的使用要求: 理 ...

  7. new.target

    [new.target] The new.target property lets you detect whether a function or constructor was called us ...

  8. Java KeyNote

    [Java KeyNote] 1.把一个ArrayList拷贝到另一个ArrayList. ArrayList list1=new ArrayList(); ArrayList list2=new A ...

  9. Unity入门&物理引擎

    一.Unity六大模块 首先,Unity界面有六大模块,分别是:Hierarchy,Scene,Game,Inspector,Project,Console.下面对这六个视图的功能进行详解. 1.Hi ...

  10. SpringMVC包括哪些组件

      1 映射器 1.1作用:Handlermapping根据url查找Handler   2 适配器 2.1作用:HandlerAdapter执行Handler   3 解析器 3.1作用:View ...