0
최신 넥서스 버전을 사용하고 있으며 클린업 작업을 만들고 싶습니다.Nexus Sonatype에서 groovy로 자산 및 구성 요소 삭제
트랜잭션 개체에서 가져온 iterable 구성 요소 목록을 통해 실행되는 그루비 스크립트가 있습니다.
이제 구성 요소에 자산을 찾은 다음 자산과 구성 요소를 삭제하고 싶습니다.
내 스크립트는 다음과 같습니다
// Get a repository
def repo = repository.repositoryManager.get('maven-releases');
// Get a database transaction
def tx = repo.facet(StorageFacet).txSupplier().get();
// Begin the transaction
tx.begin();
def components = tx.browseComponents(tx.findBucket(repo));
// retention date
def retentionDate = new DateTime();
retentionDate.minusDays(1);
components.each{comp ->
def lastComp = comp.group() + comp.name();
def lastModDate = comp.lastUpdated();
if(lastModDate.isBefore(retentionDate)) {
// here -----------
// tx.deleteAsset(<asset>)
// -----------------
tx.deleteComponent(comp);
log.info("${lastComp} deleted!");
}
log.info("anz: ${assetCount} ${comp.version()} - ${lastModDate} - ${retentionDate}");
}
// End the transaction*/
tx.commit();
는 구성 요소에 해당하는 자산을 찾을 수 있습니까?