0
私たちは最新のリリースのnexusを使用していますので、私はクリーンアップタスクを作成します。Nexus Sonatypeのgroovyでアセットとコンポーネントを削除
私は、トランザクションオブジェクトから取得した反復可能なコンポーネントリストを実行するグルーヴィースクリプトを持っています。
私はコンポーネントにアセットを見つけて、アセットとコンポーネントを削除したいと思います。
私のスクリプトは次のようになります。
// 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();
それはコンポーネントに対応する資産を見つけることは可能ですか?