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.model.Scm;
10 import org.apache.maven.project.MavenProject;
11
12
13
14
15
16 public final class MavenProjectMocker {
17
18
19
20
21 private final MavenProject project = new MavenProject();
22
23
24
25
26
27
28 public MavenProjectMocker inBasedir(final File dir) {
29 final File parent = new File(dir, "target");
30 final Build build = new Build();
31 build.setOutputDirectory(parent.getPath());
32 this.project.setFile(parent);
33 this.project.setBuild(build);
34 return this;
35 }
36
37
38
39
40
41
42 public MavenProject mock() throws Exception {
43 final Scm scm = new Scm();
44 scm.setConnection("scm:svn:...");
45 this.project.setPackaging("jar");
46 this.project.setScm(scm);
47 return this.project;
48 }
49
50 }