1 package org.apache.maven.plugin.coreit;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.artifact.Artifact;
23 import org.apache.maven.artifact.deployer.ArtifactDeployer;
24 import org.apache.maven.artifact.repository.ArtifactRepository;
25 import org.apache.maven.plugin.MojoExecutionException;
26
27
28
29
30
31
32
33
34
35 public class DeployMojo
36 extends AbstractRepoMojo
37 {
38
39
40
41
42
43
44
45
46 private ArtifactRepository deploymentRepository;
47
48
49
50
51
52
53 private ArtifactDeployer deployer;
54
55
56
57
58
59
60 public void execute()
61 throws MojoExecutionException
62 {
63 getLog().info( "[MAVEN-CORE-IT-LOG] Deploying project artifacts" );
64
65 try
66 {
67 if ( isPomArtifact() )
68 {
69 deployer.deploy( pomFile, mainArtifact, deploymentRepository, localRepository );
70 }
71 else
72 {
73 deployer.deploy( mainArtifact.getFile(), mainArtifact, deploymentRepository, localRepository );
74 }
75
76 if ( attachedArtifacts != null )
77 {
78 for ( Artifact attachedArtifact : attachedArtifacts )
79 {
80 deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository,
81 localRepository );
82 }
83 }
84 }
85 catch ( Exception e )
86 {
87 throw new MojoExecutionException( "Failed to deploy artifacts: " + e.getMessage(), e );
88 }
89 }
90
91 }