fixed CI job task
This commit is contained in:
parent
5bb128000f
commit
c349551fc3
63
build.gradle
63
build.gradle
|
@ -92,42 +92,8 @@ ext {
|
||||||
if ( project.hasProperty( 'hibernatePublishPassword' ) ) {
|
if ( project.hasProperty( 'hibernatePublishPassword' ) ) {
|
||||||
credentials.hibernatePublishPassword = project.property( 'hibernatePublishPassword' )
|
credentials.hibernatePublishPassword = project.property( 'hibernatePublishPassword' )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( project.hasProperty( 'hibernateSnapshotsUsername' ) ) {
|
|
||||||
credentials.hibernateSnapshotsUsername = project.property( 'hibernateSnapshotsUsername' )
|
|
||||||
}
|
|
||||||
if ( project.hasProperty( 'hibernateSnapshotsPassword' ) ) {
|
|
||||||
credentials.hibernateSnapshotsPassword = project.property( 'hibernateSnapshotsPassword' )
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.taskGraph.addTaskExecutionGraphListener(
|
|
||||||
new TaskExecutionGraphListener() {
|
|
||||||
@Override
|
|
||||||
void graphPopulated(TaskExecutionGraph graph) {
|
|
||||||
// make sure the needed username/password pair is available based on whether
|
|
||||||
// we are trying to perform a release or snapshot publishing (if either)
|
|
||||||
if ( graph.hasTask( 'publishMavenJavaPublicationToSnapshotRepository' ) ) {
|
|
||||||
if ( ! project.hcannVersion.isSnapshot ) {
|
|
||||||
throw new GradleException("Cannot publish non-snapshot version to snapshot repository");
|
|
||||||
}
|
|
||||||
if ( project.credentials.hibernateSnapshotsUsername == null ) {
|
|
||||||
throw new GradleException("Snapshot publishing credentials not specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (graph.hasTask('publishMavenJavaPublicationToOssrhRepository')) {
|
|
||||||
if ( project.hcannVersion.isSnapshot ) {
|
|
||||||
throw new GradleException("Cannot publish snapshot version to non-snapshot repository");
|
|
||||||
}
|
|
||||||
if (project.credentials.hibernatePublishUsername == null) {
|
|
||||||
throw new GradleException("Publishing credentials not specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
nexusPublishing {
|
nexusPublishing {
|
||||||
repositories {
|
repositories {
|
||||||
sonatype {
|
sonatype {
|
||||||
|
@ -137,6 +103,35 @@ nexusPublishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gradle.taskGraph.addTaskExecutionGraphListener(
|
||||||
|
new TaskExecutionGraphListener() {
|
||||||
|
@Override
|
||||||
|
void graphPopulated(TaskExecutionGraph graph) {
|
||||||
|
String[] tasksToLookFor = [
|
||||||
|
'publish',
|
||||||
|
'publishToSonatype',
|
||||||
|
'publishAllPublicationsToSonatype',
|
||||||
|
'publishPublishedArtifactsPublicationToSonatypeRepository',
|
||||||
|
'publishRelocationArtifactsPublicationToSonatypeRepository',
|
||||||
|
]
|
||||||
|
|
||||||
|
for ( String taskToLookFor : tasksToLookFor ) {
|
||||||
|
if ( graph.hasTask( taskToLookFor ) ) {
|
||||||
|
// trying to publish - make sure the needed tokens are available
|
||||||
|
|
||||||
|
if ( project.credentials.hibernatePublishUsername == null ) {
|
||||||
|
throw new GradleException( "Publishing credentials not specified" );
|
||||||
|
}
|
||||||
|
if ( project.credentials.hibernatePublishPassword == null ) {
|
||||||
|
throw new GradleException( "Publishing credentials not specified" );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -88,19 +88,28 @@ else {
|
||||||
tasks.release.dependsOn( tasks.publishPlugins )
|
tasks.release.dependsOn( tasks.publishPlugins )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
// look for command-line overrides of the username/password pairs for publishing
|
||||||
|
if ( project.hasProperty( 'hibernatePluginPortalUsername' ) ) {
|
||||||
|
credentials.hibernatePluginPortalUsername = project.property( 'hibernatePluginPortalUsername' )
|
||||||
|
}
|
||||||
|
if ( project.hasProperty( 'hibernatePluginPortalPassword' ) ) {
|
||||||
|
credentials.hibernatePluginPortalPassword = project.property( 'hibernatePluginPortalPassword' )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.publishPlugins {
|
tasks.publishPlugins {
|
||||||
doFirst {
|
doFirst {
|
||||||
if ( project.'gradle.publish.key' == null ) {
|
if ( credentials.hibernatePluginPortalUsername == null ) {
|
||||||
throw new RuntimeException( "`gradle.publish.key` not found" )
|
throw new RuntimeException( "`hibernatePluginPortalUsername` not found" )
|
||||||
}
|
}
|
||||||
if ( project.'gradle.publish.secret' == null ) {
|
if ( credentials.hibernatePluginPortalPassword == null ) {
|
||||||
throw new RuntimeException( "`gradle.publish.secret` not found" )
|
throw new RuntimeException( "`hibernatePluginPortalPassword` not found" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// for SNAPSHOT version
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
plugin( MavenPublication ) {
|
plugin( MavenPublication ) {
|
||||||
|
|
Loading…
Reference in New Issue