You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2010/04/06 22:46:02 UTC

svn commit: r931319 - in /geronimo/server/trunk: ./ framework/buildsupport/ framework/buildsupport/geronimo-property-plugin/ framework/buildsupport/geronimo-property-plugin/src/ framework/buildsupport/geronimo-property-plugin/src/main/ framework/builds...

Author: gawor
Date: Tue Apr  6 20:46:01 2010
New Revision: 931319

URL: http://svn.apache.org/viewvc?rev=931319&view=rev
Log:
GERONIMO-5231: Experimental way to override JVM annotation & jaxws api

Added:
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml   (with props)
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/
    geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java   (with props)
Modified:
    geronimo/server/trunk/framework/buildsupport/pom.xml
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationExample.java
    geronimo/server/trunk/plugins/pom.xml
    geronimo/server/trunk/pom.xml

Added: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml?rev=931319&view=auto
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml (added)
+++ geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml Tue Apr  6 20:46:01 2010
@@ -0,0 +1,65 @@
+<?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.
+-->
+<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>
+
+    <parent>
+        <groupId>org.apache.geronimo.buildsupport</groupId>
+        <artifactId>buildsupport</artifactId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>geronimo-property-plugin</artifactId>
+    <name>Geronimo Build Support :: Set Property Plugin</name>
+    <packaging>maven-plugin</packaging>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+            <version>2.2.1</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                </exclusion>
+            </exclusions>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+            <version>2.2.1</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.2.1</version>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+</project>

Propchange: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java?rev=931319&view=auto
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java (added)
+++ geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java Tue Apr  6 20:46:01 2010
@@ -0,0 +1,128 @@
+/*
+ * 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.property;
+
+import java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+/** 
+ * @goal set-property
+ */
+public class SetPropertyMojo extends AbstractLogEnabled implements Mojo {
+    
+    private Log log;
+
+    /**
+     * @parameter
+     * @required
+     */
+    protected String propertyName;
+    
+    /**
+     * @parameter
+     */
+    protected String propertyValuePrefix;
+    
+    /**
+     * @parameter
+     */
+    protected Dependency[] classpath;
+    
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+    
+    /**
+     * The artifact repository to use.
+     *
+     * @parameter expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * The artifact factory to use.
+     *
+     * @component
+     * @required
+     * @readonly
+     */
+    private ArtifactFactory artifactFactory;
+        
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        StringBuffer buffer = new StringBuffer();
+        
+        if (classpath != null && classpath.length > 0) {
+            if (propertyValuePrefix != null) {
+                buffer.append(propertyValuePrefix);
+            }
+            for (int i = 0; i < classpath.length; i++) {
+                Dependency dependency = classpath[i];
+                Artifact artifact = artifactFactory.createArtifact(dependency.getGroupId(), 
+                                                                   dependency.getArtifactId(), 
+                                                                   dependency.getVersion(), 
+                                                                   null, 
+                                                                   dependency.getType());
+                String path = localRepository.pathOf(artifact);
+                File file = new File(localRepository.getBasedir(), path);
+                if (!file.exists()) {
+                    getLog().warn("File " + file + " does not exist");
+                }
+                buffer.append(file.getAbsolutePath());
+                if (i + 1 < classpath.length) {
+                    buffer.append(File.pathSeparator);
+                }
+            }
+        }
+
+        getLog().debug("Setting "  + propertyName + " property to " + buffer);
+        
+        project.getProperties().put(propertyName, buffer.toString());
+    }
+
+    public void setLog(Log log) {
+        this.log = log;
+    }
+
+    public Log getLog() {
+        if (log == null) {
+            setLog(new SystemStreamLog());
+        }
+        return log;
+    }
+           
+}

Propchange: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/buildsupport/geronimo-property-plugin/src/main/java/org/apache/geronimo/mavenplugins/property/SetPropertyMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/buildsupport/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/pom.xml?rev=931319&r1=931318&r2=931319&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/pom.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/pom.xml Tue Apr  6 20:46:01 2010
@@ -66,6 +66,7 @@
         <module>geronimo-plugin-archetype</module>
         <module>geronimo-assembly-archetype</module>
         <module>geronimo-osgi-plugin</module>
+        <module>geronimo-property-plugin</module>
     </modules>
 
     <reporting>

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationExample.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationExample.java?rev=931319&r1=931318&r2=931319&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationExample.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationExample.java Tue Apr  6 20:46:01 2010
@@ -19,25 +19,26 @@
 
 package org.apache.geronimo.j2ee.deployment.annotation;
 
+import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceRef;
 import javax.xml.ws.WebServiceRefs;
 
 @WebServiceRefs ({
                      @WebServiceRef(name = "WebServiceRef10",
-                                    type = javax.xml.ws.Service.class,
-                                    value = javax.xml.ws.Service.class,
+                                    type = Service.class,
+                                    value = Service.class,
                                     wsdlLocation = "WEB-INF/wsdl/WebServiceRef10.wsdl"),
                      @WebServiceRef(name = "WebServiceRef11",
-                                    type = javax.xml.ws.Service.class,
-                                    value = javax.xml.ws.Service.class,
+                                    type = Service.class,
+                                    value = Service.class,
                                     wsdlLocation = "WEB-INF/wsdl/WebServiceRef11.wsdl",
                                     mappedName = "mappedName11")
                  })
 public class WebServiceRefAnnotationExample {
 
     @WebServiceRef(name = "WebServiceRef12",
-                   type = javax.xml.ws.Service.class,
-                   value = javax.xml.ws.Service.class,
+                   type = Service.class,
+                   value = Service.class,
                    mappedName = "mappedName12")
     String annotatedField1;
 
@@ -51,17 +52,23 @@ public class WebServiceRefAnnotationExam
     // -- Return void
     //------------------------------------------------------------------------------------------
     @WebServiceRef(name = "WebServiceRef14",
-                   value = java.lang.Object.class,
+                   value = MyService.class,
                    wsdlLocation = "WEB-INF/wsdl/WebServiceRef14.wsdl",
                    mappedName = "mappedName14")
     public void setAnnotatedMethod1(boolean bool) {
     }
 
     @WebServiceRef(name = "WebServiceRef15",
-                   value = javax.xml.ws.Service.class,
+                   value = Service.class,
                    wsdlLocation = "WEB-INF/wsdl/WebServiceRef15.wsdl",
                    mappedName = "mappedName15")
     public void setAnnotatedMethod2(String string) {
     }
 
+    public static class MyService extends Service {
+        public MyService() {
+            super(null, null);
+        }
+    }
+
 }

Modified: geronimo/server/trunk/plugins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/pom.xml?rev=931319&r1=931318&r2=931319&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/pom.xml (original)
+++ geronimo/server/trunk/plugins/pom.xml Tue Apr  6 20:46:01 2010
@@ -106,6 +106,45 @@
                     </commonInstance>
                 </configuration>
             </plugin>
+            <!-- 
+                 geronimo-property-plugin sets bootClassPath property 
+                 which is used by maven-compiler-plugin and 
+                 maven-surefire-plugin.
+            -->
+            <plugin>
+                <groupId>org.apache.geronimo.buildsupport</groupId>
+                <artifactId>geronimo-property-plugin</artifactId>
+                <configuration>
+                    <propertyName>bootClassPath</propertyName>
+                    <propertyValuePrefix>-Xbootclasspath/p:</propertyValuePrefix>
+                    <classpath>
+                        <dependency>
+                            <groupId>org.apache.geronimo.specs</groupId>
+                            <artifactId>geronimo-annotation_1.1_spec</artifactId>
+                            <version>1.0-SNAPSHOT</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>org.apache.geronimo.specs</groupId>
+                            <artifactId>geronimo-jaxws_2.2_spec</artifactId>
+                            <version>1.0-SNAPSHOT</version>
+                        </dependency>
+                    </classpath>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <compilerArgument>${bootClassPath}</compilerArgument>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <argLine>${bootClassPath}</argLine>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.geronimo.buildsupport</groupId>
                 <artifactId>geronimo-osgi-plugin</artifactId>

Modified: geronimo/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=931319&r1=931318&r2=931319&view=diff
==============================================================================
--- geronimo/server/trunk/pom.xml (original)
+++ geronimo/server/trunk/pom.xml Tue Apr  6 20:46:01 2010
@@ -2176,7 +2176,6 @@ only found in cxf
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <!--<version>2.4.2</version>-->
                     <configuration>
                         <redirectTestOutputToFile>true</redirectTestOutputToFile>
                         <failIfNoTests>false</failIfNoTests>
@@ -2348,6 +2347,20 @@ only found in cxf
                         </execution>
                     </executions>
                 </plugin>
+
+                <plugin>
+                    <groupId>org.apache.geronimo.buildsupport</groupId>
+                    <artifactId>geronimo-property-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>set-property</id>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>set-property</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
@@ -2356,7 +2369,6 @@ only found in cxf
                 <artifactId>maven-bundle-plugin</artifactId>
             </plugin>
         </plugins>
-
     </build>
 
     <distributionManagement>