diff --git a/build.gradle b/build.gradle index 51f754a..a1b1bf3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'com.nongfenqi.nexus.plugin' -version '1.0.1' +version '1.0.3' apply plugin: 'java' @@ -24,9 +24,9 @@ repositories { dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' - compileOnly group: 'org.sonatype.nexus', name: 'nexus-plugin-api', version: '3.20.1-01' - compileOnly group: 'org.sonatype.nexus', name: 'nexus-repository', version: '3.20.1-01' - compileOnly group: 'org.sonatype.nexus', name: 'nexus-rest', version: '3.20.1-01' + compileOnly group: 'org.sonatype.nexus', name: 'nexus-plugin-api', version: '3.29.2-02' + compileOnly group: 'org.sonatype.nexus', name: 'nexus-repository', version: '3.29.2-02' + compileOnly group: 'org.sonatype.nexus', name: 'nexus-rest', version: '3.29.2-02' compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.16.18' } diff --git a/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckMavenResource.java b/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckMavenResource.java index 5a3ecec..88e202b 100644 --- a/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckMavenResource.java +++ b/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckMavenResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 黑牛 + * Copyright 2017 * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the @@ -17,7 +17,6 @@ */ package com.nongfenqi.nexus.plugin.rundeck; -import com.google.common.base.Supplier; import org.apache.http.client.utils.DateUtils; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.index.query.BoolQueryBuilder; @@ -38,9 +37,19 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; -import javax.ws.rs.*; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkNotNull; @@ -114,11 +123,13 @@ public Response content( return commitAndReturn(NOT_FOUND, tx); } + String folderVersion = version.replaceAll("-\\d{8}\\.\\d{6}\\-\\d+", "-SNAPSHOT"); String fileName = artifactId + "-" + version + (isBlank(classifier) ? "" : ("-" + classifier)) + "." + extension; String path = groupId.replace(".", "/") + "/" + artifactId + - "/" + version + + "/" + folderVersion + "/" + fileName; + Asset asset = tx.findAssetWithProperty("name", path, bucket); log.debug("rundeck download asset: {}", asset); if (null == asset) { diff --git a/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckXO.java b/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckXO.java index 346c355..95491a9 100644 --- a/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckXO.java +++ b/src/main/java/com/nongfenqi/nexus/plugin/rundeck/RundeckXO.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 黑牛 + * Copyright 2017 * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the