1 | |
package org.apache.maven.plugin.assembly.archive.phase; |
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.plugin.assembly.AssemblerConfigurationSource; |
23 | |
import org.apache.maven.plugin.assembly.AssemblyContext; |
24 | |
import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException; |
25 | |
import org.apache.maven.plugin.assembly.archive.ArchiveCreationException; |
26 | |
import org.apache.maven.plugin.assembly.archive.task.AddDependencySetsTask; |
27 | |
import org.apache.maven.plugin.assembly.format.AssemblyFormattingException; |
28 | |
import org.apache.maven.plugin.assembly.model.Assembly; |
29 | |
import org.apache.maven.project.MavenProjectBuilder; |
30 | |
import org.codehaus.plexus.archiver.Archiver; |
31 | |
import org.codehaus.plexus.archiver.manager.ArchiverManager; |
32 | |
import org.codehaus.plexus.component.annotations.Component; |
33 | |
import org.codehaus.plexus.component.annotations.Requirement; |
34 | |
import org.codehaus.plexus.logging.AbstractLogEnabled; |
35 | |
import org.codehaus.plexus.logging.Logger; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
@Component( role = AssemblyArchiverPhase.class, hint = "dependency-sets" ) |
43 | |
public class DependencySetAssemblyPhase |
44 | |
extends AbstractLogEnabled |
45 | |
implements AssemblyArchiverPhase |
46 | |
{ |
47 | |
|
48 | |
@Requirement |
49 | |
private MavenProjectBuilder projectBuilder; |
50 | |
|
51 | |
@Requirement |
52 | |
private ArchiverManager archiverManager; |
53 | |
|
54 | |
public DependencySetAssemblyPhase() |
55 | 0 | { |
56 | |
|
57 | 0 | } |
58 | |
|
59 | |
public DependencySetAssemblyPhase( final MavenProjectBuilder projectBuilder, final Logger logger ) |
60 | 2 | { |
61 | 2 | this.projectBuilder = projectBuilder; |
62 | 2 | enableLogging( logger ); |
63 | 2 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
public void execute( final Assembly assembly, final Archiver archiver, |
69 | |
final AssemblerConfigurationSource configSource, final AssemblyContext context ) |
70 | |
throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException |
71 | |
{ |
72 | 2 | final AddDependencySetsTask task = |
73 | |
new AddDependencySetsTask( assembly.getDependencySets(), context.getResolvedArtifacts(), |
74 | |
configSource.getProject(), projectBuilder, archiverManager, getLogger() ); |
75 | |
|
76 | 2 | task.execute( archiver, configSource ); |
77 | 2 | } |
78 | |
} |