orshachar
orshachar

Reputation: 5037

Running Gradle from Maven

I'm looking for some Gradle executor plugin for Maven (similar to Maven ant-run plugin).
Google did not help.

Is it possible that such plugin doesn't exist?

Upvotes: 30

Views: 16371

Answers (2)

Felipe Desiderati
Felipe Desiderati

Reputation: 3002

I probably would use:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
      <execution>
        <id>test</id>
        <phase>test</phase>
        <configuration>
          <executable>./gradlew</executable>
          <arguments>
            <argument>test</argument>
            <argument>-i</argument>
          </arguments>
        </configuration>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
      <execution>
        <id>install</id>
        <phase>install</phase>
        <configuration>
          <executable>./gradlew</executable>
          <arguments>
            <argument>install</argument>
          </arguments>
        </configuration>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

Because of the following reasons:

  1. I would prefer to trust in a plugin maintained by Codehaus.
  2. If you use the gradle-maven-plugin, probably you'll have to configure additional information in your settings.xml. Otherwise this error can occur: Failed to execute goal org.fortasoft:gradle-maven-plugin:1.0.8

Upvotes: 2

orshachar
orshachar

Reputation: 5037

I should try this: https://github.com/if6was9/gradle-maven-plugin

This is a maven plugin that makes it easy to invoke gradle from maven.

It is similar to the maven-antrun-plugin that allows ant to be invoked from maven.

Upvotes: 25

Related Questions