1、maven安装

首先下载apache-maven-3.3.3-bin.zip(版本可以自己根据自己想要的下载)。

解压后如下:

  

 接下来配置系统环境变量:

   

 

到此,maven安装好了,接下来输入 mvn -v查看maven是否安装成功。

  

2、settings.xml文件与实际项目中pom.xml文件配置的关联讲解

   在settings.xml文件中

   //这是本地仓库路径,管理本地的jar包

  <localRepository>D:\SPOC\repository</localRepository>

     //这是访问私服的账户配置 

  <servers>
    <server>
      <id>nexus-releases</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
    <server>
      <id>nexus-snapshots</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
  </servers>

  

<profiles>
<profile>
<id>lifeng</id>

<activation>
<activeByDefault>false</activeByDefault>
<!-- 我这里采用的是JDK1.8,请根据自己本地的版本配置相应的参数 -->
<jdk>1.8</jdk>
</activation>

<repositories>
<!--私有库地址-->
<repository>
<id>nexus</id>
<url>http://localhost:8081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!--插件库地址-->
<pluginRepository>
<id>nexus</id>
<url>http://localhost:8081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>

</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

 3、接下来主要说一下项目中pom.xml文件的配置:

  <distributionManagement>

    <repository>
      <id>releases</id>
      <name>Nexus Release Repository</name>
      <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
    <id>snapshots</id>
    <name>Nexus Snapshot Repository</name>
    <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  此配置中的两个id标签名称需要与settings.xml文件中<servers>标签中的两个id标签名称对应一致,因为这是对应登录私服的账户,否则在把maven工程打成jar包的过程中会失败。并且通过此配置可以把工程打成jar包后对应的发布到私服中。

4、maven工程打jar包

 右键工程---->run as ----> run configurations

  然后选择 maven build, 右键-->新建  

  

 点击Beswse Workspace选择需要打包的maven工程,  在Golas 中输入  clean install deploy ,

然后点击apply应用,最后点击run进行运行。成功后就会把此jar包打到私服中去。

maven快速上手的更多相关文章

  1. 第二篇、Maven快速上手

    1.目标 该篇主要是为了快速利用maven来构建工程,maven作为项目管理的工具已经得到极大程度的应用,很多开源项目都用maven来构建.如何建立 一个maven工程,如何导入别人的maven工程, ...

  2. Eclipse利用Maven快速上手搭建MyBatis

    一.what is maven? Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的项目管理工具软件. Maven 除了以程序构建能力为特色之外,还提供高级项目管理 ...

  3. Gradle快速上手——从Maven到Gradle

    [本文写作于2018年7月5日] 本文适合于有一定Maven应用基础,想快速上手Gradle的读者. 背景 Maven.Gradle都是著名的依赖管理及自动构建工具.提到依赖管理与自动构建,其重要性在 ...

  4. Spring Boot 揭秘与实战(一) 快速上手

    文章目录 1. 简介 1.1. 什么是Spring Boot 1.2. 为什么选择Spring Boot 2. 相关知识 2.1. Spring Boot的spring-boot-starter 2. ...

  5. [Apache Pulsar] 企业级分布式消息系统-Pulsar快速上手

    Pulsar快速上手 前言 如果你还不了解Pulsar消息系统,可以先看上一篇文章 企业级分布式消息系统-Pulsar入门基础 Pulsar客户端支持多个语言,包括Java,Go,Pytho和C++, ...

  6. Spring Cloud Gateway 服务网关快速上手

    Spring Cloud Gateway 服务网关 API 主流网关有NGINX.ZUUL.Spring Cloud Gateway.Linkerd等:Spring Cloud Gateway构建于 ...

  7. 三分钟快速上手TensorFlow 2.0 (下)——模型的部署 、大规模训练、加速

    前文:三分钟快速上手TensorFlow 2.0 (中)——常用模块和模型的部署 TensorFlow 模型导出 使用 SavedModel 完整导出模型 不仅包含参数的权值,还包含计算的流程(即计算 ...

  8. Github Action 快速上手指南

    前言 各位读者,新年快乐,我是过了年匆忙赶回上海努力搬砖的蛮三刀. Github之前更新了一个Action功能(应该是很久以前了),可以实现很多自动化操作.用来替代用户自己设置的自动化脚本(比如:钩子 ...

  9. springcloud - alibaba快速上手 - 更新完毕

    1.简单对比一下springcloud与springcloud-alibaba 2.准备知识 官网:https://nacos.io/zh-cn/ 查看cloud和springboot的对应关系 ht ...

随机推荐

  1. 去除MyEclipse频繁弹出的Update Progress窗口

    方法1: 1.关闭updating index Window => Preferences => Myeclipse Enterprise Workbench => Maven4My ...

  2. Laravel踩坑笔记——illuminate/html被抛弃

    起因 在使用如下代码的时候发生报错 {!! Form::open() !!} 错误信息 [Symfony\Component\Debug\Exception\FatalErrorException] ...

  3. WCF学习——构建一个简单的WCF应用(一)

    本文的WCF服务应用功能很简单,却涵盖了一个完整WCF应用的基本结构.希望本文能对那些准备开始学习WCF的初学者提供一些帮助. 在这个例子中,我们将实现一个简单的计算器和传统的分布式通信框架一样,WC ...

  4. 二分图最小路径覆盖--poj2060 Taxi Cab Scheme

    Taxi Cab Scheme 时间限制: 1 Sec  内存限制: 64 MB 题目描述 Running a taxi station is not all that simple. Apart f ...

  5. 安装旧版的docker-engine-1.12.6

    执行kubeadm init --api-advertise-addresses=172.16.160.211命令的时候,提示docker版本太新了 想要安装旧版docker,可以使用以下方法: yu ...

  6. UE4 difference between servertravel and openlevel(多人游戏的关卡切换)

    多人游戏的关卡切换分为无缝和非无缝.非无缝切换时,客户端将跟服务器断开连接,然后重新连接到同一个服务器,服务器则加载一个新地图.无缝切换不会发生这样的情况. 有三个函数供我们使用:UEngine::B ...

  7. 针对Oracle数据库表中的数据的常见操作

    1.查询表中所有数据 select * from 表名; 例:select * from stu; 2.查询的同时修改表中数据 select * from 表名  for update; 例:sele ...

  8. CentOS下安装php的mbstring扩展

    php的mbstring扩展如果没有安装会导致一些问题: 例1:登陆phpMyAdmin的时候会提示没字符串编码和字符串处理库 php_mbstring,有些程序中会用到mb_substr函数没有ph ...

  9. Linux下pecl命令无法执行的解决

    pecl install swoole 提示如下错误:bash: pecl: command not found执行yum install php-pear生效

  10. [leetcode-572-Subtree of Another Tree]

    Given two non-empty binary trees s and t, check whether tree t hasexactly the same structure and nod ...