I’m trying to create a gradle file in order to publish my artifacts (.jar
, sources.jar
and javadoc.jar
).
Up to now, I’ve been able to write this gradle file:
plugins {
id 'java'
id 'eclipse'
id 'maven-publish'
id 'net.nemerosa.versioning' version '2.5.1'
}
targetCompatibility = 1.8
eclipse {
project {
name = 'OAuthz Library'
natures 'org.eclipse.buildship.core.gradleprojectnature'
}
classpath {
downloadSources = true
downloadJavadoc = true
defaultOutputDir = file('build-eclipse')
}
jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'org.codehaus.jettison:jettison:1.3.7'
compile 'org.apache.directory.api:api-all:1.0.0-M30'
compile 'com.whalin:Memcached-Java-Client:3.0.2'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '2.14.3'
compile 'commons-configuration:commons-configuration:1.10'
}
group = 'com.living'
version = versioning.info.display
manifest {
attributes 'Implementation-Title': 'OAuthz Library'
}
publishing {
publications {
mavenJava(MavenPublication) {
}
}
repositories {
maven {
credentials {
username 'user'
password 'passwd'
}
url "$url"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.1'
}
I’ve been able to publish my package on repository, nevertheless:
1. The published package is telling me that it has no dependencies.
2. I'd like to publish sources and java docs artifacts.
Any ideas?