简体   繁体   English

什么是maven存储库协议?

[英]What is the maven repository protocol?

I have been learning a lot about Maven lately and am very impressed. 我最近一直在学习很多关于Maven的事情并且给我留下了非常深刻的印象。 Where can I find information about communicating with, deploying to and retrieving from a repository in the same manner as Maven does? 我在哪里可以找到有关与Maven相同的方式与存储库进行通信,部署和检索的信息? Is this done through some published protocol? 这是通过一些公布的协议完成的吗?

I have found information about OSGI (and OBR) but cannot tell if this is what I should be looking into. 我找到了有关OSGI(和OBR)的信息,但无法判断这是否是我应该研究的内容。

I would like to do this in .net (for whatever reason). 我想在.net(无论出于何种原因)这样做。 I do not mind looking through java source code if someone could point me to the correct component, but would much rather be pointed to the protocol specifications. 如果有人能指出我正确的组件,我不介意查看java源代码,但更倾向于指向协议规范。

[EDIT] I see a lot of answers regarding HTTP. [编辑]我看到很多关于HTTP的答案。 I would like to further clarify, I am not looking for the transfer protocol, I am looking for the API protocol. 我想进一步澄清,我不是在寻找传输协议,我正在寻找API协议。 For example, the Simple Object Access Protocol (SOAP) uses the Hyper Text Transfer Protocol to transfer messages. 例如,简单对象访问协议(SOAP)使用超文本传输​​协议来传输消息。 What is the access protocol for Maven? Maven的访问协议是什么?

As khmarbaise already said the transfer protocol is in most cases http(s), but there are other protocols available, eg simple file access for local repositories, WebDAV, SCP, SFTP, and so on. 由于khmarbaise已经说过传输协议在大多数情况下是http(s),但是还有其他协议可用,例如本地存储库的简单文件访问,WebDAV,SCP,SFTP等等。 A maven repository is more a special directory layout. maven存储库更像是一种特殊的目录布局。 There are servers like Nexus or Artifactory that offer additional functionality like proxying remote repositories or certain checks like authentication. 有像Nexus或Artifactory这样的服务器提供其他功能,如代理远程存储库或某些检查,如身份验证。

https://maven.apache.org/guides/introduction/introduction-to-repositories.html https://maven.apache.org/guides/introduction/introduction-to-repositories.html

Taken from http://wiki.jfrog.org/confluence/display/rtf/repository+layouts Maven Repository Layout: [orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext] 取自http://wiki.jfrog.org/confluence/display/rtf/repository+layouts Maven资源库布局: [orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]

Example org/eclipse/jetty/jetty-ajp/7.0.2.v20100331/jetty-ajp-7.0.2.v20100331.jar 示例org/eclipse/jetty/jetty-ajp/7.0.2.v20100331/jetty-ajp-7.0.2.v20100331.jar

The usual protocol is http furthermore for .net there exists already a solution which is called nuget which supports that already and works with some of the repository managers like neuxs and artifactory. 通常的协议是http。对于.net,已经存在一种称为nuget的解决方案,它已经支持已经并且与某些存储库管理器(如neuxs和artifactory)一起工作。

Ah...Maven uses it's own protocol. 啊...... Maven使用它自己的协议。 No SOAP etc. May be a look here will help a little bit. 没有SOAP等可能看看这里会有所帮助。 And furthermore this . 而且这个

Update You can simply download an artifact from a Maven repository by wget ...which is simply a http-get operation. 更新您只需通过wget ...从Maven存储库下载工件......这只是一个http-get操作。 To uplodate an artifact is simply a http-put ...you can do this by curl. 要上传一个工件只是一个http-put ...你可以通过curl来做到这一点。

Strictly, there is no special access protocol for Maven. 严格来说,Maven没有特殊的访问协议。 Maven uses plain HTTP to get artifacts from repository. Maven使用普通HTTP从存储库中获取工件。 Repository should have special layout, ie URL structure (which simply projected to usual directory structure). 存储库应该有特殊的布局,即URL结构(简单地投影到通常的目录结构)。 You can organize your own repo simply by organizing directories in a special way: [orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext] without any special software on server side. 您可以通过以特殊方式组织目录来组织自己的回购: [orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]在服务器端没有任何特殊软件。

So, it is more about directory structure than special protocol. 因此,它更多地是关于目录结构而不是特殊协议。 Very simple and working approach. 非常简单和工作的方法。

Of course, if you wanna additional services around it (like search, access control, stats etc) you should do it yourself. 当然,如果你想要它周围的其他服务(如搜索,访问控制,统计等),你应该自己做。 That's what JFrog does with its Artifactory product. 这就是JFrogArtifactory产品做的事情。

As far as I know, there isn't really a protocol. 据我所知,没有真正的协议。 A Maven repository is just a specific resource structure available over HTTP (or in a local directory.) There's a somewhat dated description available at Codehaus . Maven存储库只是通过HTTP(或在本地目录中)可用的特定资源结构。 在Codehaus中有一些有些过时的描述

"Deploying to" a repository means uploading the file in whichever way you wish as long as it's available to get from the above layout later. “部署到”存储库意味着以您希望的方式上传文件,只要以后可以从上面的布局获得。 The documentation for the deploy plugin provides examples for FTP and SSH, which implies a simple file upload into such a directory structure. deploy插件文档提供了FTP和SSH的示例,这意味着可以将简单的文件上载到这样的目录结构中。 But you might as well upload files to a custom web service that stores them in a database that is then appropriately exposed over HTTP. 但您也可以将文件上载到自定义Web服务,该服务将它们存储在数据库中,然后通过HTTP进行适当的公开。 Maven won't really care; Maven不会真正关心; artefact deployment, storage, and repository access are decoupled. artefact部署,存储和存储库访问是分离的。

HTTP GET, with this format: HTTP GET,使用以下格式:

GET /content/repositories/approved-from-central/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.pom HTTP/1.1
Cache-control: no-cache
Cache-store: no-store
Pragma: no-cache
Expires: 0
Accept-Encoding: gzip
User-Agent: Apache-Maven/3.3.9 (Java 1.8.0_102; Windows 7 6.1)
Host: localhost
Connection: Keep-Alive

I have documented it here http://www.javamonamour.org/2017/10/maven-to-repository-protocol.html 我在这里记录了它http://www.javamonamour.org/2017/10/maven-to-repository-protocol.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM