Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build.gradle to publish both sources and javadoc
Current gradle build only publishes compiled Java classes to maven repository.
It helps java developers if sources and javadoc are also published as most Java IDEs can leverage those to provide better assistance (particularly during run-time debugging, static code analysis, and also for developers learning new api)
  • Loading branch information
gb96 authored Mar 27, 2018
commit 2f116de05efc1fc28cfffcb7ad086b9164e05b7e
26 changes: 25 additions & 1 deletion src/genjava/templates/genjava_project/build.gradle.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 %(author)s
* Copyright (C) 2014, 2018 %(author)s
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -55,6 +55,30 @@ task generateSources (type: JavaExec) {
tasks.compileJava.source outputs.files
}

task docsJar(type: Jar, dependsOn: 'javadoc') {
description = 'Archive JavaDoc for %(project_name)s'
from javadoc.destinationDir
classifier = 'javadoc'
}

task sourceJar(type: Jar, dependsOn: 'classes') {
description = 'Archive Source files for %(project_name)s'
from sourceSets.main.allSource
classifier = 'sources'
}

publishing {
publications {
mavenJava(MavenPublication) {
// compiled classes jar is published to maven by default
// also publish -sources.jar
artifact sourceJar
// also publish -javadoc.jar
artifact docsJar
}
}
}

dependencies {
compile 'org.ros.rosjava_bootstrap:message_generation:[0.2,0.3)'
%(msg_dependencies)s
Expand Down