hibernate-orm/gradle/published-java-module.gradle

63 lines
1.8 KiB
Groovy

/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/publishing.gradle' )
tasks.register("publishReleaseArtifacts") {
// mirror for `:release:publishReleaseArtifacts`
dependsOn tasks.release
}
configurations {
javadocSources {
description = "All Java sources for the project's Javadoc"
canBeConsumed = true
canBeResolved = false
visible = false
}
}
dependencies {
javadocSources sourceSets.main.allJava
}
java {
// Configure the Java "software component" to include javadoc and sources jars in addition to the classes jar.
// Ultimately, this component is what makes up the publication for this project.
withJavadocJar()
withSourcesJar()
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Publishing
var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension
publishingExtension.publications.named("publishedArtifacts", MavenPublication) {
// Add the Java component to the main publication
from components.java
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release / publishing tasks
tasks.register('ciBuild') {
dependsOn test, tasks.publishToSonatype
}
tasks.release.dependsOn tasks.test, tasks.publishToSonatype
tasks.preVerifyRelease.dependsOn build
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
tasks.publishToSonatype.mustRunAfter test