You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/10/07 03:26:26 UTC
svn commit: r453829 -
/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java
Author: jdillon
Date: Fri Oct 6 18:26:25 2006
New Revision: 453829
URL: http://svn.apache.org/viewvc?view=rev&rev=453829
Log:
Add tools:show-properties goal
Added:
geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java (with props)
Added: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java?view=auto&rev=453829
==============================================================================
--- geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java (added)
+++ geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java Fri Oct 6 18:26:25 2006
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.genesis.plugins.tools;
+
+import org.apache.geronimo.genesis.MojoSupport;
+
+import org.apache.maven.project.MavenProject;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * Helper to show all properties.
+ *
+ * @goal show-properties
+ *
+ * @version $Rev$ $Date$
+ */
+public class ShowPropertiesMojo
+ extends MojoSupport
+{
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ protected MavenProject getProject() {
+ return project;
+ }
+
+ protected void doExecute() throws Exception {
+ showProjectProperties();
+ showSystemProperties();
+ }
+
+ private void logProperties(final Map props) {
+ List list = new ArrayList();
+ list.addAll(props.keySet());
+ Collections.sort(list);
+
+ Iterator iter = list.iterator();
+ while (iter.hasNext()) {
+ String name = (String)iter.next();
+ String value = String.valueOf(props.get(name));
+ log.info(" " + name + "=" + value);
+ }
+ }
+
+ private void showProjectProperties() {
+ log.info("Project properties:");
+
+ Map props = getProject().getProperties();
+ logProperties(props);
+ }
+
+ private void showSystemProperties() {
+ log.info("System properties:");
+
+ Map props = System.getProperties();
+ logProperties(props);
+ }
+}
Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/genesis/trunk/plugins/tools-maven-plugin/src/main/java/org/apache/geronimo/genesis/plugins/tools/ShowPropertiesMojo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain