CPD Results

The following document contains the results of PMD's CPD 6.55.0.

Duplications

File Line
org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java 234
org/apache/maven/project/DefaultProjectDependenciesResolver.java 215
  1. public boolean visitEnter(DependencyNode node) {
  2. StringBuilder buffer = new StringBuilder(128);
  3. buffer.append(indent);
  4. org.eclipse.aether.graph.Dependency dep = node.getDependency();
  5. if (dep != null) {
  6. org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
  7.  
  8. buffer.append(art);
  9. if (StringUtils.isNotEmpty(dep.getScope())) {
  10. buffer.append(':').append(dep.getScope());
  11. }
  12.  
  13. if (dep.isOptional()) {
  14. buffer.append(" (optional)");
  15. }
  16.  
  17. // TODO We currently cannot tell which <dependencyManagement> section contained the management
  18. // information. When the resolver provides this information, these log messages should be updated
  19. // to contain it.
  20. if ((node.getManagedBits() & DependencyNode.MANAGED_SCOPE) == DependencyNode.MANAGED_SCOPE) {
  21. final String premanagedScope = DependencyManagerUtils.getPremanagedScope(node);
  22. buffer.append(" (scope managed from ");
  23. buffer.append(Objects.toString(premanagedScope, "default"));
  24. buffer.append(')');
  25. }
  26.  
  27. if ((node.getManagedBits() & DependencyNode.MANAGED_VERSION) == DependencyNode.MANAGED_VERSION) {
  28. final String premanagedVersion = DependencyManagerUtils.getPremanagedVersion(node);
  29. buffer.append(" (version managed from ");
  30. buffer.append(Objects.toString(premanagedVersion, "default"));
  31. buffer.append(')');
  32. }
  33.  
  34. if ((node.getManagedBits() & DependencyNode.MANAGED_OPTIONAL) == DependencyNode.MANAGED_OPTIONAL) {
  35. final Boolean premanagedOptional = DependencyManagerUtils.getPremanagedOptional(node);
  36. buffer.append(" (optionality managed from ");
  37. buffer.append(Objects.toString(premanagedOptional, "default"));
  38. buffer.append(')');
  39. }
  40.  
  41. if ((node.getManagedBits() & DependencyNode.MANAGED_EXCLUSIONS) == DependencyNode.MANAGED_EXCLUSIONS) {
  42. final Collection<org.eclipse.aether.graph.Exclusion> premanagedExclusions =
  43. DependencyManagerUtils.getPremanagedExclusions(node);
  44.  
  45. buffer.append(" (exclusions managed from ");
  46. buffer.append(Objects.toString(premanagedExclusions, "default"));
  47. buffer.append(')');
  48. }
  49.  
  50. if ((node.getManagedBits() & DependencyNode.MANAGED_PROPERTIES) == DependencyNode.MANAGED_PROPERTIES) {
  51. final Map<String, String> premanagedProperties =
  52. DependencyManagerUtils.getPremanagedProperties(node);
  53.  
  54. buffer.append(" (properties managed from ");
  55. buffer.append(Objects.toString(premanagedProperties, "default"));
  56. buffer.append(')');
  57. }
  58. }
File Line
org/apache/maven/artifact/factory/DefaultArtifactFactory.java 142
org/apache/maven/bridge/MavenRepositorySystem.java 473
  1. private Artifact createArtifact(
  2. String groupId,
  3. String artifactId,
  4. VersionRange versionRange,
  5. String type,
  6. String classifier,
  7. String scope,
  8. String inheritedScope,
  9. boolean optional) {
  10. String desiredScope = Artifact.SCOPE_RUNTIME;
  11.  
  12. if (inheritedScope == null) {
  13. desiredScope = scope;
  14. } else if (Artifact.SCOPE_TEST.equals(scope) || Artifact.SCOPE_PROVIDED.equals(scope)) {
  15. return null;
  16. } else if (Artifact.SCOPE_COMPILE.equals(scope) && Artifact.SCOPE_COMPILE.equals(inheritedScope)) {
  17. // added to retain compile artifactScope. Remove if you want compile inherited as runtime
  18. desiredScope = Artifact.SCOPE_COMPILE;
  19. }
  20.  
  21. if (Artifact.SCOPE_TEST.equals(inheritedScope)) {
  22. desiredScope = Artifact.SCOPE_TEST;
  23. }
  24.  
  25. if (Artifact.SCOPE_PROVIDED.equals(inheritedScope)) {
  26. desiredScope = Artifact.SCOPE_PROVIDED;
  27. }
  28.  
  29. if (Artifact.SCOPE_SYSTEM.equals(scope)) {
  30. // system scopes come through unchanged...
  31. desiredScope = Artifact.SCOPE_SYSTEM;
  32. }
  33.  
  34. ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(type);
  35.  
  36. return new DefaultArtifact(
  37. groupId, artifactId, versionRange, desiredScope, type, classifier, handler, optional);
  38. }
File Line
org/apache/maven/plugin/internal/DefaultPluginManager.java 89
org/apache/maven/plugin/internal/DefaultPluginManager.java 113
  1. throws PluginManagerException, ComponentLookupException {
  2. MavenSession session = legacySupport.getSession();
  3.  
  4. PluginDescriptor pluginDescriptor;
  5. try {
  6. pluginDescriptor = pluginManager.getPluginDescriptor(
  7. plugin, session.getCurrentProject().getRemotePluginRepositories(), session.getRepositorySession());
  8.  
  9. pluginManager.setupPluginRealm(pluginDescriptor, session, null, null, null);
  10. } catch (Exception e) {
  11. throw new PluginManagerException(plugin, e.getMessage(), e);
  12. }
  13.  
  14. ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
  15. try {
  16. Thread.currentThread().setContextClassLoader(pluginDescriptor.getClassRealm());
  17.  
  18. return container.lookup(role, roleHint);
File Line
org/apache/maven/plugin/prefix/NoPluginFoundForPrefixException.java 38
org/apache/maven/plugin/version/PluginVersionResolutionException.java 76
  1. }
  2.  
  3. private static String format(LocalRepository localRepository, List<RemoteRepository> remoteRepositories) {
  4. String repos = "[";
  5.  
  6. if (localRepository != null) {
  7. repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
  8. }
  9.  
  10. if (remoteRepositories != null && !remoteRepositories.isEmpty()) {
  11. for (RemoteRepository repository : remoteRepositories) {
  12. repos += ", ";
  13.  
  14. if (repository != null) {
  15. repos += repository.getId() + " (" + repository.getUrl() + ")";
  16. }
  17. }
  18. }
  19.  
  20. repos += "]";
  21.  
  22. return repos;
  23. }
  24. }
File Line
org/apache/maven/project/MavenProject.java 1369
org/apache/maven/project/MavenProject.java 1435
  1. || Artifact.SCOPE_SYSTEM.equals(a.getScope())) {
  2. Dependency dependency = new Dependency();
  3.  
  4. dependency.setArtifactId(a.getArtifactId());
  5. dependency.setGroupId(a.getGroupId());
  6. dependency.setVersion(a.getVersion());
  7. dependency.setScope(a.getScope());
  8. dependency.setType(a.getType());
  9. dependency.setClassifier(a.getClassifier());
  10.  
  11. list.add(dependency);
  12. }
  13. }
  14. return Collections.unmodifiableList(list);
  15. }
  16.  
  17. @Deprecated
  18. public List<Artifact> getTestArtifacts() {
File Line
org/apache/maven/project/MavenProject.java 1369
org/apache/maven/project/MavenProject.java 1514
  1. || Artifact.SCOPE_SYSTEM.equals(a.getScope())) {
  2. Dependency dependency = new Dependency();
  3.  
  4. dependency.setArtifactId(a.getArtifactId());
  5. dependency.setGroupId(a.getGroupId());
  6. dependency.setVersion(a.getVersion());
  7. dependency.setScope(a.getScope());
  8. dependency.setType(a.getType());
  9. dependency.setClassifier(a.getClassifier());
  10.  
  11. list.add(dependency);
  12. }
  13. }
  14. return Collections.unmodifiableList(list);
  15. }
  16.  
  17. @Deprecated
  18. public List<Artifact> getTestArtifacts() {