Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

nexus - Publishing Ivy SNAPSHOTS with Maven metadata

I have an Ivy project that publishes its artifacts to a Nexus Maven repository. I then need other Maven projects to be able to use those jars as dependencies. I have been able to get Ivy to create and upload the pom.xml along with the jars, which is working fine. The problem is, when I use Ivy to publish a new SNAPSHOT version - none of the Maven projects will retrieve the new snapshot dependency, even if I do:

mvn clean install -U

I have noticed that Ivy does not publish a maven-metadata.xml file to the repos -- I assume that is the problem? If so, are there any ways to get Ivy to produce this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ivy can be configured to read this file when resolving dependencies (see the "m2compatible" attribute of the ibilio resolver), but the publish task does not create or update this file.....

Seemingly it's the client's job to create and update the "maven-metadata.xml" file.... This is an undocumented feature of Maven repositories. (If someone could find where it's described, perhaps an ivy bug could be fixed).

The standard work-around is to periodically schedule a Nexus task to regenerate the metadata files. See:

A more extreme solution is to use the Maven ANT task to perform the publish step....

Commentary on snapshot revisions

In recent times I've come to the conclusion that snapshot releases are not worth the effort. Continuous delivery promotes the concept that each build is potentially releasable and ivy has a nifty buildnumber task which ensures each build is unique. I find my build process is simpler when there is only one kind of build.

Snapshots is a feature only required when sharing development build artifacts with other projects using Maven. IMHO ivy's dynamic revision features are more powerful because they resolve the "latest" revision at build time. See how the deliver task is combined with the makepom task in the following examples:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...