Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Maven dependency parameters for the Java Gradle API?

I'm writing a Gradle plugin in Java. In order to use the IDE for developing (especially code completion), I need to add to the pom.xml file of the project the dependency information for the org.gradle.api.* classes.

Where can I find it?

I tried mvnrepository.com, but couldn't find it there.

like image 717
Dmitrii Pisarenko Avatar asked Jan 14 '15 18:01

Dmitrii Pisarenko


3 Answers

If you want to use the official Gradle Releases repository in a Maven pom try this:

<dependencies>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-core</artifactId>
        <version>3.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-tooling-api</artifactId>
        <version>3.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-base-services</artifactId>
        <version>3.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.gradle</groupId>
        <artifactId>gradle-base-services-groovy</artifactId>
        <version>3.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.10</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>repo.gradle.org</id>
        <url>https://repo.gradle.org/gradle/libs-releases-local/</url>
    </repository>
</repositories>
like image 119
David Green Avatar answered Oct 21 '22 20:10

David Green


I found this artifact after a longer search: https://mvnrepository.com/artifact/org.gradle/gradle-core/2.2.1

<dependency>
  <groupId>org.gradle</groupId>
  <artifactId>gradle-core</artifactId>
  <version>2.2.1</version>
</dependency>

The artifact is available in following repository: http://repo.springsource.org/libs-release-remote/

<repository>
  <id>Spring Source Libs</id>
  <url>http://repo.springsource.org/libs-release-remote/</url>
</repository>

Add the repository to the repositories section in your pom.xml as well as the artifact as dependency. I tested it with a Maven project in my Eclipse workspace - the org.gradle.api.* classes are available and I can also browse the gradle-core sources.

like image 37
gclaussn Avatar answered Oct 21 '22 20:10

gclaussn


Use this:

dependencies {
  //we will use the Groovy version that ships with Gradle:
  compile localGroovy()

  //our plugin requires Gradle API interfaces and classes to compile:
  compile gradleApi()
}
like image 2
WonderCsabo Avatar answered Oct 21 '22 21:10

WonderCsabo