<?xml version="1.0"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.cxf.samples</groupId>
    <artifactId>ws_policy</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_addr_policy.wsdl</wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
               </executions>
           </plugin>
           <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copyxmlfiles</id>
                        <phase>generate-sources</phase>
	    	        <goals>
	    	            <goal>run</goal>
	    	        </goals>
	    	        <configuration>
	    	            <tasks>
	    	               <copy file="${basedir}/src/demo/ws_policy/client/client.xml" todir="${basedir}/target/classes/demo/ws_policy/client"/>
	    	               <copy file="${basedir}/src/demo/ws_policy/server/server.xml" todir="${basedir}/target/classes/demo/ws_policy/server"/>
	    	               <copy file="${basedir}/addr-external.xml" todir="${basedir}/target/classes/"/>
	    	            </tasks>
	    	        </configuration>
	    	    </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>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-classpath</argument>
                                        <classpath/>
                                        <argument>demo.ws_policy.server.Server</argument>
                                    </arguments>
                                </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.ws_policy.client.Client</mainClass>
                               </configuration>
                           </execution>
                       </executions>
                   </plugin>
               </plugins>
           </build>
        </profile>
    </profiles>
    <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>
        <repository>
	    <id>apache-incubating</id>
	    <name>Apache Incubating Repository</name>
	    <url>http://people.apache.org/repo/m2-incubating-repository/</url>
	</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>
        <pluginRepository>
            <id>apache-plugin-incubating</id>
            <name>Apache Plugin Incubating Repository</name>
            <url>http://people.apache.org/repo/m2-incubating-repository/</url>
        </pluginRepository>
    </pluginRepositories>
    <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>
        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http-jetty</artifactId>
             <version>${cxf.version}</version>
        </dependency>
        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-policy</artifactId>
             <version>${cxf.version}</version>
        </dependency>
   </dependencies>
</project>
