Ant / Ivy for construction project

I am considering switching the Maven project, which I run Apache-Ant / Ivy. I need more control over the build process, and I'm very upset with Maven. Please no comments on how great Maven is. My question is about Ivy.

I would like to create a β€œstandard” Ant build template that can later be used for other projects with minimal changes.

I will create a central β€œcorporate” repository where we can host third-party libraries that are not available in Maven public repositories (for example, commercial libraries, Sun libraries, own libraries, etc.). This enterprise repository will be available on the local LAN, but may not be accessible from outside the office.

Each developer will have a private repository in ~/.ivy/repository . I would like Ant build to automatically update this private repository with modified versions of libraries from the enterprise repository.

In ~/.ivy/ant I plan to place the "standard" modules for inclusion in separate build.xml project files using the include task in Ant 1.8. These modules will provide objects such as Scala and Clojure compilation targets with different versions for different versions of Scala and Clojure (for example: scala-compile-2.9.1.xml , clojure-compile-1.3.xml , etc.). Build modules will be available in the corporate repository and should be automatically updated in private repositories if they change.

Each project will follow the standard Maven directory structure: ${project}/src/main/java , ${project}/target/classes , etc.

In the past, I tried to use Ivy, but Ant build files were very large (> 500 lines for the template build file) and difficult to manage / edit. I hope that by setting standard targets in my own build modules in the ~/.ivy/ant directory, I can avoid this bloating code.

Can this be done? Am I so far from base? The only documentation I can find on Ivy is on the Apache website (http: // ant.apache.org/ivy). Is there any other documentation available, including books?

+6
source share
1 answer

Rather a reasonable idea is to divide the template assembly file into include auxiliary files. Personally, now I switched to a really large project from ant (without dependency management in general - just copying files from ftp) to the ant / ivy solution. So, I made this way - I have a file with milestone goals - I am ready for compilation, compilation, ready for archiving, archiving - and so on. I think you have an idea. I have configured dependencies for all of these goals (dependencies in ant terms, don't get me wrong). So - compiled depends on the finished compilation, ready for compilation depends on the initialization - smth, like this. These goals do not have a body - they are intended to be included in each assembly file of each module of your multi-module project. The sole purpose of these goals is to maintain the state of the assembly, because of this material for importing it becomes quite difficult, and it is difficult to find which target was redefined, and when this goal will be launched. But with this file, I can easily change the state of the vy assembly on every reasonable milestone. I want help files with exteran exe to be compiled in one module. No problem - in this project I just do it - the willingness to archive depends on the purpose of compiling the help. And since these basic steps are included, I can redefine only some of them - all the others will prefer the desired way to build the project.

Another part of my strategy - mixins build files - is for each specific area. So, I have a file for ivy. There I set initialization, permission, publication and so on. When I want to use ivy - I just include this file and control the depdendencies through my breakpoints. If the assembly is typical, I include only this file and have functionality compared to the configuration. All of this is out of the box. How?? Just mixes with other mixins. Mixins may include other mixins to depend on them. Therefore, every mixin is a reusable part of my build strategy. OOP material is a unit related to one. In your case, it is a scala mixin with goals specific to scala.

Then I have a delegate.xml that delegates child projects for a common assembly. I have dist, all, test and everything you need for a multi-module project. Build order is evaluated using ant -vy task buildlist.

There are also other files there, but these are strategically basic files that helped me create a reusable and custom assembly with this BIG and VERY Conservative project. So, if you are interested in the details, feel free to contact me. I will be very happy to help you because ivy documents are really complex and incomplete.

EDIT: About books - ant in action can help you, I took a few ideas from this book and I highly recommend everyone to read. There you can also find ivy. And about ivy documents - sorry, everything is available. But when I had problems with this bulky ivy + ant - I found some interesting articles about private blogs. So ... that can somehow fill the gap.

+2
source

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


All Articles