0

How can I publish all project dependencies to local filesystem repository ?

For example I have project P that depends on A. I would like to copy A and P to local m2 repository, but <ivy:publish/> will only copy P.

Optionally:

The repository should be in maven format (with poms and other metadata, groupIds with dots transformed to directories).

Marcin Wisnicki
  • 4,511
  • 4
  • 35
  • 57
  • The local Maven repository is really a cache (ivy has a clean and clear distinction between cache and repo). You are best advised not to use it. If you're using Maven, why not setup a proper Maven repository manager like Nexus? You'll never look back! – Mark O'Connor Jul 12 '13 at 06:12
  • By local I meant mounted network share with archive of all dependencies. I'd rather avoid setting up nexus right now and was hoping such basic functionality would be implemented in ivy. I want maven layout because it's de facto standard for jar repository and supported by many tools. – Marcin Wisnicki Jul 12 '13 at 10:48
  • Maven is the defacto layout when implemented as a **remote** repository. That was why I suggested using a repository manager (which would take care of theses details for you). For local repositories you are best advised to stick to ivy's caching mechanism unaltered. You gain very little by sharing a mounted network drive and add lots of complexity and cusom build logic to your build. Most importantly a proper Maven repository can be shared by all build technologies: Maven, Ivy, Gradle, Buildr... They all support Maven repositories. – Mark O'Connor Jul 12 '13 at 10:56
  • Additional note: I deliberately treat the Maven local repo as a disposable cache. It's safer and leads to a more reliable build process. My reasoning documented here: http://stackoverflow.com/questions/10049948/when-is-it-safe-to-delete-the-local-maven-repository/10050239#10050239 ... Of course opinions differ. I'm an extremist I want my build machines to be completely stateless. – Mark O'Connor Jul 12 '13 at 11:05
  • Indeed but it happens to have same layout locally. I did this with maven in the past and it was trivial. – Marcin Wisnicki Jul 12 '13 at 11:06
  • Of course it will work. I didn't say it wouldn't. I think I'm done here :-) Apologises for not being of any help and generating this much noise. – Mark O'Connor Jul 12 '13 at 11:09
  • To restate: I need a quick and dirty way to create published maven repository with what I have right now (and I don't have nexus yet). Since it's so easy in maven and Ivy is supposedly so flexible, I've assumed it could do this too. Unfortunately It seems I was wrong. – Marcin Wisnicki Jul 12 '13 at 11:11
  • Oh, and btw how would proper maven repo help with publishing transitive dependencies when `ivy:publish` is not publishing them anyway ? – Marcin Wisnicki Jul 12 '13 at 11:13
  • There is no quick and dirty way to do this. I advise looking at previous postings on how to publish to a Maven repository. I've never tried them in concert with the **file** resolver but I don't see why they won't work... You'll find examples of how ivy can generate Maven POM files. Remember you're trying to save in a format foreign to ivy so pain will be involved. – Mark O'Connor Jul 12 '13 at 11:13
  • I've updated the question to hopefully make it clear that maven layout is just a side-question and I was really asking for transitive publish. – Marcin Wisnicki Jul 12 '13 at 11:22
  • And I've provided a more detailed example. Hope this helps. The main reason for my stubbornness is because only ivy's ibilio resolver understands the Maven repository layout and can translate between ivy and POM files. If you use a file based approach you'll need to publish both types of file. Hope this point is clear. – Mark O'Connor Jul 12 '13 at 11:26

1 Answers1

0

If you want your local repository to have a Maven format then you'll need to adapt of the following answers to work with an ivy file resolver instead of the more normal ibilio resolver:

Things to keep note of:

  • You'll need to generate (and publish) Maven POM files using the makepom task. Why? Maven and ivy use different repository metadata files for storing dependencies. So if you use the Maven local repo for resolving ivy dependencies ivy will expect to see ivy.xml files and Maven will expect to see pom.xml files for each module
  • The ibilio resolver understands Maven POM and other meta data file weirdness and can translate for ivy resolves. This is mainly why you are best advised to use a Maven repository manager when sharing artifacts between build technologies.

Hope this helps!

Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185