1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.cling;
20
21 import java.io.IOException;
22
23 import org.apache.maven.api.cli.Invoker;
24 import org.apache.maven.api.cli.InvokerRequest;
25 import org.apache.maven.api.cli.ParserException;
26 import org.apache.maven.api.cli.ParserRequest;
27 import org.apache.maven.cling.invoker.ProtoLogger;
28 import org.apache.maven.cling.invoker.ProtoLookup;
29 import org.apache.maven.cling.invoker.mvnenc.EncryptInvoker;
30 import org.apache.maven.cling.invoker.mvnenc.EncryptParser;
31 import org.apache.maven.jline.JLineMessageBuilderFactory;
32 import org.codehaus.plexus.classworlds.ClassWorld;
33
34
35
36
37 public class MavenEncCling extends ClingSupport {
38
39
40
41
42 public static void main(String[] args) throws IOException {
43 int exitCode = new MavenEncCling().run(args);
44 System.exit(exitCode);
45 }
46
47
48
49
50 public static int main(String[] args, ClassWorld world) throws IOException {
51 return new MavenEncCling(world).run(args);
52 }
53
54 public MavenEncCling() {
55 super();
56 }
57
58 public MavenEncCling(ClassWorld classWorld) {
59 super(classWorld);
60 }
61
62 @Override
63 protected Invoker createInvoker() {
64 return new EncryptInvoker(
65 ProtoLookup.builder().addMapping(ClassWorld.class, classWorld).build());
66 }
67
68 @Override
69 protected InvokerRequest parseArguments(String[] args) throws ParserException, IOException {
70 return new EncryptParser()
71 .parseInvocation(ParserRequest.mvnenc(args, new ProtoLogger(), new JLineMessageBuilderFactory())
72 .build());
73 }
74 }