Giter Site home page Giter Site logo

gradle-maven-plugin's Introduction

gradle-maven-plugin

Circle CI

This is a maven plugin that makes it easy to invoke Gradle tasks from within Maven.

Objective

Gradle is an awesome general-purpose tool. If your project/organization is committed to maven, switching to gradle may not be a practical option. The plugin is conceptually similar to the maven-antrun-plugin, which allows ant to be invoked from maven.

Now instead of using Ant to perform ad-hoc tasks from within Maven, you can use Groovy/Gradle instead!

Usage

The gradle-maven-plugin is now in Maven Central, so there is no need to declare a custom repository.

To use the plugin, simply declare the plugin and bind it to the maven lifecycle phase of your choice:

	<plugin>
		<groupId>org.fortasoft</groupId>
		<artifactId>gradle-maven-plugin</artifactId>
		<version>1.0.8</version>
		<configuration>
			<tasks>
				<!-- this would effectively call "gradle doSomething" -->
				<task>doSomething</task>
			</tasks>
		</configuration>
		<executions>
			<execution>
				<!-- You can bind this to any phase you like -->
				<phase>compile</phase>
				<goals>
					<!-- goal must be "invoke" -->
					<goal>invoke</goal>
				</goals>
			</execution>
		</executions>
	</plugin>

Now when you run maven, gradle will be invoked and execute the "doSomething" task defined in build.gradle.

Obviously you can change the task(s) to suit your needs.

In this example, the gradle invocation will happen during the maven "compile" phase, but this can be easily changed by changing the <phase> element value.

Options

These options can be given in the <configuration> element:

optionrequireddescriptionexample
taskyes (or tasks) gradle task to be invoked
<task>myTask</task>
tasksyes (or task) gradle tasks to be invoked
<tasks>
<task>task1</task>
<task>task2</task>
</tasks>
gradleVersionnoversion of gradle to use
<gradleVersion>1.6</gradleVersion>
gradleProjectDirectorynopath to the location of your build.gradle
<gradleProjectDirectory>
${project.basedir}/another/path
</gradleProjectDirectory>
javaHomenogive and explicit path to a JAVA_HOME
<javaHome> /my/path/to/jdk </javaHome>
argsnopass argument to gradle
<args>
<arg>-q</arg>
</args>
jvmArgsnopass JVM arg to gradle
<jvmArgs>
<jvmArg>-XX:MaxPermSize=128m</jvmArg>
<jvmArg>-Xmx256m</jvmArg>
</jvmArgs>

Plugin Testing

Here is some information on maven plugin testing. This project is currently using the maven-invoker-plugin for testing.

gradle-maven-plugin's People

Contributors

if6was9 avatar rschimmack avatar psibre avatar dlethin avatar secondsun avatar tobias avatar

Watchers

FNCS avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.