mvn:deploy在整合或者发布环境下执行,将最终版本的包拷贝到远程的repository,使得其他的开发者或者工程可以共享。
一 配置settings.xml
因为nexus是需要登陆操作,当然可以通过配置免登陆,这是后话。
在settings.xml的<servers></servers>
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
当然如果你要上传包去其他仓库,可依照此例,如
<server>
<id>central</id>
<username>admin</username>
<password>admin123</password>
</server>
如果进行deploy时返回Return code is: 401错误,则需要进行用户验证或者你已经验证的信息有误。
二 cmd输入命令
mvn deploy:deploy-file -DgroupId=com.xy.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=E:\ojdbc14.jar -Durl=http://localhost:9090/nexus-2.2-01/content/repositories/thirdparty/ -DrepositoryId=thirdparty
DgroupId和DartifactId构成了该jar包在pom.xml的坐标,项目就是依靠这两个属性定位。自己起名字也行。
Dfile表示需要上传的jar包的绝对路径。
Durl 私服上仓库的位置,打开nexus——>repositories菜单,可以看到该路径。
url中也可以指定用户名、密码。格式:http://<username>:<password>@localhost:9200/nexus-2.2-01/content/repositories/thirdparty/
DrepositoryId 对应maven配置文件setting.xml中server标签的id
如果url中没有指定用户名、密码,需要指定repositoryId
Dversion表示版本信息,怎样得到一个jar包准确的版本呢?
解压该包,会发现一个叫MANIFEST.MF的文件,这个文件就有描述该包的版本信息。
比如Manifest-Version: 1.0可以知道该包的版本了。
上传成功后,在nexus界面点击3rd party仓库可以看到这包。
三、mvn deploy命令参数说明
mvn deploy:help -Ddetail=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.7:help (default-cli) @ standalone-pom ---
[INFO] org.apache.maven.plugins:maven-deploy-plugin:2.7
Maven Deploy Plugin
Uploads the project artifacts to the internal remote repository.
This plugin has 3 goals:
deploy:deploy
Deploys an artifact to remote repository.
Available parameters:
altDeploymentRepository
Specifies an alternative repository to which the project artifacts should
be deployed ( other than those specified in <distributionManagement> ).
Format: id::layout::url
Expression: ${altDeploymentRepository}
retryFailedDeploymentCount (Default: 1)
Parameter used to control how many times a failed deployment will be
retried before giving up and failing. If a value outside the range 1-10 is
specified it will be pulled to the nearest value within the range 1-10.
Expression: ${retryFailedDeploymentCount}
skip (Default: false)
Set this to 'true' to bypass artifact deploy
Expression: ${maven.deploy.skip}
updateReleaseInfo (Default: false)
Parameter used to update the metadata to make the artifact as release.
Expression: ${updateReleaseInfo}
deploy:deploy-file
Installs the artifact in the remote repository.
Available parameters:
artifactId
ArtifactId of the artifact to be deployed. Retrieved from POM file if
specified.
Expression: ${artifactId}
classifier
Add classifier to the artifact
Expression: ${classifier}
classifiers
A comma separated list of classifiers for each of the extra side artifacts
to deploy. If there is a mis-match in the number of entries in files or
types, then an error will be raised.
Expression: ${classifiers}
description
Description passed to a generated POM file (in case of generatePom=true)
Expression: ${generatePom.description}
file
File to be deployed.
Required: Yes
Expression: ${file}
files
A comma separated list of files for each of the extra side artifacts to
deploy. If there is a mis-match in the number of entries in types or
classifiers, then an error will be raised.
Expression: ${files}
generatePom (Default: true)
Upload a POM for this artifact. Will generate a default POM if none is
supplied with the pomFile argument.
Expression: ${generatePom}
groupId
GroupId of the artifact to be deployed. Retrieved from POM file if
specified.
Expression: ${groupId}
javadoc
The bundled API docs for the artifact.
Expression: ${javadoc}
packaging
Type of the artifact to be deployed. Retrieved from the <packaging>
element of the POM file if a POM file specified. Defaults to the file
extension if it is not specified via command line or POM.
Maven uses two terms to refer to this datum: the <packaging> element for
the entire POM, and the <type> element in a dependency specification.
Expression: ${packaging}
pomFile
Location of an existing POM file to be deployed alongside the main
artifact, given by the ${file} parameter.
Expression: ${pomFile}
repositoryId (Default: remote-repository)
Server Id to map on the <id> under <server> section of settings.xml In
most cases, this parameter will be required for authentication.
Required: Yes
Expression: ${repositoryId}
repositoryLayout (Default: default)
The type of remote repository layout to deploy to. Try legacy for a Maven
1.x-style repository layout.
Expression: ${repositoryLayout}
retryFailedDeploymentCount (Default: 1)
Parameter used to control how many times a failed deployment will be
retried before giving up and failing. If a value outside the range 1-10 is
specified it will be pulled to the nearest value within the range 1-10.
Expression: ${retryFailedDeploymentCount}
sources
The bundled sources for the artifact.
Expression: ${sources}
types
A comma separated list of types for each of the extra side artifacts to
deploy. If there is a mis-match in the number of entries in files or
classifiers, then an error will be raised.
Expression: ${types}
uniqueVersion (Default: true)
Whether to deploy snapshots with a unique version or not.
Expression: ${uniqueVersion}
updateReleaseInfo (Default: false)
Parameter used to update the metadata to make the artifact as release.
Expression: ${updateReleaseInfo}
url
URL where the artifact will be deployed.
ie ( file:///C:/m2-repo or scp://host.com/path/to/repo )
Required: Yes
Expression: ${url}
version
Version of the artifact to be deployed. Retrieved from POM file if
specified.
Expression: ${version}
deploy:help
Display help information on maven-deploy-plugin.
Call
mvn deploy:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.
Available parameters:
detail (Default: false)
If true, display all settable properties for each goal.
Expression: ${detail}
goal
The name of the goal for which to show help. If unspecified, all goals
will be displayed.
Expression: ${goal}
indentSize (Default: 2)
The number of spaces per indentation level, should be positive.
Expression: ${indentSize}
lineLength (Default: 80)
The maximum length of a display line, should be positive.
Expression: ${lineLength}
相关推荐
标题提到的“maven deploy时报错”通常指的是在尝试使用Maven的`deploy`生命周期阶段将构建的工件上传到远程仓库时遇到的问题。描述中的日志显示了具体的错误信息,指出“repository element was not specified in ...
55links友情链接网址跟踪器,放在桌面,每次直接打开就可以访问55links友情链接交易平台,方便快捷。
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
moore_01_0909
FIBR English learning
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
OIF_IEEE802.3_liaison_19OCt09
做网络安全FTP内容的实验必备
nagarajan_01_1107
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
mellitz_3cd_01_0318
PyQt6实战派 配套代码
陕西省省级非物质文化遗产经纬度数据统计表 统计内容包含以下字段: 1. 项目名称 2. 遗产类别 3. 入选批次 4. 所属地区 5. 申报地区/单位 6. 地理经度 7. 地理纬度 该统计表系统记录了陕西省省级非物质文化遗产的地理空间信息,为文化遗产的数字化保护与研究工作提供了重要的数据支撑。
ran_3ck_02a_0918
毕业设计_基于springboot+vue开发的汽车租赁管理系统【源码+sql+可运行】【50308】.zip 全部代码均可运行,亲测可用,尽我所能,为你服务; 1.代码压缩包内容 代码:springboo后端代码+vue前端页面代码; 脚本:数据库SQL脚本 效果图:运行结果请看资源详情效果图 2.环境准备: - JDK1.8+ - maven3.6+ - nodejs14+ - mysql5.6+ - redis 3.技术栈 - 后台:springboot+mybatisPlus+Shiro - 前台:vue+iview+Vuex+Axios - 开发工具: idea、navicate 4.功能列表 - 系统设置:用户管理、角色管理、资源管理、系统日志 - 业务管理:汽车管理、客户管理、租赁订单 3.运行步骤: 步骤一:修改数据库连接信息(ip、port修改) 步骤二:找到启动类xxxApplication启动 4.若不会,可私信博主!!!
# Runcorder - 跑步训练管理系统 Runcorder 是一款专为跑步爱好者、马拉松运动员及高校体育生设计的本地化跑步训练管理工具,基于 Python 开发,结合 Tkinter 图形界面与强大的数据处理能力,为用户提供从训练记录到数据分析的全方位支持。无论是初学者还是专业跑者,Runcorder 都能帮助你科学规划训练、精准追踪进度,并通过可视化图表直观呈现训练成果,让你的跑步训练更智能、更高效! - **多用户管理**:支持创建、加载和删除用户档案,每个用户的数据独立存储,确保隐私与安全。 - **科学训练记录**:全维度记录跑步数据,包括日期、里程、配速、自评和晨跑标记,支持智能输入校验,避免数据错误。 - **多维数据分析**:通过动态可视化图表展示跑步里程趋势、平均配速曲线,支持自定义 Y 轴范围,帮助用户深入理解训练效果。 - **高阶功能**:提供 4 种科学训练模式(有氧/无氧/混合),支持历史记录修改与删除,数据以 JSON 格式持久化存储,跨平台兼容。
paatzsch_01_0708
AnythingLLM是一个全栈应用程序,您可以使用流行的开源大语言模型,再结合向量数据库解决方案构建个人本地AI大模型知识库
mellitz_3ck_02_0519
petrilla_01_0708