%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
nl.toolforge.karma.core.MavenEnvironment |
|
|
1 | /* |
|
2 | Karma core - Core of the Karma application |
|
3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
4 | ||
5 | This library is free software; you can redistribute it and/or |
|
6 | modify it under the terms of the GNU Lesser General Public |
|
7 | License as published by the Free Software Foundation; either |
|
8 | version 2.1 of the License, or (at your option) any later version. |
|
9 | ||
10 | This library is distributed in the hope that it will be useful, |
|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 | Lesser General Public License for more details. |
|
14 | ||
15 | You should have received a copy of the GNU Lesser General Public |
|
16 | License along with this library; if not, write to the Free Software |
|
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | */ |
|
19 | package nl.toolforge.karma.core; |
|
20 | ||
21 | import org.apache.commons.logging.Log; |
|
22 | import org.apache.commons.logging.LogFactory; |
|
23 | ||
24 | import java.io.File; |
|
25 | ||
26 | /** |
|
27 | * Class that checks if the user has a proper Maven enabled environment. This is required when |
|
28 | * <code><mavenmodule></code>s are used. This class is called |
|
29 | * |
|
30 | * @author D.A. Smedes |
|
31 | * @version $Id: MavenEnvironment.java,v 1.3 2004/08/29 18:00:35 hippe Exp $ |
|
32 | */ |
|
33 | 0 | public final class MavenEnvironment { |
34 | ||
35 | /** The MAVEN_HOME environment variable that must be set. This should be passed to the JVM upon startup. */ |
|
36 | public static final String ENV_MAVEN_HOME = "maven.home"; |
|
37 | ||
38 | /** The <code>maven.repo.local</code> environment variable when running Maven. Identifies the Maven repository for the |
|
39 | * current user. When not found in as a JMV system variable, <code>${user.home}/.maven/repository</code> will be used |
|
40 | * as the default. |
|
41 | */ |
|
42 | public static final String ENV_MAVEN_REPOSITORY = "maven.repository"; |
|
43 | ||
44 | 0 | private static final String DEFAULT_MAVEN_REPOSITORY = |
45 | System.getProperty("user.home") + File.separator + ".maven" + File.separator +"repository"; |
|
46 | ||
47 | 0 | private static final Log logger = LogFactory.getLog(MavenEnvironment.class); |
48 | ||
49 | 0 | private static boolean valid = false; |
50 | ||
51 | static { |
|
52 | // |
|
53 | // |
|
54 | 0 | } |
55 | ||
56 | public static boolean isValid() { |
|
57 | ||
58 | 0 | boolean mavenHomeSet = (System.getProperty("maven.home") != null); |
59 | ||
60 | 0 | logger.error("Maven environment not configured correctly."); |
61 | ||
62 | 0 | return mavenHomeSet; |
63 | ||
64 | } |
|
65 | ||
66 | public static String getMavenRepository() { |
|
67 | ||
68 | 0 | String mavenRepo = (System.getProperty(ENV_MAVEN_REPOSITORY) == null ? DEFAULT_MAVEN_REPOSITORY : System.getProperty(ENV_MAVEN_REPOSITORY)); |
69 | 0 | return mavenRepo; |
70 | } |
|
71 | ||
72 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |