geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r680580 - in /geronimo/sandbox/gawor/geronimo-version-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/geronimo/ src/main/java/org/apache/geronimo/mavenplugins/ src/main/java/org...
Date Tue, 29 Jul 2008 00:25:13 GMT
Author: gawor
Date: Mon Jul 28 17:25:11 2008
New Revision: 680580

URL: http://svn.apache.org/viewvc?rev=680580&view=rev
Log:
a little plugin that lists and sorts plugins and dependencies

Added:
    geronimo/sandbox/gawor/geronimo-version-plugin/
    geronimo/sandbox/gawor/geronimo-version-plugin/pom.xml   (with props)
    geronimo/sandbox/gawor/geronimo-version-plugin/src/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/
    geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/VersionMojo.java
  (with props)

Added: geronimo/sandbox/gawor/geronimo-version-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gawor/geronimo-version-plugin/pom.xml?rev=680580&view=auto
==============================================================================
--- geronimo/sandbox/gawor/geronimo-version-plugin/pom.xml (added)
+++ geronimo/sandbox/gawor/geronimo-version-plugin/pom.xml Mon Jul 28 17:25:11 2008
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev: 573798 $ $Date: 2007-09-08 04:11:25 -0400 (Sat, 08 Sep 2007) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.geronimo.plugins</groupId>
+
+    <artifactId>geronimo-version-plugin</artifactId>
+    <name>Geronimo Maven2 Plugins :: Geronimo</name>
+    <packaging>maven-plugin</packaging>
+    <version>1.0</version>
+
+    <description>
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>plugin-support</artifactId>
+            <version>1.0-alpha-1</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
+

Propchange: geronimo/sandbox/gawor/geronimo-version-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/VersionMojo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/VersionMojo.java?rev=680580&view=auto
==============================================================================
--- geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/VersionMojo.java
(added)
+++ geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/VersionMojo.java
Mon Jul 28 17:25:11 2008
@@ -0,0 +1,82 @@
+/**
+ *  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.mavenplugins.geronimo;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.mojo.pluginsupport.MojoSupport;
+
+/**
+ * List Geronimo dependencies.
+ *
+ * @goal list
+ *
+ * @version $Rev: 476061 $ $Date: 2006-11-17 01:36:50 -0500 (Fri, 17 Nov 2006) $
+ */
+public class VersionMojo extends MojoSupport {
+        
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+            
+    protected void doExecute() throws Exception {  
+        List<Dependency> dependencies = project.getDependencyManagement().getDependencies();
+        
+        List plugins = project.getPluginManagement().getPlugins();
+        for (int i = 0; i < plugins.size(); i++) {
+            Plugin plugin = (Plugin)plugins.get(i);
+            Dependency dep = new Dependency();
+            dep.setArtifactId(plugin.getArtifactId());
+            dep.setGroupId(plugin.getGroupId());
+            dep.setVersion(plugin.getVersion());
+            dependencies.add(dep);
+        }
+        
+        Collections.sort(dependencies, new DependencyComparator());
+        
+        for (Dependency dependency : dependencies) {                                  
+            System.out.println(dependency.getArtifactId() + " " + dependency.getVersion());
+        }
+    }
+                
+    private String getId(Dependency dependency) {
+        return dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getType()
+ ":" + dependency.getVersion();
+    }
+    
+    private static class DependencyComparator implements Comparator<Dependency> {
+
+        public int compare(Dependency o1, Dependency o2) {
+            String a1 = o1.getArtifactId().toLowerCase();
+            String a2 = o2.getArtifactId().toLowerCase();
+            return a1.compareTo(a2);
+        }
+        
+    }
+                                            
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gawor/geronimo-version-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/VersionMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message