您的位置:首页技术文章
文章详情页

详解idea maven nexus 常见命令配置

【字号: 日期:2024-07-17 18:42:36浏览:3作者:猪猪
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.0mvn cleanmvn compilemvn testmvn packagemvn install#-e详细异常 -U强制更新mvn compile -e -U #-P按配置打包 dev test pro 对于pom profilesmvn package -P dev#跳过测试 但是会编译testmvn package -DskipTests#跳过测试 并且会编译testmvn 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:mavenrepository</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:mavenrepository</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 maven nexus 常见命令配置

idea 刷新jar

详解idea maven nexus 常见命令配置

idea 跳过测试

详解idea maven nexus 常见命令配置

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 maven nexus 常见命令配置

idea profile选择

详解idea maven nexus 常见命令配置

idea 获取jar循序

详解idea maven nexus 常见命令配置

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常见命令配置.assetsimage-20210418211114096.png)]

nexus添加阿里云代理

阿里云配置:https://maven.aliyun.com/mvn/guide

详解idea maven nexus 常见命令配置

详解idea maven nexus 常见命令配置

详解idea maven nexus 常见命令配置

详解idea maven nexus 常见命令配置

nexus修改可更新

详解idea maven nexus 常见命令配置

到此这篇关于idea maven nexus 常见命令配置的文章就介绍到这了,更多相关idea maven nexus命令配置内容请搜索好吧啦网以前的文章或继续浏览下面的相关文章希望大家以后多多支持好吧啦网!

标签: IDEA
相关文章: