List of usage examples for org.eclipse.jgit.api Git init
public static InitCommand init()
From source file:au.id.soundadvice.systemdesign.versioning.jgit.GitVersionControl.java
License:Open Source License
public static void init(Path path) throws GitAPIException { Git repo = Git.init().setDirectory(path.toFile()).call(); try {//from w ww . j av a 2 s . com repo.add().addFilepattern(".").call(); } finally { repo.close(); } }
From source file:com.binarybirchtree.contributionart.Repository.java
License:Open Source License
public Repository(Path directory, String name, String email) throws IOException, GitException { this.directory = directory; this.name = name; this.email = email; try {/*from ww w.j a v a 2s. co m*/ Git.init().setDirectory(directory.toFile()).setBare(false).call(); git = Git.open(directory.toFile()); LOGGER.info(String.format("Initialized Git repository at '%s'.", directory)); } catch (GitAPIException error) { throw new GitException(error.toString()); } }
From source file:com.buildautomation.jgit.api.InitRepository.java
License:Apache License
public static void initRepository() throws IOException, GitAPIException { // run the init-call File dir = File.createTempFile("gitinit", ".test"); if (!dir.delete()) { throw new IOException("Could not delete file " + dir); }/*from ww w . j a va 2 s . co m*/ // The Git-object has a static method to initialize a new repository try (Git git = Git.init().setDirectory(dir).call()) { System.out.println("Created a new repository at " + git.getRepository().getDirectory()); } dir = File.createTempFile("repoinit", ".test"); if (!dir.delete()) { throw new IOException("Could not delete file " + dir); } // you can also create a Repository-object directly from the try (Repository repository = FileRepositoryBuilder.create(new File(dir.getAbsolutePath(), ".git"))) { System.out.println("Created a new repository at " + repository.getDirectory()); } }
From source file:com.chungkwong.jgitgui.Main.java
License:Open Source License
private void gitInit() { try {// www. jav a 2 s. c o m File dir = dirChooser.showDialog(null); if (dir != null) navigationRoot.getChildren().add(new GitTreeItem(Git.init().setDirectory(dir).call())); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); Util.informUser(ex); } }
From source file:com.gitblit.utils.JGitUtils.java
License:Apache License
/** * Creates a bare, shared repository./*from www . ja v a2 s . c om*/ * * @param repositoriesFolder * @param name * @param shared * the setting for the --shared option of "git init". * @return Repository */ public static Repository createRepository(File repositoriesFolder, String name, String shared) { try { Repository repo = null; try { Git git = Git.init().setDirectory(new File(repositoriesFolder, name)).setBare(true).call(); repo = git.getRepository(); } catch (GitAPIException e) { throw new RuntimeException(e); } GitConfigSharedRepository sharedRepository = new GitConfigSharedRepository(shared); if (sharedRepository.isShared()) { StoredConfig config = repo.getConfig(); config.setString("core", null, "sharedRepository", sharedRepository.getValue()); config.setBoolean("receive", null, "denyNonFastforwards", true); config.save(); if (!JnaUtils.isWindows()) { Iterator<File> iter = org.apache.commons.io.FileUtils.iterateFilesAndDirs(repo.getDirectory(), TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); // Adjust permissions on file/directory while (iter.hasNext()) { adjustSharedPerm(iter.next(), sharedRepository); } } } return repo; } catch (IOException e) { throw new RuntimeException(e); } }
From source file:com.meltmedia.cadmium.blackbox.test.GitBareRepoInitializer.java
License:Apache License
public void init(String repoPath, String sourceDir, String sourceConfigDir) throws Exception { File repoDir = new File(repoPath); if (repoDir.exists()) { FileUtils.forceDelete(repoDir);//from w w w . j a v a 2s . c o m } File checkoutDir = new File(repoDir.getAbsoluteFile().getParent(), repoDir.getName() + ".checkout"); if (checkoutDir.exists()) { FileUtils.forceDelete(checkoutDir); } checkoutPath = checkoutDir.getAbsolutePath(); InitCommand init = Git.init(); init.setBare(true); init.setDirectory(repoDir); bareRepo = init.call(); clonedGit = GitService.cloneRepo(repoPath, checkoutPath); clonedGit.checkinNewContent(sourceConfigDir, "Initial commit"); clonedGit.push(false); clonedGit.newEmtpyRemoteBranch("cd-master"); clonedGit.switchBranch("cd-master"); clonedGit.checkinNewContent(sourceDir, "Initial commit"); clonedGit.push(false); clonedGit.newEmtpyRemoteBranch("cfg-master"); clonedGit.switchBranch("cfg-master"); clonedGit.checkinNewContent(sourceConfigDir, "Initial commit"); clonedGit.push(false); }
From source file:com.meltmedia.cadmium.core.git.GitServiceTest.java
License:Apache License
@Before public void createDirForTests() throws Exception { configManager.setDefaultProperties(new Properties()); testDir = new File("./target/git-test"); if (!testDir.exists()) { if (testDir.mkdir()) { gitRepo1 = new File(testDir, "checkout1"); git1 = GitService.cloneRepo("git://github.com/meltmedia/test-content-repo.git", gitRepo1.getAbsolutePath()); gitRepo2 = new File(testDir, "checkout2"); git2 = GitService.cloneRepo("git://github.com/meltmedia/test-content-repo.git", gitRepo2.getAbsolutePath()); gitRepo3 = new File(testDir, "checkout3"); git3 = GitService.cloneRepo("git://github.com/meltmedia/test-content-repo.git", gitRepo3.getAbsolutePath()); localGitRepo = new File(testDir, "local-git"); localGitRepo.mkdirs();/*from w w w .ja v a 2 s.co m*/ new File(localGitRepo, "delete.me").createNewFile(); new File(localGitRepo, "dir1").mkdirs(); new File(localGitRepo, "dir1/remove.me").createNewFile(); localGit = new GitService(Git.init().setDirectory(localGitRepo).call()); AddCommand add = localGit.git.add(); add.addFilepattern("delete.me"); add.addFilepattern("dir1"); add.call(); localGit.git.commit().setMessage("initial commit").call(); localGit.git.branchCreate().setName("test").call(); localGit.git.branchCreate().setName("test-delete").call(); localGitRepoCloned = new File(testDir, "local-git-cloned"); localClone = GitService.cloneRepo( new File(localGitRepo, ".git").getAbsoluteFile().getAbsolutePath(), localGitRepoCloned.getAbsoluteFile().getAbsolutePath()); } else { throw new Exception("Failed to set up tests"); } } else { gitRepo1 = new File(testDir, "checkout1"); git1 = GitService.createGitService(new File(gitRepo1, ".git").getAbsolutePath()); gitRepo2 = new File(testDir, "checkout2"); git2 = GitService.createGitService(new File(gitRepo2, ".git").getAbsolutePath()); gitRepo3 = new File(testDir, "checkout3"); git3 = GitService.createGitService(new File(gitRepo3, ".git").getAbsolutePath()); localGitRepo = new File(testDir, "local-git"); localGit = GitService.createGitService(new File(localGitRepo, ".git").getAbsolutePath()); localGitRepoCloned = new File(testDir, "local-git-cloned"); localClone = GitService.createGitService(new File(localGitRepoCloned, ".git").getAbsolutePath()); } File source = new File(testDir, "source"); source.mkdirs(); source = new File(source, "other.file"); source.createNewFile(); source = new File(testDir, "source/dir2"); source.mkdirs(); source = new File(source, "other.file"); source.createNewFile(); source = new File(testDir, "source2"); source.mkdirs(); source = new File(source, "other2.file"); source.createNewFile(); source = new File(testDir, "source2/dir3"); source.mkdirs(); source = new File(source, "other2.file"); source.createNewFile(); }
From source file:com.microsoft.azure.management.appservice.samples.ManageFunctionAppSourceControl.java
License:Open Source License
/** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully *///from w ww .jav a 2 s . c o m public static boolean runSample(Azure azure) { // New resources final String suffix = ".azurewebsites.net"; final String app1Name = SdkContext.randomResourceName("webapp1-", 20); final String app2Name = SdkContext.randomResourceName("webapp2-", 20); final String app3Name = SdkContext.randomResourceName("webapp3-", 20); final String app4Name = SdkContext.randomResourceName("webapp4-", 20); final String app1Url = app1Name + suffix; final String app2Url = app2Name + suffix; final String app3Url = app3Name + suffix; final String app4Url = app4Name + suffix; final String rgName = SdkContext.randomResourceName("rg1NEMV_", 24); try { //============================================================ // Create a function app with a new app service plan System.out.println("Creating function app " + app1Name + " in resource group " + rgName + "..."); FunctionApp app1 = azure.appServices().functionApps().define(app1Name).withRegion(Region.US_WEST) .withNewResourceGroup(rgName).create(); System.out.println("Created function app " + app1.name()); Utils.print(app1); //============================================================ // Deploy to app 1 through FTP System.out.println("Deploying a function app to " + app1Name + " through FTP..."); Utils.uploadFileToFunctionApp(app1.getPublishingProfile(), "host.json", ManageFunctionAppSourceControl.class.getResourceAsStream("/square-function-app/host.json")); Utils.uploadFileToFunctionApp(app1.getPublishingProfile(), "square/function.json", ManageFunctionAppSourceControl.class .getResourceAsStream("/square-function-app/square/function.json")); Utils.uploadFileToFunctionApp(app1.getPublishingProfile(), "square/index.js", ManageFunctionAppSourceControl.class .getResourceAsStream("/square-function-app/square/index.js")); // sync triggers app1.syncTriggers(); System.out.println("Deployment square app to function app " + app1.name() + " completed"); Utils.print(app1); // warm up System.out.println("Warming up " + app1Url + "/api/square..."); post("http://" + app1Url + "/api/square", "625"); Thread.sleep(5000); System.out.println("CURLing " + app1Url + "/api/square..."); System.out.println("Square of 625 is " + post("http://" + app1Url + "/api/square", "625")); //============================================================ // Create a second function app with local git source control System.out .println("Creating another function app " + app2Name + " in resource group " + rgName + "..."); AppServicePlan plan = azure.appServices().appServicePlans().getById(app1.appServicePlanId()); FunctionApp app2 = azure.appServices().functionApps().define(app2Name).withExistingAppServicePlan(plan) .withExistingResourceGroup(rgName).withExistingStorageAccount(app1.storageAccount()) .withLocalGitSourceControl().create(); System.out.println("Created function app " + app2.name()); Utils.print(app2); //============================================================ // Deploy to app 2 through local Git System.out.println("Deploying a local Tomcat source to " + app2Name + " through Git..."); PublishingProfile profile = app2.getPublishingProfile(); Git git = Git.init() .setDirectory(new File( ManageFunctionAppSourceControl.class.getResource("/square-function-app/").getPath())) .call(); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); PushCommand command = git.push(); command.setRemote(profile.gitUrl()); command.setCredentialsProvider( new UsernamePasswordCredentialsProvider(profile.gitUsername(), profile.gitPassword())); command.setRefSpecs(new RefSpec("master:master")); command.setForce(true); command.call(); System.out.println("Deployment to function app " + app2.name() + " completed"); Utils.print(app2); // warm up System.out.println("Warming up " + app2Url + "/api/square..."); post("http://" + app2Url + "/api/square", "725"); Thread.sleep(5000); System.out.println("CURLing " + app2Url + "/api/square..."); System.out.println("Square of 725 is " + post("http://" + app2Url + "/api/square", "725")); //============================================================ // Create a 3rd function app with a public GitHub repo in Azure-Samples System.out.println("Creating another function app " + app3Name + "..."); FunctionApp app3 = azure.appServices().functionApps().define(app3Name).withExistingAppServicePlan(plan) .withNewResourceGroup(rgName).withExistingStorageAccount(app2.storageAccount()) .defineSourceControl() .withPublicGitRepository("https://github.com/jianghaolu/square-function-app-sample") .withBranch("master").attach().create(); System.out.println("Created function app " + app3.name()); Utils.print(app3); // warm up System.out.println("Warming up " + app3Url + "/api/square..."); post("http://" + app3Url + "/api/square", "825"); Thread.sleep(5000); System.out.println("CURLing " + app3Url + "/api/square..."); System.out.println("Square of 825 is " + post("http://" + app3Url + "/api/square", "825")); //============================================================ // Create a 4th function app with a personal GitHub repo and turn on continuous integration System.out.println("Creating another function app " + app4Name + "..."); FunctionApp app4 = azure.appServices().functionApps().define(app4Name).withExistingAppServicePlan(plan) .withExistingResourceGroup(rgName).withExistingStorageAccount(app3.storageAccount()) // Uncomment the following lines to turn on 4th scenario //.defineSourceControl() // .withContinuouslyIntegratedGitHubRepository("username", "reponame") // .withBranch("master") // .withGitHubAccessToken("YOUR GITHUB PERSONAL TOKEN") // .attach() .create(); System.out.println("Created function app " + app4.name()); Utils.print(app4); // warm up System.out.println("Warming up " + app4Url + "..."); curl("http://" + app4Url); Thread.sleep(5000); System.out.println("CURLing " + app4Url + "..."); System.out.println(curl("http://" + app4Url)); return true; } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } finally { try { System.out.println("Deleting Resource Group: " + rgName); azure.resourceGroups().beginDeleteByName(rgName); System.out.println("Deleted Resource Group: " + rgName); } catch (NullPointerException npe) { System.out.println("Did not create any resources in Azure. No clean up is necessary"); } catch (Exception g) { g.printStackTrace(); } } return false; }
From source file:com.microsoft.azure.management.appservice.samples.ManageFunctionAppWithAuthentication.java
License:Open Source License
/** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully *//* w ww.j a v a 2 s.co m*/ public static boolean runSample(Azure azure) { // New resources final String suffix = ".azurewebsites.net"; final String app1Name = SdkContext.randomResourceName("webapp1-", 20); final String app2Name = SdkContext.randomResourceName("webapp2-", 20); final String app1Url = app1Name + suffix; final String app2Url = app2Name + suffix; final String rgName = SdkContext.randomResourceName("rg1NEMV_", 24); try { //============================================================ // Create a function app with admin level auth System.out.println("Creating function app " + app1Name + " in resource group " + rgName + " with admin level auth..."); FunctionApp app1 = azure.appServices().functionApps().define(app1Name).withRegion(Region.US_WEST) .withNewResourceGroup(rgName).withLocalGitSourceControl().create(); System.out.println("Created function app " + app1.name()); Utils.print(app1); //============================================================ // Create a second function app with function level auth System.out.println("Creating another function app " + app2Name + " in resource group " + rgName + " with function level auth..."); AppServicePlan plan = azure.appServices().appServicePlans().getById(app1.appServicePlanId()); FunctionApp app2 = azure.appServices().functionApps().define(app2Name).withExistingAppServicePlan(plan) .withExistingResourceGroup(rgName).withExistingStorageAccount(app1.storageAccount()) .withLocalGitSourceControl().create(); System.out.println("Created function app " + app2.name()); Utils.print(app2); //============================================================ // Deploy to app 1 through Git System.out.println("Deploying a local function app to " + app1Name + " through Git..."); PublishingProfile profile = app1.getPublishingProfile(); Git git = Git.init().setDirectory(new File(ManageFunctionAppWithAuthentication.class .getResource("/square-function-app-admin-auth/").getPath())).call(); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); PushCommand command = git.push(); command.setRemote(profile.gitUrl()); command.setCredentialsProvider( new UsernamePasswordCredentialsProvider(profile.gitUsername(), profile.gitPassword())); command.setRefSpecs(new RefSpec("master:master")); command.setForce(true); command.call(); System.out.println("Deployment to function app " + app1.name() + " completed"); Utils.print(app1); // warm up System.out.println("Warming up " + app1Url + "/api/square..."); post("http://" + app1Url + "/api/square", "625"); Thread.sleep(5000); System.out.println("CURLing " + app1Url + "/api/square..."); System.out.println("Square of 625 is " + post("http://" + app1Url + "/api/square?code=" + app1.getMasterKey(), "625")); //============================================================ // Deploy to app 2 through Git System.out.println("Deploying a local function app to " + app2Name + " through Git..."); profile = app2.getPublishingProfile(); git = Git.init().setDirectory(new File(ManageFunctionAppWithAuthentication.class .getResource("/square-function-app-function-auth/").getPath())).call(); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); command = git.push(); command.setRemote(profile.gitUrl()); command.setCredentialsProvider( new UsernamePasswordCredentialsProvider(profile.gitUsername(), profile.gitPassword())); command.setRefSpecs(new RefSpec("master:master")); command.setForce(true); command.call(); System.out.println("Deployment to function app " + app2.name() + " completed"); Utils.print(app2); String masterKey = app2.getMasterKey(); Map<String, String> functionsHeader = new HashMap<>(); functionsHeader.put("x-functions-key", masterKey); String response = curl("http://" + app2Url + "/admin/functions/square/keys", functionsHeader); Pattern pattern = Pattern.compile("\"name\":\"default\",\"value\":\"([\\w=/]+)\""); Matcher matcher = pattern.matcher(response); matcher.find(); String functionKey = matcher.group(1); // warm up System.out.println("Warming up " + app2Url + "/api/square..."); post("http://" + app2Url + "/api/square", "725"); Thread.sleep(5000); System.out.println("CURLing " + app2Url + "/api/square..."); System.out.println( "Square of 725 is " + post("http://" + app2Url + "/api/square?code=" + functionKey, "725")); return true; } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } finally { try { System.out.println("Deleting Resource Group: " + rgName); azure.resourceGroups().beginDeleteByName(rgName); System.out.println("Deleted Resource Group: " + rgName); } catch (NullPointerException npe) { System.out.println("Did not create any resources in Azure. No clean up is necessary"); } catch (Exception g) { g.printStackTrace(); } } return false; }
From source file:com.microsoft.azure.management.appservice.samples.ManageLinuxWebAppSourceControl.java
License:Open Source License
/** * Main function which runs the actual sample. * @param azure instance of the azure client * @return true if sample runs successfully *///ww w . j a va 2s . co m public static boolean runSample(Azure azure) { // New resources final String suffix = ".azurewebsites.net"; final String app1Name = SdkContext.randomResourceName("webapp1-", 20); final String app2Name = SdkContext.randomResourceName("webapp2-", 20); final String app3Name = SdkContext.randomResourceName("webapp3-", 20); final String app4Name = SdkContext.randomResourceName("webapp4-", 20); final String app1Url = app1Name + suffix; final String app2Url = app2Name + suffix; final String app3Url = app3Name + suffix; final String app4Url = app4Name + suffix; final String rgName = SdkContext.randomResourceName("rg1NEMV_", 24); try { //============================================================ // Create a web app with a new app service plan System.out.println("Creating web app " + app1Name + " in resource group " + rgName + "..."); WebApp app1 = azure.webApps().define(app1Name).withRegion(Region.US_WEST).withNewResourceGroup(rgName) .withNewLinuxPlan(PricingTier.STANDARD_S1).withPublicDockerHubImage("tomcat:8-jre8") .withStartUpCommand( "/bin/bash -c \"sed -ie 's/appBase=\\\"webapps\\\"/appBase=\\\"\\\\/home\\\\/site\\\\/wwwroot\\\\/webapps\\\"/g' conf/server.xml && catalina.sh run\"") .withAppSetting("PORT", "8080").create(); System.out.println("Created web app " + app1.name()); Utils.print(app1); //============================================================ // Deploy to app 1 through FTP System.out.println("Deploying helloworld.war to " + app1Name + " through FTP..."); Utils.uploadFileToWebApp(app1.getPublishingProfile(), "helloworld.war", ManageLinuxWebAppSourceControl.class.getResourceAsStream("/helloworld.war")); System.out.println("Deployment helloworld.war to web app " + app1.name() + " completed"); Utils.print(app1); // warm up System.out.println("Warming up " + app1Url + "/helloworld..."); curl("http://" + app1Url + "/helloworld"); Thread.sleep(5000); System.out.println("CURLing " + app1Url + "/helloworld..."); System.out.println(curl("http://" + app1Url + "/helloworld")); //============================================================ // Create a second web app with local git source control System.out.println("Creating another web app " + app2Name + " in resource group " + rgName + "..."); AppServicePlan plan = azure.appServices().appServicePlans().getById(app1.appServicePlanId()); WebApp app2 = azure.webApps().define(app2Name).withExistingLinuxPlan(plan) .withExistingResourceGroup(rgName).withPublicDockerHubImage("tomcat:8-jre8") .withStartUpCommand( "/bin/bash -c \"sed -ie 's/appBase=\\\"webapps\\\"/appBase=\\\"\\\\/home\\\\/site\\\\/wwwroot\\\\/webapps\\\"/g' conf/server.xml && catalina.sh run\"") .withAppSetting("PORT", "8080").withLocalGitSourceControl().create(); System.out.println("Created web app " + app2.name()); Utils.print(app2); //============================================================ // Deploy to app 2 through local Git System.out.println("Deploying a local Tomcat source to " + app2Name + " through Git..."); PublishingProfile profile = app2.getPublishingProfile(); Git git = Git.init().setDirectory(new File(ManageLinuxWebAppSourceControl.class .getResource("/azure-samples-appservice-helloworld/").getPath())).call(); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); PushCommand command = git.push(); command.setRemote(profile.gitUrl()); command.setCredentialsProvider( new UsernamePasswordCredentialsProvider(profile.gitUsername(), profile.gitPassword())); command.setRefSpecs(new RefSpec("master:master")); command.setForce(true); command.call(); System.out.println("Deployment to web app " + app2.name() + " completed"); Utils.print(app2); // warm up System.out.println("Warming up " + app2Url + "/helloworld..."); curl("http://" + app2Url + "/helloworld"); Thread.sleep(5000); System.out.println("CURLing " + app2Url + "/helloworld..."); System.out.println(curl("http://" + app2Url + "/helloworld")); //============================================================ // Create a 3rd web app with a public GitHub repo in Azure-Samples System.out.println("Creating another web app " + app3Name + "..."); WebApp app3 = azure.webApps().define(app3Name).withExistingLinuxPlan(plan).withNewResourceGroup(rgName) .withPublicDockerHubImage("tomcat:8-jre8") .withStartUpCommand( "/bin/bash -c \"sed -ie 's/appBase=\\\"webapps\\\"/appBase=\\\"\\\\/home\\\\/site\\\\/wwwroot\\\\/webapps\\\"/g' conf/server.xml && catalina.sh run\"") .withAppSetting("PORT", "8080").defineSourceControl() .withPublicGitRepository("https://github.com/azure-appservice-samples/java-get-started") .withBranch("master").attach().create(); System.out.println("Created web app " + app3.name()); Utils.print(app3); // warm up System.out.println("Warming up " + app3Url + "..."); curl("http://" + app3Url); Thread.sleep(5000); System.out.println("CURLing " + app3Url + "..."); System.out.println(curl("http://" + app3Url)); //============================================================ // Create a 4th web app with a personal GitHub repo and turn on continuous integration System.out.println("Creating another web app " + app4Name + "..."); WebApp app4 = azure.webApps().define(app4Name).withExistingLinuxPlan(plan) .withExistingResourceGroup(rgName).withPublicDockerHubImage("tomcat:8-jre8") .withStartUpCommand( "/bin/bash -c \"sed -ie 's/appBase=\\\"webapps\\\"/appBase=\\\"\\\\/home\\\\/site\\\\/wwwroot\\\\/webapps\\\"/g' conf/server.xml && catalina.sh run\"") .withAppSetting("PORT", "8080") // Uncomment the following lines to turn on 4th scenario //.defineSourceControl() // .withContinuouslyIntegratedGitHubRepository("username", "reponame") // .withBranch("master") // .withGitHubAccessToken("YOUR GITHUB PERSONAL TOKEN") // .attach() .create(); System.out.println("Created web app " + app4.name()); Utils.print(app4); // warm up System.out.println("Warming up " + app4Url + "..."); curl("http://" + app4Url); Thread.sleep(5000); System.out.println("CURLing " + app4Url + "..."); System.out.println(curl("http://" + app4Url)); return true; } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } finally { try { System.out.println("Deleting Resource Group: " + rgName); azure.resourceGroups().beginDeleteByName(rgName); System.out.println("Deleted Resource Group: " + rgName); } catch (NullPointerException npe) { System.out.println("Did not create any resources in Azure. No clean up is necessary"); } catch (Exception g) { g.printStackTrace(); } } return false; }