The simplest configuration is one that accepts all the defaults, and is outlined below:
<build> [...] <plugins> [...] <plugin> <groupId>net.sf.maven-synapse-plugin</groupId> <artifactId>maven-synapse-plugin</artifactId> <version>0.0.1</version> <executions> <execution> <id>start-synapse</id> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-synapse</id> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> [...] </plugins> [...] </build>
Note that this makes a number of assumptions on where your Synapse artefacts are. The plugin can be configured to look in various places for configuration items, such as synapse.xml and axis2.xml. An template for a "fully defined" plugin is below:
<build> [...] <plugins> [...] <plugin> <groupId>net.sf.maven-synapse-plugin</groupId> <artifactId>maven-synapse-plugin</artifactId> <version>0.0.1</version> <executions> <execution> <id>start-synapse</id> <goals> <goal>start</goal> </goals> <phase>pre-integration-test</phase> </execution> <execution> <id>stop-synapse</id> <goals> <goal>stop</goal> </goals> <phase>post-integration-test</phase> </execution> </executions> <configuration> <!-- Path to synapse.xml. Defaults to src/main/synapse/synapse.xml --> <synapseXmlConfig>${synapse.xml}</synapseXmlConfig> <!-- Path to axis2.xml. Defaults to src/main/synapse/axis2.xml --> <axis2XmlConfig>${axis2.xml}</axis2XmlConfig> <!-- Path to the "synapse home". Defaults to src/main/synapse --> <synapseHome>${project.build.directory}</synapseHome> <!-- path to "resolve root", which is the base location from which Axis2 will load module archives (mar). defaults to ${project.build.directory}/synapse --> <resolveRoot>${resolve.root}</resolveRoot> <!-- Start Synapse, then pause execution, if wait is set to "true". Useful when running tests manually against the running Synapse instance. --> <wait>${synapse.wait}</wait> </configuration> <dependencies> [...] <dependency> [...] </dependency> [...] </dependencies> </plugin> [...] </plugins> [...] </build>
Note that since the start and stop goals are bound to pre-integration-test and post-integration-test there is no need to explicitly override these in your executions section. They are shown in the configuration above anyway.
The plugin is deployed to the project's Maven2 repository. When it's a little more mature, we'll synch it up with the Maven Central repository but for now, you can add the following to your pom:
<pluginRepositories> [...] <pluginRepository> <id>maven-synapse.sourceforge.net</id> <name>Maven Synapse Plugin Repository</name> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> <url>http://maven-synapse.sourceforge.net/m2repo/release</url> </pluginRepository> [...] </pluginRepositories>
The current snapshot release can be accessed by adding this to your project's pom.xml:
<pluginRepositories> [...] <pluginRepository> <id>snapshots.maven-synapse.sourceforge.net</id> <name>Maven Synapse Plugin Snapshot Repository</name> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> <url>http://maven-synapse.sourceforge.net/m2repo/snapshot</url> </pluginRepository> [...] </pluginRepositories>