Dims
Dims

Reputation: 51069

How to assign maven (?) coordinates to my Gradle project?

I would like to use one of my projects (called filterwidget) from within another projects with

    <dependency>
        <groupId>mycompany</groupId>
        <artifactId>filterwidget</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>

with Maven or by

    compile('mycompany:filterwidget:0.0.1-SNAPSHOT')

with Gradle.

I think mycompany:filterwidget:0.0.1-SNAPSHOT is called "Maven coordinates" of my project, right?

So, how assign maven coordinates to my Gradle project?

I have

jar {
    baseName = 'filterwidget'
    version = '0.0.1-SNAPSHOT'
}

is this enough? Where is group id set?

In other words, what is Gradle equivalent for

<project ...>

    <modelVersion>4.0.0</modelVersion>

    <groupId>mycompany</groupId>
    <artifactId>filterwidget</artifactId>
    <version>0.0.1-SNAPSHOT</version>

UPDATE

Upvotes: 1

Views: 1036

Answers (1)

Kevin Wittek
Kevin Wittek

Reputation: 1572

You would specify the project properties like this:

group 'mycompany'
version '0.0.1-SNAPSHOT'

Maven's artifactId is the project name inside of Gradle and is derived from your project's directory name. So in your example, you have to put your project into a directory called filterwidget.

You do specify these properties on the top level of your build.gradle file, the jar properties you have used are intended for different things: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html

Upvotes: 2

Related Questions