Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
22,600
int () { return System.identityHashCode(this); }
getId
22,601
MavenProject (int id) { Reference<RemoteNativeMaven40ProjectHolder> reference = myMap.get(id); RemoteNativeMaven40ProjectHolder result = reference == null ? null : reference.get(); if (result == null) { throw new RuntimeException("NativeMavenProjectHolder not found for id: " + id); } return result.myMavenProject; }
findProjectById
22,602
void () { if (myIndicator.isCanceled()) throw new MavenProcessCanceledRuntimeException(); }
checkCanceled
22,603
String (TransferEvent event) { TransferResource resource = event.getResource(); File file = resource.getFile(); return (file == null ? resource.getResourceName() : file.getName()) + " [" + resource.getRepositoryUrl() + "]"; }
formatResourceName
22,604
void (TransferEvent event) { checkCanceled(); String eventString = formatResourceName(event); myIndicator.debug(eventString); }
transferInitiated
22,605
void (TransferEvent event) { checkCanceled(); TransferResource r = event.getResource(); long totalLength = r.getContentLength(); String sizeInfo; if (totalLength <= 0) { sizeInfo = StringUtilRt.formatFileSize(event.getTransferredBytes()) + " / ?"; } else { sizeInfo = StringUtilRt.formatFileSize(event.getTransferredBytes()) + " / " + StringUtilRt.formatFileSize(totalLength); } myIndicator.debug(formatResourceName(event) + " (" + sizeInfo + ')'); if (totalLength > 0) { myIndicator.debug(String.valueOf(Math.floor(100 * (double)event.getTransferredBytes() / totalLength)) + "%"); } }
transferProgressed
22,606
void (TransferEvent event) { myIndicator.debug("Finished (" + StringUtilRt.formatFileSize(event.getTransferredBytes()) + ") " + formatResourceName(event)); MavenServerGlobals.getDownloadListener().artifactDownloaded(event.getResource().getFile(), event.getResource().getResourceName()); }
transferSucceeded
22,607
void (TransferEvent event) { if (myIndicator.isCanceled()) { myIndicator.info("Canceling..."); return; // Don't throw exception here. } myIndicator.warn("Failed to download " + formatResourceName(event)); }
transferFailed
22,608
void (MavenServerConsoleIndicatorImpl wrappee) { myWrappee = wrappee; }
setWrappee
22,609
void (String string, Throwable throwable) { doPrint(MavenServerConsoleIndicator.LEVEL_DEBUG, string, throwable); }
debug
22,610
void (String string, Throwable throwable) { doPrint(MavenServerConsoleIndicator.LEVEL_INFO, string, throwable); }
info
22,611
void (String string, Throwable throwable) { doPrint(MavenServerConsoleIndicator.LEVEL_WARN, string, throwable); }
warn
22,612
void (String string, Throwable throwable) { doPrint(MavenServerConsoleIndicator.LEVEL_ERROR, string, throwable); }
error
22,613
void (String string, Throwable throwable) { doPrint(MavenServerConsoleIndicator.LEVEL_FATAL, string, throwable); }
fatalError
22,614
void (String message) { debug(message, null); }
debug
22,615
boolean () { return getThreshold() <= MavenServerConsoleIndicator.LEVEL_DEBUG; }
isDebugEnabled
22,616
void (String message) { info(message, null); }
info
22,617
boolean () { return getThreshold() <= MavenServerConsoleIndicator.LEVEL_INFO; }
isInfoEnabled
22,618
void (String message) { warn(message, null); }
warn
22,619
boolean () { return getThreshold() <= MavenServerConsoleIndicator.LEVEL_WARN; }
isWarnEnabled
22,620
void (String message) { error(message, null); }
error
22,621
boolean () { return getThreshold() <= MavenServerConsoleIndicator.LEVEL_ERROR; }
isErrorEnabled
22,622
void (String message) { fatalError(message, null); }
fatalError
22,623
boolean () { return getThreshold() <= MavenServerConsoleIndicator.LEVEL_FATAL; }
isFatalErrorEnabled
22,624
void (int threshold) { this.myThreshold = threshold; }
setThreshold
22,625
int () { return myThreshold; }
getThreshold
22,626
Logger (String s) { return null; }
getChildLogger
22,627
String () { return toString(); }
getName
22,628
MavenModel (MavenModel model, MavenModel parentModel) { // mergeModel_Properties if (null != parentModel) { Properties parentProperties = parentModel.getProperties(); Properties properties = model.getProperties(); for (Object keyObject : parentProperties.keySet()) { String key = keyObject.toString(); if (!properties.containsKey(key)) { properties.setProperty(key, parentProperties.getProperty(key)); } } } Model result = Maven40ModelConverter.toNativeModel(model).getDelegate(); Model parent = Maven40ModelConverter.toNativeModel(parentModel).getDelegate(); DefaultModelBuildingRequest request = new DefaultModelBuildingRequest(); new DefaultInheritanceAssembler().assembleModelInheritance(result, parent, request, new ModelProblemCollector() { @Override public void add(ModelProblemCollectorRequest request) { } }); return Maven40ApiModelConverter.convertModel(result); }
assembleInheritance
22,629
void (ModelProblemCollectorRequest request) { }
add
22,630
ArrayList<MavenServerExecutionResult> (@NotNull LongRunningTask task, @NotNull Collection<File> files, @NotNull List<String> activeProfiles, @NotNull List<String> inactiveProfiles) { try { Collection<Maven40ExecutionResult> results = doResolveProject( task, files, activeProfiles, inactiveProfiles ); ArrayList<MavenServerExecutionResult> list = new ArrayList<>(); results.stream().map(result -> createExecutionResult(result)).forEachOrdered(list::add); return list; } catch (Exception e) { throw myEmbedder.wrapToSerializableRuntimeException(e); } }
resolveProjects
22,631
Collection<Maven40ExecutionResult> (@NotNull LongRunningTask task, @NotNull Collection<File> files, @NotNull List<String> activeProfiles, @NotNull List<String> inactiveProfiles) { File file = !files.isEmpty() ? files.iterator().next() : null; MavenExecutionRequest request = myEmbedder.createRequest(file, activeProfiles, inactiveProfiles, userProperties); request.setUpdateSnapshots(myUpdateSnapshots); Collection<Maven40ExecutionResult> executionResults = new ArrayList<>(); Map<ProjectBuildingResult, List<Exception>> buildingResultsToResolveDependencies = new HashMap<>(); myEmbedder.executeWithMavenSession(request, () -> { try { MavenSession mavenSession = myEmbedder.getComponent(LegacySupport.class).getSession(); RepositorySystemSession repositorySession = myEmbedder.getComponent(LegacySupport.class).getRepositorySession(); if (repositorySession instanceof DefaultRepositorySystemSession) { DefaultRepositorySystemSession session = (DefaultRepositorySystemSession)repositorySession; myImporterSpy.setIndicator(myCurrentIndicator); session.setTransferListener(new Maven40TransferListenerAdapter(myCurrentIndicator)); if (myWorkspaceMap != null) { session.setWorkspaceReader(new Maven40WorkspaceMapReader(myWorkspaceMap)); } session.setConfigProperty(ConflictResolver.CONFIG_PROP_VERBOSE, true); session.setConfigProperty(DependencyManagerUtils.CONFIG_PROP_VERBOSE, true); } List<ProjectBuildingResult> buildingResults = getProjectBuildingResults(request, files); fillSessionCache(mavenSession, repositorySession, buildingResults); for (ProjectBuildingResult buildingResult : buildingResults) { MavenProject project = buildingResult.getProject(); if (project == null) { List<Exception> exceptions = new ArrayList<>(); for (ModelProblem problem : buildingResult.getProblems()) { exceptions.add(problem.getException()); } executionResults.add(new Maven40ExecutionResult(buildingResult.getPomFile(), exceptions)); continue; } List<Exception> exceptions = new ArrayList<>(); loadExtensions(project, exceptions); //project.setDependencyArtifacts(project.createArtifacts(myEmbedder.getComponent(ArtifactFactory.class), null, null)); buildingResultsToResolveDependencies.put(buildingResult, exceptions); } task.updateTotalRequests(buildingResultsToResolveDependencies.size()); boolean runInParallel = myResolveInParallel; Collection<Maven40ExecutionResult> execResults = ParallelRunner.execute( runInParallel, buildingResultsToResolveDependencies.entrySet(), entry -> { if (task.isCanceled()) return new Maven40ExecutionResult(Collections.emptyList()); Maven40ExecutionResult result = resolveBuildingResult(repositorySession, entry.getKey(), entry.getValue()); task.incrementFinishedRequests(); return result; } ); executionResults.addAll(execResults); } catch (Exception e) { executionResults.add(handleException(e)); } }); return executionResults; }
doResolveProject
22,632
Maven40ExecutionResult (RepositorySystemSession repositorySession, ProjectBuildingResult buildingResult, List<Exception> exceptions) { MavenProject project = buildingResult.getProject(); try { List<ModelProblem> modelProblems = new ArrayList<>(); if (buildingResult.getProblems() != null) { modelProblems.addAll(buildingResult.getProblems()); } DependencyResolutionResult dependencyResolutionResult = resolveDependencies(project, repositorySession); Set<Artifact> artifacts = resolveArtifacts(dependencyResolutionResult); project.setArtifacts(artifacts); return new Maven40ExecutionResult(project, dependencyResolutionResult, exceptions, modelProblems); } catch (Exception e) { return handleException(project, e); } }
resolveBuildingResult
22,633
DependencyResolutionResult (MavenProject project, RepositorySystemSession session) { DependencyResolutionResult resolutionResult; try { ProjectDependenciesResolver dependencyResolver = myEmbedder.getComponent(ProjectDependenciesResolver.class); DefaultDependencyResolutionRequest resolution = new DefaultDependencyResolutionRequest(project, session); resolutionResult = dependencyResolver.resolve(resolution); } catch (DependencyResolutionException e) { resolutionResult = e.getResult(); } Set<Artifact> artifacts = new LinkedHashSet<>(); if (resolutionResult.getDependencyGraph() != null) { RepositoryUtils.toArtifacts( artifacts, resolutionResult.getDependencyGraph().getChildren(), null == project.getArtifact() ? Collections.emptyList() : Collections.singletonList(project.getArtifact().getId()), null); // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not LocalRepositoryManager lrm = session.getLocalRepositoryManager(); for (Artifact artifact : artifacts) { if (!artifact.isResolved()) { String path = lrm.getPathForLocalArtifact(RepositoryUtils.toArtifact(artifact)); artifact.setFile(new File(lrm.getRepository().getBasedir(), path)); } } } project.setResolvedArtifacts(artifacts); project.setArtifacts(artifacts); return resolutionResult; }
resolveDependencies
22,634
MavenServerExecutionResult (Maven40ExecutionResult result) { File file = result.getPomFile(); Collection<MavenProjectProblem> problems = MavenProjectProblem.createProblemsList(); myEmbedder.collectProblems(file, result.getExceptions(), result.getModelProblems(), problems); Collection<MavenProjectProblem> unresolvedProblems = new HashSet<>(); collectUnresolvedArtifactProblems(file, result.getDependencyResolutionResult(), unresolvedProblems); MavenProject mavenProject = result.getMavenProject(); if (mavenProject == null) return new MavenServerExecutionResult(null, problems, Collections.emptySet()); MavenModel model = new MavenModel(); try { DependencyResolutionResult dependencyResolutionResult = result.getDependencyResolutionResult(); DependencyNode dependencyGraph = dependencyResolutionResult != null ? dependencyResolutionResult.getDependencyGraph() : null; List<DependencyNode> dependencyNodes = dependencyGraph != null ? dependencyGraph.getChildren() : Collections.emptyList(); model = Maven40AetherModelConverter.convertModelWithAetherDependencyTree( mavenProject.getModel(), mavenProject.getCompileSourceRoots(), mavenProject.getTestCompileSourceRoots(), mavenProject.getArtifacts(), dependencyNodes, Collections.emptyList(), //mavenProject.getExtensionArtifacts(), myLocalRepositoryFile); } catch (Exception e) { myEmbedder.collectProblems(mavenProject.getFile(), Collections.singleton(e), result.getModelProblems(), problems); } RemoteNativeMaven40ProjectHolder holder = new RemoteNativeMaven40ProjectHolder(mavenProject); try { UnicastRemoteObject.exportObject(holder, 0); } catch (RemoteException e) { throw new RuntimeException(e); } Collection<String> activatedProfiles = Maven40ProfileUtil.collectActivatedProfiles(mavenProject); Map<String, String> mavenModelMap = Maven40ModelConverter.convertToMap(mavenProject.getModel()); MavenServerExecutionResult.ProjectData data = new MavenServerExecutionResult.ProjectData(model, mavenModelMap, holder, activatedProfiles); if (null == model.getBuild() || null == model.getBuild().getDirectory()) { data = null; } return new MavenServerExecutionResult(data, problems, Collections.emptySet(), unresolvedProblems); }
createExecutionResult
22,635
void (@Nullable File file, @Nullable DependencyResolutionResult result, Collection<MavenProjectProblem> problems) { if (result == null) return; String path = file == null ? "" : file.getPath(); for (Dependency unresolvedDependency : result.getUnresolvedDependencies()) { for (Exception exception : result.getResolutionErrors(unresolvedDependency)) { String message = Maven40ServerEmbedderImpl.getRootMessage(exception); Artifact artifact = RepositoryUtils.toArtifact(unresolvedDependency.getArtifact()); MavenArtifact mavenArtifact = Maven40ModelConverter.convertArtifact(artifact, myLocalRepositoryFile); problems.add(MavenProjectProblem.createUnresolvedArtifactProblem(path, message, true, mavenArtifact)); break; } } }
collectUnresolvedArtifactProblems
22,636
Maven40ExecutionResult (Exception e) { return new Maven40ExecutionResult(Collections.singletonList(e)); }
handleException
22,637
Maven40ExecutionResult (MavenProject mavenProject, Exception e) { return new Maven40ExecutionResult(mavenProject, Collections.singletonList(e)); }
handleException
22,638
Set<Artifact> (DependencyResolutionResult dependencyResolutionResult) { Map<Dependency, Artifact> winnerDependencyMap = new IdentityHashMap<>(); Set<Artifact> artifacts = new LinkedHashSet<>(); Set<Dependency> addedDependencies = Collections.newSetFromMap(new IdentityHashMap<>()); resolveConflicts(dependencyResolutionResult, winnerDependencyMap); if (dependencyResolutionResult.getDependencyGraph() != null) { dependencyResolutionResult.getDependencyGraph().getChildren(); } for (Dependency dependency : dependencyResolutionResult.getDependencies()) { Artifact artifact = dependency == null ? null : winnerDependencyMap.get(dependency); if (artifact != null) { addedDependencies.add(dependency); artifacts.add(artifact); resolveAsModule(artifact); } } //if any syntax error presents in pom.xml we may not get dependencies via getDependencies, but they are in dependencyGraph. // we need to BFS this graph and add dependencies Queue<DependencyNode> queue = new ArrayDeque<>(dependencyResolutionResult.getDependencyGraph().getChildren()); while (!queue.isEmpty()) { DependencyNode node = queue.poll(); queue.addAll(node.getChildren()); Dependency dependency = node.getDependency(); if (dependency == null || !addedDependencies.add(dependency)) { continue; } Artifact artifact = winnerDependencyMap.get(dependency); if (artifact != null) { addedDependencies.add(dependency); //todo: properly resolve order artifacts.add(artifact); resolveAsModule(artifact); } } return artifacts; }
resolveArtifacts
22,639
void (MavenSession mavenSession, RepositorySystemSession session, List<ProjectBuildingResult> buildingResults) { if (session instanceof DefaultRepositorySystemSession) { int initialCapacity = (int)(buildingResults.size() * 1.5); Map<MavenId, Model> cacheMavenModelMap = new HashMap<>(initialCapacity); Map<String, MavenProject> mavenProjectMap = new HashMap<>(initialCapacity); for (ProjectBuildingResult result : buildingResults) { if (result.getProblems() != null && !result.getProblems().isEmpty()) continue; Model model = result.getProject().getModel(); String key = ArtifactUtils.key(model.getGroupId(), model.getArtifactId(), model.getVersion()); mavenProjectMap.put(key, result.getProject()); cacheMavenModelMap.put(new MavenId(model.getGroupId(), model.getArtifactId(), model.getVersion()), model); } mavenSession.setProjectMap(mavenProjectMap); ((DefaultRepositorySystemSession)session).setWorkspaceReader( new Maven40WorkspaceReader(session.getWorkspaceReader(), cacheMavenModelMap)); } }
fillSessionCache
22,640
void (MavenProject project, List<Exception> exceptions) { ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); Collection<AbstractMavenLifecycleParticipant> lifecycleParticipants = myEmbedder.getLifecycleParticipants(Collections.singletonList(project)); if (!lifecycleParticipants.isEmpty()) { LegacySupport legacySupport = myEmbedder.getComponent(LegacySupport.class); MavenSession session = legacySupport.getSession(); if (null != session) { session.setCurrentProject(project); try { // the method can be removed session.setAllProjects(Collections.singletonList(project)); } catch (NoSuchMethodError ignore) { } session.setProjects(Collections.singletonList(project)); for (AbstractMavenLifecycleParticipant listener : lifecycleParticipants) { Thread.currentThread().setContextClassLoader(listener.getClass().getClassLoader()); try { listener.afterProjectsRead(session); } catch (Exception e) { exceptions.add(e); } finally { Thread.currentThread().setContextClassLoader(originalClassLoader); } } } } }
loadExtensions
22,641
boolean (Artifact a) { MavenWorkspaceMap map = myWorkspaceMap; if (map == null) return false; MavenWorkspaceMap.Data resolved = map.findFileAndOriginalId(Maven40ModelConverter.createMavenId(a)); if (resolved == null) return false; a.setResolved(true); a.setFile(resolved.getFile(a.getType())); a.selectVersion(resolved.originalId.getVersion()); return true; }
resolveAsModule
22,642
void (DependencyResolutionResult dependencyResolutionResult, Map<Dependency, Artifact> winnerDependencyMap) { dependencyResolutionResult.getDependencyGraph().accept(new TreeDependencyVisitor(new DependencyVisitor() { @Override public boolean visitEnter(DependencyNode node) { Object winner = node.getData().get(ConflictResolver.NODE_DATA_WINNER); Dependency dependency = node.getDependency(); if (dependency != null && winner == null) { Artifact winnerArtifact = Maven40AetherModelConverter.toArtifact(dependency); winnerDependencyMap.put(dependency, winnerArtifact); } return true; } @Override public boolean visitLeave(DependencyNode node) { return true; } })); }
resolveConflicts
22,643
boolean (DependencyNode node) { Object winner = node.getData().get(ConflictResolver.NODE_DATA_WINNER); Dependency dependency = node.getDependency(); if (dependency != null && winner == null) { Artifact winnerArtifact = Maven40AetherModelConverter.toArtifact(dependency); winnerDependencyMap.put(dependency, winnerArtifact); } return true; }
visitEnter
22,644
boolean (DependencyNode node) { return true; }
visitLeave
22,645
List<ProjectBuildingResult> (@NotNull MavenExecutionRequest request, @NotNull Collection<File> files) { ProjectBuilder builder = myEmbedder.getComponent(ProjectBuilder.class); List<ProjectBuildingResult> buildingResults = new ArrayList<>(); ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest(); projectBuildingRequest.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); projectBuildingRequest.setResolveDependencies(false); if (files.size() == 1) { buildSinglePom(builder, buildingResults, projectBuildingRequest, files.iterator().next()); } else { try { buildingResults = builder.build(new ArrayList<>(files), false, projectBuildingRequest); } catch (ProjectBuildingException e) { for (ProjectBuildingResult result : e.getResults()) { if (result.getProject() != null) { buildingResults.add(result); } else { buildSinglePom(builder, buildingResults, projectBuildingRequest, result.getPomFile()); } } } } return buildingResults; }
getProjectBuildingResults
22,646
void (ProjectBuilder builder, List<ProjectBuildingResult> buildingResults, ProjectBuildingRequest projectBuildingRequest, File pomFile) { try { ProjectBuildingResult build = builder.build(pomFile, projectBuildingRequest); buildingResults.add(build); } catch (ProjectBuildingException e) { Maven40ResolverUtil.handleProjectBuildingException(buildingResults, e); } }
buildSinglePom
22,647
MavenModel (Model model) { Build build = model.getBuild(); return convertModel( model, asSourcesList(build.getSourceDirectory()), asSourcesList(build.getTestSourceDirectory())); }
convertModel
22,648
MavenModel (Model model, List<String> sources, List<String> testSources) { MavenModel result = new MavenModel(); result.setMavenId(new MavenId(model.getGroupId(), model.getArtifactId(), model.getVersion())); Parent parent = model.getParent(); if (parent != null) { result.setParent(new MavenParent( new MavenId(parent.getGroupId(), parent.getArtifactId(), parent.getVersion()), parent.getRelativePath())); } result.setPackaging(model.getPackaging()); result.setName(model.getName()); result.setProperties(model.getProperties()); result.setPlugins(convertPlugins(model)); result.setRemoteRepositories(convertRepositories(model.getRepositories())); result.setProfiles(convertProfiles(model.getProfiles())); result.setModules(model.getModules()); convertBuild(result.getBuild(), model.getBuild(), sources, testSources); return result; }
convertModel
22,649
List<MavenPlugin> (Model mavenModel) { List<MavenPlugin> result = new ArrayList<>(); Build build = mavenModel.getBuild(); if (build != null) { List<Plugin> plugins = build.getPlugins(); if (plugins != null) { for (Plugin each : plugins) { result.add(convertPlugin(false, each)); } } } return result; }
convertPlugins
22,650
MavenPlugin (boolean isDefault, Plugin plugin) { List<MavenPlugin.Execution> executions = new ArrayList<>(plugin.getExecutions().size()); for (PluginExecution each : plugin.getExecutions()) { executions.add(convertExecution(each)); } List<MavenId> deps = new ArrayList<>(plugin.getDependencies().size()); for (Dependency each : plugin.getDependencies()) { deps.add(new MavenId(each.getGroupId(), each.getArtifactId(), each.getVersion())); } return new MavenPlugin(plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), isDefault, "true".equals(plugin.getExtensions()), convertConfiguration(plugin.getConfiguration()), executions, deps); }
convertPlugin
22,651
Element (Object config) { return config == null ? null : xppToElement((Xpp3Dom)config); }
convertConfiguration
22,652
Element (Xpp3Dom xpp) { Element result; try { result = new Element(xpp.getName()); } catch (IllegalNameException e) { MavenServerGlobals.getLogger().info(e); return null; } Xpp3Dom[] children = xpp.getChildren(); if (children == null || children.length == 0) { result.setText(xpp.getValue()); } else { for (Xpp3Dom each : children) { Element child = xppToElement(each); if (child != null) result.addContent(child); } } return result; }
xppToElement
22,653
List<String> (String directory) { return directory == null ? Collections.emptyList() : Collections.singletonList(directory); }
asSourcesList
22,654
void (MavenBuild result, Build build, List<String> sources, List<String> testSources) { convertBuildBase(result, build); result.setOutputDirectory(build.getOutputDirectory()); result.setTestOutputDirectory(build.getTestOutputDirectory()); result.setSources(sources); result.setTestSources(testSources); }
convertBuild
22,655
void (MavenBuildBase result, BuildBase build) { result.setFinalName(build.getFinalName()); result.setDefaultGoal(build.getDefaultGoal()); result.setDirectory(build.getDirectory()); result.setResources(convertResources(build.getResources())); result.setTestResources(convertResources(build.getTestResources())); result.setFilters(build.getFilters() == null ? Collections.emptyList() : build.getFilters()); }
convertBuildBase
22,656
List<MavenResource> (List<Resource> resources) { if (resources == null) return new ArrayList<MavenResource>(); List<MavenResource> result = new ArrayList<MavenResource>(resources.size()); for (Resource each : resources) { String directory = each.getDirectory(); if (null == directory) continue; result.add(new MavenResource(directory, each.isFiltering(), each.getTargetPath(), ensurePatterns(each.getIncludes()), ensurePatterns(each.getExcludes()))); } return result; }
convertResources
22,657
List<String> (List<String> patterns) { return patterns == null ? Collections.emptyList() : patterns; }
ensurePatterns
22,658
List<MavenRemoteRepository> (List<? extends Repository> repositories) { if (repositories == null) return new ArrayList<MavenRemoteRepository>(); List<MavenRemoteRepository> result = new ArrayList<MavenRemoteRepository>(repositories.size()); for (Repository each : repositories) { result.add(new MavenRemoteRepository(each.getId(), each.getName(), each.getUrl(), each.getLayout(), convertPolicy(each.getReleases()), convertPolicy(each.getSnapshots()))); } return result; }
convertRepositories
22,659
String (Artifact artifact) { return artifact.getExtension(); }
convertExtension
22,660
List<MavenProfile> (Collection<? extends Profile> profiles) { if (profiles == null) return Collections.emptyList(); List<MavenProfile> result = new ArrayList<MavenProfile>(); for (Profile each : profiles) { String id = each.getId(); if (id == null) continue; MavenProfile profile = new MavenProfile(id, each.getSource()); List<String> modules = each.getModules(); profile.setModules(modules == null ? Collections.emptyList() : modules); profile.setActivation(convertActivation(each.getActivation())); if (each.getBuild() != null) convertBuildBase(profile.getBuild(), each.getBuild()); result.add(profile); } return result; }
convertProfiles
22,661
MavenProfileActivation (Activation activation) { if (activation == null) return null; MavenProfileActivation result = new MavenProfileActivation(); result.setActiveByDefault(activation.isActiveByDefault()); result.setOs(convertOsActivation(activation.getOs())); result.setJdk(activation.getJdk()); result.setFile(convertFileActivation(activation.getFile())); result.setProperty(convertPropertyActivation(activation.getProperty())); return result; }
convertActivation
22,662
MavenProfileActivationOS (ActivationOS os) { return os == null ? null : new MavenProfileActivationOS(os.getName(), os.getFamily(), os.getArch(), os.getVersion()); }
convertOsActivation
22,663
MavenProfileActivationFile (ActivationFile file) { return file == null ? null : new MavenProfileActivationFile(file.getExists(), file.getMissing()); }
convertFileActivation
22,664
MavenProfileActivationProperty (ActivationProperty property) { return property == null ? null : new MavenProfileActivationProperty(property.getName(), property.getValue()); }
convertPropertyActivation
22,665
boolean (String toStringResult, Object o) { String className = o.getClass().getName(); return (toStringResult.startsWith(className) && toStringResult.startsWith("@", className.length())); }
isNativeToString
22,666
boolean (Class clazz) { return clazz.isArray() || Collection.class.isAssignableFrom(clazz) || Map.class.isAssignableFrom(clazz) || Xpp3Dom.class.isAssignableFrom(clazz); }
shouldSkip
22,667
MavenArtifact (Artifact artifact, Path artifactPath, File localRepository) { return new MavenArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion().asString(), artifact.getVersion().asString(), "", //artifact.getType(), artifact.getClassifier(), "", //artifact.getScope(), false, //artifact.isOptional(), convertExtension(artifact), null == artifactPath ? null : artifactPath.toFile(), localRepository, null != artifactPath, false /*artifact instanceof CustomMaven3Artifact && ((CustomMaven3Artifact)artifact).isStub()*/); }
convertArtifactAndPath
22,668
MavenModel (Model model, List<String> sources, List<String> testSources, Collection<? extends Artifact> dependencies, Collection<? extends DependencyNode> dependencyTree, Collection<? extends Artifact> extensions, File localRepository) { MavenModel result = new MavenModel(); result.setMavenId(new MavenId(model.getGroupId(), model.getArtifactId(), model.getVersion())); Parent parent = model.getParent(); if (parent != null) { result.setParent(new MavenParent(new MavenId(parent.getGroupId(), parent.getArtifactId(), parent.getVersion()), parent.getRelativePath())); } result.setPackaging(model.getPackaging()); result.setName(model.getName()); result.setProperties(model.getProperties() == null ? new Properties() : model.getProperties()); result.setPlugins(convertPlugins(model)); Map<Artifact, MavenArtifact> convertedArtifacts = new HashMap<>(); result.setExtensions(convertArtifacts(extensions, convertedArtifacts, localRepository)); result.setDependencyTree(convertAetherDependencyNodes(null, dependencyTree, convertedArtifacts, localRepository)); result.setDependencies(convertArtifacts(dependencies, convertedArtifacts, localRepository)); result.setRemoteRepositories(convertRepositories(model.getRepositories())); result.setProfiles(convertProfiles(model.getProfiles())); result.setModules(model.getModules()); convertBuild(result.getBuild(), model.getBuild(), sources, testSources); return result; }
convertModelWithAetherDependencyTree
22,669
List<MavenArtifactNode> (MavenArtifactNode parent, Collection<? extends DependencyNode> nodes, Map<Artifact, MavenArtifact> nativeToConvertedMap, File localRepository) { List<MavenArtifactNode> result = new ArrayList<>(nodes.size()); for (DependencyNode each : nodes) { Artifact a = toArtifact(each.getDependency()); MavenArtifact ma = convertArtifact(a, nativeToConvertedMap, localRepository); Map<?, ?> data = each.getData(); String premanagedVersion = DependencyManagerUtils.getPremanagedVersion(each); String premanagedScope = DependencyManagerUtils.getPremanagedScope(each); MavenArtifactState state = MavenArtifactState.ADDED; MavenArtifact relatedArtifact = null; String scope = each.getDependency().getScope(); Object winner = data.get(ConflictResolver.NODE_DATA_WINNER); if (winner instanceof DependencyNode) { DependencyNode winnerNode = (DependencyNode)winner; scope = winnerNode.getDependency().getScope(); Artifact winnerArtifact = toArtifact(winnerNode.getDependency()); relatedArtifact = convertArtifact(winnerArtifact, nativeToConvertedMap, localRepository); nativeToConvertedMap.put(winnerArtifact, relatedArtifact); if (!Objects.equals(each.getVersion().toString(), winnerNode.getVersion().toString())) { state = MavenArtifactState.CONFLICT; } else { state = MavenArtifactState.DUPLICATE; } } ma.setScope(scope); MavenArtifactNode newNode = new MavenArtifactNode(parent, ma, state, relatedArtifact, each.getDependency().getScope(), premanagedVersion, premanagedScope); newNode.setDependencies(convertAetherDependencyNodes(newNode, each.getChildren(), nativeToConvertedMap, localRepository)); result.add(newNode); } return result; }
convertAetherDependencyNodes
22,670
Artifact (@Nullable Dependency dependency) { if (dependency == null) { return null; } Artifact result = RepositoryUtils.toArtifact(dependency.getArtifact()); if(result == null) { return null; } result.setScope(dependency.getScope()); result.setOptional(dependency.isOptional()); return result; }
toArtifact
22,671
WorkspaceRepository () { return myRepository; }
getRepository
22,672
File (Artifact artifact) { return myWorkspaceReader == null ? null : myWorkspaceReader.findArtifact(artifact); }
findArtifact
22,673
List<String> (Artifact artifact) { return myWorkspaceReader == null ? Collections.emptyList() : myWorkspaceReader.findVersions(artifact); }
findVersions
22,674
Model (Artifact artifact) { return myMavenModelMap.get(new MavenId(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion())); }
findModel
22,675
void (List<ProjectBuildingResult> buildingResults, ProjectBuildingException e) { List<ProjectBuildingResult> results = e.getResults(); if (results != null && !results.isEmpty()) { buildingResults.addAll(results); } else { Throwable cause = e.getCause(); List<ModelProblem> problems = null; if (cause instanceof ModelBuildingException) { problems = ((ModelBuildingException)cause).getProblems(); } buildingResults.add(new MyProjectBuildingResult(null, e.getPomFile(), null, problems, null)); } }
handleProjectBuildingException
22,676
String () { return myProjectId; }
getProjectId
22,677
File () { return myPomFile; }
getPomFile
22,678
MavenProject () { return myMavenProject; }
getProject
22,679
List<ModelProblem> () { return myProblems; }
getProblems
22,680
DependencyResolutionResult () { return myDependencyResolutionResult; }
getDependencyResolutionResult
22,681
Settings (SettingsBuilder builder, MavenServerSettings settings, Properties systemProperties, Properties userProperties) { SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest(); if (settings.getGlobalSettingsPath() != null) { settingsRequest.setGlobalSettingsFile(new File(settings.getGlobalSettingsPath())); } if (settings.getUserSettingsPath() != null) { settingsRequest.setUserSettingsFile(new File(settings.getUserSettingsPath())); } settingsRequest.setSystemProperties(systemProperties); settingsRequest.setUserProperties(userProperties); Settings result = new Settings(); try { result = builder.build(settingsRequest).getEffectiveSettings(); } catch (SettingsBuildingException e) { MavenServerGlobals.getLogger().info(e); } result.setOffline(settings.isOffline()); if (settings.getLocalRepositoryPath() != null) { result.setLocalRepository(settings.getLocalRepositoryPath()); } if (result.getLocalRepository() == null) { result.setLocalRepository(new File(System.getProperty("user.home"), ".m2/repository").getPath()); } return result; }
buildSettings
22,682
MavenModel (Model model) { if(model.getBuild() == null) { model.setBuild(new Build()); } Build build = model.getBuild(); return convertModel(model, asSourcesList(build.getSourceDirectory()), asSourcesList(build.getTestSourceDirectory())); }
convertModel
22,683
MavenModel (Model model, List<String> sources, List<String> testSources) { MavenModel result = new MavenModel(); result.setMavenId(new MavenId(model.getGroupId(), model.getArtifactId(), model.getVersion())); Parent parent = model.getParent(); if (parent != null) { result.setParent(new MavenParent(new MavenId(parent.getGroupId(), parent.getArtifactId(), parent.getVersion()), parent.getRelativePath())); } result.setPackaging(model.getPackaging()); result.setName(model.getName()); result.setProperties(model.getProperties() == null ? new Properties() : model.getProperties()); result.setPlugins(convertPlugins(model)); result.setRemoteRepositories(convertRepositories(model.getRepositories())); result.setProfiles(convertProfiles(model.getProfiles())); result.setModules(model.getModules()); convertBuild(result.getBuild(), model.getBuild(), sources, testSources); return result; }
convertModel
22,684
List<MavenPlugin> (Model mavenModel) { List<MavenPlugin> result = new ArrayList<>(); Build build = mavenModel.getBuild(); if (build != null) { List<Plugin> plugins = build.getPlugins(); if (plugins != null) { for (Plugin each : plugins) { result.add(convertPlugin(each)); } } } return result; }
convertPlugins
22,685
MavenPlugin (Plugin plugin) { List<MavenPlugin.Execution> executions = new ArrayList<>(plugin.getExecutions().size()); for (PluginExecution each : plugin.getExecutions()) { executions.add(convertExecution(each)); } List<MavenId> deps = new ArrayList<>(plugin.getDependencies().size()); for (Dependency each : plugin.getDependencies()) { deps.add(new MavenId(each.getGroupId(), each.getArtifactId(), each.getVersion())); } return new MavenPlugin(plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), false, "true".equals(plugin.getExtensions()), convertConfiguration(plugin.getConfiguration()), executions, deps); }
convertPlugin
22,686
Element (Object config) { return config == null ? null : xppToElement((Xpp3Dom)config); }
convertConfiguration
22,687
Element (Xpp3Dom xpp) { Element result; try { result = new Element(xpp.getName()); } catch (IllegalNameException e) { MavenServerGlobals.getLogger().info(e); return null; } Xpp3Dom[] children = xpp.getChildren(); if (children == null || children.length == 0) { result.setText(xpp.getValue()); } else { for (Xpp3Dom each : children) { Element child = xppToElement(each); if (child != null) result.addContent(child); } } return result; }
xppToElement
22,688
List<String> (String directory) { return directory == null ? Collections.emptyList() : Collections.singletonList(directory); }
asSourcesList
22,689
void (MavenBuild result, Build build, List<String> sources, List<String> testSources) { convertBuildBase(result, build); result.setOutputDirectory(build.getOutputDirectory()); result.setTestOutputDirectory(build.getTestOutputDirectory()); result.setSources(sources); result.setTestSources(testSources); }
convertBuild
22,690
void (MavenBuildBase result, BuildBase build) { result.setFinalName(build.getFinalName()); result.setDefaultGoal(build.getDefaultGoal()); result.setDirectory(build.getDirectory()); result.setResources(convertResources(build.getResources())); result.setTestResources(convertResources(build.getTestResources())); result.setFilters(build.getFilters() == null ? Collections.emptyList() : build.getFilters()); }
convertBuildBase
22,691
MavenId (Artifact artifact) { return new MavenId(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion()); }
createMavenId
22,692
List<MavenResource> (List<Resource> resources) { if (resources == null) return new ArrayList<MavenResource>(); List<MavenResource> result = new ArrayList<MavenResource>(resources.size()); for (Resource each : resources) { String directory = each.getDirectory(); if (null == directory) continue; result.add(new MavenResource(directory, each.isFiltering(), each.getTargetPath(), ensurePatterns(each.getIncludes()), ensurePatterns(each.getExcludes()))); } return result; }
convertResources
22,693
List<String> (List<String> patterns) { return patterns == null ? Collections.emptyList() : patterns; }
ensurePatterns
22,694
List<MavenRemoteRepository> (List<? extends Repository> repositories) { if (repositories == null) return new ArrayList<MavenRemoteRepository>(); List<MavenRemoteRepository> result = new ArrayList<MavenRemoteRepository>(repositories.size()); for (Repository each : repositories) { result.add(new MavenRemoteRepository(each.getId(), each.getName(), each.getUrl(), each.getLayout(), convertPolicy(each.getReleases()), convertPolicy(each.getSnapshots()))); } return result; }
convertRepositories
22,695
List<MavenRemoteRepository> (List<? extends ArtifactRepository> repositories) { if (repositories == null) return new ArrayList<MavenRemoteRepository>(); List<MavenRemoteRepository> result = new ArrayList<MavenRemoteRepository>(repositories.size()); for (ArtifactRepository each : repositories) { result.add(new MavenRemoteRepository(each.getId(), each.getId(), each.getUrl(), each.getLayout() != null ? each.getLayout().getId() : "default", convertPolicy(each.getReleases()), convertPolicy(each.getSnapshots()))); } return result; }
convertRemoteRepositories
22,696
String (Artifact artifact) { ArtifactHandler handler = artifact.getArtifactHandler(); String result = null; if (handler != null) result = handler.getExtension(); if (result == null) result = artifact.getType(); return result; }
convertExtension
22,697
List<MavenProfile> (Collection<? extends Profile> profiles) { if (profiles == null) return Collections.emptyList(); List<MavenProfile> result = new ArrayList<MavenProfile>(); for (Profile each : profiles) { String id = each.getId(); if (id == null) continue; MavenProfile profile = new MavenProfile(id, each.getSource()); List<String> modules = each.getModules(); profile.setModules(modules == null ? Collections.emptyList() : modules); profile.setActivation(convertActivation(each.getActivation())); if (each.getBuild() != null) convertBuildBase(profile.getBuild(), each.getBuild()); result.add(profile); } return result; }
convertProfiles
22,698
MavenProfileActivation (Activation activation) { if (activation == null) return null; MavenProfileActivation result = new MavenProfileActivation(); result.setActiveByDefault(activation.isActiveByDefault()); result.setOs(convertOsActivation(activation.getOs())); result.setJdk(activation.getJdk()); result.setFile(convertFileActivation(activation.getFile())); result.setProperty(convertPropertyActivation(activation.getProperty())); return result; }
convertActivation
22,699
MavenProfileActivationOS (ActivationOS os) { return os == null ? null : new MavenProfileActivationOS(os.getName(), os.getFamily(), os.getArch(), os.getVersion()); }
convertOsActivation