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.ParserException;
25 import org.apache.maven.api.cli.ParserRequest;
26 import org.apache.maven.api.cli.mvnenc.EncryptInvokerRequest;
27 import org.apache.maven.api.cli.mvnenc.EncryptOptions;
28 import org.apache.maven.cling.invoker.ProtoLogger;
29 import org.apache.maven.cling.invoker.ProtoLookup;
30 import org.apache.maven.cling.invoker.mvnenc.DefaultEncryptInvoker;
31 import org.apache.maven.cling.invoker.mvnenc.DefaultEncryptParser;
32 import org.apache.maven.jline.JLineMessageBuilderFactory;
33 import org.codehaus.plexus.classworlds.ClassWorld;
34
35
36
37
38 public class MavenEncCling extends ClingSupport<EncryptOptions, EncryptInvokerRequest> {
39
40
41
42
43 public static void main(String[] args) throws IOException {
44 int exitCode = new MavenEncCling().run(args);
45 System.exit(exitCode);
46 }
47
48
49
50
51 public static int main(String[] args, ClassWorld world) throws IOException {
52 return new MavenEncCling(world).run(args);
53 }
54
55 public MavenEncCling() {
56 super();
57 }
58
59 public MavenEncCling(ClassWorld classWorld) {
60 super(classWorld);
61 }
62
63 @Override
64 protected Invoker<EncryptInvokerRequest> createInvoker() {
65 return new DefaultEncryptInvoker(
66 ProtoLookup.builder().addMapping(ClassWorld.class, classWorld).build());
67 }
68
69 @Override
70 protected EncryptInvokerRequest parseArguments(String[] args) throws ParserException, IOException {
71 return new DefaultEncryptParser()
72 .parse(ParserRequest.mvnenc(args, new ProtoLogger(), new JLineMessageBuilderFactory())
73 .build());
74 }
75 }