Sean,


I was looking at your pom files for the sample. I'm wondering if we could get rid of the env.CXF_VERSION requirement by using version ranges and profiles and such.

I've attached an modified versionof the wsdl_first for you to look at.

First, it defines a cxf.version property (defaults it to "[2,)" which means any 2.x version), but can be overwridden on the command line like -Dcxf.version=2.1.1 or similar.

Second, by default, it only checks the release repository. No point in checking the snapshots. There is a -Psnapshot profile that would enable it if we want.

Anyway, what do you think?





<?xml version="1.0"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.cxf.samples</groupId>
    <artifactId>wsdl_first</artifactId>
    <version>1.0</version>
    
    <properties>
       <cxf.version>[2,)</cxf.version>
    </properties>
    
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>LATEST</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/wsdl/hello_world.wsdl</wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>   
    <profiles>
        <profile>
            <id>server</id>
            <build>
                <defaultGoal>test</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>test</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <mainClass>demo.hw.server.Server</mainClass>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>client</id>
            <build>
                <defaultGoal>test</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>test</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <mainClass>demo.hw.client.Client</mainClass>
                                    <arguments>
                                        <argument>${basedir}/wsdl/hello_world.wsdl</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>snapshots</id>
            <repositories>
                <repository>
                    <id>apache-snapshots</id>
                    <name>Apache SNAPSHOT Repository</name>
                    <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                    <!-- for jaxb-impl -->
                <repository>
                    <id>java.net</id>
                    <url>http://download.java.net/maven/1/</url>
                    <layout>legacy</layout>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>apache-plugin-snapshots</id>
                    <name>Apache Maven Plugin Snapshots</name>
                    <url>http://people.apache.org/repo/m2-snapshot-repository</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>

        </profile>        
    </profiles>
    <repositories>
        <!-- for jaxb-impl -->
        <repository>
            <id>java.net</id>
            <url>http://download.java.net/maven/1/</url>
            <layout>legacy</layout>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <!-- Jetty is needed if you're using the CXFServlet -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http-jetty</artifactId>
            <version>${cxf.version}</version>
        </dependency>
    </dependencies>
</project>

---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to