|
31 | 31 |
|
32 | 32 | import org.apache.maven.artifact.handler.ArtifactHandler;
|
33 | 33 | import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
| 34 | +import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; |
34 | 35 | import org.apache.maven.artifact.repository.ArtifactRepository;
|
35 | 36 | import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
36 | 37 | import org.apache.maven.impl.resolver.artifact.MavenArtifactProperties;
|
@@ -258,13 +259,15 @@ public static ArtifactHandler newHandler(Artifact artifact) {
|
258 | 259 | }
|
259 | 260 |
|
260 | 261 | public static ArtifactType newArtifactType(String id, ArtifactHandler handler) {
|
261 |
| - return new DefaultArtifactType( |
262 |
| - id, |
263 |
| - handler.getExtension(), |
264 |
| - handler.getClassifier(), |
265 |
| - handler.getLanguage(), |
266 |
| - handler.isAddedToClasspath(), |
267 |
| - handler.isIncludesDependencies()); |
| 262 | + return handler != null |
| 263 | + ? new DefaultArtifactType( |
| 264 | + id, |
| 265 | + handler.getExtension(), |
| 266 | + handler.getClassifier(), |
| 267 | + handler.getLanguage(), |
| 268 | + handler.isAddedToClasspath(), |
| 269 | + handler.isIncludesDependencies()) |
| 270 | + : null; |
268 | 271 | }
|
269 | 272 |
|
270 | 273 | public static Dependency toDependency(
|
@@ -306,6 +309,14 @@ private static Exclusion toExclusion(org.apache.maven.model.Exclusion exclusion)
|
306 | 309 | return new Exclusion(exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*");
|
307 | 310 | }
|
308 | 311 |
|
| 312 | + /** |
| 313 | + * @deprecated Use by maven-artifact-transfer. |
| 314 | + */ |
| 315 | + @Deprecated |
| 316 | + public static ArtifactTypeRegistry newArtifactTypeRegistry(ArtifactHandlerManager handlerManager) { |
| 317 | + return typeId -> newArtifactType(typeId, handlerManager.getArtifactHandler(typeId)); |
| 318 | + } |
| 319 | + |
309 | 320 | public static Collection<Artifact> toArtifacts(Collection<org.apache.maven.artifact.Artifact> artifactsToConvert) {
|
310 | 321 | return artifactsToConvert.stream().map(RepositoryUtils::toArtifact).collect(Collectors.toList());
|
311 | 322 | }
|
|
0 commit comments