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 public static <T> T firstNotNull(T... values)
29 {
30 for (T value : values)
31 {
32 if (value != null)
33 {
34 return value;
35 }
36 }
37 return null;
38 }
39
40 public final static File createDirectory(File dir)
41 {
42 if (!dir.exists() && !dir.mkdirs())
43 {
44 throw new RuntimeException("Failed to create directory " + dir.getAbsolutePath());
45 }
46 return dir;
47 }
48 }