1 package com.atlassian.maven.plugins.amps.util;
2
3 import java.io.File;
4
5 import com.atlassian.maven.plugins.amps.MavenContext;
6 import static com.atlassian.maven.plugins.amps.util.FileUtils.file;
7
8
9
10
11
12
13 public class ProjectUtils
14 {
15
16
17
18
19 public static boolean shouldDeployTestJar(MavenContext context)
20 {
21 return file(context.getProject().getBuild().getTestOutputDirectory(), "atlassian-plugin.xml").exists();
22 }
23
24
25
26
27
28
29
30
31 public static <T> T firstNotNull(T... values)
32 {
33 for (T value : values)
34 {
35 if (value != null)
36 {
37 return value;
38 }
39 }
40 throw new NullPointerException("All values are null");
41 }
42
43 public final static File createDirectory(File dir)
44 {
45 if (!dir.exists() && !dir.mkdirs())
46 {
47 throw new RuntimeException("Failed to create directory " + dir.getAbsolutePath());
48 }
49 return dir;
50 }
51 }