@BeforeClass
    public static void BuildLocalMavenRepo() throws Exception {
        //This function create a Localhost fake Maven Repository, hosting a single Test Plugin

        //Get Test plugin file
        File sourcePlugin = new File("src/test/resources/io/apiman/gateway/platforms/vertx3/engine/plugin-with-policyDefs.war");
        if (!sourcePlugin.exists()) {
            throw new Exception("Failed to find test plugin war at: " + sourcePlugin.getAbsolutePath());
        }

        //Create Local Maven Repository folder
        File repoFolder = Files.createTempDirectory("MockedMavenRepo").toFile();

        //Define Test plugin coordinates
        PluginCoordinates coordinates = PluginCoordinates.fromPolicySpec(testPluginCoordinates);

        //Build Test Plugin path in local Maven Repository folder
        File PluginFile = new File(repoFolder, PluginUtils.getMavenPath(coordinates));
        PluginFile.getParentFile().mkdirs();

        //Copy Test Plugin war into repository
        FileUtils.copyFile(sourcePlugin, PluginFile);

        //Create local Maven Repository Web Server
        mavenServer = new Server();
        ServerConnector connector = new ServerConnector(mavenServer);
        // auto-bind to available port
        connector.setPort(0);
        connector.setHost("0.0.0.0");
        mavenServer.addConnector(connector);

        //Add classic ressource handler
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setDirectoriesListed(true);
        resourceHandler.setWelcomeFiles(new String[]{"index.html"});
        PathResource pathResource = new PathResource(repoFolder);
        resourceHandler.setBaseResource(pathResource);

        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{resourceHandler, new DefaultHandler()});
        mavenServer.setHandler(handlers);

        //Start local Maven Repository Server
        mavenServer.start();

        // Determine Base URI for Server
        String host = connector.getHost();
        if (host == null || host == "0.0.0.0") host = "127.0.0.1";
        int port = connector.getLocalPort();
        mavenServerUri = new URI(String.format("http://%s:%d/", host, port));
    }
Build and start a fake local Maven Repository server based on Jetty

@throws Exception
gateway/platforms/vertx3/vertx3/src/test/java/io/apiman/gateway/platforms/vertx3/engine/VertxPluginRegistryTest.java