/** * Adds information about artifact dependencies. * * @param dependent The dependent to add artifacts as dependencies * @param dependencies The dependencies information. * @param scannerContext The scanner context */ private <P extends MavenDependentDescriptor, D extends BaseDependencyDescriptor> void addDependencies( P dependent, List<Dependency> dependencies, Class<D> dependencyType, ScannerContext scannerContext) { for (Dependency dependency : dependencies) { MavenArtifactDescriptor dependencyArtifactDescriptor = getMavenArtifactDescriptor(dependency, scannerContext); D dependencyDescriptor = scannerContext.getStore().create(dependent, dependencyType, dependencyArtifactDescriptor); dependencyDescriptor.setOptional(dependency.isOptional()); dependencyDescriptor.setScope(dependency.getScope()); } }
/** * Adds information about profile dependencies. * * @param profileDescriptor The descriptor for the current profile. * @param dependencies The dependencies information. * @param scannerContext The scanner context. */ private void addProfileDependencies( MavenProfileDescriptor profileDescriptor, List<Dependency> dependencies, ScannerContext scannerContext) { for (Dependency dependency : dependencies) { MavenArtifactDescriptor dependencyArtifactDescriptor = getMavenArtifactDescriptor(dependency, scannerContext); ProfileDependsOnDescriptor profileDependsOnDescriptor = scannerContext .getStore() .create( profileDescriptor, ProfileDependsOnDescriptor.class, dependencyArtifactDescriptor); profileDependsOnDescriptor.setOptional(dependency.isOptional()); profileDependsOnDescriptor.setScope(dependency.getScope()); } }