开发者

Download Maven2 dependency from non-standard layout repository

开发者 https://www.devze.com 2022-12-21 09:10 出处:网络
I need to download a file from a non-standard layout repository. The standard repository layout is groupId>/<artifactId>/<version>/<artifactId>-<version>.<packaging>

I need to download a file from a non-standard layout repository.

The standard repository layout is groupId>/<artifactId>/<version>/<artifactId>-<version>.<packaging> however, I need to download the following file:

http://hudson.myserver.com:10000/repo/ocp-services/schemas/trunk/201/archive/schemas/dist/schemas.jar

where ocp-services is effectively the groupId, schemas is the artifactId and 201 is the version.

How would I add a depe开发者_运维百科ndency to this file and get it downloaded into my project and local repository?

This is a Hudson file repository if this is of any help, but it is a third parties so difficult to get them to change any location.


One option would be to register a custom ArtifactRepositoryLayout implementation and to declare a repository using this custom layout. I've never done that but it should be possible, check this blog post.

A second option would be to configure Maven to go through some kind of custom proxy (e.g. a Servlet) and to rewrite the URL on the fly for this particular dependency.

In both cases, I'm afraid Maven will complain about missing metadata ("A dependency in Maven isn't just a JAR file", see 3.5.5. Maven's Dependency Management) because the hudson file repository is just not a Maven repository. Maybe this can be handled programmatically though. But as I said, I've never done this.

A third option would be to ask the project building the JAR you need to deploy it (in the maven sense). That would be of course the best solution.

A last one option would be to just download this JAR and to install it manually in your local repository. If this is an option, go for it.


Have you tried adding this to your pom.xml :

<dependencies>
            <dependency>
                <groupId>ocp-services</groupId>
                <artifactId>schemas</artifactId>
                <version>201</version>
                <type>jar</type>
            </dependency>
        </dependencies>

or if that don't work as Pascal says install it manually

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号