org.jetbrains.idea.maven.model.MavenId Java Examples
The following examples show how to use
org.jetbrains.idea.maven.model.MavenId.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MavenToolDelegate.java From intellij-quarkus with Eclipse Public License 2.0 | 6 votes |
private List<MavenArtifact> ensureDownloaded(Module module, MavenProject mavenProject, Set<MavenId> deploymentIds, String classifier) { List<MavenArtifact> result = new ArrayList<>(); long start = System.currentTimeMillis(); try { MavenEmbedderWrapper serverWrapper = MavenServerManager.getInstance().createEmbedder(module.getProject(), false, mavenProject.getDirectory(), mavenProject.getDirectory()); if (classifier != null) { for(MavenId id : deploymentIds) { result.add(serverWrapper.resolve(new MavenArtifactInfo(id, "jar", classifier), mavenProject.getRemoteRepositories())); } } else { List<MavenArtifactInfo> infos = deploymentIds.stream().map(id -> new MavenArtifactInfo(id, "jar", classifier)).collect(Collectors.toList()); result = serverWrapper.resolveTransitively(infos, mavenProject.getRemoteRepositories()); } } catch (MavenProcessCanceledException e) { LOGGER.warn(e.getLocalizedMessage(), e); } return result; }
Example #2
Source File: ArchetypePropertiesStep.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
private void updateProperties() { MavenId projectId = myBuilder.getProjectId(); Map<String, String> props = myMavenPropertiesPanel.getDataAsMap(); for(Map.Entry<String, String> entry: requiredProperties.entrySet()) { String propValue = entry.getValue(); if(StringUtil.isNotEmpty(propValue)) { if(propValue.contains(NAME_PLACEHOLDER)) { propValue = propValue.replace(NAME_PLACEHOLDER, artifactName.getText()); } else if(propValue.contains(NAME_FOR_FOLDER_PLACEHOLDER)) { propValue = propValue.replace(NAME_FOR_FOLDER_PLACEHOLDER, artifactName.getText().toLowerCase().replaceAll("[^a-zA-Z]", "")); } else if(propValue.contains(ARTIFACT_ID_PLACEHOLDER)) { propValue = propValue.replace(ARTIFACT_ID_PLACEHOLDER, projectId.getArtifactId()); } } props.put(entry.getKey(), propValue); } myMavenPropertiesPanel.setDataFromMap(props); }
Example #3
Source File: ArchetypePropertiesStep.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
@Override public void updateStep() { SlingMavenModuleBuilder.ArchetypeTemplate archetypeTemplate = myBuilder.getArchetypeTemplate(); MavenArchetype archetype = archetypeTemplate.getMavenArchetype(); Map<String, String> props = new LinkedHashMap<String, String>(); MavenId projectId = myBuilder.getProjectId(); props.put("groupId", projectId.getGroupId()); props.put("artifactId", projectId.getArtifactId()); props.put("version", projectId.getVersion()); props.put("archetypeGroupId", archetype.groupId); props.put("archetypeArtifactId", archetype.artifactId); props.put("archetypeVersion", archetype.version); if (archetype.repository != null) props.put("archetypeRepository", archetype.repository); myMavenPropertiesPanel.setDataFromMap(props); //Add any props from the Builder requiredProperties = archetypeTemplate.getRequiredProperties(); updateProperties(); }
Example #4
Source File: MuleDomainMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
public void configure(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root) { try { //Create mule folders. final VirtualFile appDirectory = VfsUtil.createDirectories(root.getPath() + "/src/main/domain"); final VirtualFile resources = VfsUtil.createDirectories(root.getPath() + "/src/main/resources"); final VirtualFile muleConfigFile = createMuleConfigFile(project, projectId, appDirectory); createMuleDeployPropertiesFile(project, projectId, appDirectory); createPomFile(project, projectId, muleVersion, root); // execute when current dialog is closed (e.g. Project Structure) MavenUtil.invokeLater(project, ModalityState.NON_MODAL, () -> EditorHelper.openInEditor(getPsiFile(project, muleConfigFile))); } catch (IOException e) { e.printStackTrace(); } }
Example #5
Source File: MuleMavenModuleBuilder.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
@Override public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException { super.setupRootModel(rootModel); addListener(new ModuleBuilderListener() { @Override public void moduleCreated(@NotNull Module module) { setMuleFramework(module); } }); setMuleFacet(rootModel.getModule()); final Project project = rootModel.getProject(); final VirtualFile root = createAndGetContentEntry(); rootModel.addContentEntry(root); //Check if this is a module and has parent final MavenId parentId = (this.getParentProject() != null ? this.getParentProject().getMavenId() : null); MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> { new MuleMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root, parentId); }); }
Example #6
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
private VirtualFile createLog4JTest(final Project project, final MavenId projectId, final VirtualFile appDirectory) { return new WriteCommandAction<VirtualFile>(project, "Create Log4J Test File", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile configFile = appDirectory.findOrCreateChildData(this, "log4j2-test.xml"); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.LOG4J2_TEST); final Properties defaultProperties = manager.getDefaultProperties(); final String text = template.getText(defaultProperties); VfsUtil.saveText(configFile, text); result.setResult(configFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #7
Source File: RootMavenActionGroup.java From MavenHelper with Apache License 2.0 | 5 votes |
@NotNull @Override protected MavenProjectInfo getMavenProject(DataContext dataContext) { MavenProject mavenProject = MavenActionUtil.getMavenProject(dataContext); if (mavenProject == null) { return new MavenProjectInfo(null, false); } MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(dataContext); List<MavenProject> rootProjects = projectsManager.getRootProjects(); MavenProject root = null; if (rootProjects.contains(mavenProject)) { root = mavenProject; } else { MavenId parentId = mavenProject.getParentId(); while (parentId != null) { mavenProject = projectsManager.findProject(parentId); if (mavenProject == null) { break; } if (rootProjects.contains(mavenProject)) { root = mavenProject; break; } parentId = mavenProject.getParentId(); } } return new MavenProjectInfo(root, true); }
Example #8
Source File: MavenToolDelegate.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
private void getDeploymentFiles(Module module, MavenProject mavenProject, List<VirtualFile>[] result) { Set<MavenArtifact> downloaded = new HashSet<>(); Set<MavenId> toDownload = new HashSet<>(); for (MavenArtifact artifact : mavenProject.getDependencies()) { if (artifact.getFile() != null) { String deploymentIdStr = ToolDelegate.getDeploymentJarId(artifact.getFile()); if (deploymentIdStr != null) { MavenId deploymentId = new MavenId(deploymentIdStr); if (mavenProject.findDependencies(deploymentId).isEmpty()) { toDownload.add(deploymentId); } } } } List<MavenArtifact> binaryDependencies = ensureDownloaded(module, mavenProject, toDownload, null); toDownload.clear(); for (MavenArtifact binaryDependency : binaryDependencies) { if (!"test".equals(binaryDependency.getScope())) { if (processDependency(mavenProject, result, downloaded, binaryDependency, BINARY)) { toDownload.add(binaryDependency.getMavenId()); } } } List<MavenArtifact> sourcesDependencies = ensureDownloaded(module, mavenProject, toDownload, "sources"); for (MavenArtifact sourceDependency : sourcesDependencies) { processDependency(mavenProject, result, downloaded, sourceDependency, SOURCES); } }
Example #9
Source File: BaseAction.java From MavenHelper with Apache License 2.0 | 5 votes |
private static VirtualFile getVirtualFile(MavenArtifactNode myArtifactNode, Project project, MavenProject mavenProject) { final MavenArtifactNode parent = myArtifactNode.getParent(); final VirtualFile file; if (parent == null) { file = mavenProject.getFile(); } else { // final MavenId id = parent.getArtifact().getMavenId(); //this doesn't work for snapshots MavenArtifact artifact = parent.getArtifact(); final MavenId id = new MavenId(artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion()); final MavenProject pr = MavenProjectsManager.getInstance(project).findProject(id); file = pr == null ? MavenNavigationUtil.getArtifactFile(project, id) : pr.getFile(); } return file; }
Example #10
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createPomFile(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root) { return new WriteCommandAction<VirtualFile>(project, "Create Mule Project", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML); final Properties templateProps = new Properties(); templateProps.setProperty("GROUP_ID", projectId.getGroupId()); templateProps.setProperty("ARTIFACT_ID", projectId.getArtifactId()); templateProps.setProperty("VERSION", projectId.getVersion()); templateProps.setProperty("MULE_VERSION", muleVersion); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_MAVEN_PROJECT); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(pomFile, text); result.setResult(pomFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #11
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createModulePomFile(final Project project, final MavenId projectId, final VirtualFile root, final MavenId parentId) { return new WriteCommandAction<VirtualFile>(project, "Create Mule Project", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML); final Properties templateProps = new Properties(); templateProps.setProperty("GROUP_ID", parentId.getGroupId()); templateProps.setProperty("ARTIFACT_ID", projectId.getArtifactId()); templateProps.setProperty("PARENT_ID", parentId.getArtifactId()); templateProps.setProperty("VERSION", parentId.getVersion()); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_MAVEN_MODULE); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(pomFile, text); result.setResult(pomFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #12
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createMuleDeployPropertiesFile(final Project project, final MavenId projectId, final VirtualFile appDirectory) { return new WriteCommandAction<VirtualFile>(project, "Create Mule Deploy Properties File", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile configFile = appDirectory.findOrCreateChildData(this, "mule-deploy.properties"); final Properties templateProps = new Properties(); templateProps.setProperty("NAME", projectId.getArtifactId()); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_DEPLOY_PROPERTIES); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(configFile, text); result.setResult(configFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #13
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createLog4J(final Project project, final MavenId projectId, final VirtualFile appDirectory) { return new WriteCommandAction<VirtualFile>(project, "Create Log4J File", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile configFile = appDirectory.findOrCreateChildData(this, "log4j2.xml"); final Properties templateProps = new Properties(); templateProps.setProperty("FILE_NAME", "${sys:mule.home}${sys:file.separator}logs${sys:file.separator}" + projectId.getArtifactId().toLowerCase() + ".log"); templateProps.setProperty("FILE_PATTERN", "${sys:mule.home}${sys:file.separator}logs${sys:file.separator}" + projectId.getArtifactId().toLowerCase() + "-%i.log"); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.LOG4J2); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(configFile, text); result.setResult(configFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #14
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createMuleConfigFile(final Project project, final MavenId projectId, final VirtualFile appDirectory) { return new WriteCommandAction<VirtualFile>(project, "Create Mule Config File", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile configFile = appDirectory.findOrCreateChildData(this, projectId.getArtifactId() + ".xml"); final Properties templateProps = new Properties(); templateProps.setProperty("NAME", projectId.getArtifactId()); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_CONFIGURATION_FILE); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(configFile, text); result.setResult(configFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #15
Source File: MuleMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
public void configure(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root, @Nullable MavenId parentId) { try { //Create mule folders. final VirtualFile appDirectory = VfsUtil.createDirectories(root.getPath() + "/src/main/app"); final VirtualFile resources = VfsUtil.createDirectories(root.getPath() + "/src/main/resources"); createLog4J(project, projectId, resources); final VirtualFile muleConfigFile = createMuleConfigFile(project, projectId, appDirectory); createMuleDeployPropertiesFile(project, projectId, appDirectory); createMuleAppPropertiesFiles(project, appDirectory); VfsUtil.createDirectories(root.getPath() + "/src/main/api"); //MUnit support VfsUtil.createDirectories(root.getPath() + "/src/test/munit"); final VirtualFile testResources = VfsUtil.createDirectories(root.getPath() + "/src/test/resources"); createLog4JTest(project, projectId, testResources); if (parentId == null) createPomFile(project, projectId, muleVersion, root); else createModulePomFile(project, projectId, root, parentId); // execute when current dialog is closed (e.g. Project Structure) MavenUtil.invokeLater(project, ModalityState.NON_MODAL, () -> EditorHelper.openInEditor(getPsiFile(project, muleConfigFile))); } catch (IOException e) { e.printStackTrace(); } }
Example #16
Source File: MuleDomainMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createPomFile(final Project project, final MavenId projectId, final String muleVersion, final VirtualFile root) { return new WriteCommandAction<VirtualFile>(project, "Create Mule Domain Project", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile pomFile = root.findOrCreateChildData(this, MavenConstants.POM_XML); final Properties templateProps = new Properties(); templateProps.setProperty("GROUP_ID", projectId.getGroupId()); templateProps.setProperty("ARTIFACT_ID", projectId.getArtifactId()); templateProps.setProperty("VERSION", projectId.getVersion()); templateProps.setProperty("MULE_VERSION", muleVersion); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_DOMAIN_MAVEN_PROJECT); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(pomFile, text); result.setResult(pomFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #17
Source File: MuleDomainMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createMuleDeployPropertiesFile(final Project project, final MavenId projectId, final VirtualFile appDirectory) { return new WriteCommandAction<VirtualFile>(project, "Create Mule Deploy Properties File", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile configFile = appDirectory.findOrCreateChildData(this, "mule-deploy.properties"); final Properties templateProps = new Properties(); templateProps.setProperty("NAME", projectId.getArtifactId()); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_DOMAIN_DEPLOY_PROPERTIES); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(configFile, text); result.setResult(configFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #18
Source File: MuleDomainMavenProjectBuilderHelper.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private VirtualFile createMuleConfigFile(final Project project, final MavenId projectId, final VirtualFile appDirectory) { //final String domainConfigName = projectId.getArtifactId(); final String domainConfigName = "mule-domain-config"; //Currently Mule requires it to be mule-domain-config.xml return new WriteCommandAction<VirtualFile>(project, "Create Mule Domain Config File", PsiFile.EMPTY_ARRAY) { @Override protected void run(@NotNull Result<VirtualFile> result) throws Throwable { try { VirtualFile configFile = appDirectory.findOrCreateChildData(this, domainConfigName + ".xml"); final Properties templateProps = new Properties(); templateProps.setProperty("NAME", projectId.getArtifactId()); final FileTemplateManager manager = FileTemplateManager.getInstance(project); final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.MULE_DOMAIN_CONFIGURATION_FILE); final Properties defaultProperties = manager.getDefaultProperties(); defaultProperties.putAll(templateProps); final String text = template.getText(defaultProperties); VfsUtil.saveText(configFile, text); result.setResult(configFile); } catch (IOException e) { showError(project, e); } } }.execute().getResultObject(); }
Example #19
Source File: MavenQuarkusConfigRootTest.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
public void testHibernateOrmResteasy() throws Exception { Module module = createMavenModule("hibernate-orm-resteasy", new File("projects/maven/hibernate-orm-resteasy")); MicroProfileProjectInfo info = PropertiesManager.getInstance().getMicroProfileProjectInfo(module, MicroProfilePropertiesScope.SOURCES_AND_DEPENDENCIES, ClasspathKind.SRC, PsiUtilsImpl.getInstance(), DocumentFormat.PlainText); File f = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-hibernate-orm-deployment:0.19.1"), "jar"); assertNotNull("Test existing of quarkus-hibernate-orm-deployment*.jar", f); assertProperties(info, // io.quarkus.hibernate.orm.deployment.HibernateOrmConfig p("quarkus-hibernate-orm", "quarkus.hibernate-orm.dialect", "java.util.Optional<java.lang.String>", "The hibernate ORM dialect class name", true, "io.quarkus.hibernate.orm.deployment.HibernateOrmConfig", "dialect", null, CONFIG_PHASE_BUILD_TIME, null)); }
Example #20
Source File: MuleDomainMavenModuleBuilder.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public MuleDomainMavenModuleBuilder() { setProjectId(new MavenId("org.mule.app", "my-domain", "1.0.0-SNAPSHOT")); }
Example #21
Source File: MuleMavenModuleBuilder.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public MuleMavenModuleBuilder() { setProjectId(new MavenId("org.mule.app", "my-app", "1.0.0-SNAPSHOT")); }
Example #22
Source File: SlingMavenModuleBuilder.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 4 votes |
public void setProjectId(MavenId id) { myProjectId = id; }
Example #23
Source File: SlingMavenModuleBuilder.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 4 votes |
public MavenId getProjectId() { return myProjectId; }
Example #24
Source File: MavenMicroProfileConfigPropertyTest.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
public void testConfigQuickstartFromClasspath() throws Exception { Module module = createMavenModule("config-quickstart", new File("projects/maven/config-quickstart")); MicroProfileProjectInfo infoFromClasspath = PropertiesManager.getInstance().getMicroProfileProjectInfo(module, MicroProfilePropertiesScope.SOURCES_AND_DEPENDENCIES, ClasspathKind.SRC, PsiUtilsImpl.getInstance(), DocumentFormat.PlainText); File f = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-core-deployment:1.1.0.Final"), "jar"); assertNotNull("Test existing of quarkus-core-deployment*.jar", f); assertProperties(infoFromClasspath, 257 /* properties from JAR */ + // 9 /* properties from Java sources with ConfigProperty */ + // 2 /* properties from Java sources with ConfigRoot */ + // 7 /* static properties from microprofile-context-propagation-api */, // io.quarkus.deployment.ApplicationConfig p("quarkus-core", "quarkus.application.name", "java.util.Optional<java.lang.String>", "The name of the application.\nIf not set, defaults to the name of the project (except for tests where it is not set at all).", true, "io.quarkus.runtime.ApplicationConfig", "name", null, CONFIG_PHASE_BUILD_AND_RUN_TIME_FIXED, null), p("quarkus-core", "quarkus.application.version", "java.util.Optional<java.lang.String>", "The version of the application.\nIf not set, defaults to the version of the project (except for tests where it is not set at all).", true, "io.quarkus.runtime.ApplicationConfig", "version", null, CONFIG_PHASE_BUILD_AND_RUN_TIME_FIXED, null), // GreetingResource // @ConfigProperty(name = "greeting.message") // String message; p(null, "greeting.message", "java.lang.String", null, false, "org.acme.config.GreetingResource", "message", null, 0, null), // @ConfigProperty(name = "greeting.suffix" , defaultValue="!") // String suffix; p(null, "greeting.suffix", "java.lang.String", null, false, "org.acme.config.GreetingResource", "suffix", null, 0, "!"), // @ConfigProperty(name = "greeting.name") // Optional<String> name; p(null, "greeting.name", "java.util.Optional<java.lang.String>", null, false, "org.acme.config.GreetingResource", "name", null, 0, null), // GreetingConstructorResource( // @ConfigProperty(name = "greeting.constructor.message") String message, // @ConfigProperty(name = "greeting.constructor.suffix" , defaultValue="!") // String suffix, // @ConfigProperty(name = "greeting.constructor.name") Optional<String> name) p(null, "greeting.constructor.message", "java.lang.String", null, false, "org.acme.config.GreetingConstructorResource", null, "GreetingConstructorResource(Ljava/lang/String;Ljava/lang/String;Ljava/util/Optional;)V", 0, null), p(null, "greeting.constructor.suffix", "java.lang.String", null, false, "org.acme.config.GreetingConstructorResource", null, "GreetingConstructorResource(Ljava/lang/String;Ljava/lang/String;Ljava/util/Optional;)V", 0, "!"), p(null, "greeting.constructor.name", "java.util.Optional<java.lang.String>", null, false, "org.acme.config.GreetingConstructorResource", null, "GreetingConstructorResource(Ljava/lang/String;Ljava/lang/String;Ljava/util/Optional;)V", 0, null), // setMessage(@ConfigProperty(name = "greeting.method.message") String message) p(null, "greeting.method.message", "java.lang.String", null, false, "org.acme.config.GreetingMethodResource", null, "setMessage(Ljava/lang/String;)V", 0, null), // setSuffix(@ConfigProperty(name = "greeting.method.suffix" , defaultValue="!") // String suffix) p(null, "greeting.method.suffix", "java.lang.String", null, false, "org.acme.config.GreetingMethodResource", null, "setSuffix(Ljava/lang/String;)V", 0, "!"), // setName(@ConfigProperty(name = "greeting.method.name") Optional<String> name) p(null, "greeting.method.name", "java.util.Optional<java.lang.String>", null, false, "org.acme.config.GreetingMethodResource", null, "setName(Ljava/util/Optional;)V", 0, null), // @ConfigRoot / CustomExtensionConfig / property1 p(null, "quarkus.custom-extension.property1", "java.lang.String", null, false, "org.acme.config.CustomExtensionConfig", "property1", null, CONFIG_PHASE_BUILD_TIME, null), // @ConfigRoot / CustomExtensionConfig / property2 p(null, "quarkus.custom-extension.property2", "java.lang.Integer", null, false, "org.acme.config.CustomExtensionConfig", "property2", null, CONFIG_PHASE_BUILD_TIME, null)); assertPropertiesDuplicate(infoFromClasspath); }
Example #25
Source File: MavenQuarkusConfigRootTest.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
public void testAllQuarkusExtensions() throws Exception { Module module = createMavenModule("all-quarkus-extensions", new File("projects/maven/all-quarkus-extensions")); MicroProfileProjectInfo info = PropertiesManager.getInstance().getMicroProfileProjectInfo(module, MicroProfilePropertiesScope.SOURCES_AND_DEPENDENCIES, ClasspathKind.SRC, PsiUtilsImpl.getInstance(), DocumentFormat.PlainText); File keycloakJARFile = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-keycloak-deployment:0.21.1"), "jar"); assertNotNull("Test existing of quarkus-keycloak-deployment*.jar", keycloakJARFile); File hibernateJARFile = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-hibernate-orm-deployment:0.21.1"), "jar"); assertNotNull("Test existing of quarkus-hibernate-orm-deployment*.jar", hibernateJARFile); File undertowJARFile = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-undertow:0.21.1"), "jar"); assertNotNull("Test existing of quarkus-undertow*.jar", undertowJARFile); File mongoJARFile = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-mongodb-client:0.21.1"), "jar"); assertNotNull("Test existing of quarkus-mongodb-client*.jar", mongoJARFile); assertProperties(info, // Test with Map<String, String> // https://github.com/quarkusio/quarkus/blob/0.21/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java#L308 p("quarkus-keycloak", "quarkus.keycloak.credentials.jwt.{*}", "java.lang.String", "The settings for client authentication with signed JWT", true, "io.quarkus.keycloak.KeycloakConfig$KeycloakConfigCredentials", "jwt", null, CONFIG_PHASE_BUILD_TIME, null), // Test with Map<String, Map<String, Map<String, String>>> // https://github.com/quarkusio/quarkus/blob/0.21/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java#L469 p("quarkus-keycloak", "quarkus.keycloak.policy-enforcer.paths.{*}.claim-information-point.{*}.{*}.{*}", "java.lang.String", "", true, "io.quarkus.keycloak.KeycloakConfig$KeycloakConfigPolicyEnforcer$ClaimInformationPointConfig", "complexConfig", null, CONFIG_PHASE_BUILD_TIME, null), // io.quarkus.hibernate.orm.deployment.HibernateOrmConfig p("quarkus-hibernate-orm", "quarkus.hibernate-orm.dialect", "java.util.Optional<java.lang.String>", "The hibernate ORM dialect class name", true, "io.quarkus.hibernate.orm.deployment.HibernateOrmConfig", "dialect", null, CONFIG_PHASE_BUILD_TIME, null), // test with extension name p("quarkus-undertow", "quarkus.http.ssl.certificate.file", "java.util.Optional<java.nio.file.Path>", "The file path to a server certificate or certificate chain in PEM format.", true, "io.quarkus.runtime.configuration.ssl.CertificateConfig", "file", null, CONFIG_PHASE_RUN_TIME, null), p("quarkus-mongodb-client", "quarkus.mongodb.credentials.auth-mechanism-properties.{*}", "java.lang.String", "Allows passing authentication mechanism properties.", true, "io.quarkus.mongodb.runtime.CredentialConfig", "authMechanismProperties", null, CONFIG_PHASE_RUN_TIME, null)); }
Example #26
Source File: MavenPropertiesManagerTest.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
public void testQuarkusCoreDeploymentProperties() { MicroProfileProjectInfo info = PropertiesManager.getInstance().getMicroProfileProjectInfo(module, MicroProfilePropertiesScope.SOURCES_AND_DEPENDENCIES, ClasspathKind.SRC, PsiUtilsImpl.getInstance(), DocumentFormat.PlainText); File quarkusCoreJARFile = MavenArtifactUtil.getArtifactFile(myProjectsManager.findProject(module).getLocalRepository(), new MavenId("io.quarkus:quarkus-core-deployment:0.24.0"), "jar"); assertNotNull("Test existing of quarkus-core*.jar", quarkusCoreJARFile); assertProperties(info, // io.quarkus.deployment.ApplicationConfig p("quarkus-core", "quarkus.application.name", "java.lang.String", "The name of the application.\nIf not set, defaults to the name of the project.", true, "io.quarkus.deployment.ApplicationConfig", "name", null, CONFIG_PHASE_BUILD_TIME, null), p("quarkus-core", "quarkus.application.version", "java.lang.String", "The version of the application.\nIf not set, defaults to the version of the project", true, "io.quarkus.deployment.ApplicationConfig", "version", null, CONFIG_PHASE_BUILD_TIME, null), // io.quarkus.deployment.JniProcessor$JniConfig p("quarkus-core", "quarkus.jni.enable", "boolean", "Enable JNI support.", true, "io.quarkus.deployment.JniProcessor$JniConfig", "enable", null, CONFIG_PHASE_BUILD_TIME, "false"), p("quarkus-core", "quarkus.jni.library-paths", "java.util.List<java.lang.String>", "Paths of library to load.", true, "io.quarkus.deployment.JniProcessor$JniConfig", "libraryPaths", null, CONFIG_PHASE_BUILD_TIME, null), // io.quarkus.deployment.SslProcessor$SslConfig p("quarkus-core", "quarkus.ssl.native", "java.util.Optional<java.lang.Boolean>", "Enable native SSL support.", true, "io.quarkus.deployment.SslProcessor$SslConfig", "native_", null, CONFIG_PHASE_BUILD_TIME, null), // io.quarkus.deployment.index.ApplicationArchiveBuildStep$IndexDependencyConfiguration // -> Map<String, IndexDependencyConfig> p("quarkus-core", "quarkus.index-dependency.{*}.classifier", "java.lang.String", "The maven classifier of the artifact to index", true, "io.quarkus.deployment.index.IndexDependencyConfig", "classifier", null, CONFIG_PHASE_BUILD_TIME, null), p("quarkus-core", "quarkus.index-dependency.{*}.artifact-id", "java.lang.String", "The maven artifactId of the artifact to index", true, "io.quarkus.deployment.index.IndexDependencyConfig", "artifactId", null, CONFIG_PHASE_BUILD_TIME, null), p("quarkus-core", "quarkus.index-dependency.{*}.group-id", "java.lang.String", "The maven groupId of the artifact to index", true, "io.quarkus.deployment.index.IndexDependencyConfig", "groupId", null, CONFIG_PHASE_BUILD_TIME, null)); }