5
5
* which accompanies this distribution, and is available at
6
6
* https://www.eclipse.org/legal/epl-v20.html
7
7
*/
8
- package eu .maveniverse .maven .toolbox .plugin ;
8
+ package eu .maveniverse .maven .toolbox .plugin . gav ;
9
9
10
- import eu .maveniverse .maven .mima .context .Context ;
11
- import eu .maveniverse .maven .mima .context .ContextOverrides ;
12
- import eu .maveniverse .maven .mima .context .Runtime ;
13
- import eu .maveniverse .maven .mima .context .Runtimes ;
14
10
import eu .maveniverse .maven .toolbox .shared .ResolutionScope ;
15
- import eu .maveniverse .maven .toolbox .shared .Slf4jOutput ;
16
11
import eu .maveniverse .maven .toolbox .shared .ToolboxCommando ;
17
- import org .apache .maven .plugin .AbstractMojo ;
18
12
import org .apache .maven .plugin .MojoExecutionException ;
19
13
import org .apache .maven .plugin .MojoFailureException ;
20
14
import org .apache .maven .plugins .annotations .Mojo ;
21
15
import org .apache .maven .plugins .annotations .Parameter ;
22
16
import org .eclipse .aether .resolution .ArtifactDescriptorException ;
23
- import org .slf4j .Logger ;
24
- import org .slf4j .LoggerFactory ;
25
17
26
18
@ Mojo (name = "gav-tree" , requiresProject = false , threadSafe = true )
27
- public class GavTreeMojo extends AbstractMojo {
28
- private final Logger logger = LoggerFactory .getLogger (getClass ());
29
-
19
+ public class GavTreeMojo extends GavMojoSupport {
30
20
/**
31
21
* The artifact coordinates in the format {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}
32
22
* to display tree for.
@@ -43,8 +33,8 @@ public class GavTreeMojo extends AbstractMojo {
43
33
/**
44
34
* Set it {@code true} for verbose tree.
45
35
*/
46
- @ Parameter (property = "verbose " , defaultValue = "false" , required = true )
47
- private boolean verbose ;
36
+ @ Parameter (property = "verboseTree " , defaultValue = "false" , required = true )
37
+ private boolean verboseTree ;
48
38
49
39
/**
50
40
* Apply BOMs, if needed.
@@ -53,12 +43,9 @@ public class GavTreeMojo extends AbstractMojo {
53
43
private java .util .List <String > boms ;
54
44
55
45
@ Override
56
- public void execute () throws MojoExecutionException , MojoFailureException {
57
- Runtime runtime = Runtimes .INSTANCE .getRuntime ();
58
- try (Context context = runtime .create (ContextOverrides .create ().build ())) {
59
- ToolboxCommando toolboxCommando = ToolboxCommando .create (runtime , context );
60
- toolboxCommando .tree (
61
- ResolutionScope .parse (scope ), toolboxCommando .loadGav (gav , boms ), verbose , new Slf4jOutput (logger ));
46
+ protected void doExecute (ToolboxCommando toolboxCommando ) throws MojoExecutionException , MojoFailureException {
47
+ try {
48
+ toolboxCommando .tree (ResolutionScope .parse (scope ), toolboxCommando .loadGav (gav , boms ), verboseTree , output );
62
49
} catch (RuntimeException e ) {
63
50
throw new MojoExecutionException (e );
64
51
} catch (ArtifactDescriptorException e ) {
0 commit comments