001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.plugins.enforcer; 020 021import org.apache.maven.enforcer.rules.utils.OSUtil; 022import org.apache.maven.enforcer.rules.version.RequireJavaVersion; 023import org.apache.maven.execution.MavenSession; 024import org.apache.maven.plugin.AbstractMojo; 025import org.apache.maven.plugins.annotations.Mojo; 026import org.apache.maven.plugins.annotations.Parameter; 027 028/** 029 * This goal displays the current platform information. 030 * 031 * @author <a href="mailto:brianf@apache.org">Brian Fox</a> 032 * @deprecated please use {@code mvn --version} 033 */ 034@Deprecated 035@Mojo(name = "display-info", threadSafe = true) 036public class DisplayInfoMojo extends AbstractMojo { 037 038 /** 039 * The MavenSession 040 */ 041 @Parameter(defaultValue = "${session}", readonly = true, required = true) 042 protected MavenSession session; 043 044 /** 045 * Entry point to the mojo 046 */ 047 public void execute() { 048 String mavenVersion = session.getSystemProperties().getProperty("maven.version"); 049 String javaVersion = System.getProperty("java.version"); 050 String javaVendor = System.getProperty("java.vendor"); 051 052 getLog().info("Maven Version: " + mavenVersion); 053 getLog().info("JDK Version: " + javaVersion + " normalized as: " 054 + RequireJavaVersion.normalizeJDKVersion(javaVersion)); 055 getLog().info("Java Vendor: " + javaVendor); 056 057 getLog().info(OSUtil.getOSInfo()); 058 } 059}