将Nexus 3.7插件升级适配3.9版本时Rest接口404问题求助
Got it, let’s work through this issue step by step. You’re right that Sonatype removed the siesta prefix from their REST API in Nexus 3.9+, but that’s only one piece of the puzzle—here are the critical changes you need to make to get your custom plugin working:
1. Update API Annotations & Dependencies
Siesta was a custom framework Sonatype used for REST endpoints; Nexus 3.9+ switched to standard JAX-RS. So:
- Replace Siesta-specific imports like
org.sonatype.siesta.Resourcewith JAX-RS standard ones (e.g.,javax.ws.rs.Path,javax.ws.rs.GET,javax.ws.rs.core.Application). - Remove any
siesta-coreor related Siesta dependencies from your build config (pom.xml or gradle script) and replace them with the JAX-RS API dependency matching Nexus 3.9.0-01’s version (usuallyjavax.ws.rs:javax.ws.rs-api:2.1or similar).
2. Adjust REST Resource Registration
Siesta handled resource registration automatically, but now you need to use JAX-RS’s standard application registration:
- Create a new class that extends
javax.ws.rs.core.Application, override thegetClasses()method, and return your REST resource class(es) in the list. - Update your plugin’s descriptor (like
nexus-plugin.xml) to register this Application class instead of the old Siesta Resource type.
3. Verify Endpoint Paths
Even after removing siesta from the URL, double-check your @Path annotations:
- Nexus 3.9+ custom REST endpoints typically sit under the
/service/rest/base path. For example, if your old endpoint was/siesta/rundeck/options, your new@Pathshould be something like/rundeck/options(Nexus will automatically prepend/service/rest/if registered correctly). - Use Nexus’s built-in API browser (usually at
/service/rest/swagger-ui/) to check if your endpoint appears in the list—if it doesn’t, it’s not being registered properly.
4. Fix Permission & Access Controls
Siesta had its own permission annotations, which might not work anymore:
- Replace any Siesta-specific permission annotations (like
@RequiresPermissions) with Nexus’s current permission system (e.g.,org.sonatype.nexus.security.authz.annotation.RequiresPermission). - Ensure the permissions your plugin uses are correctly defined and assigned in Nexus—sometimes a 404 can actually be a permission denial masquerading as a missing endpoint.
5. Debug with Nexus Logs
Turn on debug logging for Nexus’s REST layer to see what’s going wrong:
- Enable debug logs for
org.sonatype.nexus.restin Nexus’s log configuration. - Check
nexus.logfor errors during plugin loading or endpoint registration—you might see messages about missing dependencies, failed registration, or invalid path mappings that explain the 404.
内容的提问来源于stack exchange,提问作者John Williams

