Keep Eclipse project dependencies in sync with an external build system

Here is the situation. The development team has a large number (hundreds) of Eclipse projects. The code is very important - new projects are being created; projects are renamed, and project dependencies are constantly changing. External build system ant. It is extremely difficult to maintain the dependencies defined in the ant build files in sync with the state of the world in Eclipse. The external build of ant requires constant changes to keep up. For various reasons, using ant as the default constructor in Eclipse is not an option. Developers want to continue to use Eclipse as a build and editing environment for local use.

Question: Is there a tool that can support one set of dependencies that Eclipse can use, as well as an external build system such as ant? I heard about Gradle, but have never used it before. Will this make sense in this context? I am sure Maven will not work for what is needed. A typical workflow should be as follows:
1. Developers continue to work as they currently do - by creating and modifying the dependencies of the Eclipse project as they wish, and using the default Eclipse builder to compile and test locally. 2. There is some mechanism by which these dependencies can be transferred to an external build system, such as ant, and an external continuous assembly initiated on each control.
Appreciate your feedback - thanks!

+4
source share
2 answers

We pretty successfully used Gradle to solve a similar problem. Here is the installation diagram

  • Each project contains build.gradle , which defines project-specific dependencies and tasks (it may even be empty).
  • The special master project contains build.gradle , which sets up common dependencies and tasks for child projects and / or enters parameters related to the group of child projects.
    • Logically, the master project is a parent project, but it exists as a sibling folder, so Eclipse can be more convenient with it.
  • Gradle contains a built-in Eclipse plugin that allows you to create Eclipse configuration files for each project from dependency information (including dependencies between projects). It works great for simple projects, and for more complex ones, Gradle allows you to bother with configuration files, so you can do almost anything. From here you have two options:
    • Do not store the Eclipse settings file in the repository and invoke the generation task every time you do a new registration (I prefer this option).
    • Tell Gradle to use custom variables so that it generates common configuration files that can be checked in the repository. After that, you only need to run the generation task with dependencies or other configuration changes.
  • (Optional) It's a bit complicated, but you can make Gradle analyze the existing ivy.xml project ivy.xml and configure the dependencies there. I had some success with this, although I would recommend converting the dependencies to Gradle format for more flexibility.
  • The continuous build system integrates very well with Gradle (just like ant). If you are using Jenkins (Hudson), there is a Gradle plugin.

The advantage of using Gradle is that it scales very well, and you can support other IDEs like IntelliJ or Netbeans, at the same time without much effort (unless you have crazy user settings). The advantage and disadvantage is that Gradle is a powerful build system that requires Groovy and Gradle DSL training, which can take some time. Also the documentation is awesome.

Gradle has a very active community with the sole purpose of solving just such a problem.

Hope this helps and good luck!

+2
source

How to blur .classpath files, generate a dependency tree and start building from the root. What you need is an agreement on the layout of your projects or a common (ant -) build file, which can be changed in each project if necessary (for example, different project layouts). I'm not sure if Eclipse Tycho can be used for this, since it is a maven plugin for creating eclipse plugins or projects. But it is able to resolve package and project dependencies on maven repositories and eclipse update sites.

0
source

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


All Articles