迁移 Nexus 存储库上的未分配作业
升级 Talend Administration Center 后,您需要迁移已经发布到 Nexus 存储库的未分配作业,然后才能在新的 Talend Administration Center 中执行它们。
开始之前
步骤
结果
排错: 如果迁移失败,并且未显示任何错误消息,请尝试以下步骤。
- 以管理员身份登录到 Nexus Repository Manager。
- 单击 Server Administration and Configuration (服务器管理和配置) 按钮。
- 滚动至 Update stored script by name (按名称更新存储的脚本) API。
- 在 name (名称) 参数值中写入 search。
- 如果尚无搜索脚本,将以下搜索脚本粘贴到 body (主体) 参数的 value (值) 中:
{ "name": "search", "content": "import org.sonatype.nexus.repository.storage.Query; import org.sonatype.nexus.repository.storage.StorageFacet; import org.sonatype.nexus.repository.storage.Query.Builder; import groovy.json.JsonOutput; import groovy.json.JsonSlurper; def search = new JsonSlurper().parseText(args); log.info('search arguments: ' + args); def repositoryId = search.repositoryId; def groupId = search.g; def artifactId = search.a; def version = search.v; def data = []; def repo = repository.repositoryManager.get(repositoryId); StorageFacet storageFacet = repo.facet(StorageFacet); def tx = storageFacet.txSupplier().get(); tx.begin(); def builder = Query.builder(); if(groupId != null){ builder.where('group = ').param(groupId); }; if(version != null){ if(builder.hasWhere()){ builder.and('version = ').param(version); }else{ builder.where('version = ').param(version); } }; if(artifactId != null){ artifactId =[artifactId]; log.info('artifactId: ' + artifactId); if(builder.hasWhere()){ builder.and('name in ').param(artifactId); }else{ builder.where('name in ').param(artifactId); } }; def query = builder.build() ; log.info('query: ' + query.getParameters()); log.info('query: ' + query.getWhere()); def components = tx.findComponents(query , [repo]); components.each{ ArtifactResult artifact = new ArtifactResult(); artifact.groupId = it.attributes().child('maven2').get('groupId'); artifact.artifactId = it.attributes().child('maven2').get('artifactId'); artifact.version = it.attributes().child('maven2').get('baseVersion'); artifact.extension = it.attributes().child('maven2').get('packaging'); artifact.last_updated = it.lastUpdated(); artifact.description = it.attributes().child('maven2').get('pom_description'); log.info('search arguments: ' + it.attributes()); log.info('search getProperties: ' + it.getProperties()); log.info('search getEntityMetadata: ' + it.getEntityMetadata()); log.info('search getMetaPropertyValues: ' + it.getMetaPropertyValues()); data << artifact; }; tx.commit(); tx.close(); return JsonOutput.toJson(data); class ArtifactResult{ String groupId; String artifactId; String version; String extension; String last_updated; String description; } ", "type": "groovy" }
- 单击 Try it out! (试用)。