maven 自动发布更新本地和远程仓库
来源:互联网 发布:淘宝实拍保护怎么申请 编辑:程序博客网 时间:2024/06/08 02:47
$ mvn install -Dmaven.test.skip=true
mvn clean package deploy -Dmaven.test
.skip=true
- 本地仓库 的更新
- mvn clean package install
- mvn clean package install
- 远程 仓库 的更新
- mvn clean package deploy
- 工程文件pom.xml的设置
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven .plugins</groupId>
<artifactId>maven -compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<extensions>
<extension>
<groupId>org.apache.maven .wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-6</version>
</extension>
</extensions>
</build><repositories>
<repository>
<id>cdc-respository</id>
<name>cdc-respository</name>
<url>http://xxx.xxx.xxx.xx:8080/Maven 2Repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>cdc-plugin-respository</id>
<name>cdc-plugin-respository</name>
<url>http://xxx.xxx.xxx.xxx:8080/Maven 2Repository</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>my-deploy-respository</id>
<name>cdc-plugin-respository</name>
<url>ftp://192.168.2.177/home/mfguser/Maven 2Repository</url>
</repository>
</distributionManagement>
-
- 本地用户setting.xml文件的设定 /root/.m2/settings.xml
<server>
<id>my-deploy-respository</id>
<username>user</username>
<password>password</password>
</server>
maven deploy到nexus报错:Return code is: 401, ReasonPhrase:Unauthorized
提交到nexus时候报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project *: Failed to deploy artifacts: Could not transfer artifact *:jar:1.0 from/to releases (http://10.1.81.199:8081/nexus/content/repositories/releases/): Failed to transfer file: http://10.1.81.199:8081/nexus/content/repositories/releases/com/cs2c/security-management-client* /1.0/*-1.0.jar. Return code is: 401, ReasonPhrase:Unauthorized.
原来是没有配置认证。
maven目录conf的setting.xml里,
- < server >
- < id > releases </ id >
- < username > admin </ username >
- < password > admin123 </ password >
- </ server >
- < server >
- < id > snapshots </ id >
- < username > admin </ username >
- < password > admin123 </ password >
- </ server >
- </ servers >
用户名和密码都是nexus的。再次deploy即可。
注意这里的id要和pom.xml里远程deploy的地址对应一致,我的pom.xml里配置:
- <!-- 配置远程发布到私服,mvn deploy -->
- < distributionManagement >
- < repository >
- < id > releases </ id >
- < name > Nexus Release Repository </ name >
- < url > http://10.1.81.199:8081/nexus/content/repositories/releases/ </ url >
- </ repository >
- < snapshotRepository >
- < id > snapshots </ id >
- < name > Nexus Snapshot Repository </ name >
- < url > http://10.1.81.199:8081/nexus/content/repositories/snapshots/ </ url >
- </ snapshotRepository >
- </ distributionManagement >
如果这里不配置,会报错: 报 错:Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project git-demo: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
- maven 自动发布更新本地和远程仓库
- maven 自动发布更新本地和远程仓库
- maven 自动发布更新本地和远程仓库
- maven 自动发布更新本地和远程仓库
- Maven仓库-本地仓库和远程仓库
- maven远程仓库和本地仓库配置
- Maven发布项目到本地仓库和远程私服仓库
- Maven详解之仓库--本地仓库和远程仓库
- Maven详解之仓库------本地仓库和远程仓库
- maven修改远程和本地仓库地址
- maven修改远程和本地仓库地址
- maven修改远程和本地仓库地址
- maven修改远程和本地仓库地址
- maven修改远程和本地仓库地址
- maven中配置本地仓库和远程仓库(私服)
- 修改maven的本地仓库和远程仓库
- 【工作记录】maven本地仓库和远程仓库的理解
- Maven自动发布构件到远程中央仓库
- 视图或自定义函数调用存储过程结果集办法(可执行动态SQL)
- Docker命令大全
- 尝试运行百度定位Demo的准备工作
- JSP客户端请求、JSP服务器响应、JSP HTTP 状态码
- ios 错误崩溃汇总
- maven 自动发布更新本地和远程仓库
- Web Storage API
- Android中那些完美和不完美退出应用的方法
- 浅谈Java中的equals和==
- 设计模式之桥接模式PHP实现
- PE文件结构详解(四)PE导入表
- Openfire集成Sip服务器
- Android 开机启动广播
- 系统间通信:基于TCP协议的RPC实现范例