Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I migrate mavenRepo in Gradle 1.7 to maven in Gradle 1.9?

Tags:

maven

gradle

In build scripts for Gradle 1.7, it's common to see

mavenRepo url: 'https://artifactory.example.com/repo'

However, after upgrading to Gradle 1.9, running gradle yields the following warning:

The RepositoryHandler.mavenRepo() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the maven() method instead.

A quick look in the Gradle docs confirms that mavenRepo has been deprecated. How should I migrate from mavenRepo to maven.

like image 799
James Lim Avatar asked Dec 17 '13 19:12

James Lim


People also ask

Can you mix Maven and Gradle?

Short answer: yes. There's no conflict between having two independent build scripts for the same project, one in Maven and one in Gradle.

Does Gradle use POM XML?

It uses a declarative XML file for its POM file and has a host of plugins that you can use. Gradle uses the directory structure you see on Maven, but this can be customized.

Is Gradle better than Maven?

The biggest differences are Gradle's mechanisms for work avoidance and incrementality. The top 3 features that make Gradle much faster than Maven are: Incrementality — Gradle avoids work by tracking input and output of tasks and only running what is necessary, and only processing files that changed when possible.


1 Answers

The documentation for the Gradle DSL indicates that maven accepts a closure or an action. After some minutes of digging, I found an example that works as follows.

maven {
  url 'https://artifactory.example.com/repo'
}
like image 186
James Lim Avatar answered Sep 22 '22 07:09

James Lim