详解idea maven nexus 常见命令配置
作者:dawang. 发布时间:2021-06-07 18:29:03
标签:idea,maven,nexus,命令
maven 常见命令配置
maven常用命令
#创建项目 -D设置参数
mvn archetype:generate -DgroupId=cn.dwcode -DartifactId=dw.test.biz -Dversion=1.0.0
#创建项目 -B批处理模式构建项目
mvn archetype:generate -B -DgroupId=cn.dwcode -DartifactId=dw.test.biz -Dversion=1.0.0
mvn clean
mvn compile
mvn test
mvn package
mvn install
#-e详细异常 -U强制更新
mvn compile -e -U
#-P按配置打包 dev test pro 对于pom profiles
mvn package -P dev
#跳过测试 但是会编译test
mvn package -DskipTests
#跳过测试 并且会编译test
mvn package -Dmaven.test.skip=true
注意:如果命令执行失败需要制定jdk版本
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<java.version>1.8</java.version>
</properties>
settings.xml
maven localRepository
<!--设置本地仓库 -->
<localRepository>D:\maven\repository</localRepository>
maven mirrors
<!--设置maven远程仓库-->
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
maven profiles
<!--设置maven配置,选择设置不同的远程仓库-->
<profiles>
<!-- 可按profile设置私有仓库 -->
<profile>
<!-- id必须唯一 -->
<id>nexus-repository-public</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>public</id>
<!-- 仓库的url地址 -->
<url>http://192.168.72.130:8081/repository/maven-public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
maven servers
设置maven deploy推送账号密码
<!--配置服务端的一些设置。一些设置如安全证书不应该和pom.xml一起分发。这种类型的信息应该存在于构建服务器上的settings.xml文件中。-->
<servers>
<!--设置maven deploy推送账号密码 -->
<server>
<!--id与distributionManagement中repository元素的id相匹配。-->
<id>nexus-releases</id>
<!--鉴权用户名。鉴权用户名和鉴权密码表示服务器认证所需要的登录名和密码。 -->
<username>admin</username>
<!--鉴权密码 。鉴权用户名和鉴权密码表示服务器认证所需要的登录名和密码。密码加密功能已被添加到2.1.0 +。详情请访问密码加密页面-->
<password>123456</password>
</server>
</servers>
maven 完整配置
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 默认的值是${user.home}/.m2/repository -->
<localRepository>D:\maven\repository</localRepository>
<!-- 如果Maven要试图与用户交互来得到输入就设置为true,否则就设置为false,默认为true。 -->
<interactiveMode>true</interactiveMode>
<!-- 如果Maven使用${user.home}/.m2/plugin-registry.xml来管理plugin的版本,就设置为true,默认为false。 -->
<usePluginRegistry>false</usePluginRegistry>
<!-- 如果构建系统要在离线模式下工作,设置为true,默认为false。 如果构建服务器因为网络故障或者安全问题不能与远程仓库相连,那么这个设置是非常有用的。 -->
<offline>false</offline>
<!--maven全局仓库 -->
<mirrors>
<!-- <mirror>
<id>nexus-public</id>
<mirrorOf>central</mirrorOf>
<name>NexusLocal</name>
<url>http://192.168.72.130:8081/repository/maven-public</url>
</mirror> -->
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
<!-- settings.xml中的profile是pom.xml中的profile的简洁形式。 它包含了激活(activation),仓库(repositories),插件仓库(pluginRepositories)和属性(properties)元素。
profile元素仅包含这四个元素是因为他们涉及到整个的构建系统,而不是个别的POM配置。 如果settings中的profile被激活,那么它的值将重载POM或者profiles.xml中的任何相等ID的profiles。 -->
<profiles>
<!-- 可按profile设置私有仓库 -->
<profile>
<!-- id必须唯一 -->
<id>nexus-repository-public</id>
<repositories>
<repository>
<!-- id必须唯一 -->
<id>public</id>
<!-- 仓库的url地址 -->
<url>http://192.168.72.130:8081/repository/maven-public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<!-- id必须唯一 -->
<id>aliyun-repository-public</id>
<repositories>
<repository>
<id>public</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!-- activations是profile的关键,就像POM中的profiles,profile的能力在于它在特定情况下可以修改一些值。
而这些情况是通过activation来指定的。 -->
<!-- <activeProfiles/> -->
<!--配置服务端的一些设置。一些设置如安全证书不应该和pom.xml一起分发。这种类型的信息应该存在于构建服务器上的settings.xml文件中。-->
<servers>
<!--设置maven deploy推送账号密码 -->
<server>
<!--id与distributionManagement中repository元素的id相匹配。-->
<id>nexus-releases</id>
<!--鉴权用户名。鉴权用户名和鉴权密码表示服务器认证所需要的登录名和密码。 -->
<username>admin</username>
<!--鉴权密码 。鉴权用户名和鉴权密码表示服务器认证所需要的登录名和密码。密码加密功能已被添加到2.1.0 +。详情请访问密码加密页面-->
<password>123456</password>
</server>
</servers>
</settings>
idea常见配置
idea maven 配置
idea 刷新jar
idea 跳过测试
idea deploy配置
需要配置maven servers
pom.xml
<!--设置maven deploy仓库-->
<distributionManagement>
<repository>
<id>nexus-releases</id>
<url>http://192.168.72.130:8081/repository/maven-releases</url>
</repository>
</distributionManagement>
<build>
<plugins>
<!-- 要将源码放上去,需要加入这个插件 -->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
idea profile选择
idea 获取jar循序
nexus 常见配置
nexus部署
#创建nexus数据目录
mkdir -p /usr/local/work/nexus-data && chown -R 200 /usr/local/work/nexus-data
#运行模型
docker run -d \
-p 8081:8081 \
--name nexus \
-v /usr/local/work/nexus-data:/nexus-data \
sonatype/nexus3:3.19.1
#获取初始密码
echo `docker exec nexus cat /nexus-data/admin.password`
登录:http://127.0.0.1:8081/
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yqXWZGBw-1618752330380)(idea_maven_nexus常见命令配置.assets\image-20210418211114096.png)]
nexus添加阿里云代理
阿里云配置:https://maven.aliyun.com/mvn/guide
nexus修改可更新
来源:https://blog.csdn.net/tiancxz/article/details/115836928
0
投稿
猜你喜欢
- 1. maven插件介绍springboot应用通过maven插件appassembler-maven-plugi生成启动脚本bat和sh。
- 本文实例讲述了Android中TextView显示插入的图片实现方法。分享给大家供大家参考,具体如下:Android系统默认给TextVie
- 前言最近一直被无尽的业务需求淹没,没时间喘息,终于接到一个能让我突破代码舒适区的活儿,解决它的过程非常曲折,一度让我怀疑人生,不过收获也很大
- springboot项目没有mainClass实现打包运行项目分为两个部分,一个是业务代码模块,一个是框架模块,运行class放在框架部分,
- 基本操作import org.apache.hadoop.conf.Configuration;import org.apache.hado
- 实体对象之间相互传值,如:VO对象的值赋给Entity对象,是代码中常用功能,如果通过get、set相互赋值,则很麻烦,借助工具类BeanU
- MyBatis是一个优秀的持久层框架,它对jdbc的操作数据库的过程进行封装,使开发者只需要关注SQL本身,而不需要花费精力去处理例如注册驱
- 1.char数组(字符数组)->字符串可以通过:使用String.copyValueOf(charArray)函数实现。举例:char
- 本文实例为大家分享了Android自定义textview实现跑马灯效果的具体代码,供大家参考,具体内容如下xml布局<?xml ver
- 单链表:insertFirst:在表头插入一个新的链接点,时间复杂度为O(1)deleteFirst:删除表头的链接点,时间复杂度为O(1)
- 今天提交代码的时候突然发现IDEA的SVN面板Version Control下面多出来这么一句话:顿时心里咯噔一下,这肯定不是好事啊。果然,
- 本文介绍了使用C#创建Windows服务的实例代码,分享给大家一、开发环境操作系统:Windows 10 X64开发环境:VS2015编程语
- 前言:回顾之前的微信公众号配置和消息处理的内容,我们已经掌握了如何配置服务器与微信公众号建立连接,也掌握了通过消息管理的方式,对用户的信息进
- 先看一段同步代码:public int SumPageSizes(IList<Uri> uris) {
- 背景在使用Spring Boot Mvc的项目中,使用Long类型作为id的类型,但是当前端使用Number类型接收Long类型数据时,由于
- 背景我们平时在用springboot开发时,要使用事务,只需要在方法上添加@Transaction注解即可,但这种方式只适用单数据源,在多数
- 我们知道hibernate的核心就是对数据库的操作,里面的核心接口就是org.hibernate.Session接口。要想对数据库操作我们就
- 可能我们用惯了 Newtonsoft.Json.dll 等第三方的类库来实现序列化等类似的操作,但是有时只是简单的用一下,感觉没必要那么费事
- Android的一个核心特性就是一个应用程序可作为其他应用程序中的元素,可为其他应用程序提供数据。例如,如果程序需要用某些控件来加载一些图片
- 所需引入Jar包:jms-1.1.jaractivemq-all-5.15.0.jar生产者package com.mousewheel.d