1
2
3
4
5 package com.qulice.maven;
6
7 import java.io.File;
8 import org.apache.maven.model.Build;
9 import org.apache.maven.project.MavenProject;
10
11
12
13
14
15
16 public final class MavenProjectMocker {
17
18
19
20
21 private final MavenProject project;
22
23
24
25
26 public MavenProjectMocker() {
27 this.project = new MavenProject();
28 }
29
30
31
32
33
34
35
36 public MavenProjectMocker inBasedir(final File dir) {
37 final File parent = new File(dir, "target");
38 final Build build = new Build();
39 build.setOutputDirectory(parent.getPath());
40 this.project.setFile(parent);
41 this.project.setBuild(build);
42 return this;
43 }
44
45
46
47
48
49
50
51 public MavenProject mock() throws Exception {
52 this.project.setPackaging("jar");
53 return this.project;
54 }
55 }