public static ApplicationWithPrograms deployApplicationWithManager(Id.Namespace namespace, Class<?> appClass, Supplier<File> folderSupplier, Config config) throws Exception { ensureNamespaceExists(namespace.toEntityId()); Location deployedJar = createAppJar(appClass, folderSupplier); ArtifactVersion artifactVersion = new ArtifactVersion(String.format("1.0.%d", System.currentTimeMillis())); ArtifactId artifactId = new ArtifactId(appClass.getSimpleName(), artifactVersion, ArtifactScope.USER); ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(artifactId, deployedJar); ArtifactRepository artifactRepository = getInjector().getInstance(ArtifactRepository.class); artifactRepository.addArtifact(Id.Artifact.fromEntityId(Artifacts.toArtifactId(namespace.toEntityId(), artifactId)), new File(deployedJar.toURI())); AppDeploymentInfo info = new AppDeploymentInfo(artifactDescriptor, namespace.toEntityId(), appClass.getName(), null, null, config == null ? null : new Gson().toJson(config)); return getLocalManager().deploy(info).get(); }