| [news.eclipse.technology.buckminster] Re: buckminster and maven repositories |
Would you be interested in having a go at it and perhaps submit a patch?
Regards, Thomas Hallgren
Hi,
I noticed that when buckminster tries to read information from a maven repository, it assumes that the repository is a browseable apache directory, and parses the html in order to lookup artifact versions. This works for maven repositories that are implemented as browseable apache directories, such as the central http://repo1.maven.org/maven2 repository, but it does not work for many other proxy repositories (e.g. artifactory). It's good practice NOT to use the central repo, however, and to use a proxy instead in order to avoid slamming the central repo which is often slow, to insulate yourself from external connectivity issues, control version changes, etc. etc.
The right way to address this would be to change the Buckminster behavior to lookup artifact version information the same way the mvn command does: by looking up appropriate maven-metadata.xml files in the repository. These metadata files must be available and accessible in any maven repository. For instance, if I go to the central repo and want to find the available versions of org.springframework:spring artifacts, rather than going to http://repo1.maven.org/maven2/org/springframework/spring/ and parsing the directory listing, the correct thing to do would be to GET the http://repo1.maven.org/maven2/org/springframework/spring/maven-metadata.xml file and look through its contents. It is much easier to parse and has the same structure for every repository.
Using the maven-metadata.xml file will also help you support correct behavior when accessing snapshots. Maven snapshots are identified by versions with a trailing 'SNAPSHOT', e.g. commons-dbcp:commons-dbcp:1.3-SNAPSHOT. However, the artifacts actually stored in the repository will be named something like http://people.apache.org/repo/m2-snapshot-repository/commons-dbcp/commons-dbcp/1.3-SNAPSHOT/commons-dbcp-1.3-20071125.225953-2.jar - note that instead of SNAPSHOT, a timestamp is used. The maven-metadata.xml file to the rescue again: when a client asks for the 1.3-SNAPSHOT version, look at the maven-metadata.xml file: http://people.apache.org/repo/m2-snapshot-repository/commons-dbcp/commons-dbcp/maven-metadata.xml and you will see info about the timestamp and build number which you can use to construct the proper url for your artifact GET request.
I have all my maven artifacts in an Artifactory repo and can't get to them via Buckminster right now, so I'd love to see the proper behavior implemented. I'd be happy to help with the implementation, but I'm not that familiar w/the Buckminster internals so I'd need some guidance there; and given that this is pretty straightforward thing, it would probably be faster for someone more familiar w/the internals to do it instead. If you do decide you'd like my help though, please let me know.
Cheers, Edwin