开发者

Get full name of an artifact in Maven

I need to know the complete filename of a specific artifact in Maven. I looked at versions-maven-plugin but it seems to change the pom itself. Is there anot开发者_运维百科her way to reach my goal? I want to store the complete artifact name in a property so I can pick it up in Java code.


Normally you have your dependencies and let maven do all the work of retrieving the files from the repository for you. But you want to use it in your Java code - what Java code? Are you writing your own mojo that will be doing something during the install phase of your lifecycle? Then you should be able to access the artifacts that are currently being processed, from there it's not a problem to get the filename. But maybe you've got just the groupId, artifactId, version and type of an already existing artifact. With these informations it should be no problem to navigate to your local maven repository, open the directory: groupId/artifactId/version and look what files you've got there. Usually there should be your .pom a .jar, maybe a md5-hashsum and some maven-metadata. If you're not sure which file's the interesting one: take that one with the biggest filesize.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜