Skip to content

Commit

Permalink
test(maven-central): 升级ihub-publish组件,支持发布maven-central仓库 (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
henry-hub authored Jul 28, 2024
1 parent 9822d34 commit d04e6b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class IHubPublishPlugin extends IHubProjectPluginAware<IHubPublishExtension> {
withExtension(MavenCentralExtension) {
it.repoDir.set project.layout.buildDirectory.dir(REPOS_BUNDLES)
it.authToken.set Base64.encoder.encodeToString((iHubExt.repoUsername.orNull + ':' + iHubExt.repoPassword.orNull).bytes)
// TODO 测试发布手动,后续改为自动发布
it.publishingType.set 'USER_MANAGED'
}
withTask(PublishToCentralPortalTask) {
project.tasks.getByName(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME).finalizedBy it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,31 @@ iHubPublish.publishDocs=true
result.output.contains 'BUILD SUCCESSFUL'
}

def '中央仓库Publish配置测试'() {
setup: '初始化项目'
copyProject 'basic.gradle'
buildFile << '''
apply {
plugin 'java'
plugin 'pub.ihub.plugin.ihub-publish'
}
'''

when: '构建项目'
propertiesFile << '''
iHub.releaseRepoUrl=https://ihub.pub/nexus/content/repositories/releases
iHub.snapshotRepoUrl=https://ihub.pub/nexus/content/repositories/snapshots
'''
def result = gradleBuilder.withArguments("-DiHubPublish.publishMavenCentral=$publishMavenCentral",
'-DiHub.repoUsername=username', '-DiHub.repoPassword=password').build()

then: '检查结果'
result.output.contains 'BUILD SUCCESSFUL'

where:
publishMavenCentral << [true, false]
}

def '版本目录组件Publish配置测试'() {
setup: '初始化项目'
buildFile << '''
Expand Down

0 comments on commit d04e6b9

Please sign in to comment.