diff --git a/ihub-publish/src/main/groovy/pub/ihub/plugin/publish/IHubPublishPlugin.groovy b/ihub-publish/src/main/groovy/pub/ihub/plugin/publish/IHubPublishPlugin.groovy index 7139e0db..78c803fb 100644 --- a/ihub-publish/src/main/groovy/pub/ihub/plugin/publish/IHubPublishPlugin.groovy +++ b/ihub-publish/src/main/groovy/pub/ihub/plugin/publish/IHubPublishPlugin.groovy @@ -80,8 +80,6 @@ class IHubPublishPlugin extends IHubProjectPluginAware { 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 diff --git a/ihub-publish/src/test/groovy/pub/ihub/plugin/publish/IHubPublishPluginTest.groovy b/ihub-publish/src/test/groovy/pub/ihub/plugin/publish/IHubPublishPluginTest.groovy index cb961318..e7dd4c3f 100644 --- a/ihub-publish/src/test/groovy/pub/ihub/plugin/publish/IHubPublishPluginTest.groovy +++ b/ihub-publish/src/test/groovy/pub/ihub/plugin/publish/IHubPublishPluginTest.groovy @@ -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 << '''