1. 首先在windows 或者在Linux服务器中安装并运行nexus私服。

2. 使用私服就是将项目jar 上传到私服中,提供给别的项目使用,那么就需要在项目中和maven的配置文件中配置文件

3. 项目中配置私服的仓库地址

 <distributionManagement><repository><id>maven-releases</id><name>Nexus Release Repository</name><url>http://192.168.121.131:8081/repository/maven-releases/</url></repository><snapshotRepository><id>maven-snapshots</id><name>Nexus Snapshot Repository</name><url>http://192.168.121.131:8081/repository/snapshots/</url></snapshotRepository></distributionManagement>

4. 在本地的maven settings 配置文件需要配置如下:

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:||  1. User Level. This settings.xml file provides configuration for a single user,|                 and is normally provided in ${user.home}/.m2/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -s /path/to/user/settings.xml||  2. Global Level. This settings.xml file provides configuration for all Maven|                 users on a machine (assuming they're all using the same Maven|                 installation). It's normally provided in|                 ${maven.conf}/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"><localRepository>D:\java\nexus_repository</localRepository><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><server><id>maven-public</id><username>admin</username><password>admin</password></server><server><id>maven-releases</id><username>admin</username><password>admin</password></server><server><id>maven-snapshots</id><username>admin</username><password>admin</password></server></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.|| It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred| server for that repository.|--><mirrors><mirror><id>nexus</id><name>nexus</name><mirrorOf>local</mirrorOf><url>http://192.168.121.131:8083/repository/maven-public/</url></mirror><mirror><id>alimaven</id><mirrorOf>central</mirrorOf><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url></mirror></mirrors><!-- profiles| This is a list of profiles which can be activated in a variety of ways, and which can modify| the build process. Profiles provided in the settings.xml are intended to provide local machine-| specific paths and repository locations which allow the build to work in the local environment.|| For example, if you have an integration testing plugin - like cactus - that needs to know where| your Tomcat instance is installed, you can provide a variable here such that the variable is| dereferenced during the build process to configure the cactus plugin.|| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles| section of this document (settings.xml) - will be discussed later. Another way essentially| relies on the detection of a system property, either matching a particular value for the property,| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.| Finally, the list of active profiles can be specified directly from the command line.|| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact|       repositories, plugin repositories, and free-form properties to be used as configuration|       variables for plugins in the POM.||--><profiles><profile><id>nexus</id><repositories><repository><id>nexus</id><url>http://192.168.121.131:8081/nexus/content/groups/public</url><releases><enabled>true</enabled></releases></repository><repository><id>nexus-aliyun</id><url>http://maven.aliyun.com/nexus/content/groups/public</url><releases><enabled>true</enabled></releases></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>http://maven.aliyun.com/nexus/content/groups/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

注意: 项目中的pom文件配置的仓库ID要和maven settings 中 server 标签中的仓库id对应。

然后直接使用maven的deploy插件直接将项目jar包推到私服仓库中。

补充:

如果需要将jar的source 一并推到私服,需要在pom中的plugin标签下添加如下配置:

            <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>

再次deploy的时候,就会将source一起打包上传到私服中去了,也方便引用方查看源码注释

maven项目配置私服相关推荐

  1. Maven项目配置EL表达式原样输出解决方法

    Maven项目配置EL表达式原样输出解决方法 参考文章: (1)Maven项目配置EL表达式原样输出解决方法 (2)https://www.cnblogs.com/d191/p/11689610.ht ...

  2. 项目jetty服务器,maven项目配置Jetty服务器

    org.mortbay.jetty jetty-maven-plugin 8.1.7.v20120910 5 /bfc-loms 8080 500000 主要在maven的pom.xml里增加如上配置 ...

  3. Maven项目配置镜像地址

    ##Maven项目配置镜像地址 对于一些刚接触Maven项目的同学来说是否和我有过一样的烦恼,为啥新建一个maven项目这么慢!!! 话不多说 首先找到安装Maven的路径 找到setting.xml ...

  4. 配置maven仓库 手写maven项目 配置maven打包

    配置maven仓库 手写maven项目 配置maven打包 操作录像 maven环境变量 maven仓库 maven标准pom.xml maven打包插件 附录:FreeBSD默认环境变量 操作录像 ...

  5. Maven项目配置Tomcat

    文章目录 Maven项目配置Tomcat idea开发工具配置 1. 创建Maven项目 2. web.xml 3. index.jsp 4. 配置Maven项目 5. 配置Tomcat 6. 启动T ...

  6. Maven项目配置、检出、运行

    副标题:JDK安装到Maven运行 关键字:JDK + SVN + Maven + Tomcat + Eclipse + IDEA 一.JDK 1.JDK包 JDK包 ../Java/jdk1.8   ...

  7. IDEA 导入旧(带WebRoot目录)的非MAVEN项目配置教程

    公司因为业务需求要维护一批老项目,可老项目的目录结构是带WEBROOT目录的,而且也不是Maven项目,公司的前辈都建议用MyEclipse或者Eclipse启动,但是本人还是习惯于用IDEA开发,于 ...

  8. IDEA将maven项目配置到本地tomcat中运行

    想写个 WebSocket的简单应用,但是maven的jetty或tomcat的插件,不支持WebSocket.想办法把它配置到下载的tomcat中运行.. 1. Run->Edit Confi ...

  9. maven项目配置阿里云镜像下载jar包

    Apache Maven 是新一代的项目构建工具.其特有的pom文件管理jar包的配置,让你从繁琐的jar包中解脱出来,只要联网,根据配置的文件,maven会自动从互联网下载jar包,但是开发的伙伴经 ...

  10. java maven项目配置windows环境并换源

    前言 Maven 是一个项目管理工具,它包含了一个项目对象模型(Project Object Model),反映在配置中,就是一个 pom.xml 文件.是一组标准集合,一个项目的生命周期.一个依赖管 ...

最新文章

  1. Spring 面试问题 TOP 50
  2. Linux_SquidProxyServer代理服务器
  3. 推荐系统的十个关键点
  4. 在wsl下运行c语言,在Windows10通过WSL架设linux/gcc c语言学习环境
  5. 20温控f1什么意思_欧姆龙温控器是什么 欧姆龙温控器介绍【图文】
  6. 算法学习入门书籍 -- 2022.02.13
  7. 如何在django项目中使用django-ckeditor
  8. wcf 返回图片_WCF图片上传
  9. SQL.H 通过此文件寻找sqlAPI编程的一种捷径
  10. linkedin客户开发_10个LinkedIn WordPress插件赢得新客户
  11. 手机能打开的表白代码_不是程序员都能学会的5个表白代码,一学就会,附源码...
  12. 中国互联网变天,小米上市后将彻底冲破 BAT 格局
  13. 【论文阅读】深度学习与多种机器学习方法在不同的药物发现数据集进行对比
  14. 通用软件产品的漏洞数量排名
  15. 2019西安交大计算机专业研究生分数线,西安交通大学2019年考研分数线公布
  16. Java基础恶补系列
  17. iOS App thinning【( 通过 LinkMap、mach-o寻找优化点)】1、段迁移rename_section减小__TEXT 段大小(需关闭 Bitcode)2、查无用方法/类/宏/图
  18. 多多视频如何快速涨粉(赚钱变现)
  19. 基于PHP+MySQL托管中心管理系统的设计与实现#计算机毕设
  20. 虽然Orbit被砍掉了,还是可以窥见一斑

热门文章

  1. 02web前端笔试题
  2. JavaScript学习手册八:JS函数
  3. QTableView详细使用说明
  4. python手写数字识别实验报告_ANN MNIST手写数字识别总结
  5. py-faster-rcnn标注FDDB人脸便于其在FDDB上进行测试
  6. 中国AR镜片市场现状研究分析与发展前景预测报告(2022)
  7. 技术人生:恶补基础知识
  8. geometry 矢量数据操作
  9. Java中常用到的英语单词读音以及解释
  10. 【JAVA】初识Java