Java Code Examples for org.netbeans.modules.maven.api.NbMavenProject#downloadDependencyAndJavadocSource()
The following examples show how to use
org.netbeans.modules.maven.api.NbMavenProject#downloadDependencyAndJavadocSource() .
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: MavenModelUtils.java From netbeans with Apache License 2.0 | 5 votes |
/** Add Javadoc to project * @param project Project */ public static void addJavadoc(final Project project) { NbMavenProject mavenProject = project.getLookup().lookup(NbMavenProject.class); if (mavenProject != null) { mavenProject.downloadDependencyAndJavadocSource(false); } }
Example 2
Source File: BasicProjectWizardIterator.java From nb-springboot with Apache License 2.0 | 5 votes |
@Override public Set<FileObject> instantiate(ProgressHandle handle) throws IOException { handle.start(4); Set<FileObject> resultSet = new LinkedHashSet<>(); File fDir = FileUtil.normalizeFile((File) wiz.getProperty("projdir")); fDir.mkdirs(); handle.progress(1); FileObject foDir = FileUtil.toFileObject(fDir); FileObject template = URLMapper.findFileObject(getClass().getResource("BasicSpringbootProject.zip")); unZipFile(template.getInputStream(), foDir); handle.progress(2); // create nbactions.xml file createNbActions(foDir); // clear non project cache ProjectManager.getDefault().clearNonProjectCache(); // Always open top dir as a project: resultSet.add(foDir); // open pom.xml file final FileObject foPom = foDir.getFileObject("pom.xml"); if (foPom != null) { resultSet.add(foPom); } handle.progress(3); // trigger download of dependencies Project prj = ProjectManager.getDefault().findProject(foDir); if (prj != null) { final NbMavenProject mvn = prj.getLookup().lookup(NbMavenProject.class); if (mvn != null) { mvn.downloadDependencyAndJavadocSource(false); } } // remember folder for creation of new projects File parent = fDir.getParentFile(); if (parent != null && parent.exists()) { ProjectChooser.setProjectsFolder(parent); } handle.finish(); return resultSet; }
Example 3
Source File: InitializrProjectWizardIterator.java From nb-springboot with Apache License 2.0 | 4 votes |
@Override public Set<FileObject> instantiate(ProgressHandle handle) throws IOException { handle.start(4); Set<FileObject> resultSet = new LinkedHashSet<>(); File dirF = FileUtil.normalizeFile((File) wiz.getProperty(WIZ_PROJ_LOCATION)); dirF.mkdirs(); FileObject foDir = FileUtil.toFileObject(dirF); // prepare service invocation params String bootVersion = ((NamedItem) wiz.getProperty(WIZ_BOOT_VERSION)).getId(); String mvnGroup = (String) wiz.getProperty(WIZ_GROUP); String mvnArtifact = (String) wiz.getProperty(WIZ_ARTIFACT); String mvnVersion = (String) wiz.getProperty(WIZ_VERSION); String mvnName = (String) wiz.getProperty(WIZ_NAME); String mvnDesc = (String) wiz.getProperty(WIZ_DESCRIPTION); String packaging = ((NamedItem) wiz.getProperty(WIZ_PACKAGING)).getId(); String pkg = (String) wiz.getProperty(WIZ_PACKAGE); String lang = ((NamedItem) wiz.getProperty(WIZ_LANGUAGE)).getId(); String javaVersion = ((NamedItem) wiz.getProperty(WIZ_JAVA_VERSION)).getId(); String deps = (String) wiz.getProperty(WIZ_DEPENDENCIES); handle.progress(1); try { // invoke initializr webservice InputStream stream = InitializrService.getInstance().getProject(bootVersion, mvnGroup, mvnArtifact, mvnVersion, mvnName, mvnDesc, packaging, pkg, lang, javaVersion, deps); handle.progress(2); // unzip response unZipFile(stream, foDir, (boolean) wiz.getProperty(WIZ_REMOVE_MVN_WRAPPER)); handle.progress(3); // parse pom.xml final FileObject foPom = foDir.getFileObject("pom.xml"); // manage run/debug trough maven plugin if ((boolean) wiz.getProperty(WIZ_USE_SB_MVN_PLUGIN)) { // create nbactions.xml file with custom maven actions configuration createNbActions(bootVersion, pkg, mvnName, foDir); } // clear non project cache ProjectManager.getDefault().clearNonProjectCache(); // Always open top dir as a project: resultSet.add(foDir); // open pom.xml file resultSet.add(foPom); // trigger download of dependencies Project prj = ProjectManager.getDefault().findProject(foDir); if (prj != null) { final NbMavenProject mvn = prj.getLookup().lookup(NbMavenProject.class); if (mvn != null) { mvn.downloadDependencyAndJavadocSource(false); } } // remember folder for creation of new projects File parent = dirF.getParentFile(); if (parent != null && parent.exists()) { ProjectChooser.setProjectsFolder(parent); } // remember used deps final Preferences prefs = BootDependenciesPanel.depsCountPrefNode(); String[] splitDeps = deps.split(","); // add to counts in prefs for (String depName : splitDeps) { prefs.putInt(depName, prefs.getInt(depName, 0) + 1); } } catch (Exception ex) { Exceptions.printStackTrace(ex); } handle.finish(); return resultSet; }