Currently we are using Maven for build purpose. For dependency management, I know Apache Ivy is best (correct me if I am wrong). But it is completly dependent on Ant.But we are not using Ant in my application. Can I use IVY without Ant? Please provide the best approach in this scenario for dependency management?
Related
In our project we are using ant for building the system and now we want to add dependency management to our system. I already learn that we can use ivy for this. But in future, we want to change the system into maven. But for now, we just want to handle the dependency problem. Is it possible to use maven just for dependency management and build for ant?
I’m trying to create a custom Artifactory repository to resolve dependencies in my gradle project, but I’m confused between gradle and maven repo: what repository key should I choose? And what is the real difference between a gradle repository and a maven repository?
There is no such thing as a Gradle repository.
While Maven is the name for both a build tool and a repository type, Gradle ist just a build tool. It supports both Maven and Ivy repositories.
Gradle is a Java development tool, but not the only one. An alternative is Maven, which is older and commonly used. Spring Framework let developers to choose between these two tools.
Gradle is an open source build automation system that's built on Apache Maven and Apache Ant concepts. It uses a domain-specific language based on the programming language Groovy. This is a very interesting difference between Gradle and older Apache Maven, which uses XML. Gradle was developed in 2007 and in 2013 it was adopted by Google for Android system (this must say a lot about how powerful is Gradle).
Maven Repository is a directory where all the project jars, library jar and plugins can be used by Maven/Gradle easily. Maven Repository are of three types: local, central or remote. Gradle can and use the Maven Repositories, as I've said before, Gradle is build on top of Maven concepts.
You can think of Gradle as goodness of Ant and Maven put together minus the noise of XML. And scriptability with groovy is very big plus.
Gradle gives you conventions but still gives you power to override them easily.
Gradle build files are less verbose as they are written in groovy.
It provides very nice DSL for writing build tasks.
Has lot of good plugins and vibrant ecosystem
When to use Gradle and When to use Maven ?
Almost everywhere for creating java/groovy project. The build files are much terse.
With Google choosing Gradle as the new build system for Android SDK and mature libraries like Spring, Hibernate, Grails, Groovy etc. already using it to power their builds, there is no doubt that Gradle is becoming de-facto build system for the Java ecosystem.
I have a legacy JAVA project and we use Ant to build it. We are planning to keep using ant for building the project but delegate the dependency management to maven/gradle without affecting the existing build process.
What might be the best way to move forward - with Maven or with gradle?
Since existing project has it's own structure(which may not conform to standard Maven archtypes), I know might have to make a custom archtype if using maven.
https://stackoverflow.com/a/48791837/2458858 provides one way to solve it but I am trying to find a standard solution in which I am able to delegate dependency management within the same project rather than a separate project.
Is it possible, instead of importing all runtime jars into MPS, to just consume external dependency management tool like maven and let it resolve and upload all needed libraries into MPS automagically?
Short answer: Nope
Long answer: In theory you can use maven or gradle to fetch your dependencies and the transitive dependencies. For instance you can use the copy-dependencies task of maven to copy the artefacts to some locations. In gradle it's even easier. Then you select the folder in the runtime tab of your solution. At this point you will be disappointed because it did not add the folder but all jars in that folder as libs. There is no way to tell MPS to use all the jars from some location, it only references single jar files.
The only way I could think of how this theoretically could work is by using gradle and after fetching the dependencies also programatically change the .msd file. Sync the jars in there with the jars that have been fetched. I'm not sure how to do this with maven though. But with groovy it shouldn't be that much of an issue.
If you choose to try the gradle way we would be really happy to see a pull request adding this feature to our gradle plugin. ;)
You should probably use the MPS Build Language:
Build Language is an extensible build automation DSL for defining builds in a declarative way. Generated into Ant, it leverages Ant execution power while keeping your sources clean and free from clutter and irrelevant details. Organized as a stack of MPS languages with ANT at the bottom, it allows each part of your build procedure to be expressed at a different abstraction level. Building a complex artifact (like an MPS plug-in) could be specified in just one line of code, if you follow the language conventions, but, at the same time, nothing prevents you from diving deeper and customize the details like file management or manifest properties.
There is a lot of talk about maven being the dependency resolution engine of choice (or Aether more specifically). What is the result of this change from an application development perspective? Going forward am I meant to use an external pom file to capture my dependencies rather than BuildConfig? Do I run create-pom on legacy projects upgraded to 2.3x? Is there a recommended approach?
The recommended approach is to express your dependencies in BuildConfig.groovy and let Grails take care of it from there. You don't need to generate a pom file unless you are trying to integrate your Grails build as part of some other build (like a Maven build). The normal thing to do, unless you have some specific reason to do otherwise, is to use the Grails build system which by default in recent versions will use aether to do the resolution, but that is largely an implementation detail and all you typically have to interact with is BuildConfig.groovy.
I hope that helps.