1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.api.services;
20
21 import org.apache.maven.api.ArtifactCoordinates;
22 import org.apache.maven.api.DependencyCoordinates;
23 import org.apache.maven.api.Service;
24 import org.apache.maven.api.Session;
25 import org.apache.maven.api.annotations.Experimental;
26 import org.apache.maven.api.annotations.Nonnull;
27 import org.apache.maven.api.model.Dependency;
28 import org.apache.maven.api.model.Plugin;
29 import org.apache.maven.api.model.ReportPlugin;
30
31
32
33
34
35 @Experimental
36 public interface DependencyCoordinatesFactory extends Service {
37
38
39
40
41
42
43
44
45
46
47 @Nonnull
48 DependencyCoordinates create(@Nonnull DependencyCoordinatesFactoryRequest request);
49
50 @Nonnull
51 default DependencyCoordinates create(@Nonnull Session session, @Nonnull ArtifactCoordinates coordinates) {
52 return create(DependencyCoordinatesFactoryRequest.build(session, coordinates));
53 }
54
55 @Nonnull
56 default DependencyCoordinates create(
57 @Nonnull Session session, @Nonnull org.apache.maven.api.Dependency dependency) {
58 return create(DependencyCoordinatesFactoryRequest.build(session, dependency));
59 }
60
61 @Nonnull
62 default DependencyCoordinates create(@Nonnull Session session, Dependency dependency) {
63 return create(DependencyCoordinatesFactoryRequest.build(
64 session,
65 dependency.getGroupId(),
66 dependency.getArtifactId(),
67 dependency.getVersion(),
68 dependency.getClassifier(),
69 null,
70 dependency.getType()));
71 }
72
73 @Nonnull
74 default DependencyCoordinates create(@Nonnull Session session, Plugin plugin) {
75
76 return create(DependencyCoordinatesFactoryRequest.build(
77 session, plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, null, "maven-plugin"));
78 }
79
80 @Nonnull
81 default DependencyCoordinates create(@Nonnull Session session, ReportPlugin reportPlugin) {
82
83 return create(DependencyCoordinatesFactoryRequest.build(
84 session,
85 reportPlugin.getGroupId(),
86 reportPlugin.getArtifactId(),
87 reportPlugin.getVersion(),
88 null,
89 null,
90 "maven-plugin"));
91 }
92 }