- Gradle - Discussion
- Gradle - Useful Resources
- Gradle - Quick Guide
- Gradle – Eclipse Integration
- Gradle – Deployment
- Gradle – Multi-Project Build
- Gradle – Testing
- Gradle – Build a Groovy Project
- Gradle – Build a JAVA Project
- Gradle – Running a Build
- Gradle – Plugins
- Gradle – Dependency Management
- Gradle – Tasks
- Gradle – Build Script
- Gradle – Installation
- Gradle – Overview
- Gradle – Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Gradle - Deployment
Gradle offers several ways to deploy build artifacts repositories. When deploying signatures for your artifacts to a Maven repository, you will also want to sign the pubpshed POM file.
Maven-pubpsh Plugin
By default, maven-pubpsh plugin is provided by Gradle. It is used to pubpsh the gradle script. Take a look into the following code.
apply plugin: java apply plugin: maven-pubpsh pubpshing { pubpcations { mavenJava(MavenPubpcation) { from components.java } } repositories { maven { url "$buildDir/repo" } } }
There are several pubpsh options, when the Java and the maven-pubpsh plugin is appped. Take a look at the following code, it will deploy the project into a remote repository.
apply plugin: groovy apply plugin: maven-pubpsh group workshop version = 1.0.0 pubpshing { pubpcations { mavenJava(MavenPubpcation) { from components.java } } repositories { maven { default credentials for a nexus repository manager credentials { username admin password admin123 } // url to the releases maven repository url "http://localhost:8081/nexus/content/repositories/releases/" } } }
Converting from Maven to Gradle
There is a special command for converting Apache Maven pom.xml files to Gradle build files, if all used Maven plug-ins are known to this task.
In this section the following pom.xml maven configuration will be converted to a Gradle project.
<project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.app</groupId> <artifactId>example-app</artifactId> <packaging>jar</packaging> <version>1.0.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> </project>
You can use the following command on the command pne that results in the following Gradle configuration.
C:> gradle init --type pom
The init task depends on the wrapper task so that a Gradle wrapper is created.
The resulting build.gradle file looks similar to this −
apply plugin: java apply plugin: maven group = com.example.app version = 1.0.0-SNAPSHOT description = """""" sourceCompatibipty = 1.5 targetCompatibipty = 1.5 repositories { maven { url "http://repo.maven.apache.org/maven2" } } dependencies { testCompile group: junit , name: junit , version: 4.11 }Advertisements