@Test public void testCreateApi() throws Exception { File workspaceDir = _workspaceDir; MavenTestUtil.makeMavenWorkspace(_extensionsDir, workspaceDir, BladeTest.PRODUCT_VERSION_PORTAL_73); File modulesDir = new File(workspaceDir, "modules"); String[] mavenArgs = { "create", "--base", workspaceDir.getAbsolutePath(), "-d", modulesDir.getAbsolutePath(), "-P", "maven", "-t", "api", "foo" }; File projectDir = new File(modulesDir, "foo"); String projectPath = projectDir.getAbsolutePath(); TestUtil.runBlade(workspaceDir, _extensionsDir, mavenArgs); _checkMavenBuildFiles(projectPath); _contains(_checkFileExists(projectPath + "/src/main/java/foo/api/Foo.java"), ".*^public interface Foo.*"); _contains(_checkFileExists(projectPath + "/src/main/resources/foo/api/packageinfo"), "version 1.0.0"); TestUtil.updateMavenRepositories(projectPath); execute(projectPath, new String[] {"clean", "package"}); MavenTestUtil.verifyBuildOutput(projectPath, "foo-1.0.0.jar"); _verifyImportPackage(new File(projectPath, "target/foo-1.0.0.jar")); try (Jar jar = new Jar(new File(projectPath, "target/foo-1.0.0.jar"))) { Manifest manifest = jar.getManifest(); Attributes mainAttributes = manifest.getMainAttributes(); Assert.assertEquals("foo.api;version=\"1.0.0\"", mainAttributes.getValue("Export-Package")); } }
@Override public void execute() throws Exception { BladeCLI bladeCLI = getBladeCLI(); CreateArgs createArgs = getArgs(); File dir = createArgs.getDir(); if (dir == null) { dir = createArgs.getBase(); } WorkspaceProvider workspaceProvider = bladeCLI.getWorkspaceProvider(dir); if ((workspaceProvider == null) || (workspaceProvider instanceof MavenWorkspaceProvider)) { createArgs.setProduct("portal"); createArgs.setProfileName("maven"); super.execute(); } else { bladeCLI.error("Cannot create maven project here, incompatible workspace profile type."); } }
CreateCommandMaven extends CreateCommand { @Override public void execute() throws Exception { BladeCLI bladeCLI = getBladeCLI(); CreateArgs createArgs = getArgs(); File dir = createArgs.getDir(); if (dir == null) { dir = createArgs.getBase(); } WorkspaceProvider workspaceProvider = bladeCLI.getWorkspaceProvider(dir); if ((workspaceProvider == null) || (workspaceProvider instanceof MavenWorkspaceProvider)) { createArgs.setProduct("portal"); createArgs.setProfileName("maven"); super.execute(); } else { bladeCLI.error("Cannot create maven project here, incompatible workspace profile type."); } } }
CreateCommandMaven extends CreateCommand { @Override public void execute() throws Exception { BladeCLI bladeCLI = getBladeCLI(); CreateArgs createArgs = getArgs(); File dir = createArgs.getDir(); if (dir == null) { dir = createArgs.getBase(); } WorkspaceProvider workspaceProvider = bladeCLI.getWorkspaceProvider(dir); if ((workspaceProvider == null) || (workspaceProvider instanceof MavenWorkspaceProvider)) { createArgs.setProduct("portal"); createArgs.setProfileName("maven"); super.execute(); } else { bladeCLI.error("Cannot create maven project here, incompatible workspace profile type."); } } CreateCommandMaven();  CreateCommandMaven(BladeCLI bladeCLI); }
CreateCommandMaven extends CreateCommand { @Override public void execute() throws Exception { BladeCLI bladeCLI = getBladeCLI(); CreateArgs createArgs = getArgs(); File dir = createArgs.getDir(); if (dir == null) { dir = createArgs.getBase(); } WorkspaceProvider workspaceProvider = bladeCLI.getWorkspaceProvider(dir); if ((workspaceProvider == null) || (workspaceProvider instanceof MavenWorkspaceProvider)) { createArgs.setProduct("portal"); createArgs.setProfileName("maven"); super.execute(); } else { bladeCLI.error("Cannot create maven project here, incompatible workspace profile type."); } } CreateCommandMaven();  CreateCommandMaven(BladeCLI bladeCLI); @Override void execute(); }
CreateCommandMaven extends CreateCommand { @Override public void execute() throws Exception { BladeCLI bladeCLI = getBladeCLI(); CreateArgs createArgs = getArgs(); File dir = createArgs.getDir(); if (dir == null) { dir = createArgs.getBase(); } WorkspaceProvider workspaceProvider = bladeCLI.getWorkspaceProvider(dir); if ((workspaceProvider == null) || (workspaceProvider instanceof MavenWorkspaceProvider)) { createArgs.setProduct("portal"); createArgs.setProfileName("maven"); super.execute(); } else { bladeCLI.error("Cannot create maven project here, incompatible workspace profile type."); } } CreateCommandMaven();  CreateCommandMaven(BladeCLI bladeCLI); @Override void execute();  }