Maven: How to use a build.gradle file? - java

I'm a complete beginner with both Maven and Gradle. I have a working Maven project. Now I want to add a bunch of classes from another project which was built using Gradle. I want to take classes from the Gradle project and use it in my Maven project. When I copy the classes into my Maven project, I get a bunch of dependency errors. To resolve those errors I would like to add the required stuff to my pom.xml file.
Basically, I want to add all dependencies specified in a build.gradle file, to my pom.xml file.
The pom.xml file:
<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>myGroupId</groupId>
<artifactId>myArtifactId</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>10</release>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.jgrapht/jgrapht-core -->
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>1.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jgrapht/jgrapht-jdk1.5 -->
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-jdk1.5</artifactId>
<version>0.7.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jgrapht/jgrapht-ext -->
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-ext</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0-jre</version>
<!-- or, for Android: -->
<!-- <version>27.0-android</version> -->
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.trove4j/trove4j -->
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
</project>
The build.gradle file:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.rapidminer.com/content/groups/public/' }
}
}
plugins { id 'com.rapidminer.extension' version '0.8.2' }
// Define Maven artifact repositories
repositories {
jcenter()
maven { url 'https://maven.rapidminer.com/content/groups/public/' }
ivy {
url "https://github.com/rapidprom/rapidprom-libraries/raw/${project.properties["version"]}/prom/"
layout "pattern", {
artifact "[module]-[revision]/[module]-[revision].[ext]"
artifact "[module]-[revision]/[artifact].[ext]"
ivy "[module]-[revision]/ivy-[module]-[revision].xml"
}
}
ivy {
url "https://github.com/rapidprom/rapidprom-libraries/raw/${project.properties["version"]}/thirdparty/lib/"
layout "pattern", {
artifact "[module]-[revision]/[module]-[revision].[ext]"
ivy "[module]-[revision]/ivy-[module]-[revision].xml"
}
}
ivy {
url "https://github.com/rapidprom/rapidprom-libraries/raw/${project.properties["version"]}/thirdparty/resource/"
layout "pattern", {
artifact "[module]-[revision]/[module]-[revision].[ext]"
ivy "[module]-[revision]/ivy-[module]-[revision].xml"
}
}
}
extensionConfig {
// The extension name
name 'RapidProM'
/*
* The artifact group which will be used when publishing the extensions Jar
* and for package customization when initializing the project repository.
*
*/
groupId = 'org.rapidprom'
/*
* The extension vendor which will be displayed in the extensions about box
* and for customizing the license headers when initializing the project repository.
*
*/
vendor = "Eindhoven University of Technology"
/*
* The vendor homepage which will be displayed in the extensions about box
* and for customizing the license headers when initializing the project repository.
*
*/
homepage = "www.rapidprom.org"
// enable shadowJar before rapidminer dependency (otherwise build fails)
shadowJar {
zip64 true
}
// define RapidMiner version and extension dependencies
dependencies {
rapidminer '7.2.0'
//extension namespace: 'text', version: '7.2.0'
}
}
// Define third party library dependencies
dependencies {
compile group:"org.rapidprom", name:"ProM-Framework", version:"31245"
compile "org.rapidprom:AcceptingPetriNet:6.7.93"
compile "org.rapidprom:AlphaMiner:6.5.47"
compile "org.rapidprom:Animation:6.5.50"
compile "org.rapidprom:ApacheUtils:6.7.88"
compile "org.rapidprom:BasicUtils:6.7.104"
compile "org.rapidprom:BPMN:6.5.56"
compile "org.rapidprom:BPMNConversions:6.5.48"
compile "org.rapidprom:CPNet:6.5.84"
compile "org.rapidprom:DataAwareReplayer:6.7.563"
compile "org.rapidprom:DataPetriNets:6.5.291"
compile "org.rapidprom:DottedChart:6.5.17"
compile "org.rapidprom:EvolutionaryTreeMiner:6.7.154"
compile "org.rapidprom:EventStream:6.5.72"
compile "org.rapidprom:FeaturePrediction:6.5.61"
compile "org.rapidprom:Fuzzy:6.5.33"
compile "org.rapidprom:GraphViz:6.7.185"
compile "org.rapidprom:GuideTreeMiner:6.5.18"
compile "org.rapidprom:HeuristicsMiner:6.5.49"
compile "org.rapidprom:HybridILPMiner:6.7.116"
compile "org.rapidprom:InductiveMiner:6.7.297"
compile "org.rapidprom:InductiveVisualMiner:6.7.413"
compile "org.rapidprom:Log:6.7.293"
compile "org.rapidprom:LogDialog:6.5.42"
compile "org.rapidprom:LogProjection:6.5.38"
compile "org.rapidprom:ModelRepair:6.5.12"
compile "org.rapidprom:Murata:6.5.54"
compile "org.rapidprom:PetriNets:6.7.95"
compile "org.rapidprom:PNetAlignmentAnalysis:6.5.35"
compile "org.rapidprom:PNAnalysis:6.7.122"
compile "org.rapidprom:PNetReplayer:6.7.99"
compile "org.rapidprom:PTConversions:6.5.3"
compile "org.rapidprom:PomPomView:6.5.36"
compile "org.rapidprom:SocialNetwork:6.5.35"
compile "org.rapidprom:StreamAlphaMiner:6.5.15"
compile "org.rapidprom:StreamAnalysis:6.5.38"
compile "org.rapidprom:StreamInductiveMiner:6.5.42"
compile "org.rapidprom:TransitionSystems:6.7.71"
compile "org.rapidprom:TSPetriNet:6.5.35"
compile "org.rapidprom:Uma:6.5.46"
compile "org.rapidprom:Woflan:6.7.59"
compile "org.rapidprom:XESLite:6.7.217"
compile "org.rapidprom:Weka:6.7.3"
}

To deploy to Maven, use the maven plugin.
apply plugin: 'maven'
group = 'com.company'
version = '1.0.0.6'
// To build and push development snapshots, add a suffix to the name
// version = '1.0.0.6-SNAPSHOT'
artifacts {
archives jar
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(url: 'https://maven.repo/bla') {
authentication(userName: snapshotUser, password: snapshotPassword)
}
repository(url: 'https://maven.repo/bla') {
authentication(userName: releaseUser, password: releasePassword);
}
}
}
}
You can both install to a remote repository by running the uploadArchives task, (example above is https://maven.repo/bla), or install to ~/.m2/repository which is maven local using the install task.
gradle install uploadArchives
If you choose to install to maven local, you can add a dependency on maven local to other gradle projects by using dependencies { mavenLocal() }, or including it in your pom.xml
<settings <!-- bla --> >
<localRepository>${user.home}/.m2/repository</localRepository>
</settings>

Related

Dependency can't be found if gradle version is increased

We currently use gradle 5.6.4 version. After I upgrade the gradle version, above 6, I tried with 6.3 and 6.7.1, the following error occurs:
What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find com.lowagie:itext:2.1.7.js8.
Required by:
project : > net.sf.jasperreports:jasperreports:6.16.0
The dependency exists in ".gradle/caches/modules-2/files-2.1". I also tried with --refresh-dependencies flag, but nothing works. Any ideas?
I had the same issue. Some solutions which worked for me:
Adding new repositories
repositories {
mavenCentral()
maven{url "http://jasperreports.sourceforge.net/maven2/"}
maven{url "http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/"
}
dependencies {
...
implementation 'net.sf.jasperreports:jasperreports:6.16.0'
...
}
Excluding a deprecated artifact (com.lowagie)
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.16.0</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>
PS. Similar problem with itext library
I got the following build error:
Could not find com.lowagie:itext:2.1.7.js6
So I added http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/ as repository and now it works.
repositories {
mavenCentral()
maven { url "https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/" }
}
dependencies {
compile 'net.sf.jasperreports:jasperreports:6.8.0'
}
I had the same issue. I externally added the dependency for itext 2.1.7, which required for the complier.
implementation 'com.lowagie:itext:2.1.7'
implementation 'net.sf.jasperreports:jasperreports:6.17.0'

Gradle include transitive dependencies in directory

I have a java project which has a couple of dependencies, e.g.:
dependencies {
compile("com.whatever.jar:jar-1:1.2.3")
compile("com.whatever.jar:jar-2:4.5.6")
compile("com.whatever.jar:jar-3:7.8.9")
}
I package it as a jar library and publish it to the repository together with a POM file that describes those dependencies:
<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.my.project</groupId>
<artifactId>my-library</artifactId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>com.whatever.jar</groupId>
<artifactId>jar-1</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.whatever.jar</groupId>
<artifactId>jar-2</artifactId>
<version>4.5.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.whatever.jar</groupId>
<artifactId>jar-3</artifactId>
<version>7.8.9</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
I also have another project which depends on this previously built jar on compile time:
dependencies {
compileOnly("com.my.project:my-library:1.0.0")
}
I would like to create a task that builds the second project and creates a zip file containing both com.my.project:my-library:1.0.0 jar and its transitive dependencies (jar-1, jar-2 and jar-3).
task createZip << {
into('lib') {
// here I would like to do something like (it's a horrible pseudo-code):
from configurations.(com.my.project:my-library:1.0.0).jar.transitiveDependencies.files
}
}
How do I achieve that?
Edit: I also would like to access the list of my-library's transitive dependencies (and precisely those, not any other dependencies in the project) programmatically in order to build a Loader-Path manifest attribute using those.
Here’s a self-contained build.gradle script which demonstrates how your createZip task (which only adds specific dependencies to the ZIP archive) can be created:
/* make the "compileOnly" configuration available */
plugins {
id 'java'
}
/* add some demo dependencies to the project */
repositories {
jcenter()
}
dependencies {
compileOnly 'junit:junit:4.12'
compileOnly 'org.slf4j:slf4j-simple:1.7.28'
}
task createZip(type: Zip) {
// the "lib" directory in the ZIP file will only have all those dependency
// files of the "compileOnly" configuration which belong to the
// "junit:junit:4.12" module:
def depOfInterest = dependencies.create('junit:junit:4.12')
into('lib') {
from configurations.compileOnly.resolvedConfiguration.getFiles({dep ->
dep == depOfInterest
})
}
// the "justForDemonstration" directory in the ZIP file will have all
// dependency files of the "compileOnly" configuration, incl. SLF4J:
into('justForDemonstration') {
from configurations.compileOnly
}
}
This can be run with ./gradlew createZip (tested with Gradle 5.6.2). It produces the ZIP file under build/distributions/<your_project_name>.zip. Let me know if that’s what you had in mind with your pseudocode.
task uberJar(type: Jar) {
dependsOn classes
from sourceSets.main.runtimeClasspath.collect { it.directory?fileTree(it):zipTree(it)}
classifier = 'uber-jar'
}
assemble.dependsOn uberJar

Move all libs version to root gradle file in multi module gradle project

I have gradle project with modules.
-RootProject
-my-server(spring boot 2server)
-my-generator(module)
Now my root project's gradle file look like this:
group = 'com.mayprojekt'
version = '0.0.1-SNAPSHOT'
Gradle settings file look like this:
rootProject.name = 'root-project'
include 'my-generator'
include 'my-server'
my-server's gradle file look like this:
buildscript {
ext {
springBootVersion = '2.0.3.RELEASE'
cxfVersion = '3.2.2'
uuidGeneratorVersion = '3.1.5'
commonLang3Version = '3.7'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group 'com.mayprojekt'
version '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
mavenLocal()
}
bootJar {
mainClassName = 'com.mayprojekt.Application'
archiveName = 'my-server.jar'
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter'
compile "org.apache.cxf:cxf-spring-boot-starter-jaxws:${cxfVersion}"
compile "com.fasterxml.uuid:java-uuid-generator:${uuidGeneratorVersion}"
compile "org.apache.cxf:cxf-rt-features-logging:${cxfVersion}"
compile "org.apache.commons:commons-lang3:${commonLang3Version}"
compileOnly('org.projectlombok:lombok')
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("oracle:ojdbc6:11.2.0.3")
compile project(':my-generator')
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
my-generator module just module with some classes.
But I want move all libraries versions to root gradle file. I make it in maven project and I need something look like this:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring.ws.version>3.0.0.RELEASE</spring.ws.version>
<jvnet.jaxb2.maven2.version>0.13.2</jvnet.jaxb2.maven2.version>
<cxf.version>3.2.4</cxf.version>
<commons.codec.version>1.11</commons.codec.version>
<springfox.version>2.7.0</springfox.version>
<oracle.version>11.2.0.3</oracle.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
But I don know how can I make this with gradle.
Assuming your my-generator project is a gradle project, then you can do this in the root build.gradle:
...
project(':my-server') {
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
....
}
project(':my-generator') {
apply plugin: 'java'
dependencies {
compile 'org.springframework.boot:spring-boot-dependencies:2.0.2.RELEASE'
}
}
...
Using the 'project' clause, you can apply configurations only to children module projects from the root project.
using the 'allprojects' clause you can apply certain configurations to all your child module projects:
allprojects {
dependencies { ... }
}
Check this out https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-creating-a-multi-project-build/
Hope this helps

no main manifest attribute, in application.jar

I am getting the following error while spring boot jar in CI environment
java -jar application.jar
no main manifest attribute, in application.jar
The weird thing is, it does not give the issue in my local or jenkins slave. It starts all right.
It faces issue when I upload the jar to Nexus artifactory and download it on my CI environment.
Building jar using
gradle clean build -x test
My gradle.build file
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:1.2.4'
classpath 'org.ajoberstar:gradle-jacoco:0.1.0'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2'
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE")
}
}
repositories {
mavenCentral()
mavenLocal()
maven {
credentials {
username "hello"
password "world"
}
url "Nexus URL"
}
}
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'spring-boot'
apply plugin: "org.sonarqube"
apply plugin: 'jacoco'
group = 'com.company.pod'
/* Determining version from jenkins pipeline, otherwise is set to 1.0.0-SNAPSHOT */
version = new ProjectVersion(1, 0, System.env.SOURCE_BUILD_NUMBER, System.env.RELEASE_TYPE)
println(version)
class ProjectVersion {
Integer major
Integer minor
String build
String releaseType
ProjectVersion(Integer major, Integer minor, String build, String releaseType) {
this.major = major
this.minor = minor
this.build = build
this.releaseType = releaseType
}
#Override
String toString() {
String fullVersion = "$major.$minor"
if(build) {
fullVersion += ".$build"
}
else{
fullVersion += ".0"
}
if(releaseType) {
fullVersion += "-RELEASE"
}
else{
fullVersion += "-SNAPSHOT"
}
fullVersion
}
}
/*Sonarqube linting of your repository.*/
sonarqube {
properties {
property "sonar.language", "java"
}
}
/* Please don't comment out the part below
To run the same on your laptops/prod boxes/CUAT boxes, just edit the gradle.properties file.
(It will be present in the home directory of the user you are using to run gradle with.`sudo` means root user and likewise)
Enter the following lines(and yes, it will run without values, thank you gradle!)
nexusUrl=
nexusRelease=
nexusSnapshot=
nexusUsername=
nexusPassword=
*/
uploadArchives {
repositories {
mavenDeployer {
repository(url: nexusUrl+"/"+nexusRelease+"/") {
authentication(userName: nexusUsername, password: nexusPassword)
}
snapshotRepository(url: nexusUrl+"/"+nexusSnapshot+"/"){
authentication(userName: nexusUsername, password: nexusPassword)
uniqueVersion = false
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
publishing {
publications {
maven(MavenPublication) {
groupId 'com.company.something'/*This is different from group variable before*/
artifactId 'something'
version '2.0.0'
from components.java
}
}
}
/*
publishing {
repositories {
maven {
url "~/.m2/repository/"
}
}
}
*/
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
distributionUrl = "https://services.gradle.org/distributions/gradle-$GradleVersion-all.zip"
}
dependencies {
compile('org.projectlombok:lombok:1.16.6')
compile("com.company.commons:company-app:0.0.1-RELEASE")
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile("com.squareup.retrofit2:retrofit:2.0.1")
compile("com.squareup.retrofit2:converter-jackson:2.0.1")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
compile("com.getsentry.raven:raven-logback:7.2.2")
compile("org.springframework.boot:spring-boot-starter-actuator")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("com.h2database:h2")
testCompile("junit:junit")
// testCompile("org.springframework.boot:spring-boot-starter-test")
// testCompile group: 'org.hibernate', name: 'hibernate-validator', version: '4.2.0.Final'
}
Articles consulted with no vain
1. Gradle- no main manifest attribute
2. http://www.vogella.com/tutorials/Gradle/article.html#specifying-the-java-version-in-your-build-file
3. Can't execute jar- file: "no main manifest attribute"
The default packaged jar file does not contain MANIFEST file.
I don't know how to configure in Gradle, but in Maven when I added plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>vn.dung.Application</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
And it works for me.
You could change that Maven plugin config to Gradle.
i had to run gradle bootRepackage after building the jar and git a jar that I could execute!
It worked with
gradle upload -x jar
In build.gradle, I noticed boot repackaging was disabled so I enabled it :
bootRepackage {
enabled = true
}
Hi I had exactly same problem, and I found the answer in:
Spring Boot Upload BootRepackage Executable Jar
I used the solution 2
publish {
dependsOn assemble
}

Gradle mavenDeployer - how to include a separate modules code

I have a project like this:
MyProject
|-ModuleA
|-ModuleB
Module A is an Android Library that creates an aar, it has a dependency on Module B like so:
dependencies {
compile project(':ModuleB')
In ModuleA I am using mavenDepoyer to release locally:
uploadArchives {
repositories.mavenDeployer {
pom.groupId = "com.foo"
pom.artifactId = "bar"
pom.version = "1.0"
repository(url: "file://${localReleaseDest}")
}
}
This generates me an AAR file and a POM.
When uncompressed the AAR does not contain the class files from Module B
and the POM looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>bar</artifactId>
<version>1.0</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>MyProject</groupId>
<artifactId>ModuleB</artifactId>
<version>unspecified</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
As you can see this declares that the AAR has a dependency on ModuleB with an unspecified version. And so if I use this this AAR/POM as a remote, it fails to resolve the dependency ModuleB.
Error:A problem occurred configuring project ':example'.
Could not resolve all dependencies for configuration ':example:_debugCompile'.
Could not find MyProject:ModuleB:unspecified.
Searched in the following locations:
https://jcenter.bintray.com/MyProject/ModuleB/unspecified/ModuleB-unspecified.pom
https://jcenter.bintray.com/MyProject/ModuleB/unspecified/ModuleB-unspecified.jar
Required by:
Test:example:unspecified > com.foo:MyProject:1.0
I do not want it to try and resolve Module B as another dependency, I want to use the mavenDeployer to be able to create the AAR & POM with Module B included inside, since I have the source code here to do that!
Searched the web to no avail, these sites gave hints but no answer:
How to publish apks to the Maven Central with gradle?
how to tell gradle to build and upload archives of dependent projects to local maven
http://www.gradle.org/docs/current/userguide/artifact_management.html
http://gradle.org/docs/current/userguide/userguide_single.html#sub:multiple_artifacts_per_project
http://gradle.org/docs/current/userguide/userguide_single.html#deployerConfig
As far as I know, AARs don't include their dependencies (only APKs do). Instead, transitive dependency resolution will take care of resolving not only the AAR but also its dependencies. The unspecified version is most likely a result of not setting the project.version property in ModuleB.
<dependency>
<groupId>MyProject</groupId>
<artifactId>ModuleB</artifactId>
<version>unspecified</version>
<scope>compile</scope>
</dependency>
The reason is your module dependencies is below :
compile project(':module B')
to resolve this issue, you should dependens maven dep
compile 'com.xxxxxx.xxx:xxxxx:1.0.0-SHNAPSHOT'

Categories