File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\maven-plugin\src\main\java\hudson\maven\MavenBuildInformation.java.html

1 package hudson.maven;
2
3 /*
4 * Olivier Lamy
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 */
22
23 import java.io.Serializable;
24
25 import org.apache.commons.lang.StringUtils;
26 import org.apache.maven.artifact.versioning.ComparableVersion;
27
28 /**
29 * @author Olivier Lamy
30 * @since 1.392
31 */
32 public class MavenBuildInformation implements Serializable {
33
34 private static final long serialVersionUID = -3719709179508200057L;
35 private String mavenVersion;
36
37 public MavenBuildInformation(String mavenVersion) {
38 this.mavenVersion = mavenVersion;
39 }
40
41 public String getMavenVersion()
42 {
43 return mavenVersion;
44 }
45
46 /**
47 * @since 1.441
48 */
49 public boolean isMaven3OrLater() {
50 return MavenUtil.maven3orLater(mavenVersion);
51 }
52
53 /**
54 * Returns if this maven version is at least 'version'.
55 * @param version the version to compare against
56 *
57 * @since 1.441
58 */
59 public boolean isAtLeastMavenVersion(String version) {
60 if (StringUtils.isBlank(mavenVersion)) {
61 return false;
62 }
63 return new ComparableVersion(mavenVersion).compareTo(new ComparableVersion(version)) >= 0;
64 }
65
66 @Override
67 public String toString() {
68 return mavenVersion;
69 }
70 }
71