2

Since the new version of Nexus has no more REST functionality to search the repositories for artifacts my idea is to use a Groovy script to build "my own REST" system. Currently I am trying to post a script that looks like this:

@Singleton
class NexusSearch extends Script {
    @Inject
    SearchService service;

    def run() {
        assert service != null;
        return args;
    }
}

My problem is that service stays null and I don't know if injection would ever work in scripts. Is this the right approach? If yes what am I doing wrong, if not what would be the right approach?

2 Answers2

1

After checking internally, you can't do injection directly in scripts, but you can use container.lookup(className)

DarthHater
  • 3,222
  • 25
  • 26
0

To come back to this and attempt to be future helpful, the REST API is now in beta, and you can give us some great feedback about it:

http://blog.sonatype.com/nexus-repository-new-beta-rest-api-for-content

Try this out now, given you were looking for it originally.

DarthHater
  • 3,222
  • 25
  • 26