Ivy: Permission and Publication of JARs Locally

We have been using Ivy for several months and have our own “Ivy Repo” on the web server here in the office. All our projects are set up to migrate to this repo to resolve dependencies.

We have several commons JAR systems that are used by many of our projects. Because of this, and because we only have 1 repo, we find a lot of ugly overheads coming from the following scenario:

  • The developer is tasked with adding a function to project 1 (which depends on the Common jar)
  • During the development of project 1, the developer understands that he needs to make changes to the common bank
  • General changes made to jar
  • The common jar should pass code verification and normal code promotion.
  • Build Wizard publishes new shared jar
  • Project 1 may resume development now that the Common jar has been updated

It becomes funny and painful for our team.

For me, the obvious solution is to provide ant goals in each project that allow the developer to publish / resolve locally (to and from his file system). Thus, they can break the Common jar of 9 ways on Sunday, but without losing 2 - 4 days, waiting for the publication of Common. Thus, the developer makes local changes for both Project 1 and Common, and the code goes through our promotion process right away.

I know this is possible with Ivy, but I'm so new to this, I don’t even know where to start.

We are currently using the global ivy.settings file for all projects. In the settings file, we use the chain solution, in which there is 1 url resolver inside, which connects to our "plus repo".

I believe the following change will be necessary, but I'm not 100% sure:

  • In ivy.settings we will need to add a local file receiver before the calling URL is called; this way we check the local file system for dependencies before moving on to the ivy repository (web server)
  • Customize each ivy.xml project with an option that allows local cache publishing
  • Create an ant line to have a publish-locally target that uses the above option

I believe that these changes will allow us to: (1) always search locally for dependencies before looking at the web server, (2) publish locally as an assembly option (target).

If this is not the case, or if I am missing any steps , please let us know! Otherwise, I can probably figure out how to add a file system converter from Ivy documents, but I have no idea how to make publish-locally work. Any ideas? Thanks in advance!

+6
source share
2 answers

Ivy supports dynamic changes:

The stable code will refer to the latest approved version of the public ATM:

 <dependency org="my-org" name="commons" rev="latest.release"/> 

Unstable (in development) code refers to the latest unauthorized version of the code

 <dependency org="my-org" name="commons" rev="latest.integration"/> 

So, you need to modify the build process for your commons module to have two publishing goals. One for unstable snapshots of your code - another for formal releases.

(see status attribute in ivy publish function)

Note: In Maven, you have two types of repository, release and snapshot. Ivy support for this concept is thinner and more powerful IMHO.

+2
source

I would also prefer the approach of Marx.

As for publish-locally , you can specify the publication task for which the converter is used ( resolver="local" ). Thus, it can be published to the local file system or to any specific resolver.

 <ivy:publish resolver="local" overwrite="true" revision="${project.version}"> <artifacts pattern="dist/[artifact]-[revision].[type]" /> </ivy:publish> 

And if you use a chain resolver, you must set returnFirst="true" to allow a stop when something was found locally.

+2
source

Source: https://habr.com/ru/post/905993/


All Articles